Fossil SCM
Improvements to handling of localtime. The 'utc' and 'localtime' query parameters now work on all web pages. Timestamps can be expressed with a timezone modifier and that works correctly.
Commit
ea63a2d1f409581afde02949a51b68ac30133a0e
Parent
6b292eaa7819262…
20 files changed
+4
-5
+3
-3
+3
-3
-1
+64
-1
+4
-4
+5
-5
+2
-2
+2
-2
+7
+4
-4
+10
-10
+1
-1
+2
-3
+64
-48
+1
-1
+2
-2
+6
-32
+8
-8
+2
-2
+4
-5
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -41,15 +41,14 @@ | ||
| 41 | 41 | |
| 42 | 42 | if( zPage && zTkt ) zTkt = 0; |
| 43 | 43 | login_check_credentials(); |
| 44 | 44 | blob_zero(&sql); |
| 45 | 45 | blob_append_sql(&sql, |
| 46 | - "SELECT datetime(mtime%s), src, target, filename," | |
| 46 | + "SELECT datetime(mtime,toLocal()), src, target, filename," | |
| 47 | 47 | " comment, user," |
| 48 | 48 | " (SELECT uuid FROM blob WHERE rid=attachid), attachid" |
| 49 | - " FROM attachment", | |
| 50 | - timeline_utc() | |
| 49 | + " FROM attachment" | |
| 51 | 50 | ); |
| 52 | 51 | if( zPage ){ |
| 53 | 52 | if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; } |
| 54 | 53 | style_header("Attachments To %h", zPage); |
| 55 | 54 | blob_append_sql(&sql, " WHERE target=%Q", zPage); |
| @@ -574,16 +573,16 @@ | ||
| 574 | 573 | const char *zHeader /* Header to display with attachments */ |
| 575 | 574 | ){ |
| 576 | 575 | int cnt = 0; |
| 577 | 576 | Stmt q; |
| 578 | 577 | db_prepare(&q, |
| 579 | - "SELECT datetime(mtime%s), filename, user," | |
| 578 | + "SELECT datetime(mtime,toLocal()), filename, user," | |
| 580 | 579 | " (SELECT uuid FROM blob WHERE rid=attachid), src" |
| 581 | 580 | " FROM attachment" |
| 582 | 581 | " WHERE isLatest AND src!='' AND target=%Q" |
| 583 | 582 | " ORDER BY mtime DESC", |
| 584 | - timeline_utc(), zTarget | |
| 583 | + zTarget | |
| 585 | 584 | ); |
| 586 | 585 | while( db_step(&q)==SQLITE_ROW ){ |
| 587 | 586 | const char *zDate = db_column_text(&q, 0); |
| 588 | 587 | const char *zFile = db_column_text(&q, 1); |
| 589 | 588 | const char *zUser = db_column_text(&q, 2); |
| 590 | 589 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -41,15 +41,14 @@ | |
| 41 | |
| 42 | if( zPage && zTkt ) zTkt = 0; |
| 43 | login_check_credentials(); |
| 44 | blob_zero(&sql); |
| 45 | blob_append_sql(&sql, |
| 46 | "SELECT datetime(mtime%s), src, target, filename," |
| 47 | " comment, user," |
| 48 | " (SELECT uuid FROM blob WHERE rid=attachid), attachid" |
| 49 | " FROM attachment", |
| 50 | timeline_utc() |
| 51 | ); |
| 52 | if( zPage ){ |
| 53 | if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; } |
| 54 | style_header("Attachments To %h", zPage); |
| 55 | blob_append_sql(&sql, " WHERE target=%Q", zPage); |
| @@ -574,16 +573,16 @@ | |
| 574 | const char *zHeader /* Header to display with attachments */ |
| 575 | ){ |
| 576 | int cnt = 0; |
| 577 | Stmt q; |
| 578 | db_prepare(&q, |
| 579 | "SELECT datetime(mtime%s), filename, user," |
| 580 | " (SELECT uuid FROM blob WHERE rid=attachid), src" |
| 581 | " FROM attachment" |
| 582 | " WHERE isLatest AND src!='' AND target=%Q" |
| 583 | " ORDER BY mtime DESC", |
| 584 | timeline_utc(), zTarget |
| 585 | ); |
| 586 | while( db_step(&q)==SQLITE_ROW ){ |
| 587 | const char *zDate = db_column_text(&q, 0); |
| 588 | const char *zFile = db_column_text(&q, 1); |
| 589 | const char *zUser = db_column_text(&q, 2); |
| 590 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -41,15 +41,14 @@ | |
| 41 | |
| 42 | if( zPage && zTkt ) zTkt = 0; |
| 43 | login_check_credentials(); |
| 44 | blob_zero(&sql); |
| 45 | blob_append_sql(&sql, |
| 46 | "SELECT datetime(mtime,toLocal()), src, target, filename," |
| 47 | " comment, user," |
| 48 | " (SELECT uuid FROM blob WHERE rid=attachid), attachid" |
| 49 | " FROM attachment" |
| 50 | ); |
| 51 | if( zPage ){ |
| 52 | if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; } |
| 53 | style_header("Attachments To %h", zPage); |
| 54 | blob_append_sql(&sql, " WHERE target=%Q", zPage); |
| @@ -574,16 +573,16 @@ | |
| 573 | const char *zHeader /* Header to display with attachments */ |
| 574 | ){ |
| 575 | int cnt = 0; |
| 576 | Stmt q; |
| 577 | db_prepare(&q, |
| 578 | "SELECT datetime(mtime,toLocal()), filename, user," |
| 579 | " (SELECT uuid FROM blob WHERE rid=attachid), src" |
| 580 | " FROM attachment" |
| 581 | " WHERE isLatest AND src!='' AND target=%Q" |
| 582 | " ORDER BY mtime DESC", |
| 583 | zTarget |
| 584 | ); |
| 585 | while( db_step(&q)==SQLITE_ROW ){ |
| 586 | const char *zDate = db_column_text(&q, 0); |
| 587 | const char *zFile = db_column_text(&q, 1); |
| 588 | const char *zUser = db_column_text(&q, 2); |
| 589 |
+3
-3
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -599,19 +599,19 @@ | ||
| 599 | 599 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 600 | 600 | linkTrunk = trunkRid && rid != trunkRid; |
| 601 | 601 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 602 | 602 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 603 | 603 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 604 | - zNow = db_text("", "SELECT datetime(mtime,'localtime')" | |
| 604 | + zNow = db_text("", "SELECT datetime(mtime,toLocal())" | |
| 605 | 605 | " FROM event WHERE objid=%d", rid); |
| 606 | 606 | }else{ |
| 607 | 607 | zCI = 0; |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | if( zCI==0 ){ |
| 611 | 611 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 612 | - zNow = db_text("", "SELECT datetime(max(mtime),'localtime') FROM event"); | |
| 612 | + zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); | |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | /* Compute the title of the page */ |
| 616 | 616 | blob_zero(&dirname); |
| 617 | 617 | if( zD ){ |
| @@ -1029,11 +1029,11 @@ | ||
| 1029 | 1029 | if( rid==0 ){ |
| 1030 | 1030 | fossil_fatal("not a valid check-in: %s", zName); |
| 1031 | 1031 | } |
| 1032 | 1032 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1033 | 1033 | baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid); |
| 1034 | - zNow = db_text("", "SELECT datetime(mtime,'localtime') FROM event" | |
| 1034 | + zNow = db_text("", "SELECT datetime(mtime,toLocal()) FROM event" | |
| 1035 | 1035 | " WHERE objid=%d", rid); |
| 1036 | 1036 | style_submenu_element("Tree-View", "Tree-View", |
| 1037 | 1037 | "%R/tree?ci=%T&mtime=1&type=tree", |
| 1038 | 1038 | zName); |
| 1039 | 1039 | style_header("File Ages"); |
| 1040 | 1040 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -599,19 +599,19 @@ | |
| 599 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 600 | linkTrunk = trunkRid && rid != trunkRid; |
| 601 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 602 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 603 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 604 | zNow = db_text("", "SELECT datetime(mtime,'localtime')" |
| 605 | " FROM event WHERE objid=%d", rid); |
| 606 | }else{ |
| 607 | zCI = 0; |
| 608 | } |
| 609 | } |
| 610 | if( zCI==0 ){ |
| 611 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 612 | zNow = db_text("", "SELECT datetime(max(mtime),'localtime') FROM event"); |
| 613 | } |
| 614 | |
| 615 | /* Compute the title of the page */ |
| 616 | blob_zero(&dirname); |
| 617 | if( zD ){ |
| @@ -1029,11 +1029,11 @@ | |
| 1029 | if( rid==0 ){ |
| 1030 | fossil_fatal("not a valid check-in: %s", zName); |
| 1031 | } |
| 1032 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1033 | baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid); |
| 1034 | zNow = db_text("", "SELECT datetime(mtime,'localtime') FROM event" |
| 1035 | " WHERE objid=%d", rid); |
| 1036 | style_submenu_element("Tree-View", "Tree-View", |
| 1037 | "%R/tree?ci=%T&mtime=1&type=tree", |
| 1038 | zName); |
| 1039 | style_header("File Ages"); |
| 1040 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -599,19 +599,19 @@ | |
| 599 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 600 | linkTrunk = trunkRid && rid != trunkRid; |
| 601 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 602 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 603 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 604 | zNow = db_text("", "SELECT datetime(mtime,toLocal())" |
| 605 | " FROM event WHERE objid=%d", rid); |
| 606 | }else{ |
| 607 | zCI = 0; |
| 608 | } |
| 609 | } |
| 610 | if( zCI==0 ){ |
| 611 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 612 | zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); |
| 613 | } |
| 614 | |
| 615 | /* Compute the title of the page */ |
| 616 | blob_zero(&dirname); |
| 617 | if( zD ){ |
| @@ -1029,11 +1029,11 @@ | |
| 1029 | if( rid==0 ){ |
| 1030 | fossil_fatal("not a valid check-in: %s", zName); |
| 1031 | } |
| 1032 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1033 | baseTime = db_double(0.0,"SELECT mtime FROM event WHERE objid=%d", rid); |
| 1034 | zNow = db_text("", "SELECT datetime(mtime,toLocal()) FROM event" |
| 1035 | " WHERE objid=%d", rid); |
| 1036 | style_submenu_element("Tree-View", "Tree-View", |
| 1037 | "%R/tree?ci=%T&mtime=1&type=tree", |
| 1038 | zName); |
| 1039 | style_header("File Ages"); |
| 1040 |
+3
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -327,11 +327,11 @@ | ||
| 327 | 327 | zOrderBy = "mtime DESC"; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | compute_fileage(rid,0); |
| 331 | 331 | db_prepare(&q, |
| 332 | - "SELECT datetime(fileage.mtime, 'localtime'), fileage.pathname,\n" | |
| 332 | + "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n" | |
| 333 | 333 | " blob.size\n" |
| 334 | 334 | " FROM fileage, blob\n" |
| 335 | 335 | " WHERE blob.rid=fileage.fid %s\n" |
| 336 | 336 | " ORDER BY %s;", blob_sql_text(&where), zOrderBy /*safe-for-%s*/ |
| 337 | 337 | ); |
| @@ -429,14 +429,14 @@ | ||
| 429 | 429 | } |
| 430 | 430 | vfile_check_signature(vid, 0); |
| 431 | 431 | if( showAge ){ |
| 432 | 432 | db_prepare(&q, |
| 433 | 433 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 434 | - " datetime(checkin_mtime(%d,rid),'unixepoch'%s)" | |
| 434 | + " datetime(checkin_mtime(%d,rid),'unixepoch',toLocal())" | |
| 435 | 435 | " FROM vfile %s" |
| 436 | 436 | " ORDER BY %s", |
| 437 | - vid, timeline_utc(), blob_sql_text(&where), zOrderBy /*safe-for-%s*/ | |
| 437 | + vid, blob_sql_text(&where), zOrderBy /*safe-for-%s*/ | |
| 438 | 438 | ); |
| 439 | 439 | }else{ |
| 440 | 440 | db_prepare(&q, |
| 441 | 441 | "SELECT pathname, deleted, rid, chnged," |
| 442 | 442 | " coalesce(origname!=pathname,0), islink" |
| 443 | 443 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -327,11 +327,11 @@ | |
| 327 | zOrderBy = "mtime DESC"; |
| 328 | } |
| 329 | |
| 330 | compute_fileage(rid,0); |
| 331 | db_prepare(&q, |
| 332 | "SELECT datetime(fileage.mtime, 'localtime'), fileage.pathname,\n" |
| 333 | " blob.size\n" |
| 334 | " FROM fileage, blob\n" |
| 335 | " WHERE blob.rid=fileage.fid %s\n" |
| 336 | " ORDER BY %s;", blob_sql_text(&where), zOrderBy /*safe-for-%s*/ |
| 337 | ); |
| @@ -429,14 +429,14 @@ | |
| 429 | } |
| 430 | vfile_check_signature(vid, 0); |
| 431 | if( showAge ){ |
| 432 | db_prepare(&q, |
| 433 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 434 | " datetime(checkin_mtime(%d,rid),'unixepoch'%s)" |
| 435 | " FROM vfile %s" |
| 436 | " ORDER BY %s", |
| 437 | vid, timeline_utc(), blob_sql_text(&where), zOrderBy /*safe-for-%s*/ |
| 438 | ); |
| 439 | }else{ |
| 440 | db_prepare(&q, |
| 441 | "SELECT pathname, deleted, rid, chnged," |
| 442 | " coalesce(origname!=pathname,0), islink" |
| 443 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -327,11 +327,11 @@ | |
| 327 | zOrderBy = "mtime DESC"; |
| 328 | } |
| 329 | |
| 330 | compute_fileage(rid,0); |
| 331 | db_prepare(&q, |
| 332 | "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n" |
| 333 | " blob.size\n" |
| 334 | " FROM fileage, blob\n" |
| 335 | " WHERE blob.rid=fileage.fid %s\n" |
| 336 | " ORDER BY %s;", blob_sql_text(&where), zOrderBy /*safe-for-%s*/ |
| 337 | ); |
| @@ -429,14 +429,14 @@ | |
| 429 | } |
| 430 | vfile_check_signature(vid, 0); |
| 431 | if( showAge ){ |
| 432 | db_prepare(&q, |
| 433 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," |
| 434 | " datetime(checkin_mtime(%d,rid),'unixepoch',toLocal())" |
| 435 | " FROM vfile %s" |
| 436 | " ORDER BY %s", |
| 437 | vid, blob_sql_text(&where), zOrderBy /*safe-for-%s*/ |
| 438 | ); |
| 439 | }else{ |
| 440 | db_prepare(&q, |
| 441 | "SELECT pathname, deleted, rid, chnged," |
| 442 | " coalesce(origname!=pathname,0), islink" |
| 443 |
-1
| --- src/codecheck1.c | ||
| +++ src/codecheck1.c | ||
| @@ -250,11 +250,10 @@ | ||
| 250 | 250 | ** SQL using %s. |
| 251 | 251 | */ |
| 252 | 252 | static const char *azSafeFunc[] = { |
| 253 | 253 | "filename_collation", |
| 254 | 254 | "db_name", |
| 255 | - "timeline_utc", | |
| 256 | 255 | "leaf_is_closed_sql", |
| 257 | 256 | "timeline_query_for_www", |
| 258 | 257 | "timeline_query_for_tty", |
| 259 | 258 | "blob_sql_text", |
| 260 | 259 | "glob_expr", |
| 261 | 260 |
| --- src/codecheck1.c | |
| +++ src/codecheck1.c | |
| @@ -250,11 +250,10 @@ | |
| 250 | ** SQL using %s. |
| 251 | */ |
| 252 | static const char *azSafeFunc[] = { |
| 253 | "filename_collation", |
| 254 | "db_name", |
| 255 | "timeline_utc", |
| 256 | "leaf_is_closed_sql", |
| 257 | "timeline_query_for_www", |
| 258 | "timeline_query_for_tty", |
| 259 | "blob_sql_text", |
| 260 | "glob_expr", |
| 261 |
| --- src/codecheck1.c | |
| +++ src/codecheck1.c | |
| @@ -250,11 +250,10 @@ | |
| 250 | ** SQL using %s. |
| 251 | */ |
| 252 | static const char *azSafeFunc[] = { |
| 253 | "filename_collation", |
| 254 | "db_name", |
| 255 | "leaf_is_closed_sql", |
| 256 | "timeline_query_for_www", |
| 257 | "timeline_query_for_tty", |
| 258 | "blob_sql_text", |
| 259 | "glob_expr", |
| 260 |
M
src/db.c
+64
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -791,10 +791,69 @@ | ||
| 791 | 791 | }else{ |
| 792 | 792 | sqlite3_result_int64(context, rid); |
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | + | |
| 797 | +/* | |
| 798 | +** The toLocal() SQL function returns a string that is an argument to a | |
| 799 | +** date/time function that is appropriate for modifying the time for display. | |
| 800 | +** If UTC time display is selected, no modification occurs. If local time | |
| 801 | +** display is selected, the time is adjusted appropriately. | |
| 802 | +** | |
| 803 | +** Example usage: | |
| 804 | +** | |
| 805 | +** SELECT datetime('now',toLocal()); | |
| 806 | +*/ | |
| 807 | +void db_tolocal_function( | |
| 808 | + sqlite3_context *context, | |
| 809 | + int argc, | |
| 810 | + sqlite3_value **argv | |
| 811 | +){ | |
| 812 | + if( g.fTimeFormat==0 ){ | |
| 813 | + if( db_get_int("timeline-utc", 1) ){ | |
| 814 | + g.fTimeFormat = 1; | |
| 815 | + }else{ | |
| 816 | + g.fTimeFormat = 2; | |
| 817 | + } | |
| 818 | + } | |
| 819 | + if( g.fTimeFormat==1 ){ | |
| 820 | + sqlite3_result_text(context, "0 seconds", -1, SQLITE_STATIC); | |
| 821 | + }else{ | |
| 822 | + sqlite3_result_text(context, "localtime", -1, SQLITE_STATIC); | |
| 823 | + } | |
| 824 | +} | |
| 825 | + | |
| 826 | +/* | |
| 827 | +** The fromLocal() SQL function returns a string that is an argument to a | |
| 828 | +** date/time function that is appropriate to convert an input time to UTC. | |
| 829 | +** If UTC time display is selected, no modification occurs. If local time | |
| 830 | +** display is selected, the time is adjusted from local to UTC. | |
| 831 | +** | |
| 832 | +** Example usage: | |
| 833 | +** | |
| 834 | +** SELECT julianday(:user_input,fromLocal()); | |
| 835 | +*/ | |
| 836 | +void db_fromlocal_function( | |
| 837 | + sqlite3_context *context, | |
| 838 | + int argc, | |
| 839 | + sqlite3_value **argv | |
| 840 | +){ | |
| 841 | + if( g.fTimeFormat==0 ){ | |
| 842 | + if( db_get_int("timeline-utc", 1) ){ | |
| 843 | + g.fTimeFormat = 1; | |
| 844 | + }else{ | |
| 845 | + g.fTimeFormat = 2; | |
| 846 | + } | |
| 847 | + } | |
| 848 | + if( g.fTimeFormat==1 ){ | |
| 849 | + sqlite3_result_text(context, "0 seconds", -1, SQLITE_STATIC); | |
| 850 | + }else{ | |
| 851 | + sqlite3_result_text(context, "utc", -1, SQLITE_STATIC); | |
| 852 | + } | |
| 853 | +} | |
| 854 | + | |
| 796 | 855 | |
| 797 | 856 | /* |
| 798 | 857 | ** Register the SQL functions that are useful both to the internal |
| 799 | 858 | ** representation and to the "fossil sql" command. |
| 800 | 859 | */ |
| @@ -804,11 +863,15 @@ | ||
| 804 | 863 | sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, |
| 805 | 864 | db_sym2rid_function, 0, 0); |
| 806 | 865 | sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, |
| 807 | 866 | db_sym2rid_function, 0, 0); |
| 808 | 867 | sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0, |
| 809 | - db_now_function, 0, 0); | |
| 868 | + db_now_function, 0, 0); | |
| 869 | + sqlite3_create_function(db, "toLocal", 0, SQLITE_UTF8, 0, | |
| 870 | + db_tolocal_function, 0, 0); | |
| 871 | + sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0, | |
| 872 | + db_fromlocal_function, 0, 0); | |
| 810 | 873 | } |
| 811 | 874 | |
| 812 | 875 | |
| 813 | 876 | /* |
| 814 | 877 | ** Open a database file. Return a pointer to the new database |
| 815 | 878 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -791,10 +791,69 @@ | |
| 791 | }else{ |
| 792 | sqlite3_result_int64(context, rid); |
| 793 | } |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | /* |
| 798 | ** Register the SQL functions that are useful both to the internal |
| 799 | ** representation and to the "fossil sql" command. |
| 800 | */ |
| @@ -804,11 +863,15 @@ | |
| 804 | sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, |
| 805 | db_sym2rid_function, 0, 0); |
| 806 | sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, |
| 807 | db_sym2rid_function, 0, 0); |
| 808 | sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0, |
| 809 | db_now_function, 0, 0); |
| 810 | } |
| 811 | |
| 812 | |
| 813 | /* |
| 814 | ** Open a database file. Return a pointer to the new database |
| 815 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -791,10 +791,69 @@ | |
| 791 | }else{ |
| 792 | sqlite3_result_int64(context, rid); |
| 793 | } |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | /* |
| 798 | ** The toLocal() SQL function returns a string that is an argument to a |
| 799 | ** date/time function that is appropriate for modifying the time for display. |
| 800 | ** If UTC time display is selected, no modification occurs. If local time |
| 801 | ** display is selected, the time is adjusted appropriately. |
| 802 | ** |
| 803 | ** Example usage: |
| 804 | ** |
| 805 | ** SELECT datetime('now',toLocal()); |
| 806 | */ |
| 807 | void db_tolocal_function( |
| 808 | sqlite3_context *context, |
| 809 | int argc, |
| 810 | sqlite3_value **argv |
| 811 | ){ |
| 812 | if( g.fTimeFormat==0 ){ |
| 813 | if( db_get_int("timeline-utc", 1) ){ |
| 814 | g.fTimeFormat = 1; |
| 815 | }else{ |
| 816 | g.fTimeFormat = 2; |
| 817 | } |
| 818 | } |
| 819 | if( g.fTimeFormat==1 ){ |
| 820 | sqlite3_result_text(context, "0 seconds", -1, SQLITE_STATIC); |
| 821 | }else{ |
| 822 | sqlite3_result_text(context, "localtime", -1, SQLITE_STATIC); |
| 823 | } |
| 824 | } |
| 825 | |
| 826 | /* |
| 827 | ** The fromLocal() SQL function returns a string that is an argument to a |
| 828 | ** date/time function that is appropriate to convert an input time to UTC. |
| 829 | ** If UTC time display is selected, no modification occurs. If local time |
| 830 | ** display is selected, the time is adjusted from local to UTC. |
| 831 | ** |
| 832 | ** Example usage: |
| 833 | ** |
| 834 | ** SELECT julianday(:user_input,fromLocal()); |
| 835 | */ |
| 836 | void db_fromlocal_function( |
| 837 | sqlite3_context *context, |
| 838 | int argc, |
| 839 | sqlite3_value **argv |
| 840 | ){ |
| 841 | if( g.fTimeFormat==0 ){ |
| 842 | if( db_get_int("timeline-utc", 1) ){ |
| 843 | g.fTimeFormat = 1; |
| 844 | }else{ |
| 845 | g.fTimeFormat = 2; |
| 846 | } |
| 847 | } |
| 848 | if( g.fTimeFormat==1 ){ |
| 849 | sqlite3_result_text(context, "0 seconds", -1, SQLITE_STATIC); |
| 850 | }else{ |
| 851 | sqlite3_result_text(context, "utc", -1, SQLITE_STATIC); |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | |
| 856 | /* |
| 857 | ** Register the SQL functions that are useful both to the internal |
| 858 | ** representation and to the "fossil sql" command. |
| 859 | */ |
| @@ -804,11 +863,15 @@ | |
| 863 | sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0, |
| 864 | db_sym2rid_function, 0, 0); |
| 865 | sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0, |
| 866 | db_sym2rid_function, 0, 0); |
| 867 | sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0, |
| 868 | db_now_function, 0, 0); |
| 869 | sqlite3_create_function(db, "toLocal", 0, SQLITE_UTF8, 0, |
| 870 | db_tolocal_function, 0, 0); |
| 871 | sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0, |
| 872 | db_fromlocal_function, 0, 0); |
| 873 | } |
| 874 | |
| 875 | |
| 876 | /* |
| 877 | ** Open a database file. Return a pointer to the new database |
| 878 |
+4
-4
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -182,11 +182,11 @@ | ||
| 182 | 182 | if( rid==0 ){ |
| 183 | 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | 184 | } |
| 185 | 185 | zFilename = blob_str(&fname); |
| 186 | 186 | db_prepare(&q, |
| 187 | - "SELECT DISTINCT b.uuid, ci.uuid, date(event.mtime%s)," | |
| 187 | + "SELECT DISTINCT b.uuid, ci.uuid, date(event.mtime,toLocal())," | |
| 188 | 188 | " coalesce(event.ecomment, event.comment)," |
| 189 | 189 | " coalesce(event.euser, event.user)," |
| 190 | 190 | " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0" |
| 191 | 191 | " AND tagxref.rid=mlink.mid)" /* Tags */ |
| 192 | 192 | " FROM mlink, blob b, event, blob ci, filename" |
| @@ -194,11 +194,11 @@ | ||
| 194 | 194 | " AND mlink.fnid=filename.fnid" |
| 195 | 195 | " AND b.rid=mlink.fid" |
| 196 | 196 | " AND event.objid=mlink.mid" |
| 197 | 197 | " AND event.objid=ci.rid" |
| 198 | 198 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 199 | - timeline_utc(), TAG_BRANCH, zFilename, filename_collation(), | |
| 199 | + TAG_BRANCH, zFilename, filename_collation(), | |
| 200 | 200 | iLimit, iOffset |
| 201 | 201 | ); |
| 202 | 202 | blob_zero(&line); |
| 203 | 203 | if( iBrief ){ |
| 204 | 204 | fossil_print("History of %s\n", blob_str(&fname)); |
| @@ -332,11 +332,11 @@ | ||
| 332 | 332 | } |
| 333 | 333 | url_add_parameter(&url, "name", zFilename); |
| 334 | 334 | blob_zero(&sql); |
| 335 | 335 | blob_append_sql(&sql, |
| 336 | 336 | "SELECT" |
| 337 | - " datetime(min(event.mtime)%s)," /* Date of change */ | |
| 337 | + " datetime(min(event.mtime),toLocal())," /* Date of change */ | |
| 338 | 338 | " coalesce(event.ecomment, event.comment)," /* Check-in comment */ |
| 339 | 339 | " coalesce(event.euser, event.user)," /* User who made chng */ |
| 340 | 340 | " mlink.pid," /* Parent file rid */ |
| 341 | 341 | " mlink.fid," /* File rid */ |
| 342 | 342 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */ |
| @@ -348,11 +348,11 @@ | ||
| 348 | 348 | " mlink.mid," /* check-in ID */ |
| 349 | 349 | " mlink.pfnid" /* Previous filename */ |
| 350 | 350 | " FROM mlink, event" |
| 351 | 351 | " WHERE mlink.fnid=%d" |
| 352 | 352 | " AND event.objid=mlink.mid", |
| 353 | - timeline_utc(), TAG_BRANCH, fnid | |
| 353 | + TAG_BRANCH, fnid | |
| 354 | 354 | ); |
| 355 | 355 | if( (zA = P("a"))!=0 ){ |
| 356 | 356 | blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA); |
| 357 | 357 | url_add_parameter(&url, "a", zA); |
| 358 | 358 | } |
| 359 | 359 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -182,11 +182,11 @@ | |
| 182 | if( rid==0 ){ |
| 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | } |
| 185 | zFilename = blob_str(&fname); |
| 186 | db_prepare(&q, |
| 187 | "SELECT DISTINCT b.uuid, ci.uuid, date(event.mtime%s)," |
| 188 | " coalesce(event.ecomment, event.comment)," |
| 189 | " coalesce(event.euser, event.user)," |
| 190 | " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0" |
| 191 | " AND tagxref.rid=mlink.mid)" /* Tags */ |
| 192 | " FROM mlink, blob b, event, blob ci, filename" |
| @@ -194,11 +194,11 @@ | |
| 194 | " AND mlink.fnid=filename.fnid" |
| 195 | " AND b.rid=mlink.fid" |
| 196 | " AND event.objid=mlink.mid" |
| 197 | " AND event.objid=ci.rid" |
| 198 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 199 | timeline_utc(), TAG_BRANCH, zFilename, filename_collation(), |
| 200 | iLimit, iOffset |
| 201 | ); |
| 202 | blob_zero(&line); |
| 203 | if( iBrief ){ |
| 204 | fossil_print("History of %s\n", blob_str(&fname)); |
| @@ -332,11 +332,11 @@ | |
| 332 | } |
| 333 | url_add_parameter(&url, "name", zFilename); |
| 334 | blob_zero(&sql); |
| 335 | blob_append_sql(&sql, |
| 336 | "SELECT" |
| 337 | " datetime(min(event.mtime)%s)," /* Date of change */ |
| 338 | " coalesce(event.ecomment, event.comment)," /* Check-in comment */ |
| 339 | " coalesce(event.euser, event.user)," /* User who made chng */ |
| 340 | " mlink.pid," /* Parent file rid */ |
| 341 | " mlink.fid," /* File rid */ |
| 342 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */ |
| @@ -348,11 +348,11 @@ | |
| 348 | " mlink.mid," /* check-in ID */ |
| 349 | " mlink.pfnid" /* Previous filename */ |
| 350 | " FROM mlink, event" |
| 351 | " WHERE mlink.fnid=%d" |
| 352 | " AND event.objid=mlink.mid", |
| 353 | timeline_utc(), TAG_BRANCH, fnid |
| 354 | ); |
| 355 | if( (zA = P("a"))!=0 ){ |
| 356 | blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA); |
| 357 | url_add_parameter(&url, "a", zA); |
| 358 | } |
| 359 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -182,11 +182,11 @@ | |
| 182 | if( rid==0 ){ |
| 183 | fossil_fatal("no history for file: %b", &fname); |
| 184 | } |
| 185 | zFilename = blob_str(&fname); |
| 186 | db_prepare(&q, |
| 187 | "SELECT DISTINCT b.uuid, ci.uuid, date(event.mtime,toLocal())," |
| 188 | " coalesce(event.ecomment, event.comment)," |
| 189 | " coalesce(event.euser, event.user)," |
| 190 | " (SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0" |
| 191 | " AND tagxref.rid=mlink.mid)" /* Tags */ |
| 192 | " FROM mlink, blob b, event, blob ci, filename" |
| @@ -194,11 +194,11 @@ | |
| 194 | " AND mlink.fnid=filename.fnid" |
| 195 | " AND b.rid=mlink.fid" |
| 196 | " AND event.objid=mlink.mid" |
| 197 | " AND event.objid=ci.rid" |
| 198 | " ORDER BY event.mtime DESC LIMIT %d OFFSET %d", |
| 199 | TAG_BRANCH, zFilename, filename_collation(), |
| 200 | iLimit, iOffset |
| 201 | ); |
| 202 | blob_zero(&line); |
| 203 | if( iBrief ){ |
| 204 | fossil_print("History of %s\n", blob_str(&fname)); |
| @@ -332,11 +332,11 @@ | |
| 332 | } |
| 333 | url_add_parameter(&url, "name", zFilename); |
| 334 | blob_zero(&sql); |
| 335 | blob_append_sql(&sql, |
| 336 | "SELECT" |
| 337 | " datetime(min(event.mtime),toLocal())," /* Date of change */ |
| 338 | " coalesce(event.ecomment, event.comment)," /* Check-in comment */ |
| 339 | " coalesce(event.euser, event.user)," /* User who made chng */ |
| 340 | " mlink.pid," /* Parent file rid */ |
| 341 | " mlink.fid," /* File rid */ |
| 342 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */ |
| @@ -348,11 +348,11 @@ | |
| 348 | " mlink.mid," /* check-in ID */ |
| 349 | " mlink.pfnid" /* Previous filename */ |
| 350 | " FROM mlink, event" |
| 351 | " WHERE mlink.fnid=%d" |
| 352 | " AND event.objid=mlink.mid", |
| 353 | TAG_BRANCH, fnid |
| 354 | ); |
| 355 | if( (zA = P("a"))!=0 ){ |
| 356 | blob_append_sql(&sql, " AND event.mtime>=julianday('%q')", zA); |
| 357 | url_add_parameter(&url, "a", zA); |
| 358 | } |
| 359 |
+5
-5
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -233,15 +233,15 @@ | ||
| 233 | 233 | Stmt q; |
| 234 | 234 | int cnt = 0; |
| 235 | 235 | db_prepare(&q, |
| 236 | 236 | "SELECT tag.tagid, tagname, " |
| 237 | 237 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 238 | - " value, datetime(tagxref.mtime%s), tagtype," | |
| 238 | + " value, datetime(tagxref.mtime,toLocal()), tagtype," | |
| 239 | 239 | " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" |
| 240 | 240 | " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" |
| 241 | 241 | " WHERE tagxref.rid=%d" |
| 242 | - " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid | |
| 242 | + " ORDER BY tagname /*sort*/", rid, rid, rid | |
| 243 | 243 | ); |
| 244 | 244 | while( db_step(&q)==SQLITE_ROW ){ |
| 245 | 245 | const char *zTagname = db_column_text(&q, 1); |
| 246 | 246 | const char *zSrcUuid = db_column_text(&q, 2); |
| 247 | 247 | const char *zValue = db_column_text(&q, 3); |
| @@ -546,16 +546,16 @@ | ||
| 546 | 546 | " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim", |
| 547 | 547 | rid |
| 548 | 548 | ); |
| 549 | 549 | isLeaf = is_a_leaf(rid); |
| 550 | 550 | db_prepare(&q1, |
| 551 | - "SELECT uuid, datetime(mtime%s), user, comment," | |
| 552 | - " datetime(omtime%s), mtime" | |
| 551 | + "SELECT uuid, datetime(mtime,toLocal()), user, comment," | |
| 552 | + " datetime(omtime,toLocal()), mtime" | |
| 553 | 553 | " FROM blob, event" |
| 554 | 554 | " WHERE blob.rid=%d" |
| 555 | 555 | " AND event.objid=%d", |
| 556 | - timeline_utc(), timeline_utc(), rid, rid | |
| 556 | + rid, rid | |
| 557 | 557 | ); |
| 558 | 558 | sideBySide = !is_false(PD("sbs","1")); |
| 559 | 559 | if( db_step(&q1)==SQLITE_ROW ){ |
| 560 | 560 | const char *zUuid = db_column_text(&q1, 0); |
| 561 | 561 | char *zEUser, *zEComment; |
| 562 | 562 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -233,15 +233,15 @@ | |
| 233 | Stmt q; |
| 234 | int cnt = 0; |
| 235 | db_prepare(&q, |
| 236 | "SELECT tag.tagid, tagname, " |
| 237 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 238 | " value, datetime(tagxref.mtime%s), tagtype," |
| 239 | " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" |
| 240 | " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" |
| 241 | " WHERE tagxref.rid=%d" |
| 242 | " ORDER BY tagname /*sort*/", rid, timeline_utc(), rid, rid |
| 243 | ); |
| 244 | while( db_step(&q)==SQLITE_ROW ){ |
| 245 | const char *zTagname = db_column_text(&q, 1); |
| 246 | const char *zSrcUuid = db_column_text(&q, 2); |
| 247 | const char *zValue = db_column_text(&q, 3); |
| @@ -546,16 +546,16 @@ | |
| 546 | " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim", |
| 547 | rid |
| 548 | ); |
| 549 | isLeaf = is_a_leaf(rid); |
| 550 | db_prepare(&q1, |
| 551 | "SELECT uuid, datetime(mtime%s), user, comment," |
| 552 | " datetime(omtime%s), mtime" |
| 553 | " FROM blob, event" |
| 554 | " WHERE blob.rid=%d" |
| 555 | " AND event.objid=%d", |
| 556 | timeline_utc(), timeline_utc(), rid, rid |
| 557 | ); |
| 558 | sideBySide = !is_false(PD("sbs","1")); |
| 559 | if( db_step(&q1)==SQLITE_ROW ){ |
| 560 | const char *zUuid = db_column_text(&q1, 0); |
| 561 | char *zEUser, *zEComment; |
| 562 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -233,15 +233,15 @@ | |
| 233 | Stmt q; |
| 234 | int cnt = 0; |
| 235 | db_prepare(&q, |
| 236 | "SELECT tag.tagid, tagname, " |
| 237 | " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," |
| 238 | " value, datetime(tagxref.mtime,toLocal()), tagtype," |
| 239 | " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" |
| 240 | " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" |
| 241 | " WHERE tagxref.rid=%d" |
| 242 | " ORDER BY tagname /*sort*/", rid, rid, rid |
| 243 | ); |
| 244 | while( db_step(&q)==SQLITE_ROW ){ |
| 245 | const char *zTagname = db_column_text(&q, 1); |
| 246 | const char *zSrcUuid = db_column_text(&q, 2); |
| 247 | const char *zValue = db_column_text(&q, 3); |
| @@ -546,16 +546,16 @@ | |
| 546 | " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim", |
| 547 | rid |
| 548 | ); |
| 549 | isLeaf = is_a_leaf(rid); |
| 550 | db_prepare(&q1, |
| 551 | "SELECT uuid, datetime(mtime,toLocal()), user, comment," |
| 552 | " datetime(omtime,toLocal()), mtime" |
| 553 | " FROM blob, event" |
| 554 | " WHERE blob.rid=%d" |
| 555 | " AND event.objid=%d", |
| 556 | rid, rid |
| 557 | ); |
| 558 | sideBySide = !is_false(PD("sbs","1")); |
| 559 | if( db_step(&q1)==SQLITE_ROW ){ |
| 560 | const char *zUuid = db_column_text(&q1, 0); |
| 561 | char *zEUser, *zEComment; |
| 562 |
+2
-2
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -228,18 +228,18 @@ | ||
| 228 | 228 | zBefore = zAfter ? NULL : json_find_option_cstr("before",NULL,"b"); |
| 229 | 229 | |
| 230 | 230 | if(zAfter&&*zAfter){ |
| 231 | 231 | while( fossil_isspace(*zAfter) ) ++zAfter; |
| 232 | 232 | blob_appendf(pSql, |
| 233 | - " AND event.mtime>=(SELECT julianday(%Q,'utc')) " | |
| 233 | + " AND event.mtime>=(SELECT julianday(%Q,fromLocal())) " | |
| 234 | 234 | " ORDER BY event.mtime ASC ", |
| 235 | 235 | zAfter); |
| 236 | 236 | rc = 1; |
| 237 | 237 | }else if(zBefore && *zBefore){ |
| 238 | 238 | while( fossil_isspace(*zBefore) ) ++zBefore; |
| 239 | 239 | blob_appendf(pSql, |
| 240 | - " AND event.mtime<=(SELECT julianday(%Q,'utc')) " | |
| 240 | + " AND event.mtime<=(SELECT julianday(%Q,fromLocal())) " | |
| 241 | 241 | " ORDER BY event.mtime DESC ", |
| 242 | 242 | zBefore); |
| 243 | 243 | rc = -1; |
| 244 | 244 | }else{ |
| 245 | 245 | blob_append(pSql, " ORDER BY event.mtime DESC ", -1); |
| 246 | 246 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -228,18 +228,18 @@ | |
| 228 | zBefore = zAfter ? NULL : json_find_option_cstr("before",NULL,"b"); |
| 229 | |
| 230 | if(zAfter&&*zAfter){ |
| 231 | while( fossil_isspace(*zAfter) ) ++zAfter; |
| 232 | blob_appendf(pSql, |
| 233 | " AND event.mtime>=(SELECT julianday(%Q,'utc')) " |
| 234 | " ORDER BY event.mtime ASC ", |
| 235 | zAfter); |
| 236 | rc = 1; |
| 237 | }else if(zBefore && *zBefore){ |
| 238 | while( fossil_isspace(*zBefore) ) ++zBefore; |
| 239 | blob_appendf(pSql, |
| 240 | " AND event.mtime<=(SELECT julianday(%Q,'utc')) " |
| 241 | " ORDER BY event.mtime DESC ", |
| 242 | zBefore); |
| 243 | rc = -1; |
| 244 | }else{ |
| 245 | blob_append(pSql, " ORDER BY event.mtime DESC ", -1); |
| 246 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -228,18 +228,18 @@ | |
| 228 | zBefore = zAfter ? NULL : json_find_option_cstr("before",NULL,"b"); |
| 229 | |
| 230 | if(zAfter&&*zAfter){ |
| 231 | while( fossil_isspace(*zAfter) ) ++zAfter; |
| 232 | blob_appendf(pSql, |
| 233 | " AND event.mtime>=(SELECT julianday(%Q,fromLocal())) " |
| 234 | " ORDER BY event.mtime ASC ", |
| 235 | zAfter); |
| 236 | rc = 1; |
| 237 | }else if(zBefore && *zBefore){ |
| 238 | while( fossil_isspace(*zBefore) ) ++zBefore; |
| 239 | blob_appendf(pSql, |
| 240 | " AND event.mtime<=(SELECT julianday(%Q,fromLocal())) " |
| 241 | " ORDER BY event.mtime DESC ", |
| 242 | zBefore); |
| 243 | rc = -1; |
| 244 | }else{ |
| 245 | blob_append(pSql, " ORDER BY event.mtime DESC ", -1); |
| 246 |
+2
-2
| --- src/leaf.c | ||
| +++ src/leaf.c | ||
| @@ -224,17 +224,17 @@ | ||
| 224 | 224 | blob_init(&msg, 0, 0); |
| 225 | 225 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 226 | 226 | db_prepare(&q, |
| 227 | 227 | "SELECT" |
| 228 | 228 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 229 | - " (SELECT datetime(mtime%s) FROM event WHERE objid=leaf.rid)," | |
| 229 | + " (SELECT datetime(mtime,toLocal()) FROM event WHERE objid=leaf.rid)," | |
| 230 | 230 | " leaf.rid" |
| 231 | 231 | " FROM leaf" |
| 232 | 232 | " WHERE (SELECT value FROM tagxref WHERE tagid=%d AND rid=leaf.rid)=%Q" |
| 233 | 233 | " AND NOT %z" |
| 234 | 234 | " ORDER BY 2 DESC", |
| 235 | - timeline_utc(), TAG_BRANCH, zBr, leaf_is_closed_sql("leaf.rid") | |
| 235 | + TAG_BRANCH, zBr, leaf_is_closed_sql("leaf.rid") | |
| 236 | 236 | ); |
| 237 | 237 | while( db_step(&q)==SQLITE_ROW ){ |
| 238 | 238 | blob_appendf(&msg, "\n (%d) %s [%S]%s", |
| 239 | 239 | ++n, db_column_text(&q,1), db_column_text(&q,0), |
| 240 | 240 | db_column_int(&q,2)==currentCkout ? " (current)" : ""); |
| 241 | 241 |
| --- src/leaf.c | |
| +++ src/leaf.c | |
| @@ -224,17 +224,17 @@ | |
| 224 | blob_init(&msg, 0, 0); |
| 225 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 226 | db_prepare(&q, |
| 227 | "SELECT" |
| 228 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 229 | " (SELECT datetime(mtime%s) FROM event WHERE objid=leaf.rid)," |
| 230 | " leaf.rid" |
| 231 | " FROM leaf" |
| 232 | " WHERE (SELECT value FROM tagxref WHERE tagid=%d AND rid=leaf.rid)=%Q" |
| 233 | " AND NOT %z" |
| 234 | " ORDER BY 2 DESC", |
| 235 | timeline_utc(), TAG_BRANCH, zBr, leaf_is_closed_sql("leaf.rid") |
| 236 | ); |
| 237 | while( db_step(&q)==SQLITE_ROW ){ |
| 238 | blob_appendf(&msg, "\n (%d) %s [%S]%s", |
| 239 | ++n, db_column_text(&q,1), db_column_text(&q,0), |
| 240 | db_column_int(&q,2)==currentCkout ? " (current)" : ""); |
| 241 |
| --- src/leaf.c | |
| +++ src/leaf.c | |
| @@ -224,17 +224,17 @@ | |
| 224 | blob_init(&msg, 0, 0); |
| 225 | blob_appendf(&msg, "WARNING: multiple open leaf check-ins on %s:", zBr); |
| 226 | db_prepare(&q, |
| 227 | "SELECT" |
| 228 | " (SELECT uuid FROM blob WHERE rid=leaf.rid)," |
| 229 | " (SELECT datetime(mtime,toLocal()) FROM event WHERE objid=leaf.rid)," |
| 230 | " leaf.rid" |
| 231 | " FROM leaf" |
| 232 | " WHERE (SELECT value FROM tagxref WHERE tagid=%d AND rid=leaf.rid)=%Q" |
| 233 | " AND NOT %z" |
| 234 | " ORDER BY 2 DESC", |
| 235 | TAG_BRANCH, zBr, leaf_is_closed_sql("leaf.rid") |
| 236 | ); |
| 237 | while( db_step(&q)==SQLITE_ROW ){ |
| 238 | blob_appendf(&msg, "\n (%d) %s [%S]%s", |
| 239 | ++n, db_column_text(&q,1), db_column_text(&q,0), |
| 240 | db_column_int(&q,2)==currentCkout ? " (current)" : ""); |
| 241 |
+7
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1553,10 +1553,17 @@ | ||
| 1553 | 1553 | ){ |
| 1554 | 1554 | const char *zPathInfo; |
| 1555 | 1555 | char *zPath = NULL; |
| 1556 | 1556 | int idx; |
| 1557 | 1557 | int i; |
| 1558 | + | |
| 1559 | + /* Handle universal query parameters */ | |
| 1560 | + if( PB("utc") ){ | |
| 1561 | + g.fTimeFormat = 1; | |
| 1562 | + }else if( PB("localtime") ){ | |
| 1563 | + g.fTimeFormat = 2; | |
| 1564 | + } | |
| 1558 | 1565 | |
| 1559 | 1566 | /* If the repository has not been opened already, then find the |
| 1560 | 1567 | ** repository based on the first element of PATH_INFO and open it. |
| 1561 | 1568 | */ |
| 1562 | 1569 | zPathInfo = PD("PATH_INFO",""); |
| 1563 | 1570 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1553,10 +1553,17 @@ | |
| 1553 | ){ |
| 1554 | const char *zPathInfo; |
| 1555 | char *zPath = NULL; |
| 1556 | int idx; |
| 1557 | int i; |
| 1558 | |
| 1559 | /* If the repository has not been opened already, then find the |
| 1560 | ** repository based on the first element of PATH_INFO and open it. |
| 1561 | */ |
| 1562 | zPathInfo = PD("PATH_INFO",""); |
| 1563 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1553,10 +1553,17 @@ | |
| 1553 | ){ |
| 1554 | const char *zPathInfo; |
| 1555 | char *zPath = NULL; |
| 1556 | int idx; |
| 1557 | int i; |
| 1558 | |
| 1559 | /* Handle universal query parameters */ |
| 1560 | if( PB("utc") ){ |
| 1561 | g.fTimeFormat = 1; |
| 1562 | }else if( PB("localtime") ){ |
| 1563 | g.fTimeFormat = 2; |
| 1564 | } |
| 1565 | |
| 1566 | /* If the repository has not been opened already, then find the |
| 1567 | ** repository based on the first element of PATH_INFO and open it. |
| 1568 | */ |
| 1569 | zPathInfo = PD("PATH_INFO",""); |
| 1570 |
+4
-4
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -26,17 +26,17 @@ | ||
| 26 | 26 | ** Print information about a particular check-in. |
| 27 | 27 | */ |
| 28 | 28 | void print_checkin_description(int rid, int indent, const char *zLabel){ |
| 29 | 29 | Stmt q; |
| 30 | 30 | db_prepare(&q, |
| 31 | - "SELECT datetime(mtime%s)," | |
| 31 | + "SELECT datetime(mtime,toLocal())," | |
| 32 | 32 | " coalesce(euser,user), coalesce(ecomment,comment)," |
| 33 | 33 | " (SELECT uuid FROM blob WHERE rid=%d)," |
| 34 | 34 | " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" |
| 35 | 35 | " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
| 36 | 36 | " AND tagxref.rid=%d AND tagxref.tagtype>0)" |
| 37 | - " FROM event WHERE objid=%d", timeline_utc(), rid, rid, rid); | |
| 37 | + " FROM event WHERE objid=%d", rid, rid, rid); | |
| 38 | 38 | if( db_step(&q)==SQLITE_ROW ){ |
| 39 | 39 | const char *zTagList = db_column_text(&q, 4); |
| 40 | 40 | char *zCom; |
| 41 | 41 | if( zTagList && zTagList[0] ){ |
| 42 | 42 | zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); |
| @@ -263,16 +263,16 @@ | ||
| 263 | 263 | TAG_BRANCH, vid) |
| 264 | 264 | ); |
| 265 | 265 | } |
| 266 | 266 | db_prepare(&q, |
| 267 | 267 | "SELECT blob.uuid," |
| 268 | - " datetime(event.mtime%s)," | |
| 268 | + " datetime(event.mtime,toLocal())," | |
| 269 | 269 | " coalesce(ecomment, comment)," |
| 270 | 270 | " coalesce(euser, user)" |
| 271 | 271 | " FROM event, blob" |
| 272 | 272 | " WHERE event.objid=%d AND blob.rid=%d", |
| 273 | - timeline_utc(), mid, mid | |
| 273 | + mid, mid | |
| 274 | 274 | ); |
| 275 | 275 | if( db_step(&q)==SQLITE_ROW ){ |
| 276 | 276 | char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", |
| 277 | 277 | db_column_text(&q, 0), db_column_text(&q, 1), |
| 278 | 278 | db_column_text(&q, 3), db_column_text(&q, 2)); |
| 279 | 279 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -26,17 +26,17 @@ | |
| 26 | ** Print information about a particular check-in. |
| 27 | */ |
| 28 | void print_checkin_description(int rid, int indent, const char *zLabel){ |
| 29 | Stmt q; |
| 30 | db_prepare(&q, |
| 31 | "SELECT datetime(mtime%s)," |
| 32 | " coalesce(euser,user), coalesce(ecomment,comment)," |
| 33 | " (SELECT uuid FROM blob WHERE rid=%d)," |
| 34 | " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" |
| 35 | " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
| 36 | " AND tagxref.rid=%d AND tagxref.tagtype>0)" |
| 37 | " FROM event WHERE objid=%d", timeline_utc(), rid, rid, rid); |
| 38 | if( db_step(&q)==SQLITE_ROW ){ |
| 39 | const char *zTagList = db_column_text(&q, 4); |
| 40 | char *zCom; |
| 41 | if( zTagList && zTagList[0] ){ |
| 42 | zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); |
| @@ -263,16 +263,16 @@ | |
| 263 | TAG_BRANCH, vid) |
| 264 | ); |
| 265 | } |
| 266 | db_prepare(&q, |
| 267 | "SELECT blob.uuid," |
| 268 | " datetime(event.mtime%s)," |
| 269 | " coalesce(ecomment, comment)," |
| 270 | " coalesce(euser, user)" |
| 271 | " FROM event, blob" |
| 272 | " WHERE event.objid=%d AND blob.rid=%d", |
| 273 | timeline_utc(), mid, mid |
| 274 | ); |
| 275 | if( db_step(&q)==SQLITE_ROW ){ |
| 276 | char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", |
| 277 | db_column_text(&q, 0), db_column_text(&q, 1), |
| 278 | db_column_text(&q, 3), db_column_text(&q, 2)); |
| 279 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -26,17 +26,17 @@ | |
| 26 | ** Print information about a particular check-in. |
| 27 | */ |
| 28 | void print_checkin_description(int rid, int indent, const char *zLabel){ |
| 29 | Stmt q; |
| 30 | db_prepare(&q, |
| 31 | "SELECT datetime(mtime,toLocal())," |
| 32 | " coalesce(euser,user), coalesce(ecomment,comment)," |
| 33 | " (SELECT uuid FROM blob WHERE rid=%d)," |
| 34 | " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" |
| 35 | " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
| 36 | " AND tagxref.rid=%d AND tagxref.tagtype>0)" |
| 37 | " FROM event WHERE objid=%d", rid, rid, rid); |
| 38 | if( db_step(&q)==SQLITE_ROW ){ |
| 39 | const char *zTagList = db_column_text(&q, 4); |
| 40 | char *zCom; |
| 41 | if( zTagList && zTagList[0] ){ |
| 42 | zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); |
| @@ -263,16 +263,16 @@ | |
| 263 | TAG_BRANCH, vid) |
| 264 | ); |
| 265 | } |
| 266 | db_prepare(&q, |
| 267 | "SELECT blob.uuid," |
| 268 | " datetime(event.mtime,toLocal())," |
| 269 | " coalesce(ecomment, comment)," |
| 270 | " coalesce(euser, user)" |
| 271 | " FROM event, blob" |
| 272 | " WHERE event.objid=%d AND blob.rid=%d", |
| 273 | mid, mid |
| 274 | ); |
| 275 | if( db_step(&q)==SQLITE_ROW ){ |
| 276 | char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", |
| 277 | db_column_text(&q, 0), db_column_text(&q, 1), |
| 278 | db_column_text(&q, 3), db_column_text(&q, 2)); |
| 279 |
+10
-10
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -154,19 +154,19 @@ | ||
| 154 | 154 | |
| 155 | 155 | /* Date and times */ |
| 156 | 156 | if( memcmp(zTag, "date:", 5)==0 ){ |
| 157 | 157 | rid = db_int(0, |
| 158 | 158 | "SELECT objid FROM event" |
| 159 | - " WHERE mtime<=julianday(%Q,'utc') AND type GLOB '%q'" | |
| 159 | + " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" | |
| 160 | 160 | " ORDER BY mtime DESC LIMIT 1", |
| 161 | 161 | &zTag[5], zType); |
| 162 | 162 | return rid; |
| 163 | 163 | } |
| 164 | 164 | if( fossil_isdate(zTag) ){ |
| 165 | 165 | rid = db_int(0, |
| 166 | 166 | "SELECT objid FROM event" |
| 167 | - " WHERE mtime<=julianday(%Q,'utc') AND type GLOB '%q'" | |
| 167 | + " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" | |
| 168 | 168 | " ORDER BY mtime DESC LIMIT 1", |
| 169 | 169 | zTag, zType); |
| 170 | 170 | if( rid) return rid; |
| 171 | 171 | } |
| 172 | 172 | |
| @@ -530,15 +530,15 @@ | ||
| 530 | 530 | Stmt q; |
| 531 | 531 | int cnt; |
| 532 | 532 | |
| 533 | 533 | /* Basic information about the object. */ |
| 534 | 534 | db_prepare(&q, |
| 535 | - "SELECT uuid, size, datetime(mtime%s), ipaddr" | |
| 535 | + "SELECT uuid, size, datetime(mtime,toLocal()), ipaddr" | |
| 536 | 536 | " FROM blob, rcvfrom" |
| 537 | 537 | " WHERE rid=%d" |
| 538 | 538 | " AND rcvfrom.rcvid=blob.rcvid", |
| 539 | - timeline_utc(), rid); | |
| 539 | + rid); | |
| 540 | 540 | if( db_step(&q)==SQLITE_ROW ){ |
| 541 | 541 | if( verboseFlag ){ |
| 542 | 542 | fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); |
| 543 | 543 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 544 | 544 | fossil_print("received: %s from %s\n", |
| @@ -585,13 +585,13 @@ | ||
| 585 | 585 | if( cnt ) fossil_print("\n"); |
| 586 | 586 | db_finalize(&q); |
| 587 | 587 | |
| 588 | 588 | /* Check for entries on the timeline that reference this object */ |
| 589 | 589 | db_prepare(&q, |
| 590 | - "SELECT type, datetime(mtime%s)," | |
| 590 | + "SELECT type, datetime(mtime,toLocal())," | |
| 591 | 591 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 592 | - " FROM event WHERE objid=%d", timeline_utc(), rid); | |
| 592 | + " FROM event WHERE objid=%d", rid); | |
| 593 | 593 | if( db_step(&q)==SQLITE_ROW ){ |
| 594 | 594 | const char *zType; |
| 595 | 595 | switch( db_column_text(&q,0)[0] ){ |
| 596 | 596 | case 'c': zType = "Check-in"; break; |
| 597 | 597 | case 'w': zType = "Wiki-edit"; break; |
| @@ -607,19 +607,19 @@ | ||
| 607 | 607 | } |
| 608 | 608 | db_finalize(&q); |
| 609 | 609 | |
| 610 | 610 | /* Check to see if this object is used as a file in a check-in */ |
| 611 | 611 | db_prepare(&q, |
| 612 | - "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," | |
| 612 | + "SELECT filename.name, blob.uuid, datetime(event.mtime,toLocal())," | |
| 613 | 613 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 614 | 614 | " FROM mlink, filename, blob, event" |
| 615 | 615 | " WHERE mlink.fid=%d" |
| 616 | 616 | " AND filename.fnid=mlink.fnid" |
| 617 | 617 | " AND event.objid=mlink.mid" |
| 618 | 618 | " AND blob.rid=mlink.mid" |
| 619 | 619 | " ORDER BY event.mtime DESC /*sort*/", |
| 620 | - timeline_utc(), rid); | |
| 620 | + rid); | |
| 621 | 621 | while( db_step(&q)==SQLITE_ROW ){ |
| 622 | 622 | fossil_print("file: %s\n", db_column_text(&q,0)); |
| 623 | 623 | fossil_print(" part of [%S] by %s on %s\n", |
| 624 | 624 | db_column_text(&q, 1), |
| 625 | 625 | db_column_text(&q, 3), |
| @@ -632,21 +632,21 @@ | ||
| 632 | 632 | /* Check to see if this object is used as an attachment */ |
| 633 | 633 | db_prepare(&q, |
| 634 | 634 | "SELECT attachment.filename," |
| 635 | 635 | " attachment.comment," |
| 636 | 636 | " attachment.user," |
| 637 | - " datetime(attachment.mtime%s)," | |
| 637 | + " datetime(attachment.mtime,toLocal())," | |
| 638 | 638 | " attachment.target," |
| 639 | 639 | " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))" |
| 640 | 640 | " THEN 'ticket'" |
| 641 | 641 | " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))" |
| 642 | 642 | " THEN 'wiki' END," |
| 643 | 643 | " attachment.attachid," |
| 644 | 644 | " (SELECT uuid FROM blob WHERE rid=attachid)" |
| 645 | 645 | " FROM attachment JOIN blob ON attachment.src=blob.uuid" |
| 646 | 646 | " WHERE blob.rid=%d", |
| 647 | - timeline_utc(), rid | |
| 647 | + rid | |
| 648 | 648 | ); |
| 649 | 649 | while( db_step(&q)==SQLITE_ROW ){ |
| 650 | 650 | fossil_print("attachment: %s\n", db_column_text(&q,0)); |
| 651 | 651 | fossil_print(" attached to %s %s\n", |
| 652 | 652 | db_column_text(&q,5), db_column_text(&q,4)); |
| 653 | 653 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -154,19 +154,19 @@ | |
| 154 | |
| 155 | /* Date and times */ |
| 156 | if( memcmp(zTag, "date:", 5)==0 ){ |
| 157 | rid = db_int(0, |
| 158 | "SELECT objid FROM event" |
| 159 | " WHERE mtime<=julianday(%Q,'utc') AND type GLOB '%q'" |
| 160 | " ORDER BY mtime DESC LIMIT 1", |
| 161 | &zTag[5], zType); |
| 162 | return rid; |
| 163 | } |
| 164 | if( fossil_isdate(zTag) ){ |
| 165 | rid = db_int(0, |
| 166 | "SELECT objid FROM event" |
| 167 | " WHERE mtime<=julianday(%Q,'utc') AND type GLOB '%q'" |
| 168 | " ORDER BY mtime DESC LIMIT 1", |
| 169 | zTag, zType); |
| 170 | if( rid) return rid; |
| 171 | } |
| 172 | |
| @@ -530,15 +530,15 @@ | |
| 530 | Stmt q; |
| 531 | int cnt; |
| 532 | |
| 533 | /* Basic information about the object. */ |
| 534 | db_prepare(&q, |
| 535 | "SELECT uuid, size, datetime(mtime%s), ipaddr" |
| 536 | " FROM blob, rcvfrom" |
| 537 | " WHERE rid=%d" |
| 538 | " AND rcvfrom.rcvid=blob.rcvid", |
| 539 | timeline_utc(), rid); |
| 540 | if( db_step(&q)==SQLITE_ROW ){ |
| 541 | if( verboseFlag ){ |
| 542 | fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); |
| 543 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 544 | fossil_print("received: %s from %s\n", |
| @@ -585,13 +585,13 @@ | |
| 585 | if( cnt ) fossil_print("\n"); |
| 586 | db_finalize(&q); |
| 587 | |
| 588 | /* Check for entries on the timeline that reference this object */ |
| 589 | db_prepare(&q, |
| 590 | "SELECT type, datetime(mtime%s)," |
| 591 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 592 | " FROM event WHERE objid=%d", timeline_utc(), rid); |
| 593 | if( db_step(&q)==SQLITE_ROW ){ |
| 594 | const char *zType; |
| 595 | switch( db_column_text(&q,0)[0] ){ |
| 596 | case 'c': zType = "Check-in"; break; |
| 597 | case 'w': zType = "Wiki-edit"; break; |
| @@ -607,19 +607,19 @@ | |
| 607 | } |
| 608 | db_finalize(&q); |
| 609 | |
| 610 | /* Check to see if this object is used as a file in a check-in */ |
| 611 | db_prepare(&q, |
| 612 | "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," |
| 613 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 614 | " FROM mlink, filename, blob, event" |
| 615 | " WHERE mlink.fid=%d" |
| 616 | " AND filename.fnid=mlink.fnid" |
| 617 | " AND event.objid=mlink.mid" |
| 618 | " AND blob.rid=mlink.mid" |
| 619 | " ORDER BY event.mtime DESC /*sort*/", |
| 620 | timeline_utc(), rid); |
| 621 | while( db_step(&q)==SQLITE_ROW ){ |
| 622 | fossil_print("file: %s\n", db_column_text(&q,0)); |
| 623 | fossil_print(" part of [%S] by %s on %s\n", |
| 624 | db_column_text(&q, 1), |
| 625 | db_column_text(&q, 3), |
| @@ -632,21 +632,21 @@ | |
| 632 | /* Check to see if this object is used as an attachment */ |
| 633 | db_prepare(&q, |
| 634 | "SELECT attachment.filename," |
| 635 | " attachment.comment," |
| 636 | " attachment.user," |
| 637 | " datetime(attachment.mtime%s)," |
| 638 | " attachment.target," |
| 639 | " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))" |
| 640 | " THEN 'ticket'" |
| 641 | " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))" |
| 642 | " THEN 'wiki' END," |
| 643 | " attachment.attachid," |
| 644 | " (SELECT uuid FROM blob WHERE rid=attachid)" |
| 645 | " FROM attachment JOIN blob ON attachment.src=blob.uuid" |
| 646 | " WHERE blob.rid=%d", |
| 647 | timeline_utc(), rid |
| 648 | ); |
| 649 | while( db_step(&q)==SQLITE_ROW ){ |
| 650 | fossil_print("attachment: %s\n", db_column_text(&q,0)); |
| 651 | fossil_print(" attached to %s %s\n", |
| 652 | db_column_text(&q,5), db_column_text(&q,4)); |
| 653 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -154,19 +154,19 @@ | |
| 154 | |
| 155 | /* Date and times */ |
| 156 | if( memcmp(zTag, "date:", 5)==0 ){ |
| 157 | rid = db_int(0, |
| 158 | "SELECT objid FROM event" |
| 159 | " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" |
| 160 | " ORDER BY mtime DESC LIMIT 1", |
| 161 | &zTag[5], zType); |
| 162 | return rid; |
| 163 | } |
| 164 | if( fossil_isdate(zTag) ){ |
| 165 | rid = db_int(0, |
| 166 | "SELECT objid FROM event" |
| 167 | " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" |
| 168 | " ORDER BY mtime DESC LIMIT 1", |
| 169 | zTag, zType); |
| 170 | if( rid) return rid; |
| 171 | } |
| 172 | |
| @@ -530,15 +530,15 @@ | |
| 530 | Stmt q; |
| 531 | int cnt; |
| 532 | |
| 533 | /* Basic information about the object. */ |
| 534 | db_prepare(&q, |
| 535 | "SELECT uuid, size, datetime(mtime,toLocal()), ipaddr" |
| 536 | " FROM blob, rcvfrom" |
| 537 | " WHERE rid=%d" |
| 538 | " AND rcvfrom.rcvid=blob.rcvid", |
| 539 | rid); |
| 540 | if( db_step(&q)==SQLITE_ROW ){ |
| 541 | if( verboseFlag ){ |
| 542 | fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); |
| 543 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 544 | fossil_print("received: %s from %s\n", |
| @@ -585,13 +585,13 @@ | |
| 585 | if( cnt ) fossil_print("\n"); |
| 586 | db_finalize(&q); |
| 587 | |
| 588 | /* Check for entries on the timeline that reference this object */ |
| 589 | db_prepare(&q, |
| 590 | "SELECT type, datetime(mtime,toLocal())," |
| 591 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 592 | " FROM event WHERE objid=%d", rid); |
| 593 | if( db_step(&q)==SQLITE_ROW ){ |
| 594 | const char *zType; |
| 595 | switch( db_column_text(&q,0)[0] ){ |
| 596 | case 'c': zType = "Check-in"; break; |
| 597 | case 'w': zType = "Wiki-edit"; break; |
| @@ -607,19 +607,19 @@ | |
| 607 | } |
| 608 | db_finalize(&q); |
| 609 | |
| 610 | /* Check to see if this object is used as a file in a check-in */ |
| 611 | db_prepare(&q, |
| 612 | "SELECT filename.name, blob.uuid, datetime(event.mtime,toLocal())," |
| 613 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 614 | " FROM mlink, filename, blob, event" |
| 615 | " WHERE mlink.fid=%d" |
| 616 | " AND filename.fnid=mlink.fnid" |
| 617 | " AND event.objid=mlink.mid" |
| 618 | " AND blob.rid=mlink.mid" |
| 619 | " ORDER BY event.mtime DESC /*sort*/", |
| 620 | rid); |
| 621 | while( db_step(&q)==SQLITE_ROW ){ |
| 622 | fossil_print("file: %s\n", db_column_text(&q,0)); |
| 623 | fossil_print(" part of [%S] by %s on %s\n", |
| 624 | db_column_text(&q, 1), |
| 625 | db_column_text(&q, 3), |
| @@ -632,21 +632,21 @@ | |
| 632 | /* Check to see if this object is used as an attachment */ |
| 633 | db_prepare(&q, |
| 634 | "SELECT attachment.filename," |
| 635 | " attachment.comment," |
| 636 | " attachment.user," |
| 637 | " datetime(attachment.mtime,toLocal())," |
| 638 | " attachment.target," |
| 639 | " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))" |
| 640 | " THEN 'ticket'" |
| 641 | " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))" |
| 642 | " THEN 'wiki' END," |
| 643 | " attachment.attachid," |
| 644 | " (SELECT uuid FROM blob WHERE rid=attachid)" |
| 645 | " FROM attachment JOIN blob ON attachment.src=blob.uuid" |
| 646 | " WHERE blob.rid=%d", |
| 647 | rid |
| 648 | ); |
| 649 | while( db_step(&q)==SQLITE_ROW ){ |
| 650 | fossil_print("attachment: %s\n", db_column_text(&q,0)); |
| 651 | fossil_print(" attached to %s %s\n", |
| 652 | db_column_text(&q,5), db_column_text(&q,4)); |
| 653 |
+1
-1
| --- src/purge.c | ||
| +++ src/purge.c | ||
| @@ -492,11 +492,11 @@ | ||
| 492 | 492 | /* The "checkins" subcommand goes here in alphabetical order, but it must |
| 493 | 493 | ** be moved to the end since it is the default case */ |
| 494 | 494 | }else if( strncmp(zSubcmd, "list", n)==0 || strcmp(zSubcmd,"ls")==0 ){ |
| 495 | 495 | int showDetail = find_option("l","l",0)!=0; |
| 496 | 496 | if( !db_table_exists("repository","purgeevent") ) return; |
| 497 | - db_prepare(&q, "SELECT peid, datetime(ctime,'unixepoch','localtime')" | |
| 497 | + db_prepare(&q, "SELECT peid, datetime(ctime,'unixepoch',toLocal())" | |
| 498 | 498 | " FROM purgeevent"); |
| 499 | 499 | while( db_step(&q)==SQLITE_ROW ){ |
| 500 | 500 | fossil_print("%4d on %s\n", db_column_int(&q,0), db_column_text(&q,1)); |
| 501 | 501 | if( showDetail ){ |
| 502 | 502 | purge_list_event_content(db_column_int(&q,0)); |
| 503 | 503 |
| --- src/purge.c | |
| +++ src/purge.c | |
| @@ -492,11 +492,11 @@ | |
| 492 | /* The "checkins" subcommand goes here in alphabetical order, but it must |
| 493 | ** be moved to the end since it is the default case */ |
| 494 | }else if( strncmp(zSubcmd, "list", n)==0 || strcmp(zSubcmd,"ls")==0 ){ |
| 495 | int showDetail = find_option("l","l",0)!=0; |
| 496 | if( !db_table_exists("repository","purgeevent") ) return; |
| 497 | db_prepare(&q, "SELECT peid, datetime(ctime,'unixepoch','localtime')" |
| 498 | " FROM purgeevent"); |
| 499 | while( db_step(&q)==SQLITE_ROW ){ |
| 500 | fossil_print("%4d on %s\n", db_column_int(&q,0), db_column_text(&q,1)); |
| 501 | if( showDetail ){ |
| 502 | purge_list_event_content(db_column_int(&q,0)); |
| 503 |
| --- src/purge.c | |
| +++ src/purge.c | |
| @@ -492,11 +492,11 @@ | |
| 492 | /* The "checkins" subcommand goes here in alphabetical order, but it must |
| 493 | ** be moved to the end since it is the default case */ |
| 494 | }else if( strncmp(zSubcmd, "list", n)==0 || strcmp(zSubcmd,"ls")==0 ){ |
| 495 | int showDetail = find_option("l","l",0)!=0; |
| 496 | if( !db_table_exists("repository","purgeevent") ) return; |
| 497 | db_prepare(&q, "SELECT peid, datetime(ctime,'unixepoch',toLocal())" |
| 498 | " FROM purgeevent"); |
| 499 | while( db_step(&q)==SQLITE_ROW ){ |
| 500 | fossil_print("%4d on %s\n", db_column_int(&q,0), db_column_text(&q,1)); |
| 501 | if( showDetail ){ |
| 502 | purge_list_event_content(db_column_int(&q,0)); |
| 503 |
+2
-3
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -567,17 +567,16 @@ | ||
| 567 | 567 | |
| 568 | 568 | db_multi_exec( |
| 569 | 569 | "CREATE TEMP TABLE srch(rid,uuid,date,comment,x);" |
| 570 | 570 | "CREATE INDEX srch_idx1 ON srch(x);" |
| 571 | 571 | "INSERT INTO srch(rid,uuid,date,comment,x)" |
| 572 | - " SELECT blob.rid, uuid, datetime(event.mtime%s)," | |
| 572 | + " SELECT blob.rid, uuid, datetime(event.mtime,toLocal())," | |
| 573 | 573 | " coalesce(ecomment,comment)," |
| 574 | 574 | " search_score()" |
| 575 | 575 | " FROM event, blob" |
| 576 | 576 | " WHERE blob.rid=event.objid" |
| 577 | - " AND search_match(coalesce(ecomment,comment));", | |
| 578 | - timeline_utc() | |
| 577 | + " AND search_match(coalesce(ecomment,comment));" | |
| 579 | 578 | ); |
| 580 | 579 | iBest = db_int(0, "SELECT max(x) FROM srch"); |
| 581 | 580 | blob_append(&sql, |
| 582 | 581 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch " |
| 583 | 582 | "WHERE 1 ", -1); |
| 584 | 583 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -567,17 +567,16 @@ | |
| 567 | |
| 568 | db_multi_exec( |
| 569 | "CREATE TEMP TABLE srch(rid,uuid,date,comment,x);" |
| 570 | "CREATE INDEX srch_idx1 ON srch(x);" |
| 571 | "INSERT INTO srch(rid,uuid,date,comment,x)" |
| 572 | " SELECT blob.rid, uuid, datetime(event.mtime%s)," |
| 573 | " coalesce(ecomment,comment)," |
| 574 | " search_score()" |
| 575 | " FROM event, blob" |
| 576 | " WHERE blob.rid=event.objid" |
| 577 | " AND search_match(coalesce(ecomment,comment));", |
| 578 | timeline_utc() |
| 579 | ); |
| 580 | iBest = db_int(0, "SELECT max(x) FROM srch"); |
| 581 | blob_append(&sql, |
| 582 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch " |
| 583 | "WHERE 1 ", -1); |
| 584 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -567,17 +567,16 @@ | |
| 567 | |
| 568 | db_multi_exec( |
| 569 | "CREATE TEMP TABLE srch(rid,uuid,date,comment,x);" |
| 570 | "CREATE INDEX srch_idx1 ON srch(x);" |
| 571 | "INSERT INTO srch(rid,uuid,date,comment,x)" |
| 572 | " SELECT blob.rid, uuid, datetime(event.mtime,toLocal())," |
| 573 | " coalesce(ecomment,comment)," |
| 574 | " search_score()" |
| 575 | " FROM event, blob" |
| 576 | " WHERE blob.rid=event.objid" |
| 577 | " AND search_match(coalesce(ecomment,comment));" |
| 578 | ); |
| 579 | iBest = db_int(0, "SELECT max(x) FROM srch"); |
| 580 | blob_append(&sql, |
| 581 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch " |
| 582 | "WHERE 1 ", -1); |
| 583 |
+64
-48
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -325,11 +325,11 @@ | ||
| 325 | 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | 327 | */ |
| 328 | 328 | #define SQLITE_VERSION "3.10.0" |
| 329 | 329 | #define SQLITE_VERSION_NUMBER 3010000 |
| 330 | -#define SQLITE_SOURCE_ID "2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d" | |
| 330 | +#define SQLITE_SOURCE_ID "2015-12-23 10:54:48 b910a3d53769689d9212a06f974ccce54844bbe4" | |
| 331 | 331 | |
| 332 | 332 | /* |
| 333 | 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | 335 | ** |
| @@ -14256,10 +14256,11 @@ | ||
| 14256 | 14256 | SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*); |
| 14257 | 14257 | SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); |
| 14258 | 14258 | SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*); |
| 14259 | 14259 | SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int); |
| 14260 | 14260 | SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); |
| 14261 | +SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); | |
| 14261 | 14262 | SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); |
| 14262 | 14263 | SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8); |
| 14263 | 14264 | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 14264 | 14265 | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 14265 | 14266 | SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
| @@ -16491,10 +16492,11 @@ | ||
| 16491 | 16492 | double s; /* Seconds */ |
| 16492 | 16493 | char validYMD; /* True (1) if Y,M,D are valid */ |
| 16493 | 16494 | char validHMS; /* True (1) if h,m,s are valid */ |
| 16494 | 16495 | char validJD; /* True (1) if iJD is valid */ |
| 16495 | 16496 | char validTZ; /* True (1) if tz is valid */ |
| 16497 | + char tzSet; /* Timezone was set explicitly */ | |
| 16496 | 16498 | }; |
| 16497 | 16499 | |
| 16498 | 16500 | |
| 16499 | 16501 | /* |
| 16500 | 16502 | ** Convert zDate into one or more integers. Additional arguments |
| @@ -16584,10 +16586,11 @@ | ||
| 16584 | 16586 | } |
| 16585 | 16587 | zDate += 5; |
| 16586 | 16588 | p->tz = sgn*(nMn + nHr*60); |
| 16587 | 16589 | zulu_time: |
| 16588 | 16590 | while( sqlite3Isspace(*zDate) ){ zDate++; } |
| 16591 | + p->tzSet = 1; | |
| 16589 | 16592 | return *zDate!=0; |
| 16590 | 16593 | } |
| 16591 | 16594 | |
| 16592 | 16595 | /* |
| 16593 | 16596 | ** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. |
| @@ -17016,17 +17019,22 @@ | ||
| 17016 | 17019 | clearYMD_HMS_TZ(p); |
| 17017 | 17020 | rc = 0; |
| 17018 | 17021 | } |
| 17019 | 17022 | #ifndef SQLITE_OMIT_LOCALTIME |
| 17020 | 17023 | else if( strcmp(z, "utc")==0 ){ |
| 17021 | - sqlite3_int64 c1; | |
| 17022 | - computeJD(p); | |
| 17023 | - c1 = localtimeOffset(p, pCtx, &rc); | |
| 17024 | - if( rc==SQLITE_OK ){ | |
| 17025 | - p->iJD -= c1; | |
| 17026 | - clearYMD_HMS_TZ(p); | |
| 17027 | - p->iJD += c1 - localtimeOffset(p, pCtx, &rc); | |
| 17024 | + if( p->tzSet==0 ){ | |
| 17025 | + sqlite3_int64 c1; | |
| 17026 | + computeJD(p); | |
| 17027 | + c1 = localtimeOffset(p, pCtx, &rc); | |
| 17028 | + if( rc==SQLITE_OK ){ | |
| 17029 | + p->iJD -= c1; | |
| 17030 | + clearYMD_HMS_TZ(p); | |
| 17031 | + p->iJD += c1 - localtimeOffset(p, pCtx, &rc); | |
| 17032 | + } | |
| 17033 | + p->tzSet = 1; | |
| 17034 | + }else{ | |
| 17035 | + rc = SQLITE_OK; | |
| 17028 | 17036 | } |
| 17029 | 17037 | } |
| 17030 | 17038 | #endif |
| 17031 | 17039 | break; |
| 17032 | 17040 | } |
| @@ -19662,11 +19670,11 @@ | ||
| 19662 | 19670 | ** This version of the memory allocation subsystem is included |
| 19663 | 19671 | ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. |
| 19664 | 19672 | ** |
| 19665 | 19673 | ** This memory allocator uses the following algorithm: |
| 19666 | 19674 | ** |
| 19667 | -** 1. All memory allocations sizes are rounded up to a power of 2. | |
| 19675 | +** 1. All memory allocation sizes are rounded up to a power of 2. | |
| 19668 | 19676 | ** |
| 19669 | 19677 | ** 2. If two adjacent free blocks are the halves of a larger block, |
| 19670 | 19678 | ** then the two blocks are coalesced into the single larger block. |
| 19671 | 19679 | ** |
| 19672 | 19680 | ** 3. New memory is allocated from the first available free block. |
| @@ -19754,11 +19762,11 @@ | ||
| 19754 | 19762 | u32 maxRequest; /* Largest allocation (exclusive of internal frag) */ |
| 19755 | 19763 | |
| 19756 | 19764 | /* |
| 19757 | 19765 | ** Lists of free blocks. aiFreelist[0] is a list of free blocks of |
| 19758 | 19766 | ** size mem5.szAtom. aiFreelist[1] holds blocks of size szAtom*2. |
| 19759 | - ** and so forth. | |
| 19767 | + ** aiFreelist[2] holds free blocks of size szAtom*4. And so forth. | |
| 19760 | 19768 | */ |
| 19761 | 19769 | int aiFreelist[LOGMAX+1]; |
| 19762 | 19770 | |
| 19763 | 19771 | /* |
| 19764 | 19772 | ** Space for tracking which blocks are checked out and the size |
| @@ -19820,25 +19828,22 @@ | ||
| 19820 | 19828 | } |
| 19821 | 19829 | mem5.aiFreelist[iLogsize] = i; |
| 19822 | 19830 | } |
| 19823 | 19831 | |
| 19824 | 19832 | /* |
| 19825 | -** If the STATIC_MEM mutex is not already held, obtain it now. The mutex | |
| 19826 | -** will already be held (obtained by code in malloc.c) if | |
| 19827 | -** sqlite3GlobalConfig.bMemStat is true. | |
| 19833 | +** Obtain or release the mutex needed to access global data structures. | |
| 19828 | 19834 | */ |
| 19829 | 19835 | static void memsys5Enter(void){ |
| 19830 | 19836 | sqlite3_mutex_enter(mem5.mutex); |
| 19831 | 19837 | } |
| 19832 | 19838 | static void memsys5Leave(void){ |
| 19833 | 19839 | sqlite3_mutex_leave(mem5.mutex); |
| 19834 | 19840 | } |
| 19835 | 19841 | |
| 19836 | 19842 | /* |
| 19837 | -** Return the size of an outstanding allocation, in bytes. The | |
| 19838 | -** size returned omits the 8-byte header overhead. This only | |
| 19839 | -** works for chunks that are currently checked out. | |
| 19843 | +** Return the size of an outstanding allocation, in bytes. | |
| 19844 | +** This only works for chunks that are currently checked out. | |
| 19840 | 19845 | */ |
| 19841 | 19846 | static int memsys5Size(void *p){ |
| 19842 | 19847 | int iSize, i; |
| 19843 | 19848 | assert( p!=0 ); |
| 19844 | 19849 | i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom); |
| @@ -19867,20 +19872,16 @@ | ||
| 19867 | 19872 | assert( nByte>0 ); |
| 19868 | 19873 | |
| 19869 | 19874 | /* Keep track of the maximum allocation request. Even unfulfilled |
| 19870 | 19875 | ** requests are counted */ |
| 19871 | 19876 | if( (u32)nByte>mem5.maxRequest ){ |
| 19877 | + /* Abort if the requested allocation size is larger than the largest | |
| 19878 | + ** power of two that we can represent using 32-bit signed integers. */ | |
| 19879 | + if( nByte > 0x40000000 ) return 0; | |
| 19872 | 19880 | mem5.maxRequest = nByte; |
| 19873 | 19881 | } |
| 19874 | 19882 | |
| 19875 | - /* Abort if the requested allocation size is larger than the largest | |
| 19876 | - ** power of two that we can represent using 32-bit signed integers. | |
| 19877 | - */ | |
| 19878 | - if( nByte > 0x40000000 ){ | |
| 19879 | - return 0; | |
| 19880 | - } | |
| 19881 | - | |
| 19882 | 19883 | /* Round nByte up to the next valid power of two */ |
| 19883 | 19884 | for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){} |
| 19884 | 19885 | |
| 19885 | 19886 | /* Make sure mem5.aiFreelist[iLogsize] contains at least one free |
| 19886 | 19887 | ** block. If not, then split a block of the next larger power of |
| @@ -20035,17 +20036,15 @@ | ||
| 20035 | 20036 | } |
| 20036 | 20037 | nOld = memsys5Size(pPrior); |
| 20037 | 20038 | if( nBytes<=nOld ){ |
| 20038 | 20039 | return pPrior; |
| 20039 | 20040 | } |
| 20040 | - memsys5Enter(); | |
| 20041 | - p = memsys5MallocUnsafe(nBytes); | |
| 20041 | + p = memsys5Malloc(nBytes); | |
| 20042 | 20042 | if( p ){ |
| 20043 | 20043 | memcpy(p, pPrior, nOld); |
| 20044 | - memsys5FreeUnsafe(pPrior); | |
| 20044 | + memsys5Free(pPrior); | |
| 20045 | 20045 | } |
| 20046 | - memsys5Leave(); | |
| 20047 | 20046 | return p; |
| 20048 | 20047 | } |
| 20049 | 20048 | |
| 20050 | 20049 | /* |
| 20051 | 20050 | ** Round up a request size to the next valid allocation size. If |
| @@ -41848,11 +41847,11 @@ | ||
| 41848 | 41847 | ** Free an allocated buffer obtained from pcache1Alloc(). |
| 41849 | 41848 | */ |
| 41850 | 41849 | static void pcache1Free(void *p){ |
| 41851 | 41850 | int nFreed = 0; |
| 41852 | 41851 | if( p==0 ) return; |
| 41853 | - if( p>=pcache1.pStart && p<pcache1.pEnd ){ | |
| 41852 | + if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){ | |
| 41854 | 41853 | PgFreeslot *pSlot; |
| 41855 | 41854 | sqlite3_mutex_enter(pcache1.mutex); |
| 41856 | 41855 | sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1); |
| 41857 | 41856 | pSlot = (PgFreeslot*)p; |
| 41858 | 41857 | pSlot->pNext = pcache1.pFree; |
| @@ -53187,10 +53186,11 @@ | ||
| 53187 | 53186 | ** with *pSnapshot and set *pChanged as appropriate for opening the |
| 53188 | 53187 | ** snapshot. */ |
| 53189 | 53188 | if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) |
| 53190 | 53189 | && pSnapshot->mxFrame>=pInfo->nBackfillAttempted |
| 53191 | 53190 | ){ |
| 53191 | + assert( pWal->readLock>0 ); | |
| 53192 | 53192 | memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr)); |
| 53193 | 53193 | *pChanged = bChanged; |
| 53194 | 53194 | }else{ |
| 53195 | 53195 | rc = SQLITE_BUSY_SNAPSHOT; |
| 53196 | 53196 | } |
| @@ -61549,11 +61549,11 @@ | ||
| 61549 | 61549 | memcpy(&pTmp[i], &aData[i], usableSize - i); |
| 61550 | 61550 | |
| 61551 | 61551 | pData = pEnd; |
| 61552 | 61552 | for(i=0; i<nCell; i++){ |
| 61553 | 61553 | u8 *pCell = apCell[i]; |
| 61554 | - if( pCell>aData && pCell<pEnd ){ | |
| 61554 | + if( SQLITE_WITHIN(pCell,aData,pEnd) ){ | |
| 61555 | 61555 | pCell = &pTmp[pCell - aData]; |
| 61556 | 61556 | } |
| 61557 | 61557 | pData -= szCell[i]; |
| 61558 | 61558 | put2byte(pCellptr, (pData - aData)); |
| 61559 | 61559 | pCellptr += 2; |
| @@ -61660,11 +61660,11 @@ | ||
| 61660 | 61660 | u8 *pFree = 0; |
| 61661 | 61661 | int szFree = 0; |
| 61662 | 61662 | |
| 61663 | 61663 | for(i=iFirst; i<iEnd; i++){ |
| 61664 | 61664 | u8 *pCell = pCArray->apCell[i]; |
| 61665 | - if( pCell>=pStart && pCell<pEnd ){ | |
| 61665 | + if( SQLITE_WITHIN(pCell, pStart, pEnd) ){ | |
| 61666 | 61666 | int sz; |
| 61667 | 61667 | /* No need to use cachedCellSize() here. The sizes of all cells that |
| 61668 | 61668 | ** are to be freed have already been computing while deciding which |
| 61669 | 61669 | ** cells need freeing */ |
| 61670 | 61670 | sz = pCArray->szCell[i]; assert( sz>0 ); |
| @@ -75650,10 +75650,11 @@ | ||
| 75650 | 75650 | ** then the result is always NULL. |
| 75651 | 75651 | ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. |
| 75652 | 75652 | */ |
| 75653 | 75653 | if( pOp->p5 & SQLITE_STOREP2 ){ |
| 75654 | 75654 | pOut = &aMem[pOp->p2]; |
| 75655 | + memAboutToChange(p, pOut); | |
| 75655 | 75656 | MemSetTypeFlag(pOut, MEM_Null); |
| 75656 | 75657 | REGISTER_TRACE(pOp->p2, pOut); |
| 75657 | 75658 | }else{ |
| 75658 | 75659 | VdbeBranchTaken(2,3); |
| 75659 | 75660 | if( pOp->p5 & SQLITE_JUMPIFNULL ){ |
| @@ -76192,10 +76193,12 @@ | ||
| 76192 | 76193 | || (offset64 > pC->payloadSize) |
| 76193 | 76194 | ){ |
| 76194 | 76195 | rc = SQLITE_CORRUPT_BKPT; |
| 76195 | 76196 | goto op_column_error; |
| 76196 | 76197 | } |
| 76198 | + }else{ | |
| 76199 | + VVA_ONLY( t = 0; ) /* Only needed by assert() statements */ | |
| 76197 | 76200 | } |
| 76198 | 76201 | |
| 76199 | 76202 | /* If after trying to extract new entries from the header, nHdrParsed is |
| 76200 | 76203 | ** still not up to p2, that means that the record has fewer than p2 |
| 76201 | 76204 | ** columns. So the result will be either the default value or a NULL. |
| @@ -88316,11 +88319,11 @@ | ||
| 88316 | 88319 | i16 iTabCol = pIdx->aiColumn[iIdxCol]; |
| 88317 | 88320 | if( iTabCol==XN_EXPR ){ |
| 88318 | 88321 | assert( pIdx->aColExpr ); |
| 88319 | 88322 | assert( pIdx->aColExpr->nExpr>iIdxCol ); |
| 88320 | 88323 | pParse->iSelfTab = iTabCur; |
| 88321 | - sqlite3ExprCode(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); | |
| 88324 | + sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); | |
| 88322 | 88325 | }else{ |
| 88323 | 88326 | sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, |
| 88324 | 88327 | iTabCol, regOut); |
| 88325 | 88328 | } |
| 88326 | 88329 | } |
| @@ -89169,16 +89172,28 @@ | ||
| 89169 | 89172 | assert( target>0 && target<=pParse->nMem ); |
| 89170 | 89173 | if( pExpr && pExpr->op==TK_REGISTER ){ |
| 89171 | 89174 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); |
| 89172 | 89175 | }else{ |
| 89173 | 89176 | inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 89174 | - assert( pParse->pVdbe || pParse->db->mallocFailed ); | |
| 89177 | + assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); | |
| 89175 | 89178 | if( inReg!=target && pParse->pVdbe ){ |
| 89176 | 89179 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); |
| 89177 | 89180 | } |
| 89178 | 89181 | } |
| 89179 | 89182 | } |
| 89183 | + | |
| 89184 | +/* | |
| 89185 | +** Make a transient copy of expression pExpr and then code it using | |
| 89186 | +** sqlite3ExprCode(). This routine works just like sqlite3ExprCode() | |
| 89187 | +** except that the input expression is guaranteed to be unchanged. | |
| 89188 | +*/ | |
| 89189 | +SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ | |
| 89190 | + sqlite3 *db = pParse->db; | |
| 89191 | + pExpr = sqlite3ExprDup(db, pExpr, 0); | |
| 89192 | + if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target); | |
| 89193 | + sqlite3ExprDelete(db, pExpr); | |
| 89194 | +} | |
| 89180 | 89195 | |
| 89181 | 89196 | /* |
| 89182 | 89197 | ** Generate code that will evaluate expression pExpr and store the |
| 89183 | 89198 | ** results in register target. The results are guaranteed to appear |
| 89184 | 89199 | ** in register target. If the expression is constant, then this routine |
| @@ -104114,11 +104129,11 @@ | ||
| 104114 | 104129 | for(i=0; i<pIdx->nColumn; i++){ |
| 104115 | 104130 | int iField = pIdx->aiColumn[i]; |
| 104116 | 104131 | int x; |
| 104117 | 104132 | if( iField==XN_EXPR ){ |
| 104118 | 104133 | pParse->ckBase = regNewData+1; |
| 104119 | - sqlite3ExprCode(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); | |
| 104134 | + sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); | |
| 104120 | 104135 | pParse->ckBase = 0; |
| 104121 | 104136 | VdbeComment((v, "%s column %d", pIdx->zName, i)); |
| 104122 | 104137 | }else{ |
| 104123 | 104138 | if( iField==XN_ROWID || iField==pTab->iPKey ){ |
| 104124 | 104139 | if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ |
| @@ -106627,11 +106642,11 @@ | ||
| 106627 | 106642 | { /* zName: */ "page_size", |
| 106628 | 106643 | /* ePragTyp: */ PragTyp_PAGE_SIZE, |
| 106629 | 106644 | /* ePragFlag: */ 0, |
| 106630 | 106645 | /* iArg: */ 0 }, |
| 106631 | 106646 | #endif |
| 106632 | -#if defined(SQLITE_DEBUG) | |
| 106647 | +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE) | |
| 106633 | 106648 | { /* zName: */ "parser_trace", |
| 106634 | 106649 | /* ePragTyp: */ PragTyp_PARSER_TRACE, |
| 106635 | 106650 | /* ePragFlag: */ 0, |
| 106636 | 106651 | /* iArg: */ 0 }, |
| 106637 | 106652 | #endif |
| @@ -171613,11 +171628,11 @@ | ||
| 171613 | 171628 | }else{ |
| 171614 | 171629 | rc = sqlite3Fts5IterPoslist(pTerm->pIter, pColset, &a, &n, &dummy); |
| 171615 | 171630 | } |
| 171616 | 171631 | if( rc!=SQLITE_OK ) goto ismatch_out; |
| 171617 | 171632 | sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); |
| 171618 | - aIter[i].bFlag = bFlag; | |
| 171633 | + aIter[i].bFlag = (u8)bFlag; | |
| 171619 | 171634 | if( aIter[i].bEof ) goto ismatch_out; |
| 171620 | 171635 | } |
| 171621 | 171636 | |
| 171622 | 171637 | while( 1 ){ |
| 171623 | 171638 | int bMatch; |
| @@ -173611,11 +173626,11 @@ | ||
| 173611 | 173626 | int nSz = (p->nData - p->iSzPoslist - 1); /* Size in bytes */ |
| 173612 | 173627 | int nPos = nSz*2 + p->bDel; /* Value of nPos field */ |
| 173613 | 173628 | |
| 173614 | 173629 | assert( p->bDel==0 || p->bDel==1 ); |
| 173615 | 173630 | if( nPos<=127 ){ |
| 173616 | - pPtr[p->iSzPoslist] = nPos; | |
| 173631 | + pPtr[p->iSzPoslist] = (u8)nPos; | |
| 173617 | 173632 | }else{ |
| 173618 | 173633 | int nByte = sqlite3Fts5GetVarintLen((u32)nPos); |
| 173619 | 173634 | memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); |
| 173620 | 173635 | sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); |
| 173621 | 173636 | p->nData += (nByte-1); |
| @@ -176287,11 +176302,11 @@ | ||
| 176287 | 176302 | }else{ |
| 176288 | 176303 | iRes = i2; |
| 176289 | 176304 | } |
| 176290 | 176305 | } |
| 176291 | 176306 | |
| 176292 | - pRes->iFirst = iRes; | |
| 176307 | + pRes->iFirst = (u16)iRes; | |
| 176293 | 176308 | return 0; |
| 176294 | 176309 | } |
| 176295 | 176310 | |
| 176296 | 176311 | /* |
| 176297 | 176312 | ** Move the seg-iter so that it points to the first rowid on page iLeafPgno. |
| @@ -176454,11 +176469,11 @@ | ||
| 176454 | 176469 | pNew = pOther; |
| 176455 | 176470 | }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){ |
| 176456 | 176471 | pIter->iSwitchRowid = pOther->iRowid; |
| 176457 | 176472 | } |
| 176458 | 176473 | } |
| 176459 | - pRes->iFirst = (pNew - pIter->aSeg); | |
| 176474 | + pRes->iFirst = (u16)(pNew - pIter->aSeg); | |
| 176460 | 176475 | if( i==1 ) break; |
| 176461 | 176476 | |
| 176462 | 176477 | pOther = &pIter->aSeg[ pIter->aFirst[i ^ 0x0001].iFirst ]; |
| 176463 | 176478 | } |
| 176464 | 176479 | } |
| @@ -176605,11 +176620,11 @@ | ||
| 176605 | 176620 | } |
| 176606 | 176621 | } |
| 176607 | 176622 | *ppOut = pNew = fts5MultiIterAlloc(p, nSeg); |
| 176608 | 176623 | if( pNew==0 ) return; |
| 176609 | 176624 | pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC)); |
| 176610 | - pNew->bSkipEmpty = bSkipEmpty; | |
| 176625 | + pNew->bSkipEmpty = (u8)bSkipEmpty; | |
| 176611 | 176626 | pNew->pStruct = pStruct; |
| 176612 | 176627 | fts5StructureRef(pStruct); |
| 176613 | 176628 | |
| 176614 | 176629 | /* Initialize each of the component segment iterators. */ |
| 176615 | 176630 | if( iLevel<0 ){ |
| @@ -177068,11 +177083,11 @@ | ||
| 177068 | 177083 | |
| 177069 | 177084 | assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) ); |
| 177070 | 177085 | |
| 177071 | 177086 | /* Set the szLeaf header field. */ |
| 177072 | 177087 | assert( 0==fts5GetU16(&pPage->buf.p[2]) ); |
| 177073 | - fts5PutU16(&pPage->buf.p[2], pPage->buf.n); | |
| 177088 | + fts5PutU16(&pPage->buf.p[2], (u16)pPage->buf.n); | |
| 177074 | 177089 | |
| 177075 | 177090 | if( pWriter->bFirstTermInPage ){ |
| 177076 | 177091 | /* No term was written to this page. */ |
| 177077 | 177092 | assert( pPage->pgidx.n==0 ); |
| 177078 | 177093 | fts5WriteBtreeNoTerm(p, pWriter); |
| @@ -177200,11 +177215,11 @@ | ||
| 177200 | 177215 | |
| 177201 | 177216 | /* If this is to be the first rowid written to the page, set the |
| 177202 | 177217 | ** rowid-pointer in the page-header. Also append a value to the dlidx |
| 177203 | 177218 | ** buffer, in case a doclist-index is required. */ |
| 177204 | 177219 | if( pWriter->bFirstRowidInPage ){ |
| 177205 | - fts5PutU16(pPage->buf.p, pPage->buf.n); | |
| 177220 | + fts5PutU16(pPage->buf.p, (u16)pPage->buf.n); | |
| 177206 | 177221 | fts5WriteDlidxAppend(p, pWriter, iRowid); |
| 177207 | 177222 | } |
| 177208 | 177223 | |
| 177209 | 177224 | /* Write the rowid. */ |
| 177210 | 177225 | if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){ |
| @@ -177358,11 +177373,11 @@ | ||
| 177358 | 177373 | fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n); |
| 177359 | 177374 | fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p); |
| 177360 | 177375 | fts5BufferAppendBlob(&p->rc, &buf, pData->szLeaf-iOff, &pData->p[iOff]); |
| 177361 | 177376 | if( p->rc==SQLITE_OK ){ |
| 177362 | 177377 | /* Set the szLeaf field */ |
| 177363 | - fts5PutU16(&buf.p[2], buf.n); | |
| 177378 | + fts5PutU16(&buf.p[2], (u16)buf.n); | |
| 177364 | 177379 | } |
| 177365 | 177380 | |
| 177366 | 177381 | /* Set up the new page-index array */ |
| 177367 | 177382 | fts5BufferAppendVarint(&p->rc, &buf, 4); |
| 177368 | 177383 | if( pSeg->iLeafPgno==pSeg->iTermLeafPgno |
| @@ -177724,11 +177739,11 @@ | ||
| 177724 | 177739 | nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); |
| 177725 | 177740 | nCopy += nPos; |
| 177726 | 177741 | iRowid += iDelta; |
| 177727 | 177742 | |
| 177728 | 177743 | if( writer.bFirstRowidInPage ){ |
| 177729 | - fts5PutU16(&pBuf->p[0], pBuf->n); /* first rowid on page */ | |
| 177744 | + fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */ | |
| 177730 | 177745 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); |
| 177731 | 177746 | writer.bFirstRowidInPage = 0; |
| 177732 | 177747 | fts5WriteDlidxAppend(p, &writer, iRowid); |
| 177733 | 177748 | }else{ |
| 177734 | 177749 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); |
| @@ -178521,11 +178536,12 @@ | ||
| 178521 | 178536 | |
| 178522 | 178537 | for(i=0; i<pConfig->nPrefix && rc==SQLITE_OK; i++){ |
| 178523 | 178538 | int nByte = fts5IndexCharlenToBytelen(pToken, nToken, pConfig->aPrefix[i]); |
| 178524 | 178539 | if( nByte ){ |
| 178525 | 178540 | rc = sqlite3Fts5HashWrite(p->pHash, |
| 178526 | - p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX+i+1, pToken, nByte | |
| 178541 | + p->iWriteRowid, iCol, iPos, (char)(FTS5_MAIN_PREFIX+i+1), pToken, | |
| 178542 | + nByte | |
| 178527 | 178543 | ); |
| 178528 | 178544 | } |
| 178529 | 178545 | } |
| 178530 | 178546 | |
| 178531 | 178547 | return rc; |
| @@ -178571,11 +178587,11 @@ | ||
| 178571 | 178587 | } |
| 178572 | 178588 | } |
| 178573 | 178589 | |
| 178574 | 178590 | if( iIdx<=pConfig->nPrefix ){ |
| 178575 | 178591 | Fts5Structure *pStruct = fts5StructureRead(p); |
| 178576 | - buf.p[0] = FTS5_MAIN_PREFIX + iIdx; | |
| 178592 | + buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx); | |
| 178577 | 178593 | if( pStruct ){ |
| 178578 | 178594 | fts5MultiIterNew(p, pStruct, 1, flags, buf.p, nToken+1, -1, 0, &pRet); |
| 178579 | 178595 | fts5StructureRelease(pStruct); |
| 178580 | 178596 | } |
| 178581 | 178597 | }else{ |
| @@ -180277,11 +180293,11 @@ | ||
| 180277 | 180293 | iNext = 1; |
| 180278 | 180294 | for(i=0; i<sizeof(aConstraint)/sizeof(aConstraint[0]); i++){ |
| 180279 | 180295 | struct Constraint *pC = &aConstraint[i]; |
| 180280 | 180296 | if( pC->iConsIndex>=0 ){ |
| 180281 | 180297 | pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++; |
| 180282 | - pInfo->aConstraintUsage[pC->iConsIndex].omit = pC->omit; | |
| 180298 | + pInfo->aConstraintUsage[pC->iConsIndex].omit = (unsigned char)pC->omit; | |
| 180283 | 180299 | } |
| 180284 | 180300 | } |
| 180285 | 180301 | |
| 180286 | 180302 | pInfo->idxNum = idxFlags; |
| 180287 | 180303 | return SQLITE_OK; |
| @@ -182123,11 +182139,11 @@ | ||
| 182123 | 182139 | sqlite3_context *pCtx, /* Function call context */ |
| 182124 | 182140 | int nArg, /* Number of args */ |
| 182125 | 182141 | sqlite3_value **apVal /* Function arguments */ |
| 182126 | 182142 | ){ |
| 182127 | 182143 | assert( nArg==0 ); |
| 182128 | - sqlite3_result_text(pCtx, "fts5: 2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d", -1, SQLITE_TRANSIENT); | |
| 182144 | + sqlite3_result_text(pCtx, "fts5: 2015-12-18 16:29:47 8bf5e056eb8beb6e0ed5874fb24d7fe9f0b66d2b", -1, SQLITE_TRANSIENT); | |
| 182129 | 182145 | } |
| 182130 | 182146 | |
| 182131 | 182147 | static int fts5Init(sqlite3 *db){ |
| 182132 | 182148 | static const sqlite3_module fts5Mod = { |
| 182133 | 182149 | /* iVersion */ 2, |
| @@ -183590,11 +183606,11 @@ | ||
| 183590 | 183606 | while( zCsr<zTerm ){ |
| 183591 | 183607 | int iCode; |
| 183592 | 183608 | int bToken; |
| 183593 | 183609 | READ_UTF8(zCsr, zTerm, iCode); |
| 183594 | 183610 | if( iCode<128 ){ |
| 183595 | - p->aTokenChar[iCode] = bTokenChars; | |
| 183611 | + p->aTokenChar[iCode] = (unsigned char)bTokenChars; | |
| 183596 | 183612 | }else{ |
| 183597 | 183613 | bToken = sqlite3Fts5UnicodeIsalnum(iCode); |
| 183598 | 183614 | assert( (bToken==0 || bToken==1) ); |
| 183599 | 183615 | assert( (bTokenChars==0 || bTokenChars==1) ); |
| 183600 | 183616 | if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){ |
| 183601 | 183617 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -325,11 +325,11 @@ | |
| 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | */ |
| 328 | #define SQLITE_VERSION "3.10.0" |
| 329 | #define SQLITE_VERSION_NUMBER 3010000 |
| 330 | #define SQLITE_SOURCE_ID "2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d" |
| 331 | |
| 332 | /* |
| 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | ** |
| @@ -14256,10 +14256,11 @@ | |
| 14256 | SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*); |
| 14257 | SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); |
| 14258 | SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*); |
| 14259 | SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int); |
| 14260 | SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); |
| 14261 | SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); |
| 14262 | SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8); |
| 14263 | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 14264 | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 14265 | SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
| @@ -16491,10 +16492,11 @@ | |
| 16491 | double s; /* Seconds */ |
| 16492 | char validYMD; /* True (1) if Y,M,D are valid */ |
| 16493 | char validHMS; /* True (1) if h,m,s are valid */ |
| 16494 | char validJD; /* True (1) if iJD is valid */ |
| 16495 | char validTZ; /* True (1) if tz is valid */ |
| 16496 | }; |
| 16497 | |
| 16498 | |
| 16499 | /* |
| 16500 | ** Convert zDate into one or more integers. Additional arguments |
| @@ -16584,10 +16586,11 @@ | |
| 16584 | } |
| 16585 | zDate += 5; |
| 16586 | p->tz = sgn*(nMn + nHr*60); |
| 16587 | zulu_time: |
| 16588 | while( sqlite3Isspace(*zDate) ){ zDate++; } |
| 16589 | return *zDate!=0; |
| 16590 | } |
| 16591 | |
| 16592 | /* |
| 16593 | ** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. |
| @@ -17016,17 +17019,22 @@ | |
| 17016 | clearYMD_HMS_TZ(p); |
| 17017 | rc = 0; |
| 17018 | } |
| 17019 | #ifndef SQLITE_OMIT_LOCALTIME |
| 17020 | else if( strcmp(z, "utc")==0 ){ |
| 17021 | sqlite3_int64 c1; |
| 17022 | computeJD(p); |
| 17023 | c1 = localtimeOffset(p, pCtx, &rc); |
| 17024 | if( rc==SQLITE_OK ){ |
| 17025 | p->iJD -= c1; |
| 17026 | clearYMD_HMS_TZ(p); |
| 17027 | p->iJD += c1 - localtimeOffset(p, pCtx, &rc); |
| 17028 | } |
| 17029 | } |
| 17030 | #endif |
| 17031 | break; |
| 17032 | } |
| @@ -19662,11 +19670,11 @@ | |
| 19662 | ** This version of the memory allocation subsystem is included |
| 19663 | ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. |
| 19664 | ** |
| 19665 | ** This memory allocator uses the following algorithm: |
| 19666 | ** |
| 19667 | ** 1. All memory allocations sizes are rounded up to a power of 2. |
| 19668 | ** |
| 19669 | ** 2. If two adjacent free blocks are the halves of a larger block, |
| 19670 | ** then the two blocks are coalesced into the single larger block. |
| 19671 | ** |
| 19672 | ** 3. New memory is allocated from the first available free block. |
| @@ -19754,11 +19762,11 @@ | |
| 19754 | u32 maxRequest; /* Largest allocation (exclusive of internal frag) */ |
| 19755 | |
| 19756 | /* |
| 19757 | ** Lists of free blocks. aiFreelist[0] is a list of free blocks of |
| 19758 | ** size mem5.szAtom. aiFreelist[1] holds blocks of size szAtom*2. |
| 19759 | ** and so forth. |
| 19760 | */ |
| 19761 | int aiFreelist[LOGMAX+1]; |
| 19762 | |
| 19763 | /* |
| 19764 | ** Space for tracking which blocks are checked out and the size |
| @@ -19820,25 +19828,22 @@ | |
| 19820 | } |
| 19821 | mem5.aiFreelist[iLogsize] = i; |
| 19822 | } |
| 19823 | |
| 19824 | /* |
| 19825 | ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex |
| 19826 | ** will already be held (obtained by code in malloc.c) if |
| 19827 | ** sqlite3GlobalConfig.bMemStat is true. |
| 19828 | */ |
| 19829 | static void memsys5Enter(void){ |
| 19830 | sqlite3_mutex_enter(mem5.mutex); |
| 19831 | } |
| 19832 | static void memsys5Leave(void){ |
| 19833 | sqlite3_mutex_leave(mem5.mutex); |
| 19834 | } |
| 19835 | |
| 19836 | /* |
| 19837 | ** Return the size of an outstanding allocation, in bytes. The |
| 19838 | ** size returned omits the 8-byte header overhead. This only |
| 19839 | ** works for chunks that are currently checked out. |
| 19840 | */ |
| 19841 | static int memsys5Size(void *p){ |
| 19842 | int iSize, i; |
| 19843 | assert( p!=0 ); |
| 19844 | i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom); |
| @@ -19867,20 +19872,16 @@ | |
| 19867 | assert( nByte>0 ); |
| 19868 | |
| 19869 | /* Keep track of the maximum allocation request. Even unfulfilled |
| 19870 | ** requests are counted */ |
| 19871 | if( (u32)nByte>mem5.maxRequest ){ |
| 19872 | mem5.maxRequest = nByte; |
| 19873 | } |
| 19874 | |
| 19875 | /* Abort if the requested allocation size is larger than the largest |
| 19876 | ** power of two that we can represent using 32-bit signed integers. |
| 19877 | */ |
| 19878 | if( nByte > 0x40000000 ){ |
| 19879 | return 0; |
| 19880 | } |
| 19881 | |
| 19882 | /* Round nByte up to the next valid power of two */ |
| 19883 | for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){} |
| 19884 | |
| 19885 | /* Make sure mem5.aiFreelist[iLogsize] contains at least one free |
| 19886 | ** block. If not, then split a block of the next larger power of |
| @@ -20035,17 +20036,15 @@ | |
| 20035 | } |
| 20036 | nOld = memsys5Size(pPrior); |
| 20037 | if( nBytes<=nOld ){ |
| 20038 | return pPrior; |
| 20039 | } |
| 20040 | memsys5Enter(); |
| 20041 | p = memsys5MallocUnsafe(nBytes); |
| 20042 | if( p ){ |
| 20043 | memcpy(p, pPrior, nOld); |
| 20044 | memsys5FreeUnsafe(pPrior); |
| 20045 | } |
| 20046 | memsys5Leave(); |
| 20047 | return p; |
| 20048 | } |
| 20049 | |
| 20050 | /* |
| 20051 | ** Round up a request size to the next valid allocation size. If |
| @@ -41848,11 +41847,11 @@ | |
| 41848 | ** Free an allocated buffer obtained from pcache1Alloc(). |
| 41849 | */ |
| 41850 | static void pcache1Free(void *p){ |
| 41851 | int nFreed = 0; |
| 41852 | if( p==0 ) return; |
| 41853 | if( p>=pcache1.pStart && p<pcache1.pEnd ){ |
| 41854 | PgFreeslot *pSlot; |
| 41855 | sqlite3_mutex_enter(pcache1.mutex); |
| 41856 | sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1); |
| 41857 | pSlot = (PgFreeslot*)p; |
| 41858 | pSlot->pNext = pcache1.pFree; |
| @@ -53187,10 +53186,11 @@ | |
| 53187 | ** with *pSnapshot and set *pChanged as appropriate for opening the |
| 53188 | ** snapshot. */ |
| 53189 | if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) |
| 53190 | && pSnapshot->mxFrame>=pInfo->nBackfillAttempted |
| 53191 | ){ |
| 53192 | memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr)); |
| 53193 | *pChanged = bChanged; |
| 53194 | }else{ |
| 53195 | rc = SQLITE_BUSY_SNAPSHOT; |
| 53196 | } |
| @@ -61549,11 +61549,11 @@ | |
| 61549 | memcpy(&pTmp[i], &aData[i], usableSize - i); |
| 61550 | |
| 61551 | pData = pEnd; |
| 61552 | for(i=0; i<nCell; i++){ |
| 61553 | u8 *pCell = apCell[i]; |
| 61554 | if( pCell>aData && pCell<pEnd ){ |
| 61555 | pCell = &pTmp[pCell - aData]; |
| 61556 | } |
| 61557 | pData -= szCell[i]; |
| 61558 | put2byte(pCellptr, (pData - aData)); |
| 61559 | pCellptr += 2; |
| @@ -61660,11 +61660,11 @@ | |
| 61660 | u8 *pFree = 0; |
| 61661 | int szFree = 0; |
| 61662 | |
| 61663 | for(i=iFirst; i<iEnd; i++){ |
| 61664 | u8 *pCell = pCArray->apCell[i]; |
| 61665 | if( pCell>=pStart && pCell<pEnd ){ |
| 61666 | int sz; |
| 61667 | /* No need to use cachedCellSize() here. The sizes of all cells that |
| 61668 | ** are to be freed have already been computing while deciding which |
| 61669 | ** cells need freeing */ |
| 61670 | sz = pCArray->szCell[i]; assert( sz>0 ); |
| @@ -75650,10 +75650,11 @@ | |
| 75650 | ** then the result is always NULL. |
| 75651 | ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. |
| 75652 | */ |
| 75653 | if( pOp->p5 & SQLITE_STOREP2 ){ |
| 75654 | pOut = &aMem[pOp->p2]; |
| 75655 | MemSetTypeFlag(pOut, MEM_Null); |
| 75656 | REGISTER_TRACE(pOp->p2, pOut); |
| 75657 | }else{ |
| 75658 | VdbeBranchTaken(2,3); |
| 75659 | if( pOp->p5 & SQLITE_JUMPIFNULL ){ |
| @@ -76192,10 +76193,12 @@ | |
| 76192 | || (offset64 > pC->payloadSize) |
| 76193 | ){ |
| 76194 | rc = SQLITE_CORRUPT_BKPT; |
| 76195 | goto op_column_error; |
| 76196 | } |
| 76197 | } |
| 76198 | |
| 76199 | /* If after trying to extract new entries from the header, nHdrParsed is |
| 76200 | ** still not up to p2, that means that the record has fewer than p2 |
| 76201 | ** columns. So the result will be either the default value or a NULL. |
| @@ -88316,11 +88319,11 @@ | |
| 88316 | i16 iTabCol = pIdx->aiColumn[iIdxCol]; |
| 88317 | if( iTabCol==XN_EXPR ){ |
| 88318 | assert( pIdx->aColExpr ); |
| 88319 | assert( pIdx->aColExpr->nExpr>iIdxCol ); |
| 88320 | pParse->iSelfTab = iTabCur; |
| 88321 | sqlite3ExprCode(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); |
| 88322 | }else{ |
| 88323 | sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, |
| 88324 | iTabCol, regOut); |
| 88325 | } |
| 88326 | } |
| @@ -89169,16 +89172,28 @@ | |
| 89169 | assert( target>0 && target<=pParse->nMem ); |
| 89170 | if( pExpr && pExpr->op==TK_REGISTER ){ |
| 89171 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); |
| 89172 | }else{ |
| 89173 | inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 89174 | assert( pParse->pVdbe || pParse->db->mallocFailed ); |
| 89175 | if( inReg!=target && pParse->pVdbe ){ |
| 89176 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); |
| 89177 | } |
| 89178 | } |
| 89179 | } |
| 89180 | |
| 89181 | /* |
| 89182 | ** Generate code that will evaluate expression pExpr and store the |
| 89183 | ** results in register target. The results are guaranteed to appear |
| 89184 | ** in register target. If the expression is constant, then this routine |
| @@ -104114,11 +104129,11 @@ | |
| 104114 | for(i=0; i<pIdx->nColumn; i++){ |
| 104115 | int iField = pIdx->aiColumn[i]; |
| 104116 | int x; |
| 104117 | if( iField==XN_EXPR ){ |
| 104118 | pParse->ckBase = regNewData+1; |
| 104119 | sqlite3ExprCode(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); |
| 104120 | pParse->ckBase = 0; |
| 104121 | VdbeComment((v, "%s column %d", pIdx->zName, i)); |
| 104122 | }else{ |
| 104123 | if( iField==XN_ROWID || iField==pTab->iPKey ){ |
| 104124 | if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ |
| @@ -106627,11 +106642,11 @@ | |
| 106627 | { /* zName: */ "page_size", |
| 106628 | /* ePragTyp: */ PragTyp_PAGE_SIZE, |
| 106629 | /* ePragFlag: */ 0, |
| 106630 | /* iArg: */ 0 }, |
| 106631 | #endif |
| 106632 | #if defined(SQLITE_DEBUG) |
| 106633 | { /* zName: */ "parser_trace", |
| 106634 | /* ePragTyp: */ PragTyp_PARSER_TRACE, |
| 106635 | /* ePragFlag: */ 0, |
| 106636 | /* iArg: */ 0 }, |
| 106637 | #endif |
| @@ -171613,11 +171628,11 @@ | |
| 171613 | }else{ |
| 171614 | rc = sqlite3Fts5IterPoslist(pTerm->pIter, pColset, &a, &n, &dummy); |
| 171615 | } |
| 171616 | if( rc!=SQLITE_OK ) goto ismatch_out; |
| 171617 | sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); |
| 171618 | aIter[i].bFlag = bFlag; |
| 171619 | if( aIter[i].bEof ) goto ismatch_out; |
| 171620 | } |
| 171621 | |
| 171622 | while( 1 ){ |
| 171623 | int bMatch; |
| @@ -173611,11 +173626,11 @@ | |
| 173611 | int nSz = (p->nData - p->iSzPoslist - 1); /* Size in bytes */ |
| 173612 | int nPos = nSz*2 + p->bDel; /* Value of nPos field */ |
| 173613 | |
| 173614 | assert( p->bDel==0 || p->bDel==1 ); |
| 173615 | if( nPos<=127 ){ |
| 173616 | pPtr[p->iSzPoslist] = nPos; |
| 173617 | }else{ |
| 173618 | int nByte = sqlite3Fts5GetVarintLen((u32)nPos); |
| 173619 | memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); |
| 173620 | sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); |
| 173621 | p->nData += (nByte-1); |
| @@ -176287,11 +176302,11 @@ | |
| 176287 | }else{ |
| 176288 | iRes = i2; |
| 176289 | } |
| 176290 | } |
| 176291 | |
| 176292 | pRes->iFirst = iRes; |
| 176293 | return 0; |
| 176294 | } |
| 176295 | |
| 176296 | /* |
| 176297 | ** Move the seg-iter so that it points to the first rowid on page iLeafPgno. |
| @@ -176454,11 +176469,11 @@ | |
| 176454 | pNew = pOther; |
| 176455 | }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){ |
| 176456 | pIter->iSwitchRowid = pOther->iRowid; |
| 176457 | } |
| 176458 | } |
| 176459 | pRes->iFirst = (pNew - pIter->aSeg); |
| 176460 | if( i==1 ) break; |
| 176461 | |
| 176462 | pOther = &pIter->aSeg[ pIter->aFirst[i ^ 0x0001].iFirst ]; |
| 176463 | } |
| 176464 | } |
| @@ -176605,11 +176620,11 @@ | |
| 176605 | } |
| 176606 | } |
| 176607 | *ppOut = pNew = fts5MultiIterAlloc(p, nSeg); |
| 176608 | if( pNew==0 ) return; |
| 176609 | pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC)); |
| 176610 | pNew->bSkipEmpty = bSkipEmpty; |
| 176611 | pNew->pStruct = pStruct; |
| 176612 | fts5StructureRef(pStruct); |
| 176613 | |
| 176614 | /* Initialize each of the component segment iterators. */ |
| 176615 | if( iLevel<0 ){ |
| @@ -177068,11 +177083,11 @@ | |
| 177068 | |
| 177069 | assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) ); |
| 177070 | |
| 177071 | /* Set the szLeaf header field. */ |
| 177072 | assert( 0==fts5GetU16(&pPage->buf.p[2]) ); |
| 177073 | fts5PutU16(&pPage->buf.p[2], pPage->buf.n); |
| 177074 | |
| 177075 | if( pWriter->bFirstTermInPage ){ |
| 177076 | /* No term was written to this page. */ |
| 177077 | assert( pPage->pgidx.n==0 ); |
| 177078 | fts5WriteBtreeNoTerm(p, pWriter); |
| @@ -177200,11 +177215,11 @@ | |
| 177200 | |
| 177201 | /* If this is to be the first rowid written to the page, set the |
| 177202 | ** rowid-pointer in the page-header. Also append a value to the dlidx |
| 177203 | ** buffer, in case a doclist-index is required. */ |
| 177204 | if( pWriter->bFirstRowidInPage ){ |
| 177205 | fts5PutU16(pPage->buf.p, pPage->buf.n); |
| 177206 | fts5WriteDlidxAppend(p, pWriter, iRowid); |
| 177207 | } |
| 177208 | |
| 177209 | /* Write the rowid. */ |
| 177210 | if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){ |
| @@ -177358,11 +177373,11 @@ | |
| 177358 | fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n); |
| 177359 | fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p); |
| 177360 | fts5BufferAppendBlob(&p->rc, &buf, pData->szLeaf-iOff, &pData->p[iOff]); |
| 177361 | if( p->rc==SQLITE_OK ){ |
| 177362 | /* Set the szLeaf field */ |
| 177363 | fts5PutU16(&buf.p[2], buf.n); |
| 177364 | } |
| 177365 | |
| 177366 | /* Set up the new page-index array */ |
| 177367 | fts5BufferAppendVarint(&p->rc, &buf, 4); |
| 177368 | if( pSeg->iLeafPgno==pSeg->iTermLeafPgno |
| @@ -177724,11 +177739,11 @@ | |
| 177724 | nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); |
| 177725 | nCopy += nPos; |
| 177726 | iRowid += iDelta; |
| 177727 | |
| 177728 | if( writer.bFirstRowidInPage ){ |
| 177729 | fts5PutU16(&pBuf->p[0], pBuf->n); /* first rowid on page */ |
| 177730 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); |
| 177731 | writer.bFirstRowidInPage = 0; |
| 177732 | fts5WriteDlidxAppend(p, &writer, iRowid); |
| 177733 | }else{ |
| 177734 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); |
| @@ -178521,11 +178536,12 @@ | |
| 178521 | |
| 178522 | for(i=0; i<pConfig->nPrefix && rc==SQLITE_OK; i++){ |
| 178523 | int nByte = fts5IndexCharlenToBytelen(pToken, nToken, pConfig->aPrefix[i]); |
| 178524 | if( nByte ){ |
| 178525 | rc = sqlite3Fts5HashWrite(p->pHash, |
| 178526 | p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX+i+1, pToken, nByte |
| 178527 | ); |
| 178528 | } |
| 178529 | } |
| 178530 | |
| 178531 | return rc; |
| @@ -178571,11 +178587,11 @@ | |
| 178571 | } |
| 178572 | } |
| 178573 | |
| 178574 | if( iIdx<=pConfig->nPrefix ){ |
| 178575 | Fts5Structure *pStruct = fts5StructureRead(p); |
| 178576 | buf.p[0] = FTS5_MAIN_PREFIX + iIdx; |
| 178577 | if( pStruct ){ |
| 178578 | fts5MultiIterNew(p, pStruct, 1, flags, buf.p, nToken+1, -1, 0, &pRet); |
| 178579 | fts5StructureRelease(pStruct); |
| 178580 | } |
| 178581 | }else{ |
| @@ -180277,11 +180293,11 @@ | |
| 180277 | iNext = 1; |
| 180278 | for(i=0; i<sizeof(aConstraint)/sizeof(aConstraint[0]); i++){ |
| 180279 | struct Constraint *pC = &aConstraint[i]; |
| 180280 | if( pC->iConsIndex>=0 ){ |
| 180281 | pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++; |
| 180282 | pInfo->aConstraintUsage[pC->iConsIndex].omit = pC->omit; |
| 180283 | } |
| 180284 | } |
| 180285 | |
| 180286 | pInfo->idxNum = idxFlags; |
| 180287 | return SQLITE_OK; |
| @@ -182123,11 +182139,11 @@ | |
| 182123 | sqlite3_context *pCtx, /* Function call context */ |
| 182124 | int nArg, /* Number of args */ |
| 182125 | sqlite3_value **apVal /* Function arguments */ |
| 182126 | ){ |
| 182127 | assert( nArg==0 ); |
| 182128 | sqlite3_result_text(pCtx, "fts5: 2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d", -1, SQLITE_TRANSIENT); |
| 182129 | } |
| 182130 | |
| 182131 | static int fts5Init(sqlite3 *db){ |
| 182132 | static const sqlite3_module fts5Mod = { |
| 182133 | /* iVersion */ 2, |
| @@ -183590,11 +183606,11 @@ | |
| 183590 | while( zCsr<zTerm ){ |
| 183591 | int iCode; |
| 183592 | int bToken; |
| 183593 | READ_UTF8(zCsr, zTerm, iCode); |
| 183594 | if( iCode<128 ){ |
| 183595 | p->aTokenChar[iCode] = bTokenChars; |
| 183596 | }else{ |
| 183597 | bToken = sqlite3Fts5UnicodeIsalnum(iCode); |
| 183598 | assert( (bToken==0 || bToken==1) ); |
| 183599 | assert( (bTokenChars==0 || bTokenChars==1) ); |
| 183600 | if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){ |
| 183601 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -325,11 +325,11 @@ | |
| 325 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 326 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 327 | */ |
| 328 | #define SQLITE_VERSION "3.10.0" |
| 329 | #define SQLITE_VERSION_NUMBER 3010000 |
| 330 | #define SQLITE_SOURCE_ID "2015-12-23 10:54:48 b910a3d53769689d9212a06f974ccce54844bbe4" |
| 331 | |
| 332 | /* |
| 333 | ** CAPI3REF: Run-Time Library Version Numbers |
| 334 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 335 | ** |
| @@ -14256,10 +14256,11 @@ | |
| 14256 | SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*); |
| 14257 | SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); |
| 14258 | SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*); |
| 14259 | SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int); |
| 14260 | SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); |
| 14261 | SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); |
| 14262 | SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); |
| 14263 | SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8); |
| 14264 | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 14265 | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 14266 | SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
| @@ -16491,10 +16492,11 @@ | |
| 16492 | double s; /* Seconds */ |
| 16493 | char validYMD; /* True (1) if Y,M,D are valid */ |
| 16494 | char validHMS; /* True (1) if h,m,s are valid */ |
| 16495 | char validJD; /* True (1) if iJD is valid */ |
| 16496 | char validTZ; /* True (1) if tz is valid */ |
| 16497 | char tzSet; /* Timezone was set explicitly */ |
| 16498 | }; |
| 16499 | |
| 16500 | |
| 16501 | /* |
| 16502 | ** Convert zDate into one or more integers. Additional arguments |
| @@ -16584,10 +16586,11 @@ | |
| 16586 | } |
| 16587 | zDate += 5; |
| 16588 | p->tz = sgn*(nMn + nHr*60); |
| 16589 | zulu_time: |
| 16590 | while( sqlite3Isspace(*zDate) ){ zDate++; } |
| 16591 | p->tzSet = 1; |
| 16592 | return *zDate!=0; |
| 16593 | } |
| 16594 | |
| 16595 | /* |
| 16596 | ** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. |
| @@ -17016,17 +17019,22 @@ | |
| 17019 | clearYMD_HMS_TZ(p); |
| 17020 | rc = 0; |
| 17021 | } |
| 17022 | #ifndef SQLITE_OMIT_LOCALTIME |
| 17023 | else if( strcmp(z, "utc")==0 ){ |
| 17024 | if( p->tzSet==0 ){ |
| 17025 | sqlite3_int64 c1; |
| 17026 | computeJD(p); |
| 17027 | c1 = localtimeOffset(p, pCtx, &rc); |
| 17028 | if( rc==SQLITE_OK ){ |
| 17029 | p->iJD -= c1; |
| 17030 | clearYMD_HMS_TZ(p); |
| 17031 | p->iJD += c1 - localtimeOffset(p, pCtx, &rc); |
| 17032 | } |
| 17033 | p->tzSet = 1; |
| 17034 | }else{ |
| 17035 | rc = SQLITE_OK; |
| 17036 | } |
| 17037 | } |
| 17038 | #endif |
| 17039 | break; |
| 17040 | } |
| @@ -19662,11 +19670,11 @@ | |
| 19670 | ** This version of the memory allocation subsystem is included |
| 19671 | ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. |
| 19672 | ** |
| 19673 | ** This memory allocator uses the following algorithm: |
| 19674 | ** |
| 19675 | ** 1. All memory allocation sizes are rounded up to a power of 2. |
| 19676 | ** |
| 19677 | ** 2. If two adjacent free blocks are the halves of a larger block, |
| 19678 | ** then the two blocks are coalesced into the single larger block. |
| 19679 | ** |
| 19680 | ** 3. New memory is allocated from the first available free block. |
| @@ -19754,11 +19762,11 @@ | |
| 19762 | u32 maxRequest; /* Largest allocation (exclusive of internal frag) */ |
| 19763 | |
| 19764 | /* |
| 19765 | ** Lists of free blocks. aiFreelist[0] is a list of free blocks of |
| 19766 | ** size mem5.szAtom. aiFreelist[1] holds blocks of size szAtom*2. |
| 19767 | ** aiFreelist[2] holds free blocks of size szAtom*4. And so forth. |
| 19768 | */ |
| 19769 | int aiFreelist[LOGMAX+1]; |
| 19770 | |
| 19771 | /* |
| 19772 | ** Space for tracking which blocks are checked out and the size |
| @@ -19820,25 +19828,22 @@ | |
| 19828 | } |
| 19829 | mem5.aiFreelist[iLogsize] = i; |
| 19830 | } |
| 19831 | |
| 19832 | /* |
| 19833 | ** Obtain or release the mutex needed to access global data structures. |
| 19834 | */ |
| 19835 | static void memsys5Enter(void){ |
| 19836 | sqlite3_mutex_enter(mem5.mutex); |
| 19837 | } |
| 19838 | static void memsys5Leave(void){ |
| 19839 | sqlite3_mutex_leave(mem5.mutex); |
| 19840 | } |
| 19841 | |
| 19842 | /* |
| 19843 | ** Return the size of an outstanding allocation, in bytes. |
| 19844 | ** This only works for chunks that are currently checked out. |
| 19845 | */ |
| 19846 | static int memsys5Size(void *p){ |
| 19847 | int iSize, i; |
| 19848 | assert( p!=0 ); |
| 19849 | i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom); |
| @@ -19867,20 +19872,16 @@ | |
| 19872 | assert( nByte>0 ); |
| 19873 | |
| 19874 | /* Keep track of the maximum allocation request. Even unfulfilled |
| 19875 | ** requests are counted */ |
| 19876 | if( (u32)nByte>mem5.maxRequest ){ |
| 19877 | /* Abort if the requested allocation size is larger than the largest |
| 19878 | ** power of two that we can represent using 32-bit signed integers. */ |
| 19879 | if( nByte > 0x40000000 ) return 0; |
| 19880 | mem5.maxRequest = nByte; |
| 19881 | } |
| 19882 | |
| 19883 | /* Round nByte up to the next valid power of two */ |
| 19884 | for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){} |
| 19885 | |
| 19886 | /* Make sure mem5.aiFreelist[iLogsize] contains at least one free |
| 19887 | ** block. If not, then split a block of the next larger power of |
| @@ -20035,17 +20036,15 @@ | |
| 20036 | } |
| 20037 | nOld = memsys5Size(pPrior); |
| 20038 | if( nBytes<=nOld ){ |
| 20039 | return pPrior; |
| 20040 | } |
| 20041 | p = memsys5Malloc(nBytes); |
| 20042 | if( p ){ |
| 20043 | memcpy(p, pPrior, nOld); |
| 20044 | memsys5Free(pPrior); |
| 20045 | } |
| 20046 | return p; |
| 20047 | } |
| 20048 | |
| 20049 | /* |
| 20050 | ** Round up a request size to the next valid allocation size. If |
| @@ -41848,11 +41847,11 @@ | |
| 41847 | ** Free an allocated buffer obtained from pcache1Alloc(). |
| 41848 | */ |
| 41849 | static void pcache1Free(void *p){ |
| 41850 | int nFreed = 0; |
| 41851 | if( p==0 ) return; |
| 41852 | if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){ |
| 41853 | PgFreeslot *pSlot; |
| 41854 | sqlite3_mutex_enter(pcache1.mutex); |
| 41855 | sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1); |
| 41856 | pSlot = (PgFreeslot*)p; |
| 41857 | pSlot->pNext = pcache1.pFree; |
| @@ -53187,10 +53186,11 @@ | |
| 53186 | ** with *pSnapshot and set *pChanged as appropriate for opening the |
| 53187 | ** snapshot. */ |
| 53188 | if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) |
| 53189 | && pSnapshot->mxFrame>=pInfo->nBackfillAttempted |
| 53190 | ){ |
| 53191 | assert( pWal->readLock>0 ); |
| 53192 | memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr)); |
| 53193 | *pChanged = bChanged; |
| 53194 | }else{ |
| 53195 | rc = SQLITE_BUSY_SNAPSHOT; |
| 53196 | } |
| @@ -61549,11 +61549,11 @@ | |
| 61549 | memcpy(&pTmp[i], &aData[i], usableSize - i); |
| 61550 | |
| 61551 | pData = pEnd; |
| 61552 | for(i=0; i<nCell; i++){ |
| 61553 | u8 *pCell = apCell[i]; |
| 61554 | if( SQLITE_WITHIN(pCell,aData,pEnd) ){ |
| 61555 | pCell = &pTmp[pCell - aData]; |
| 61556 | } |
| 61557 | pData -= szCell[i]; |
| 61558 | put2byte(pCellptr, (pData - aData)); |
| 61559 | pCellptr += 2; |
| @@ -61660,11 +61660,11 @@ | |
| 61660 | u8 *pFree = 0; |
| 61661 | int szFree = 0; |
| 61662 | |
| 61663 | for(i=iFirst; i<iEnd; i++){ |
| 61664 | u8 *pCell = pCArray->apCell[i]; |
| 61665 | if( SQLITE_WITHIN(pCell, pStart, pEnd) ){ |
| 61666 | int sz; |
| 61667 | /* No need to use cachedCellSize() here. The sizes of all cells that |
| 61668 | ** are to be freed have already been computing while deciding which |
| 61669 | ** cells need freeing */ |
| 61670 | sz = pCArray->szCell[i]; assert( sz>0 ); |
| @@ -75650,10 +75650,11 @@ | |
| 75650 | ** then the result is always NULL. |
| 75651 | ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. |
| 75652 | */ |
| 75653 | if( pOp->p5 & SQLITE_STOREP2 ){ |
| 75654 | pOut = &aMem[pOp->p2]; |
| 75655 | memAboutToChange(p, pOut); |
| 75656 | MemSetTypeFlag(pOut, MEM_Null); |
| 75657 | REGISTER_TRACE(pOp->p2, pOut); |
| 75658 | }else{ |
| 75659 | VdbeBranchTaken(2,3); |
| 75660 | if( pOp->p5 & SQLITE_JUMPIFNULL ){ |
| @@ -76192,10 +76193,12 @@ | |
| 76193 | || (offset64 > pC->payloadSize) |
| 76194 | ){ |
| 76195 | rc = SQLITE_CORRUPT_BKPT; |
| 76196 | goto op_column_error; |
| 76197 | } |
| 76198 | }else{ |
| 76199 | VVA_ONLY( t = 0; ) /* Only needed by assert() statements */ |
| 76200 | } |
| 76201 | |
| 76202 | /* If after trying to extract new entries from the header, nHdrParsed is |
| 76203 | ** still not up to p2, that means that the record has fewer than p2 |
| 76204 | ** columns. So the result will be either the default value or a NULL. |
| @@ -88316,11 +88319,11 @@ | |
| 88319 | i16 iTabCol = pIdx->aiColumn[iIdxCol]; |
| 88320 | if( iTabCol==XN_EXPR ){ |
| 88321 | assert( pIdx->aColExpr ); |
| 88322 | assert( pIdx->aColExpr->nExpr>iIdxCol ); |
| 88323 | pParse->iSelfTab = iTabCur; |
| 88324 | sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); |
| 88325 | }else{ |
| 88326 | sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, |
| 88327 | iTabCol, regOut); |
| 88328 | } |
| 88329 | } |
| @@ -89169,16 +89172,28 @@ | |
| 89172 | assert( target>0 && target<=pParse->nMem ); |
| 89173 | if( pExpr && pExpr->op==TK_REGISTER ){ |
| 89174 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); |
| 89175 | }else{ |
| 89176 | inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 89177 | assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); |
| 89178 | if( inReg!=target && pParse->pVdbe ){ |
| 89179 | sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); |
| 89180 | } |
| 89181 | } |
| 89182 | } |
| 89183 | |
| 89184 | /* |
| 89185 | ** Make a transient copy of expression pExpr and then code it using |
| 89186 | ** sqlite3ExprCode(). This routine works just like sqlite3ExprCode() |
| 89187 | ** except that the input expression is guaranteed to be unchanged. |
| 89188 | */ |
| 89189 | SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ |
| 89190 | sqlite3 *db = pParse->db; |
| 89191 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 89192 | if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target); |
| 89193 | sqlite3ExprDelete(db, pExpr); |
| 89194 | } |
| 89195 | |
| 89196 | /* |
| 89197 | ** Generate code that will evaluate expression pExpr and store the |
| 89198 | ** results in register target. The results are guaranteed to appear |
| 89199 | ** in register target. If the expression is constant, then this routine |
| @@ -104114,11 +104129,11 @@ | |
| 104129 | for(i=0; i<pIdx->nColumn; i++){ |
| 104130 | int iField = pIdx->aiColumn[i]; |
| 104131 | int x; |
| 104132 | if( iField==XN_EXPR ){ |
| 104133 | pParse->ckBase = regNewData+1; |
| 104134 | sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); |
| 104135 | pParse->ckBase = 0; |
| 104136 | VdbeComment((v, "%s column %d", pIdx->zName, i)); |
| 104137 | }else{ |
| 104138 | if( iField==XN_ROWID || iField==pTab->iPKey ){ |
| 104139 | if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ |
| @@ -106627,11 +106642,11 @@ | |
| 106642 | { /* zName: */ "page_size", |
| 106643 | /* ePragTyp: */ PragTyp_PAGE_SIZE, |
| 106644 | /* ePragFlag: */ 0, |
| 106645 | /* iArg: */ 0 }, |
| 106646 | #endif |
| 106647 | #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE) |
| 106648 | { /* zName: */ "parser_trace", |
| 106649 | /* ePragTyp: */ PragTyp_PARSER_TRACE, |
| 106650 | /* ePragFlag: */ 0, |
| 106651 | /* iArg: */ 0 }, |
| 106652 | #endif |
| @@ -171613,11 +171628,11 @@ | |
| 171628 | }else{ |
| 171629 | rc = sqlite3Fts5IterPoslist(pTerm->pIter, pColset, &a, &n, &dummy); |
| 171630 | } |
| 171631 | if( rc!=SQLITE_OK ) goto ismatch_out; |
| 171632 | sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]); |
| 171633 | aIter[i].bFlag = (u8)bFlag; |
| 171634 | if( aIter[i].bEof ) goto ismatch_out; |
| 171635 | } |
| 171636 | |
| 171637 | while( 1 ){ |
| 171638 | int bMatch; |
| @@ -173611,11 +173626,11 @@ | |
| 173626 | int nSz = (p->nData - p->iSzPoslist - 1); /* Size in bytes */ |
| 173627 | int nPos = nSz*2 + p->bDel; /* Value of nPos field */ |
| 173628 | |
| 173629 | assert( p->bDel==0 || p->bDel==1 ); |
| 173630 | if( nPos<=127 ){ |
| 173631 | pPtr[p->iSzPoslist] = (u8)nPos; |
| 173632 | }else{ |
| 173633 | int nByte = sqlite3Fts5GetVarintLen((u32)nPos); |
| 173634 | memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); |
| 173635 | sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); |
| 173636 | p->nData += (nByte-1); |
| @@ -176287,11 +176302,11 @@ | |
| 176302 | }else{ |
| 176303 | iRes = i2; |
| 176304 | } |
| 176305 | } |
| 176306 | |
| 176307 | pRes->iFirst = (u16)iRes; |
| 176308 | return 0; |
| 176309 | } |
| 176310 | |
| 176311 | /* |
| 176312 | ** Move the seg-iter so that it points to the first rowid on page iLeafPgno. |
| @@ -176454,11 +176469,11 @@ | |
| 176469 | pNew = pOther; |
| 176470 | }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){ |
| 176471 | pIter->iSwitchRowid = pOther->iRowid; |
| 176472 | } |
| 176473 | } |
| 176474 | pRes->iFirst = (u16)(pNew - pIter->aSeg); |
| 176475 | if( i==1 ) break; |
| 176476 | |
| 176477 | pOther = &pIter->aSeg[ pIter->aFirst[i ^ 0x0001].iFirst ]; |
| 176478 | } |
| 176479 | } |
| @@ -176605,11 +176620,11 @@ | |
| 176620 | } |
| 176621 | } |
| 176622 | *ppOut = pNew = fts5MultiIterAlloc(p, nSeg); |
| 176623 | if( pNew==0 ) return; |
| 176624 | pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC)); |
| 176625 | pNew->bSkipEmpty = (u8)bSkipEmpty; |
| 176626 | pNew->pStruct = pStruct; |
| 176627 | fts5StructureRef(pStruct); |
| 176628 | |
| 176629 | /* Initialize each of the component segment iterators. */ |
| 176630 | if( iLevel<0 ){ |
| @@ -177068,11 +177083,11 @@ | |
| 177083 | |
| 177084 | assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) ); |
| 177085 | |
| 177086 | /* Set the szLeaf header field. */ |
| 177087 | assert( 0==fts5GetU16(&pPage->buf.p[2]) ); |
| 177088 | fts5PutU16(&pPage->buf.p[2], (u16)pPage->buf.n); |
| 177089 | |
| 177090 | if( pWriter->bFirstTermInPage ){ |
| 177091 | /* No term was written to this page. */ |
| 177092 | assert( pPage->pgidx.n==0 ); |
| 177093 | fts5WriteBtreeNoTerm(p, pWriter); |
| @@ -177200,11 +177215,11 @@ | |
| 177215 | |
| 177216 | /* If this is to be the first rowid written to the page, set the |
| 177217 | ** rowid-pointer in the page-header. Also append a value to the dlidx |
| 177218 | ** buffer, in case a doclist-index is required. */ |
| 177219 | if( pWriter->bFirstRowidInPage ){ |
| 177220 | fts5PutU16(pPage->buf.p, (u16)pPage->buf.n); |
| 177221 | fts5WriteDlidxAppend(p, pWriter, iRowid); |
| 177222 | } |
| 177223 | |
| 177224 | /* Write the rowid. */ |
| 177225 | if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){ |
| @@ -177358,11 +177373,11 @@ | |
| 177373 | fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n); |
| 177374 | fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p); |
| 177375 | fts5BufferAppendBlob(&p->rc, &buf, pData->szLeaf-iOff, &pData->p[iOff]); |
| 177376 | if( p->rc==SQLITE_OK ){ |
| 177377 | /* Set the szLeaf field */ |
| 177378 | fts5PutU16(&buf.p[2], (u16)buf.n); |
| 177379 | } |
| 177380 | |
| 177381 | /* Set up the new page-index array */ |
| 177382 | fts5BufferAppendVarint(&p->rc, &buf, 4); |
| 177383 | if( pSeg->iLeafPgno==pSeg->iTermLeafPgno |
| @@ -177724,11 +177739,11 @@ | |
| 177739 | nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); |
| 177740 | nCopy += nPos; |
| 177741 | iRowid += iDelta; |
| 177742 | |
| 177743 | if( writer.bFirstRowidInPage ){ |
| 177744 | fts5PutU16(&pBuf->p[0], (u16)pBuf->n); /* first rowid on page */ |
| 177745 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); |
| 177746 | writer.bFirstRowidInPage = 0; |
| 177747 | fts5WriteDlidxAppend(p, &writer, iRowid); |
| 177748 | }else{ |
| 177749 | pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); |
| @@ -178521,11 +178536,12 @@ | |
| 178536 | |
| 178537 | for(i=0; i<pConfig->nPrefix && rc==SQLITE_OK; i++){ |
| 178538 | int nByte = fts5IndexCharlenToBytelen(pToken, nToken, pConfig->aPrefix[i]); |
| 178539 | if( nByte ){ |
| 178540 | rc = sqlite3Fts5HashWrite(p->pHash, |
| 178541 | p->iWriteRowid, iCol, iPos, (char)(FTS5_MAIN_PREFIX+i+1), pToken, |
| 178542 | nByte |
| 178543 | ); |
| 178544 | } |
| 178545 | } |
| 178546 | |
| 178547 | return rc; |
| @@ -178571,11 +178587,11 @@ | |
| 178587 | } |
| 178588 | } |
| 178589 | |
| 178590 | if( iIdx<=pConfig->nPrefix ){ |
| 178591 | Fts5Structure *pStruct = fts5StructureRead(p); |
| 178592 | buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx); |
| 178593 | if( pStruct ){ |
| 178594 | fts5MultiIterNew(p, pStruct, 1, flags, buf.p, nToken+1, -1, 0, &pRet); |
| 178595 | fts5StructureRelease(pStruct); |
| 178596 | } |
| 178597 | }else{ |
| @@ -180277,11 +180293,11 @@ | |
| 180293 | iNext = 1; |
| 180294 | for(i=0; i<sizeof(aConstraint)/sizeof(aConstraint[0]); i++){ |
| 180295 | struct Constraint *pC = &aConstraint[i]; |
| 180296 | if( pC->iConsIndex>=0 ){ |
| 180297 | pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++; |
| 180298 | pInfo->aConstraintUsage[pC->iConsIndex].omit = (unsigned char)pC->omit; |
| 180299 | } |
| 180300 | } |
| 180301 | |
| 180302 | pInfo->idxNum = idxFlags; |
| 180303 | return SQLITE_OK; |
| @@ -182123,11 +182139,11 @@ | |
| 182139 | sqlite3_context *pCtx, /* Function call context */ |
| 182140 | int nArg, /* Number of args */ |
| 182141 | sqlite3_value **apVal /* Function arguments */ |
| 182142 | ){ |
| 182143 | assert( nArg==0 ); |
| 182144 | sqlite3_result_text(pCtx, "fts5: 2015-12-18 16:29:47 8bf5e056eb8beb6e0ed5874fb24d7fe9f0b66d2b", -1, SQLITE_TRANSIENT); |
| 182145 | } |
| 182146 | |
| 182147 | static int fts5Init(sqlite3 *db){ |
| 182148 | static const sqlite3_module fts5Mod = { |
| 182149 | /* iVersion */ 2, |
| @@ -183590,11 +183606,11 @@ | |
| 183606 | while( zCsr<zTerm ){ |
| 183607 | int iCode; |
| 183608 | int bToken; |
| 183609 | READ_UTF8(zCsr, zTerm, iCode); |
| 183610 | if( iCode<128 ){ |
| 183611 | p->aTokenChar[iCode] = (unsigned char)bTokenChars; |
| 183612 | }else{ |
| 183613 | bToken = sqlite3Fts5UnicodeIsalnum(iCode); |
| 183614 | assert( (bToken==0 || bToken==1) ); |
| 183615 | assert( (bTokenChars==0 || bTokenChars==1) ); |
| 183616 | if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){ |
| 183617 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -111,11 +111,11 @@ | ||
| 111 | 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | 113 | */ |
| 114 | 114 | #define SQLITE_VERSION "3.10.0" |
| 115 | 115 | #define SQLITE_VERSION_NUMBER 3010000 |
| 116 | -#define SQLITE_SOURCE_ID "2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d" | |
| 116 | +#define SQLITE_SOURCE_ID "2015-12-23 10:54:48 b910a3d53769689d9212a06f974ccce54844bbe4" | |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | 121 | ** |
| 122 | 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -111,11 +111,11 @@ | |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.10.0" |
| 115 | #define SQLITE_VERSION_NUMBER 3010000 |
| 116 | #define SQLITE_SOURCE_ID "2015-12-11 13:51:02 e998513e442ce1206b12dc28bdc996d7b5f9f94d" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -111,11 +111,11 @@ | |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.10.0" |
| 115 | #define SQLITE_VERSION_NUMBER 3010000 |
| 116 | #define SQLITE_SOURCE_ID "2015-12-23 10:54:48 b910a3d53769689d9212a06f974ccce54844bbe4" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |
+2
-2
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -167,11 +167,11 @@ | ||
| 167 | 167 | int rid; |
| 168 | 168 | |
| 169 | 169 | rid = th1_name_to_typed_rid(interp, zRev, "ci"); |
| 170 | 170 | compute_fileage(rid, zGlob); |
| 171 | 171 | db_prepare(&q, |
| 172 | - "SELECT datetime(fileage.mtime, 'localtime'), fileage.pathname,\n" | |
| 172 | + "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n" | |
| 173 | 173 | " blob.size\n" |
| 174 | 174 | " FROM fileage, blob\n" |
| 175 | 175 | " WHERE blob.rid=fileage.fid \n" |
| 176 | 176 | " ORDER BY %s;", zOrderBy /*safe-for-%s*/ |
| 177 | 177 | ); |
| @@ -549,11 +549,11 @@ | ||
| 549 | 549 | const char **argv, |
| 550 | 550 | int *argl |
| 551 | 551 | ){ |
| 552 | 552 | char *zOut; |
| 553 | 553 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 554 | - zOut = db_text("??", "SELECT datetime('now'%s)", timeline_utc()); | |
| 554 | + zOut = db_text("??", "SELECT datetime('now',toLocal())"); | |
| 555 | 555 | }else{ |
| 556 | 556 | zOut = db_text("??", "SELECT datetime('now')"); |
| 557 | 557 | } |
| 558 | 558 | Th_SetResult(interp, zOut, -1); |
| 559 | 559 | free(zOut); |
| 560 | 560 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -167,11 +167,11 @@ | |
| 167 | int rid; |
| 168 | |
| 169 | rid = th1_name_to_typed_rid(interp, zRev, "ci"); |
| 170 | compute_fileage(rid, zGlob); |
| 171 | db_prepare(&q, |
| 172 | "SELECT datetime(fileage.mtime, 'localtime'), fileage.pathname,\n" |
| 173 | " blob.size\n" |
| 174 | " FROM fileage, blob\n" |
| 175 | " WHERE blob.rid=fileage.fid \n" |
| 176 | " ORDER BY %s;", zOrderBy /*safe-for-%s*/ |
| 177 | ); |
| @@ -549,11 +549,11 @@ | |
| 549 | const char **argv, |
| 550 | int *argl |
| 551 | ){ |
| 552 | char *zOut; |
| 553 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 554 | zOut = db_text("??", "SELECT datetime('now'%s)", timeline_utc()); |
| 555 | }else{ |
| 556 | zOut = db_text("??", "SELECT datetime('now')"); |
| 557 | } |
| 558 | Th_SetResult(interp, zOut, -1); |
| 559 | free(zOut); |
| 560 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -167,11 +167,11 @@ | |
| 167 | int rid; |
| 168 | |
| 169 | rid = th1_name_to_typed_rid(interp, zRev, "ci"); |
| 170 | compute_fileage(rid, zGlob); |
| 171 | db_prepare(&q, |
| 172 | "SELECT datetime(fileage.mtime, toLocal()), fileage.pathname,\n" |
| 173 | " blob.size\n" |
| 174 | " FROM fileage, blob\n" |
| 175 | " WHERE blob.rid=fileage.fid \n" |
| 176 | " ORDER BY %s;", zOrderBy /*safe-for-%s*/ |
| 177 | ); |
| @@ -549,11 +549,11 @@ | |
| 549 | const char **argv, |
| 550 | int *argl |
| 551 | ){ |
| 552 | char *zOut; |
| 553 | if( argc>=2 && argl[1]==6 && memcmp(argv[1],"-local",6)==0 ){ |
| 554 | zOut = db_text("??", "SELECT datetime('now',toLocal())"); |
| 555 | }else{ |
| 556 | zOut = db_text("??", "SELECT datetime('now')"); |
| 557 | } |
| 558 | Th_SetResult(interp, zOut, -1); |
| 559 | free(zOut); |
| 560 |
+6
-32
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1027,16 +1027,15 @@ | ||
| 1027 | 1027 | /* |
| 1028 | 1028 | ** Return a pointer to a constant string that forms the basis |
| 1029 | 1029 | ** for a timeline query for the WWW interface. |
| 1030 | 1030 | */ |
| 1031 | 1031 | const char *timeline_query_for_www(void){ |
| 1032 | - static const char *zBase = 0; | |
| 1033 | - static const char zBaseSql[] = | |
| 1032 | + static const char zBase[] = | |
| 1034 | 1033 | @ SELECT |
| 1035 | 1034 | @ blob.rid AS blobRid, |
| 1036 | 1035 | @ uuid AS uuid, |
| 1037 | - @ datetime(event.mtime%s) AS timestamp, | |
| 1036 | + @ datetime(event.mtime,toLocal()) AS timestamp, | |
| 1038 | 1037 | @ coalesce(ecomment, comment) AS comment, |
| 1039 | 1038 | @ coalesce(euser, user) AS user, |
| 1040 | 1039 | @ blob.rid IN leaf AS leaf, |
| 1041 | 1040 | @ bgcolor AS bgColor, |
| 1042 | 1041 | @ event.type AS eventType, |
| @@ -1047,13 +1046,10 @@ | ||
| 1047 | 1046 | @ brief AS brief, |
| 1048 | 1047 | @ event.mtime AS mtime |
| 1049 | 1048 | @ FROM event CROSS JOIN blob |
| 1050 | 1049 | @ WHERE blob.rid=event.objid |
| 1051 | 1050 | ; |
| 1052 | - if( zBase==0 ){ | |
| 1053 | - zBase = mprintf(zBaseSql /*works-like: "%s"*/, timeline_utc()); | |
| 1054 | - } | |
| 1055 | 1051 | return zBase; |
| 1056 | 1052 | } |
| 1057 | 1053 | |
| 1058 | 1054 | /* |
| 1059 | 1055 | ** Generate a submenu element with a single parameter change. |
| @@ -1077,11 +1073,11 @@ | ||
| 1077 | 1073 | double symbolic_name_to_mtime(const char *z){ |
| 1078 | 1074 | double mtime; |
| 1079 | 1075 | int rid; |
| 1080 | 1076 | if( z==0 ) return -1.0; |
| 1081 | 1077 | if( fossil_isdate(z) ){ |
| 1082 | - mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z); | |
| 1078 | + mtime = db_double(0.0, "SELECT julianday(%Q,fromLocal())", z); | |
| 1083 | 1079 | if( mtime>0.0 ) return mtime; |
| 1084 | 1080 | } |
| 1085 | 1081 | rid = symbolic_name_to_rid(z, "*"); |
| 1086 | 1082 | if( rid ){ |
| 1087 | 1083 | mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| @@ -1939,11 +1935,11 @@ | ||
| 1939 | 1935 | const char *timeline_query_for_tty(void){ |
| 1940 | 1936 | static const char zBaseSql[] = |
| 1941 | 1937 | @ SELECT |
| 1942 | 1938 | @ blob.rid AS rid, |
| 1943 | 1939 | @ uuid, |
| 1944 | - @ datetime(event.mtime%s) AS mDateTime, | |
| 1940 | + @ datetime(event.mtime,toLocal()) AS mDateTime, | |
| 1945 | 1941 | @ coalesce(ecomment,comment) |
| 1946 | 1942 | @ || ' (user: ' || coalesce(euser,user,'?') |
| 1947 | 1943 | @ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end |
| 1948 | 1944 | @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x |
| 1949 | 1945 | @ FROM tag, tagxref |
| @@ -1960,11 +1956,11 @@ | ||
| 1960 | 1956 | @ AND tagxref.tagtype>0 |
| 1961 | 1957 | @ AND tagxref.rid=blob.rid |
| 1962 | 1958 | @ WHERE blob.rid=event.objid |
| 1963 | 1959 | @ AND tag.tagname='branch' |
| 1964 | 1960 | ; |
| 1965 | - return mprintf(zBaseSql /*works-like: "%s"*/, timeline_utc()); | |
| 1961 | + return zBaseSql; | |
| 1966 | 1962 | } |
| 1967 | 1963 | |
| 1968 | 1964 | /* |
| 1969 | 1965 | ** Return true if the input string is a date in the ISO 8601 format: |
| 1970 | 1966 | ** YYYY-MM-DD. |
| @@ -2118,11 +2114,11 @@ | ||
| 2118 | 2114 | fossil_fatal("cannot compute descendants or ancestors of a date"); |
| 2119 | 2115 | } |
| 2120 | 2116 | if( mode==0 ){ |
| 2121 | 2117 | if( isIsoDate(zOrigin) ) zShift = ",'+1 day'"; |
| 2122 | 2118 | } |
| 2123 | - zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift); | |
| 2119 | + zDate = mprintf("(SELECT julianday(%Q%s, fromLocal())", zOrigin, zShift); | |
| 2124 | 2120 | } |
| 2125 | 2121 | |
| 2126 | 2122 | if( zFilePattern ){ |
| 2127 | 2123 | if( zType==0 ){ |
| 2128 | 2124 | /* When zFilePattern is specified and type is not specified, only show |
| @@ -2187,32 +2183,10 @@ | ||
| 2187 | 2183 | blob_reset(&sql); |
| 2188 | 2184 | print_timeline(&q, n, width, verboseFlag); |
| 2189 | 2185 | db_finalize(&q); |
| 2190 | 2186 | } |
| 2191 | 2187 | |
| 2192 | -/* | |
| 2193 | -** Return one of two things: | |
| 2194 | -** | |
| 2195 | -** ",'localtime'" if the timeline-utc property is set to 0. | |
| 2196 | -** | |
| 2197 | -** "" (empty string) otherwise. | |
| 2198 | -*/ | |
| 2199 | -const char *timeline_utc(){ | |
| 2200 | - if( g.fTimeFormat==0 ){ | |
| 2201 | - if( db_get_int("timeline-utc", 1) ){ | |
| 2202 | - g.fTimeFormat = 1; | |
| 2203 | - }else{ | |
| 2204 | - g.fTimeFormat = 2; | |
| 2205 | - } | |
| 2206 | - } | |
| 2207 | - if( g.fTimeFormat==1 ){ | |
| 2208 | - return ""; | |
| 2209 | - }else{ | |
| 2210 | - return ",'localtime'"; | |
| 2211 | - } | |
| 2212 | -} | |
| 2213 | - | |
| 2214 | 2188 | |
| 2215 | 2189 | /* |
| 2216 | 2190 | ** COMMAND: test-timewarp-list |
| 2217 | 2191 | ** |
| 2218 | 2192 | ** Usage: %fossil test-timewarp-list ?-v|---verbose? |
| 2219 | 2193 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1027,16 +1027,15 @@ | |
| 1027 | /* |
| 1028 | ** Return a pointer to a constant string that forms the basis |
| 1029 | ** for a timeline query for the WWW interface. |
| 1030 | */ |
| 1031 | const char *timeline_query_for_www(void){ |
| 1032 | static const char *zBase = 0; |
| 1033 | static const char zBaseSql[] = |
| 1034 | @ SELECT |
| 1035 | @ blob.rid AS blobRid, |
| 1036 | @ uuid AS uuid, |
| 1037 | @ datetime(event.mtime%s) AS timestamp, |
| 1038 | @ coalesce(ecomment, comment) AS comment, |
| 1039 | @ coalesce(euser, user) AS user, |
| 1040 | @ blob.rid IN leaf AS leaf, |
| 1041 | @ bgcolor AS bgColor, |
| 1042 | @ event.type AS eventType, |
| @@ -1047,13 +1046,10 @@ | |
| 1047 | @ brief AS brief, |
| 1048 | @ event.mtime AS mtime |
| 1049 | @ FROM event CROSS JOIN blob |
| 1050 | @ WHERE blob.rid=event.objid |
| 1051 | ; |
| 1052 | if( zBase==0 ){ |
| 1053 | zBase = mprintf(zBaseSql /*works-like: "%s"*/, timeline_utc()); |
| 1054 | } |
| 1055 | return zBase; |
| 1056 | } |
| 1057 | |
| 1058 | /* |
| 1059 | ** Generate a submenu element with a single parameter change. |
| @@ -1077,11 +1073,11 @@ | |
| 1077 | double symbolic_name_to_mtime(const char *z){ |
| 1078 | double mtime; |
| 1079 | int rid; |
| 1080 | if( z==0 ) return -1.0; |
| 1081 | if( fossil_isdate(z) ){ |
| 1082 | mtime = db_double(0.0, "SELECT julianday(%Q,'utc')", z); |
| 1083 | if( mtime>0.0 ) return mtime; |
| 1084 | } |
| 1085 | rid = symbolic_name_to_rid(z, "*"); |
| 1086 | if( rid ){ |
| 1087 | mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| @@ -1939,11 +1935,11 @@ | |
| 1939 | const char *timeline_query_for_tty(void){ |
| 1940 | static const char zBaseSql[] = |
| 1941 | @ SELECT |
| 1942 | @ blob.rid AS rid, |
| 1943 | @ uuid, |
| 1944 | @ datetime(event.mtime%s) AS mDateTime, |
| 1945 | @ coalesce(ecomment,comment) |
| 1946 | @ || ' (user: ' || coalesce(euser,user,'?') |
| 1947 | @ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end |
| 1948 | @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x |
| 1949 | @ FROM tag, tagxref |
| @@ -1960,11 +1956,11 @@ | |
| 1960 | @ AND tagxref.tagtype>0 |
| 1961 | @ AND tagxref.rid=blob.rid |
| 1962 | @ WHERE blob.rid=event.objid |
| 1963 | @ AND tag.tagname='branch' |
| 1964 | ; |
| 1965 | return mprintf(zBaseSql /*works-like: "%s"*/, timeline_utc()); |
| 1966 | } |
| 1967 | |
| 1968 | /* |
| 1969 | ** Return true if the input string is a date in the ISO 8601 format: |
| 1970 | ** YYYY-MM-DD. |
| @@ -2118,11 +2114,11 @@ | |
| 2118 | fossil_fatal("cannot compute descendants or ancestors of a date"); |
| 2119 | } |
| 2120 | if( mode==0 ){ |
| 2121 | if( isIsoDate(zOrigin) ) zShift = ",'+1 day'"; |
| 2122 | } |
| 2123 | zDate = mprintf("(SELECT julianday(%Q%s, 'utc'))", zOrigin, zShift); |
| 2124 | } |
| 2125 | |
| 2126 | if( zFilePattern ){ |
| 2127 | if( zType==0 ){ |
| 2128 | /* When zFilePattern is specified and type is not specified, only show |
| @@ -2187,32 +2183,10 @@ | |
| 2187 | blob_reset(&sql); |
| 2188 | print_timeline(&q, n, width, verboseFlag); |
| 2189 | db_finalize(&q); |
| 2190 | } |
| 2191 | |
| 2192 | /* |
| 2193 | ** Return one of two things: |
| 2194 | ** |
| 2195 | ** ",'localtime'" if the timeline-utc property is set to 0. |
| 2196 | ** |
| 2197 | ** "" (empty string) otherwise. |
| 2198 | */ |
| 2199 | const char *timeline_utc(){ |
| 2200 | if( g.fTimeFormat==0 ){ |
| 2201 | if( db_get_int("timeline-utc", 1) ){ |
| 2202 | g.fTimeFormat = 1; |
| 2203 | }else{ |
| 2204 | g.fTimeFormat = 2; |
| 2205 | } |
| 2206 | } |
| 2207 | if( g.fTimeFormat==1 ){ |
| 2208 | return ""; |
| 2209 | }else{ |
| 2210 | return ",'localtime'"; |
| 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | |
| 2215 | /* |
| 2216 | ** COMMAND: test-timewarp-list |
| 2217 | ** |
| 2218 | ** Usage: %fossil test-timewarp-list ?-v|---verbose? |
| 2219 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1027,16 +1027,15 @@ | |
| 1027 | /* |
| 1028 | ** Return a pointer to a constant string that forms the basis |
| 1029 | ** for a timeline query for the WWW interface. |
| 1030 | */ |
| 1031 | const char *timeline_query_for_www(void){ |
| 1032 | static const char zBase[] = |
| 1033 | @ SELECT |
| 1034 | @ blob.rid AS blobRid, |
| 1035 | @ uuid AS uuid, |
| 1036 | @ datetime(event.mtime,toLocal()) AS timestamp, |
| 1037 | @ coalesce(ecomment, comment) AS comment, |
| 1038 | @ coalesce(euser, user) AS user, |
| 1039 | @ blob.rid IN leaf AS leaf, |
| 1040 | @ bgcolor AS bgColor, |
| 1041 | @ event.type AS eventType, |
| @@ -1047,13 +1046,10 @@ | |
| 1046 | @ brief AS brief, |
| 1047 | @ event.mtime AS mtime |
| 1048 | @ FROM event CROSS JOIN blob |
| 1049 | @ WHERE blob.rid=event.objid |
| 1050 | ; |
| 1051 | return zBase; |
| 1052 | } |
| 1053 | |
| 1054 | /* |
| 1055 | ** Generate a submenu element with a single parameter change. |
| @@ -1077,11 +1073,11 @@ | |
| 1073 | double symbolic_name_to_mtime(const char *z){ |
| 1074 | double mtime; |
| 1075 | int rid; |
| 1076 | if( z==0 ) return -1.0; |
| 1077 | if( fossil_isdate(z) ){ |
| 1078 | mtime = db_double(0.0, "SELECT julianday(%Q,fromLocal())", z); |
| 1079 | if( mtime>0.0 ) return mtime; |
| 1080 | } |
| 1081 | rid = symbolic_name_to_rid(z, "*"); |
| 1082 | if( rid ){ |
| 1083 | mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| @@ -1939,11 +1935,11 @@ | |
| 1935 | const char *timeline_query_for_tty(void){ |
| 1936 | static const char zBaseSql[] = |
| 1937 | @ SELECT |
| 1938 | @ blob.rid AS rid, |
| 1939 | @ uuid, |
| 1940 | @ datetime(event.mtime,toLocal()) AS mDateTime, |
| 1941 | @ coalesce(ecomment,comment) |
| 1942 | @ || ' (user: ' || coalesce(euser,user,'?') |
| 1943 | @ || (SELECT case when length(x)>0 then ' tags: ' || x else '' end |
| 1944 | @ FROM (SELECT group_concat(substr(tagname,5), ', ') AS x |
| 1945 | @ FROM tag, tagxref |
| @@ -1960,11 +1956,11 @@ | |
| 1956 | @ AND tagxref.tagtype>0 |
| 1957 | @ AND tagxref.rid=blob.rid |
| 1958 | @ WHERE blob.rid=event.objid |
| 1959 | @ AND tag.tagname='branch' |
| 1960 | ; |
| 1961 | return zBaseSql; |
| 1962 | } |
| 1963 | |
| 1964 | /* |
| 1965 | ** Return true if the input string is a date in the ISO 8601 format: |
| 1966 | ** YYYY-MM-DD. |
| @@ -2118,11 +2114,11 @@ | |
| 2114 | fossil_fatal("cannot compute descendants or ancestors of a date"); |
| 2115 | } |
| 2116 | if( mode==0 ){ |
| 2117 | if( isIsoDate(zOrigin) ) zShift = ",'+1 day'"; |
| 2118 | } |
| 2119 | zDate = mprintf("(SELECT julianday(%Q%s, fromLocal())", zOrigin, zShift); |
| 2120 | } |
| 2121 | |
| 2122 | if( zFilePattern ){ |
| 2123 | if( zType==0 ){ |
| 2124 | /* When zFilePattern is specified and type is not specified, only show |
| @@ -2187,32 +2183,10 @@ | |
| 2183 | blob_reset(&sql); |
| 2184 | print_timeline(&q, n, width, verboseFlag); |
| 2185 | db_finalize(&q); |
| 2186 | } |
| 2187 | |
| 2188 | |
| 2189 | /* |
| 2190 | ** COMMAND: test-timewarp-list |
| 2191 | ** |
| 2192 | ** Usage: %fossil test-timewarp-list ?-v|---verbose? |
| 2193 |
+8
-8
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -137,13 +137,13 @@ | ||
| 137 | 137 | const char *zName; |
| 138 | 138 | Stmt q; |
| 139 | 139 | int i, n, size, j; |
| 140 | 140 | |
| 141 | 141 | zName = PD("name","-none-"); |
| 142 | - db_prepare(&q, "SELECT datetime(tkt_mtime%s) AS tkt_datetime, *" | |
| 142 | + db_prepare(&q, "SELECT datetime(tkt_mtime,toLocal()) AS tkt_datetime, *" | |
| 143 | 143 | " FROM ticket WHERE tkt_uuid GLOB '%q*'", |
| 144 | - timeline_utc(), zName); | |
| 144 | + zName); | |
| 145 | 145 | if( db_step(&q)==SQLITE_ROW ){ |
| 146 | 146 | n = db_column_count(&q); |
| 147 | 147 | for(i=0; i<n; i++){ |
| 148 | 148 | const char *zVal = db_column_text(&q, i); |
| 149 | 149 | const char *zName = db_column_name(&q, i); |
| @@ -946,21 +946,21 @@ | ||
| 946 | 946 | @ No such ticket: %h(zUuid) |
| 947 | 947 | style_footer(); |
| 948 | 948 | return; |
| 949 | 949 | } |
| 950 | 950 | db_prepare(&q, |
| 951 | - "SELECT datetime(mtime%s), objid, uuid, NULL, NULL, NULL" | |
| 951 | + "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" | |
| 952 | 952 | " FROM event, blob" |
| 953 | 953 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 954 | 954 | " AND blob.rid=event.objid" |
| 955 | 955 | " UNION " |
| 956 | - "SELECT datetime(mtime%s), attachid, uuid, src, filename, user" | |
| 956 | + "SELECT datetime(mtime,toLocal()), attachid, uuid, src, filename, user" | |
| 957 | 957 | " FROM attachment, blob" |
| 958 | 958 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 959 | 959 | " AND blob.rid=attachid" |
| 960 | 960 | " ORDER BY 1", |
| 961 | - timeline_utc(), tagid, timeline_utc(), tagid | |
| 961 | + tagid, tagid | |
| 962 | 962 | ); |
| 963 | 963 | while( db_step(&q)==SQLITE_ROW ){ |
| 964 | 964 | Manifest *pTicket; |
| 965 | 965 | const char *zDate = db_column_text(&q, 0); |
| 966 | 966 | int rid = db_column_int(&q, 1); |
| @@ -1254,22 +1254,22 @@ | ||
| 1254 | 1254 | zTktUuid); |
| 1255 | 1255 | if( tagid==0 ){ |
| 1256 | 1256 | fossil_fatal("no such ticket %h", zTktUuid); |
| 1257 | 1257 | } |
| 1258 | 1258 | db_prepare(&q, |
| 1259 | - "SELECT datetime(mtime%s), objid, NULL, NULL, NULL" | |
| 1259 | + "SELECT datetime(mtime,toLocal()), objid, NULL, NULL, NULL" | |
| 1260 | 1260 | " FROM event, blob" |
| 1261 | 1261 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 1262 | 1262 | " AND blob.rid=event.objid" |
| 1263 | 1263 | " UNION " |
| 1264 | - "SELECT datetime(mtime%s), attachid, filename, " | |
| 1264 | + "SELECT datetime(mtime,toLocal()), attachid, filename, " | |
| 1265 | 1265 | " src, user" |
| 1266 | 1266 | " FROM attachment, blob" |
| 1267 | 1267 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 1268 | 1268 | " AND blob.rid=attachid" |
| 1269 | 1269 | " ORDER BY 1 DESC", |
| 1270 | - timeline_utc(), tagid, timeline_utc(), tagid | |
| 1270 | + tagid, tagid | |
| 1271 | 1271 | ); |
| 1272 | 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1273 | 1273 | Manifest *pTicket; |
| 1274 | 1274 | const char *zDate = db_column_text(&q, 0); |
| 1275 | 1275 | int rid = db_column_int(&q, 1); |
| 1276 | 1276 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -137,13 +137,13 @@ | |
| 137 | const char *zName; |
| 138 | Stmt q; |
| 139 | int i, n, size, j; |
| 140 | |
| 141 | zName = PD("name","-none-"); |
| 142 | db_prepare(&q, "SELECT datetime(tkt_mtime%s) AS tkt_datetime, *" |
| 143 | " FROM ticket WHERE tkt_uuid GLOB '%q*'", |
| 144 | timeline_utc(), zName); |
| 145 | if( db_step(&q)==SQLITE_ROW ){ |
| 146 | n = db_column_count(&q); |
| 147 | for(i=0; i<n; i++){ |
| 148 | const char *zVal = db_column_text(&q, i); |
| 149 | const char *zName = db_column_name(&q, i); |
| @@ -946,21 +946,21 @@ | |
| 946 | @ No such ticket: %h(zUuid) |
| 947 | style_footer(); |
| 948 | return; |
| 949 | } |
| 950 | db_prepare(&q, |
| 951 | "SELECT datetime(mtime%s), objid, uuid, NULL, NULL, NULL" |
| 952 | " FROM event, blob" |
| 953 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 954 | " AND blob.rid=event.objid" |
| 955 | " UNION " |
| 956 | "SELECT datetime(mtime%s), attachid, uuid, src, filename, user" |
| 957 | " FROM attachment, blob" |
| 958 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 959 | " AND blob.rid=attachid" |
| 960 | " ORDER BY 1", |
| 961 | timeline_utc(), tagid, timeline_utc(), tagid |
| 962 | ); |
| 963 | while( db_step(&q)==SQLITE_ROW ){ |
| 964 | Manifest *pTicket; |
| 965 | const char *zDate = db_column_text(&q, 0); |
| 966 | int rid = db_column_int(&q, 1); |
| @@ -1254,22 +1254,22 @@ | |
| 1254 | zTktUuid); |
| 1255 | if( tagid==0 ){ |
| 1256 | fossil_fatal("no such ticket %h", zTktUuid); |
| 1257 | } |
| 1258 | db_prepare(&q, |
| 1259 | "SELECT datetime(mtime%s), objid, NULL, NULL, NULL" |
| 1260 | " FROM event, blob" |
| 1261 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 1262 | " AND blob.rid=event.objid" |
| 1263 | " UNION " |
| 1264 | "SELECT datetime(mtime%s), attachid, filename, " |
| 1265 | " src, user" |
| 1266 | " FROM attachment, blob" |
| 1267 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 1268 | " AND blob.rid=attachid" |
| 1269 | " ORDER BY 1 DESC", |
| 1270 | timeline_utc(), tagid, timeline_utc(), tagid |
| 1271 | ); |
| 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1273 | Manifest *pTicket; |
| 1274 | const char *zDate = db_column_text(&q, 0); |
| 1275 | int rid = db_column_int(&q, 1); |
| 1276 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -137,13 +137,13 @@ | |
| 137 | const char *zName; |
| 138 | Stmt q; |
| 139 | int i, n, size, j; |
| 140 | |
| 141 | zName = PD("name","-none-"); |
| 142 | db_prepare(&q, "SELECT datetime(tkt_mtime,toLocal()) AS tkt_datetime, *" |
| 143 | " FROM ticket WHERE tkt_uuid GLOB '%q*'", |
| 144 | zName); |
| 145 | if( db_step(&q)==SQLITE_ROW ){ |
| 146 | n = db_column_count(&q); |
| 147 | for(i=0; i<n; i++){ |
| 148 | const char *zVal = db_column_text(&q, i); |
| 149 | const char *zName = db_column_name(&q, i); |
| @@ -946,21 +946,21 @@ | |
| 946 | @ No such ticket: %h(zUuid) |
| 947 | style_footer(); |
| 948 | return; |
| 949 | } |
| 950 | db_prepare(&q, |
| 951 | "SELECT datetime(mtime,toLocal()), objid, uuid, NULL, NULL, NULL" |
| 952 | " FROM event, blob" |
| 953 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 954 | " AND blob.rid=event.objid" |
| 955 | " UNION " |
| 956 | "SELECT datetime(mtime,toLocal()), attachid, uuid, src, filename, user" |
| 957 | " FROM attachment, blob" |
| 958 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 959 | " AND blob.rid=attachid" |
| 960 | " ORDER BY 1", |
| 961 | tagid, tagid |
| 962 | ); |
| 963 | while( db_step(&q)==SQLITE_ROW ){ |
| 964 | Manifest *pTicket; |
| 965 | const char *zDate = db_column_text(&q, 0); |
| 966 | int rid = db_column_int(&q, 1); |
| @@ -1254,22 +1254,22 @@ | |
| 1254 | zTktUuid); |
| 1255 | if( tagid==0 ){ |
| 1256 | fossil_fatal("no such ticket %h", zTktUuid); |
| 1257 | } |
| 1258 | db_prepare(&q, |
| 1259 | "SELECT datetime(mtime,toLocal()), objid, NULL, NULL, NULL" |
| 1260 | " FROM event, blob" |
| 1261 | " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)" |
| 1262 | " AND blob.rid=event.objid" |
| 1263 | " UNION " |
| 1264 | "SELECT datetime(mtime,toLocal()), attachid, filename, " |
| 1265 | " src, user" |
| 1266 | " FROM attachment, blob" |
| 1267 | " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)" |
| 1268 | " AND blob.rid=attachid" |
| 1269 | " ORDER BY 1 DESC", |
| 1270 | tagid, tagid |
| 1271 | ); |
| 1272 | while( db_step(&q)==SQLITE_ROW ){ |
| 1273 | Manifest *pTicket; |
| 1274 | const char *zDate = db_column_text(&q, 0); |
| 1275 | int rid = db_column_int(&q, 1); |
| 1276 |
+2
-2
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -459,12 +459,12 @@ | ||
| 459 | 459 | return; |
| 460 | 460 | } |
| 461 | 461 | style_header("Access Log"); |
| 462 | 462 | blob_zero(&sql); |
| 463 | 463 | blob_append_sql(&sql, |
| 464 | - "SELECT uname, ipaddr, datetime(mtime%s), success" | |
| 465 | - " FROM accesslog", timeline_utc() | |
| 464 | + "SELECT uname, ipaddr, datetime(mtime,toLocal()), success" | |
| 465 | + " FROM accesslog" | |
| 466 | 466 | ); |
| 467 | 467 | if( y==1 ){ |
| 468 | 468 | blob_append(&sql, " WHERE success", -1); |
| 469 | 469 | }else if( y==2 ){ |
| 470 | 470 | blob_append(&sql, " WHERE NOT success", -1); |
| 471 | 471 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -459,12 +459,12 @@ | |
| 459 | return; |
| 460 | } |
| 461 | style_header("Access Log"); |
| 462 | blob_zero(&sql); |
| 463 | blob_append_sql(&sql, |
| 464 | "SELECT uname, ipaddr, datetime(mtime%s), success" |
| 465 | " FROM accesslog", timeline_utc() |
| 466 | ); |
| 467 | if( y==1 ){ |
| 468 | blob_append(&sql, " WHERE success", -1); |
| 469 | }else if( y==2 ){ |
| 470 | blob_append(&sql, " WHERE NOT success", -1); |
| 471 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -459,12 +459,12 @@ | |
| 459 | return; |
| 460 | } |
| 461 | style_header("Access Log"); |
| 462 | blob_zero(&sql); |
| 463 | blob_append_sql(&sql, |
| 464 | "SELECT uname, ipaddr, datetime(mtime,toLocal()), success" |
| 465 | " FROM accesslog" |
| 466 | ); |
| 467 | if( y==1 ){ |
| 468 | blob_append(&sql, " WHERE success", -1); |
| 469 | }else if( y==2 ){ |
| 470 | blob_append(&sql, " WHERE NOT success", -1); |
| 471 |