Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch pure-date-functions Excluding Merge-Ins
This is equivalent to a diff from c93284cd to 55791928
2017-07-19
| ||
18:01 | Remove some 'breakpoint' commands in test files. (check-in: d14fc621 user: mistachkin tags: trunk) | |
17:12 | Create "pure" versions of the date/time functions that omit the 'now' feature and are therefore deterministic and usable in an index. (Closed-Leaf check-in: 55791928 user: drh tags: pure-date-functions) | |
11:52 | Add further tests to unionvtab.test. (check-in: c93284cd user: dan tags: trunk) | |
2017-07-18
| ||
21:19 | Fix a crash in unionvtab caused by a misconfiguration. Add other test cases for the same. (check-in: 255d6b99 user: dan tags: trunk) | |
Changes to src/date.c.
︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + + + + + + + + | char validYMD; /* True (1) if Y,M,D are valid */ char validHMS; /* True (1) if h,m,s are valid */ char validTZ; /* True (1) if tz is valid */ char tzSet; /* Timezone was set explicitly */ char isError; /* An overflow has occurred */ }; /* ** Based on the sqlite3_context pointer, determine if the current ** function is "pure" (that is to say, if it omits the 'now' time ** and the 'localtime' and 'utc' modifiers and is thus deterministic ** and suitable for use in indexes). */ static int dateFuncIsPure(sqlite3_context *pCtx){ return sqlite3_user_data(pCtx)!=0; } /* ** Convert zDate into one or more integers according to the conversion ** specifier zFormat. ** ** zFormat[] contains 4 characters for each integer converted, except for ** the last integer which is specified by three characters. The meaning |
︙ | |||
382 383 384 385 386 387 388 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | - + | DateTime *p ){ double r; if( parseYyyyMmDd(zDate,p)==0 ){ return 0; }else if( parseHhMmSs(zDate, p)==0 ){ return 0; |
︙ | |||
665 666 667 668 669 670 671 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | - + | #ifndef SQLITE_OMIT_LOCALTIME case 'l': { /* localtime ** ** Assuming the current time value is UTC (a.k.a. GMT), shift it to ** show local time. */ |
︙ | |||
691 692 693 694 695 696 697 | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | - + | p->iJD = (sqlite3_int64)r; p->validJD = 1; p->rawS = 0; rc = 0; } } #ifndef SQLITE_OMIT_LOCALTIME |
︙ | |||
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | + + + + + | static FuncDef aDateTimeFuncs[] = { #ifndef SQLITE_OMIT_DATETIME_FUNCS DFUNCTION(julianday, -1, 0, 0, juliandayFunc ), DFUNCTION(date, -1, 0, 0, dateFunc ), DFUNCTION(time, -1, 0, 0, timeFunc ), DFUNCTION(datetime, -1, 0, 0, datetimeFunc ), DFUNCTION(strftime, -1, 0, 0, strftimeFunc ), PURE_DATE(pure_julianday, -1, 0, 0, juliandayFunc ), PURE_DATE(pure_date, -1, 0, 0, dateFunc ), PURE_DATE(pure_time, -1, 0, 0, timeFunc ), PURE_DATE(pure_datetime, -1, 0, 0, datetimeFunc ), PURE_DATE(pure_strftime, -1, 0, 0, strftimeFunc ), DFUNCTION(current_time, 0, 0, 0, ctimeFunc ), DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc), DFUNCTION(current_date, 0, 0, 0, cdateFunc ), #else STR_FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc), STR_FUNCTION(current_date, 0, "%Y-%m-%d", 0, currentTimeFunc), STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc), #endif }; sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs)); } |
Changes to src/sqliteInt.h.
︙ | |||
1624 1625 1626 1627 1628 1629 1630 | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 | - + + + + + + + + | ** VFUNCTION(zName, nArg, iArg, bNC, xFunc) ** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag. ** ** DFUNCTION(zName, nArg, iArg, bNC, xFunc) ** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and ** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions ** and functions like sqlite_version() that can change, but not during |
︙ | |||
1647 1648 1649 1650 1651 1652 1653 | 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 | - - + + + + + | #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} } #define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \ {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} } #define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \ |
︙ |
Added test/date-pure.test.