comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <bauhaus@futureapps.invalid>
Subject: Re: GNATCOLL SQLite3 vs Ada.Calendar.Time
Date: Thu, 18 Aug 2016 13:19:44 +0200
Date: 2016-08-18T13:19:44+02:00	[thread overview]
Message-ID: <np45kg$q1f$1@dont-email.me> (raw)
In-Reply-To: <fa1918c3-32cc-4203-bfad-55f26646305f@googlegroups.com>

On 17.08.16 23:05, Stephen Leake wrote:
> One solution would be to replace the "DATETIME" field type in the .sql file with "TEXT", always pass strings for times, and rely on lexicographic sorting for time comparison. But that seems extreme.

It seems advisable to use SQLite's Date And Time Functions
when using SQLite for SQL. Thus,

    " ... WHERE Modified >= datetime(?) ... "

With Ubuntu's standard GNAT, this change results in:

find modified time (1 day before created):
[SQL.SELECT] SELECT ID, Modified, Title FROM Title WHERE Modified >= 
datetime(?) ORDER BY ID, 1999-12-31 23:00:00
1, 2000-01-02 00:00:00, 2001
2, 2000-01-02 00:00:00, Foundation
3, 2000-01-02 00:00:00, Foundations Edge
4, 2000-01-02 00:00:00, Foundation and Earth
5, 2000-01-02 00:00:00, Foundation and Empire

Also, I think that +"some string" has only recently been added
as an overloaded "+" in GNATCOLL.SQL.Exec, in case it's resolved
to be from there and portability to older installation matters.

Testing SQL scripts using standard SQL syntax and several
SQL DBMSs has proven to be useful in detecting caveats.
SQLite's .dump command seems pretty good at producing
standard SQL syntax. (I have had cases where using double
quotes for VARCHAR literals had made the DBMS take "foo"
for column FOO, and that's formally correct.)


  parent reply	other threads:[~2016-08-18 11:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 21:05 GNATCOLL SQLite3 vs Ada.Calendar.Time Stephen Leake
2016-08-18  8:09 ` Dmitry A. Kazakov
2016-08-18 11:19 ` G.B. [this message]
2016-08-18 17:45   ` Stephen Leake
2016-08-18 18:13     ` Stephen Leake
2016-08-19 15:30       ` Stephen Leake
2016-08-19 17:43         ` G.B.
2016-08-18 18:28     ` Jeffrey R. Carter
2016-08-18 19:48       ` Dmitry A. Kazakov
2016-08-18 20:50         ` Jeffrey R. Carter
2016-08-18 22:05         ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox