From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: GNATCOLL SQLite3 vs Ada.Calendar.Time Date: Thu, 18 Aug 2016 11:28:30 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <7a1eaa60-3be9-4e9b-b67a-d174f3960276@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 18 Aug 2016 18:28:39 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="d7c030f56102b58a2c16dea977db88bb"; logging-data="25261"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zVwpKZooxUHzDvZiqk5pouyuv+x+4OCA=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: <7a1eaa60-3be9-4e9b-b67a-d174f3960276@googlegroups.com> Cancel-Lock: sha1:fOGt+w/VoU9TzrnYjnI6g/a4JVQ= Xref: news.eternal-september.org comp.lang.ada:31460 Date: 2016-08-18T11:28:30-07:00 List-Id: On 08/18/2016 10:45 AM, Stephen Leake wrote: > > 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. I know nothing about SQLite or how GNATColl accesses it, but ... Clearly, the query produced using a bare '?' and "+" applied to an Ada.Calendar.Time is different from the query produced using a bare '?' and "+" applied to a string [with contents in the correct format]. The query produced using "datetime(?)" and "+" applied to an Ada.Calendar.Time is equivalent to the query produced using a bare '?' and "+" applied to a string. Presumably, the result of "+" applied to an Ada.Calendar.Time is different from "+" applied to a string, but passing the former to datetime corrects it. I would guess that, since you used strings to insert the datetime values, SQLite is using TEXT representation for them. Also that "+" applied to an Ada.Calendar.Time is producing a non-string result (numeric?) and SQLite has problems dealing with the combination. Or something. Personally, I'd want to compare the results of the two "+" calls (which might require some cheating). I'd also want to see the resulting SQL statements from substituting them for the '?'. One could then feed those SQL statements directly into SQLite to see if the problem is in GNATColl or SQLite. -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49