comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: GNATCOLL SQLite3 vs Ada.Calendar.Time
Date: Thu, 18 Aug 2016 10:45:08 -0700 (PDT)
Date: 2016-08-18T10:45:08-07:00	[thread overview]
Message-ID: <7a1eaa60-3be9-4e9b-b67a-d174f3960276@googlegroups.com> (raw)
In-Reply-To: <np45kg$q1f$1@dont-email.me>

On Thursday, August 18, 2016 at 6:19:45 AM UTC-5, G.B. wrote:
> 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(?) ... "
> 

Yes, that works. Although I'm not clear why; 
https://www.sqlite.org/lang_datefunc.html defines that function to return a string, and the examples are about output formatting. Apparently it has a different meaning when processing bound parameters.

> 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. 

That gives:

INSERT INTO "Title" VALUES(2,'2000-01-02 00:00:00','Foundation');

no "datetime" function call.

But we are talking about bound parameters, which could easily be different.

I need to remember SQL is not Ada; it can silently do the wrong thing any time it wants :(.

-- Stephe

  reply	other threads:[~2016-08-18 17:45 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.
2016-08-18 17:45   ` Stephen Leake [this message]
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