Restore support for date/time constants in KEXI SQL
ClosedPublic

Authored by staniek on Mon, Dec 3, 4:12 PM.

Details

Summary
  • 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

Test Plan

Precondition: Only the KDb patch needed (branch 393094-date-constants against 3.2 branch), no changes in KEXI.

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.

Diff Detail

Repository
R15 KDb
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
staniek created this revision.Mon, Dec 3, 4:12 PM
Restricted Application added a project: KDb. · View Herald TranscriptMon, Dec 3, 4:12 PM
Restricted Application added a subscriber: Kexi-Devel-list. · View Herald Transcript
staniek requested review of this revision.Mon, Dec 3, 4:12 PM
staniek edited the test plan for this revision. (Show Details)Mon, Dec 3, 4:15 PM
staniek added reviewers: dczechowicz, wkosowicz.
staniek edited the summary of this revision. (Show Details)
staniek edited the test plan for this revision. (Show Details)
staniek updated this revision to Diff 46800.Mon, Dec 3, 4:23 PM
  • Add autotests for date/time related KDBSQL statements
staniek edited the test plan for this revision. (Show Details)Mon, Dec 3, 4:24 PM
staniek edited the test plan for this revision. (Show Details)Mon, Dec 3, 5:36 PM
staniek updated this revision to Diff 47213.Sun, Dec 9, 8:18 PM
  • Merge remote-tracking branch 'origin/3.1' into 393094-date-constants
staniek added inline comments.Mon, Dec 10, 1:57 PM
src/parser/generated/KDbToken.cpp
182 ↗(On Diff #47213)

Please ignore all files in the generated/ folder.

staniek updated this revision to Diff 47515.Thu, Dec 13, 1:54 PM
  • Version 3.2.0
  • Merge remote-tracking branch 'origin/3.2' into 393094-date-constants
staniek edited the summary of this revision. (Show Details)Thu, Dec 13, 1:54 PM
staniek edited the test plan for this revision. (Show Details)
staniek edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Thu, Dec 13, 1:56 PM
Closed by commit R15:7d4dad4efb18: Version 3.2.0 (authored by staniek). · Explain Why
This revision was automatically updated to reflect the committed changes.
staniek reopened this revision.Thu, Dec 13, 4:14 PM
staniek updated this revision to Diff 47525.Thu, Dec 13, 4:15 PM
  • Merge branch '3.2' into 393094-date-constants
This revision was not accepted when it landed; it landed in state Needs Review.Thu, Dec 13, 4:21 PM
This revision was automatically updated to reflect the committed changes.