Diffusion KDb 28ade683a351

Restore support for date/time constants in KEXI SQL

Authored by staniek on Jan 4 2019, 9:06 PM.

Description

Restore support for date/time constants in KEXI SQL

Merge branch '393094-date-constants-3.2' into 3.2

  • Add Date/Time classes for precise type support
  • Add autotests for the KDb date/time classes
  • Add support for the Date/Time constants in the SQL parser
  • improve lexer too
  • obsolete previous approach for SQL default date support
  • and for SQLite, add new APIs for converting date/times

https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants

  • Add autotests for date/time related KDBSQL statements

BUG:393094

KDb VERSION -> 3.2.0 Beta 1

Test Plan:
Precondition: KDb branch: 393094-date-constants against 3.2 branch, KEXI branch 393094-date-constants (D17847)

0. Run KDb autotests
Expected: 100% passes

  1. Open a new design in KEXI Query Designer.

Note: Visual designer does not support these constants, use the SQL view.

  1. Type a number of statements involving Date, Time and Date/Time constants

You can use test cases from autotests/parser/data/statements.txt, sections:

  • Date Constants (KDbSQL EXTENSION)
  • Time Constants (KDbSQL EXTENSION)
  • Date/Time Constants (KDbSQL EXTENSION)

Use the Check Query button to try both valid and invalid constants. For example "SELECT #12:13:01#" should work and "SELECT #2018-11-37#" should be rejected as invalid constant.

Expected: Valid constants should be accepted and then data view should work, there should be warning for invalid constants.
Expected: Saving of both valid and invalid statements should be possible in the SQL view.

  1. Create table with columns of type date, time and date/time and add some records.
  1. Open a new design in Query SQL Designer, create statements involving both constants and columns e.g. SELECT #12:13:01# AS expr1, timecolumn FROM table where table.timecolumn < #2018-11-37#

Expected: valid statement, the Data view works.

  1. Test all of the above for SQLite, pgsql, mysql.

Differential Revision: https://phabricator.kde.org/D17336

Merged Changes

CommitAuthorDetailsCommitted
c2fcf8a68170staniek
Add autotests for date/time related KDBSQL statements 
Jan 4 2019
5b700dfd7c0dstaniek
Add support for the Date/Time constants in the SQL parser 
Jan 4 2019
81ad5897692cstaniek
Add autotests for the KDb date/time classes 
Jan 4 2019
eef6b7c900castaniek
Add Date/Time classes for precise type support 
Jan 4 2019