On 11 Oct 2017, at 18:53, R Smith <rsm...@rsweb.co.za> wrote:

> Yes. When you concatenate/add a string and integer together some SQL 
> engines will try to give a sensible result, so that '5' + 3 will yield 8 
> because 3 is INT and it reckons that '5' probably meant 5 since it is 
> added to another INT and the 5 doesn't have an explicit type. But, if 
> you force one of the terms to be string, such as CAST( 5 AS TEXT) or 
> strftime(%s,5) or use the value as a parameter to a function that 
> expects a specific type, then the engine might assume stuff, or try to 
> make sense of it, but in general when you start these shenanigans you 
> are on thin ice over "UNDEFINED" territory, which is what bit the OP 
> since the result in one version of SQlite differed from another version 
> (which the devs might adjust, but it's not a bug since mixing types is 
> not strictly supported).

All my times and dates are stored as seconds since the epoch (in a double for 
reasons that escape me at the minute). As a result I've never had a problem 
trying to compare them.

My philosophy is: internal format, seconds. External format (for display 
purposes), convert to the format the user wants.

Cheers  --  Tim
sqlite-users mailing list

Reply via email to