1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

The documentation says that the built-in date-time functions give undefined

results for dates before 0000-01-01 and after 9999-12-31.  Change the
actually implementation so that the answer given is really NULL.  This also
avoids unnecessary hand-wringing over an signed integer overflow that might
otherwise occur when processing out-of-bound dates.

FossilOrigin-Name: d410a839752153c6d8be08f758abfbc16475745a
This commit is contained in:
drh
2016-11-29 20:39:48 +00:00
parent bc60368d6f
commit 3edb157e23
4 changed files with 25 additions and 20 deletions

View File

@ -61,8 +61,8 @@ datetest 1.19 {julianday('2000-01-01 12:00:00.1')} 2451545.00000116
datetest 1.20 {julianday('2000-01-01 12:00:00.01')} 2451545.00000012
datetest 1.21 {julianday('2000-01-01 12:00:00.001')} 2451545.00000001
datetest 1.22 {julianday('2000-01-01 12:00:00.')} NULL
datetest 1.23 julianday(12345.6) 12345.6
datetest 1.23b julianday('12345.6') 12345.6
datetest 1.23 julianday(12345.6) NULL
datetest 1.23b julianday(1721059.5) 1721059.5
datetest 1.24 {julianday('2001-01-01 12:00:00 bogus')} NULL
datetest 1.25 {julianday('2001-01-01 bogus')} NULL
datetest 1.26 {julianday('2001-01-01 12:60:00')} NULL
@ -418,16 +418,6 @@ datetest 8.19 {datetime('now','11.25 seconds')} {2003-10-22 12:34:11}
datetest 8.90 {datetime('now','abcdefghijklmnopqrstuvwyxzABCDEFGHIJLMNOP')} NULL
set sqlite_current_time 0
# Negative years work. Example: '-4713-11-26' is JD 1.5.
#
datetest 9.1 {julianday('-4713-11-24 12:00:00')} {0.0}
datetest 9.2 {julianday(datetime(5))} {5.0}
datetest 9.3 {julianday(datetime(10))} {10.0}
datetest 9.4 {julianday(datetime(100))} {100.0}
datetest 9.5 {julianday(datetime(1000))} {1000.0}
datetest 9.6 {julianday(datetime(10000))} {10000.0}
datetest 9.7 {julianday(datetime(100000))} {100000.0}
# datetime() with just an HH:MM:SS correctly inserts the date 2000-01-01.
#
datetest 10.1 {datetime('01:02:03')} {2000-01-01 01:02:03}