Fossil SCM
Merge trunk. Some more comments.
Commit
4e3f4d26d86a9e47ec8cb1aef2d468c67173a4c9
Parent
1db9134d6b56195…
37 files changed
+6
-4
+6
-4
+22
-1
+4
-3
+314
-151
+53
-18
+1
+4
-2
+6
-3
~
src/db.c
~
src/db.c
~
src/info.c
~
src/shell.c
~
src/sqlite3.c
~
src/sqlite3.h
~
test/cmdline.test
~
test/cmdline.test
~
test/delta1.test
~
test/delta1.test
~
test/file1.test
~
test/file1.test
~
test/glob.test
~
test/glob.test
~
test/merge1.test
~
test/merge1.test
~
test/merge2.test
~
test/merge2.test
~
test/merge3.test
~
test/merge3.test
~
test/merge4.test
~
test/merge4.test
~
test/merge5.test
~
test/merge5.test
~
test/merge_renames.test
~
test/merge_renames.test
~
test/revert.test
~
test/revert.test
~
test/th1-tcl.test
~
test/th1-tcl.test
~
test/th1.test
~
test/th1.test
~
test/utf.test
~
test/utf.test
~
win/buildmsvc.bat
~
www/build.wiki
~
www/changes.wiki
M
src/db.c
+6
-4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -711,16 +711,18 @@ | ||
| 711 | 711 | */ |
| 712 | 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | 713 | int rc; |
| 714 | 714 | sqlite3 *db; |
| 715 | 715 | |
| 716 | -#if defined(__CYGWIN__) || defined(_WIN32) | |
| 716 | +#if defined(__CYGWIN__) | |
| 717 | + /* Necessary if we want Cygwin fossil to recognize win32 file | |
| 718 | + * paths, as SQLite doesn't handle that (yet) */ | |
| 719 | + zDbName = fossil_utf8_to_filename(zDbName); | |
| 720 | +#elif defined(_WIN32) | |
| 721 | + /* Only necessary when SQLite doesn't handle Extended paths. */ | |
| 717 | 722 | zDbName = fossil_utf8_to_filename(zDbName); |
| 718 | -#ifdef _WIN32 | |
| 719 | - /* Convert back to utf-8. TODO: SQLite should handle this */ | |
| 720 | 723 | zDbName = fossil_filename_to_utf8(zDbName); |
| 721 | -#endif | |
| 722 | 724 | #endif |
| 723 | 725 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | 726 | rc = sqlite3_open_v2( |
| 725 | 727 | zDbName, &db, |
| 726 | 728 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 727 | 729 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -711,16 +711,18 @@ | |
| 711 | */ |
| 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | int rc; |
| 714 | sqlite3 *db; |
| 715 | |
| 716 | #if defined(__CYGWIN__) || defined(_WIN32) |
| 717 | zDbName = fossil_utf8_to_filename(zDbName); |
| 718 | #ifdef _WIN32 |
| 719 | /* Convert back to utf-8. TODO: SQLite should handle this */ |
| 720 | zDbName = fossil_filename_to_utf8(zDbName); |
| 721 | #endif |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| 726 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 727 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -711,16 +711,18 @@ | |
| 711 | */ |
| 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | int rc; |
| 714 | sqlite3 *db; |
| 715 | |
| 716 | #if defined(__CYGWIN__) |
| 717 | /* Necessary if we want Cygwin fossil to recognize win32 file |
| 718 | * paths, as SQLite doesn't handle that (yet) */ |
| 719 | zDbName = fossil_utf8_to_filename(zDbName); |
| 720 | #elif defined(_WIN32) |
| 721 | /* Only necessary when SQLite doesn't handle Extended paths. */ |
| 722 | zDbName = fossil_utf8_to_filename(zDbName); |
| 723 | zDbName = fossil_filename_to_utf8(zDbName); |
| 724 | #endif |
| 725 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 726 | rc = sqlite3_open_v2( |
| 727 | zDbName, &db, |
| 728 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 729 |
M
src/db.c
+6
-4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -711,16 +711,18 @@ | ||
| 711 | 711 | */ |
| 712 | 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | 713 | int rc; |
| 714 | 714 | sqlite3 *db; |
| 715 | 715 | |
| 716 | -#if defined(__CYGWIN__) || defined(_WIN32) | |
| 716 | +#if defined(__CYGWIN__) | |
| 717 | + /* Necessary if we want Cygwin fossil to recognize win32 file | |
| 718 | + * paths, as SQLite doesn't handle that (yet) */ | |
| 719 | + zDbName = fossil_utf8_to_filename(zDbName); | |
| 720 | +#elif defined(_WIN32) | |
| 721 | + /* Only necessary when SQLite doesn't handle Extended paths. */ | |
| 717 | 722 | zDbName = fossil_utf8_to_filename(zDbName); |
| 718 | -#ifdef _WIN32 | |
| 719 | - /* Convert back to utf-8. TODO: SQLite should handle this */ | |
| 720 | 723 | zDbName = fossil_filename_to_utf8(zDbName); |
| 721 | -#endif | |
| 722 | 724 | #endif |
| 723 | 725 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | 726 | rc = sqlite3_open_v2( |
| 725 | 727 | zDbName, &db, |
| 726 | 728 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 727 | 729 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -711,16 +711,18 @@ | |
| 711 | */ |
| 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | int rc; |
| 714 | sqlite3 *db; |
| 715 | |
| 716 | #if defined(__CYGWIN__) || defined(_WIN32) |
| 717 | zDbName = fossil_utf8_to_filename(zDbName); |
| 718 | #ifdef _WIN32 |
| 719 | /* Convert back to utf-8. TODO: SQLite should handle this */ |
| 720 | zDbName = fossil_filename_to_utf8(zDbName); |
| 721 | #endif |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| 726 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 727 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -711,16 +711,18 @@ | |
| 711 | */ |
| 712 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 713 | int rc; |
| 714 | sqlite3 *db; |
| 715 | |
| 716 | #if defined(__CYGWIN__) |
| 717 | /* Necessary if we want Cygwin fossil to recognize win32 file |
| 718 | * paths, as SQLite doesn't handle that (yet) */ |
| 719 | zDbName = fossil_utf8_to_filename(zDbName); |
| 720 | #elif defined(_WIN32) |
| 721 | /* Only necessary when SQLite doesn't handle Extended paths. */ |
| 722 | zDbName = fossil_utf8_to_filename(zDbName); |
| 723 | zDbName = fossil_filename_to_utf8(zDbName); |
| 724 | #endif |
| 725 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 726 | rc = sqlite3_open_v2( |
| 727 | zDbName, &db, |
| 728 | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, |
| 729 |
+22
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -524,11 +524,12 @@ | ||
| 524 | 524 | |
| 525 | 525 | style_header(zTitle); |
| 526 | 526 | login_anonymous_available(); |
| 527 | 527 | free(zTitle); |
| 528 | 528 | zEUser = db_text(0, |
| 529 | - "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", | |
| 529 | + "SELECT value FROM tagxref" | |
| 530 | + " WHERE tagid=%d AND rid=%d AND tagtype>0", | |
| 530 | 531 | TAG_USER, rid); |
| 531 | 532 | zEComment = db_text(0, |
| 532 | 533 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 533 | 534 | TAG_COMMENT, rid); |
| 534 | 535 | zUser = db_column_text(&q1, 2); |
| @@ -2051,12 +2052,14 @@ | ||
| 2051 | 2052 | const char *zNewTagFlag; |
| 2052 | 2053 | const char *zNewTag; |
| 2053 | 2054 | const char *zNewBrFlag; |
| 2054 | 2055 | const char *zNewBranch; |
| 2055 | 2056 | const char *zCloseFlag; |
| 2057 | + const char *zHideFlag; | |
| 2056 | 2058 | int fPropagateColor; /* True if color propagates before edit */ |
| 2057 | 2059 | int fNewPropagateColor; /* True if color propagates after edit */ |
| 2060 | + int fHasHidden = 0; /* True if hidden tag already set */ | |
| 2058 | 2061 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2059 | 2062 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ |
| 2060 | 2063 | char *zUuid; |
| 2061 | 2064 | Blob comment; |
| 2062 | 2065 | char *zBranchName = 0; |
| @@ -2095,10 +2098,11 @@ | ||
| 2095 | 2098 | zNewTagFlag = P("newtag") ? " checked" : ""; |
| 2096 | 2099 | zNewTag = PDT("tagname",""); |
| 2097 | 2100 | zNewBrFlag = P("newbr") ? " checked" : ""; |
| 2098 | 2101 | zNewBranch = PDT("brname",""); |
| 2099 | 2102 | zCloseFlag = P("close") ? " checked" : ""; |
| 2103 | + zHideFlag = P("hide") ? " checked" : ""; | |
| 2100 | 2104 | if( P("apply") ){ |
| 2101 | 2105 | Blob ctrl; |
| 2102 | 2106 | char *zNow; |
| 2103 | 2107 | int nChng = 0; |
| 2104 | 2108 | |
| @@ -2145,10 +2149,13 @@ | ||
| 2145 | 2149 | if( P(zLabel) ){ |
| 2146 | 2150 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 2147 | 2151 | } |
| 2148 | 2152 | } |
| 2149 | 2153 | db_finalize(&q); |
| 2154 | + if( zHideFlag[0] ){ | |
| 2155 | + db_multi_exec("REPLACE INTO newtags VALUES('hidden','*',NULL)"); | |
| 2156 | + } | |
| 2150 | 2157 | if( zCloseFlag[0] ){ |
| 2151 | 2158 | db_multi_exec("REPLACE INTO newtags VALUES('closed','%s',NULL)", |
| 2152 | 2159 | is_a_leaf(rid)?"+":"*"); |
| 2153 | 2160 | } |
| 2154 | 2161 | if( zNewTagFlag[0] && zNewTag[0] ){ |
| @@ -2206,16 +2213,19 @@ | ||
| 2206 | 2213 | */ |
| 2207 | 2214 | @ <script> |
| 2208 | 2215 | @ function chgcbn(checked, branch){ |
| 2209 | 2216 | @ val = gebi('brname').value.trim(); |
| 2210 | 2217 | @ if( !val || !checked ) val = branch; |
| 2218 | + @ if( checked ) gebi('brname').select(); | |
| 2219 | + @ gebi('hbranch').textContent = val; | |
| 2211 | 2220 | @ cidbrid = document.getElementById('cbranch'); |
| 2212 | 2221 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2213 | 2222 | @ } |
| 2214 | 2223 | @ function chgbn(val, branch){ |
| 2215 | 2224 | @ if( !val ) val = branch; |
| 2216 | 2225 | @ gebi('newbr').checked = (val!=branch); |
| 2226 | + @ gebi('hbranch').textContent = val; | |
| 2217 | 2227 | @ cidbrid = document.getElementById('cbranch'); |
| 2218 | 2228 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2219 | 2229 | @ } |
| 2220 | 2230 | @ </script> |
| 2221 | 2231 | if( P("preview") ){ |
| @@ -2315,10 +2325,12 @@ | ||
| 2315 | 2325 | |
| 2316 | 2326 | if( tagid == TAG_CLOSED ){ |
| 2317 | 2327 | fHasClosed = 1; |
| 2318 | 2328 | }else if( (tagid == TAG_COMMENT) || (tagid == TAG_BRANCH) ){ |
| 2319 | 2329 | continue; |
| 2330 | + }else if( tagid==TAG_HIDDEN ){ | |
| 2331 | + fHasHidden = 1; | |
| 2320 | 2332 | }else if( !isSpecialTag && zTagName && |
| 2321 | 2333 | fossil_strcmp(&zTagName[4], zBranchName)==0){ |
| 2322 | 2334 | continue; |
| 2323 | 2335 | } |
| 2324 | 2336 | sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); |
| @@ -2349,10 +2361,19 @@ | ||
| 2349 | 2361 | @ onchange="chgcbn(this.checked,'%h(zBranchName)')" /> |
| 2350 | 2362 | @ Make this check-in the start of a new branch named:</label> |
| 2351 | 2363 | @ <input id="brname" type="text" style="width:15;" name="brname" |
| 2352 | 2364 | @ value="%h(zNewBranch)" |
| 2353 | 2365 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2366 | + if( !fHasHidden ){ | |
| 2367 | + @ <tr><th align="right" valign="top">Branch Hiding:</th> | |
| 2368 | + @ <td valign="top"> | |
| 2369 | + @ <label><input type="checkbox" id="hidebr" name="hide"%s(zHideFlag) /> | |
| 2370 | + @ Hide branch | |
| 2371 | + @ <span style="font-weight:bold" id="hbranch">%h(zBranchName)</span> | |
| 2372 | + @ from the timeline starting from this check-in</label> | |
| 2373 | + @ </td></tr> | |
| 2374 | + } | |
| 2354 | 2375 | if( !fHasClosed ){ |
| 2355 | 2376 | if( is_a_leaf(rid) ){ |
| 2356 | 2377 | @ <tr><th align="right" valign="top">Leaf Closure:</th> |
| 2357 | 2378 | @ <td valign="top"> |
| 2358 | 2379 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2359 | 2380 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -524,11 +524,12 @@ | |
| 524 | |
| 525 | style_header(zTitle); |
| 526 | login_anonymous_available(); |
| 527 | free(zTitle); |
| 528 | zEUser = db_text(0, |
| 529 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 530 | TAG_USER, rid); |
| 531 | zEComment = db_text(0, |
| 532 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 533 | TAG_COMMENT, rid); |
| 534 | zUser = db_column_text(&q1, 2); |
| @@ -2051,12 +2052,14 @@ | |
| 2051 | const char *zNewTagFlag; |
| 2052 | const char *zNewTag; |
| 2053 | const char *zNewBrFlag; |
| 2054 | const char *zNewBranch; |
| 2055 | const char *zCloseFlag; |
| 2056 | int fPropagateColor; /* True if color propagates before edit */ |
| 2057 | int fNewPropagateColor; /* True if color propagates after edit */ |
| 2058 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2059 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ |
| 2060 | char *zUuid; |
| 2061 | Blob comment; |
| 2062 | char *zBranchName = 0; |
| @@ -2095,10 +2098,11 @@ | |
| 2095 | zNewTagFlag = P("newtag") ? " checked" : ""; |
| 2096 | zNewTag = PDT("tagname",""); |
| 2097 | zNewBrFlag = P("newbr") ? " checked" : ""; |
| 2098 | zNewBranch = PDT("brname",""); |
| 2099 | zCloseFlag = P("close") ? " checked" : ""; |
| 2100 | if( P("apply") ){ |
| 2101 | Blob ctrl; |
| 2102 | char *zNow; |
| 2103 | int nChng = 0; |
| 2104 | |
| @@ -2145,10 +2149,13 @@ | |
| 2145 | if( P(zLabel) ){ |
| 2146 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 2147 | } |
| 2148 | } |
| 2149 | db_finalize(&q); |
| 2150 | if( zCloseFlag[0] ){ |
| 2151 | db_multi_exec("REPLACE INTO newtags VALUES('closed','%s',NULL)", |
| 2152 | is_a_leaf(rid)?"+":"*"); |
| 2153 | } |
| 2154 | if( zNewTagFlag[0] && zNewTag[0] ){ |
| @@ -2206,16 +2213,19 @@ | |
| 2206 | */ |
| 2207 | @ <script> |
| 2208 | @ function chgcbn(checked, branch){ |
| 2209 | @ val = gebi('brname').value.trim(); |
| 2210 | @ if( !val || !checked ) val = branch; |
| 2211 | @ cidbrid = document.getElementById('cbranch'); |
| 2212 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2213 | @ } |
| 2214 | @ function chgbn(val, branch){ |
| 2215 | @ if( !val ) val = branch; |
| 2216 | @ gebi('newbr').checked = (val!=branch); |
| 2217 | @ cidbrid = document.getElementById('cbranch'); |
| 2218 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2219 | @ } |
| 2220 | @ </script> |
| 2221 | if( P("preview") ){ |
| @@ -2315,10 +2325,12 @@ | |
| 2315 | |
| 2316 | if( tagid == TAG_CLOSED ){ |
| 2317 | fHasClosed = 1; |
| 2318 | }else if( (tagid == TAG_COMMENT) || (tagid == TAG_BRANCH) ){ |
| 2319 | continue; |
| 2320 | }else if( !isSpecialTag && zTagName && |
| 2321 | fossil_strcmp(&zTagName[4], zBranchName)==0){ |
| 2322 | continue; |
| 2323 | } |
| 2324 | sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); |
| @@ -2349,10 +2361,19 @@ | |
| 2349 | @ onchange="chgcbn(this.checked,'%h(zBranchName)')" /> |
| 2350 | @ Make this check-in the start of a new branch named:</label> |
| 2351 | @ <input id="brname" type="text" style="width:15;" name="brname" |
| 2352 | @ value="%h(zNewBranch)" |
| 2353 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2354 | if( !fHasClosed ){ |
| 2355 | if( is_a_leaf(rid) ){ |
| 2356 | @ <tr><th align="right" valign="top">Leaf Closure:</th> |
| 2357 | @ <td valign="top"> |
| 2358 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2359 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -524,11 +524,12 @@ | |
| 524 | |
| 525 | style_header(zTitle); |
| 526 | login_anonymous_available(); |
| 527 | free(zTitle); |
| 528 | zEUser = db_text(0, |
| 529 | "SELECT value FROM tagxref" |
| 530 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 531 | TAG_USER, rid); |
| 532 | zEComment = db_text(0, |
| 533 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 534 | TAG_COMMENT, rid); |
| 535 | zUser = db_column_text(&q1, 2); |
| @@ -2051,12 +2052,14 @@ | |
| 2052 | const char *zNewTagFlag; |
| 2053 | const char *zNewTag; |
| 2054 | const char *zNewBrFlag; |
| 2055 | const char *zNewBranch; |
| 2056 | const char *zCloseFlag; |
| 2057 | const char *zHideFlag; |
| 2058 | int fPropagateColor; /* True if color propagates before edit */ |
| 2059 | int fNewPropagateColor; /* True if color propagates after edit */ |
| 2060 | int fHasHidden = 0; /* True if hidden tag already set */ |
| 2061 | int fHasClosed = 0; /* True if closed tag already set */ |
| 2062 | const char *zChngTime = 0; /* Value of chngtime= query param, if any */ |
| 2063 | char *zUuid; |
| 2064 | Blob comment; |
| 2065 | char *zBranchName = 0; |
| @@ -2095,10 +2098,11 @@ | |
| 2098 | zNewTagFlag = P("newtag") ? " checked" : ""; |
| 2099 | zNewTag = PDT("tagname",""); |
| 2100 | zNewBrFlag = P("newbr") ? " checked" : ""; |
| 2101 | zNewBranch = PDT("brname",""); |
| 2102 | zCloseFlag = P("close") ? " checked" : ""; |
| 2103 | zHideFlag = P("hide") ? " checked" : ""; |
| 2104 | if( P("apply") ){ |
| 2105 | Blob ctrl; |
| 2106 | char *zNow; |
| 2107 | int nChng = 0; |
| 2108 | |
| @@ -2145,10 +2149,13 @@ | |
| 2149 | if( P(zLabel) ){ |
| 2150 | db_multi_exec("REPLACE INTO newtags VALUES(%Q,'-',NULL)", zTag); |
| 2151 | } |
| 2152 | } |
| 2153 | db_finalize(&q); |
| 2154 | if( zHideFlag[0] ){ |
| 2155 | db_multi_exec("REPLACE INTO newtags VALUES('hidden','*',NULL)"); |
| 2156 | } |
| 2157 | if( zCloseFlag[0] ){ |
| 2158 | db_multi_exec("REPLACE INTO newtags VALUES('closed','%s',NULL)", |
| 2159 | is_a_leaf(rid)?"+":"*"); |
| 2160 | } |
| 2161 | if( zNewTagFlag[0] && zNewTag[0] ){ |
| @@ -2206,16 +2213,19 @@ | |
| 2213 | */ |
| 2214 | @ <script> |
| 2215 | @ function chgcbn(checked, branch){ |
| 2216 | @ val = gebi('brname').value.trim(); |
| 2217 | @ if( !val || !checked ) val = branch; |
| 2218 | @ if( checked ) gebi('brname').select(); |
| 2219 | @ gebi('hbranch').textContent = val; |
| 2220 | @ cidbrid = document.getElementById('cbranch'); |
| 2221 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2222 | @ } |
| 2223 | @ function chgbn(val, branch){ |
| 2224 | @ if( !val ) val = branch; |
| 2225 | @ gebi('newbr').checked = (val!=branch); |
| 2226 | @ gebi('hbranch').textContent = val; |
| 2227 | @ cidbrid = document.getElementById('cbranch'); |
| 2228 | @ if( cidbrid ) cidbrid.textContent = val; |
| 2229 | @ } |
| 2230 | @ </script> |
| 2231 | if( P("preview") ){ |
| @@ -2315,10 +2325,12 @@ | |
| 2325 | |
| 2326 | if( tagid == TAG_CLOSED ){ |
| 2327 | fHasClosed = 1; |
| 2328 | }else if( (tagid == TAG_COMMENT) || (tagid == TAG_BRANCH) ){ |
| 2329 | continue; |
| 2330 | }else if( tagid==TAG_HIDDEN ){ |
| 2331 | fHasHidden = 1; |
| 2332 | }else if( !isSpecialTag && zTagName && |
| 2333 | fossil_strcmp(&zTagName[4], zBranchName)==0){ |
| 2334 | continue; |
| 2335 | } |
| 2336 | sqlite3_snprintf(sizeof(zLabel), zLabel, "c%d", tagid); |
| @@ -2349,10 +2361,19 @@ | |
| 2361 | @ onchange="chgcbn(this.checked,'%h(zBranchName)')" /> |
| 2362 | @ Make this check-in the start of a new branch named:</label> |
| 2363 | @ <input id="brname" type="text" style="width:15;" name="brname" |
| 2364 | @ value="%h(zNewBranch)" |
| 2365 | @ onkeyup="chgbn(this.value.trim(),'%h(zBranchName)')" /></td></tr> |
| 2366 | if( !fHasHidden ){ |
| 2367 | @ <tr><th align="right" valign="top">Branch Hiding:</th> |
| 2368 | @ <td valign="top"> |
| 2369 | @ <label><input type="checkbox" id="hidebr" name="hide"%s(zHideFlag) /> |
| 2370 | @ Hide branch |
| 2371 | @ <span style="font-weight:bold" id="hbranch">%h(zBranchName)</span> |
| 2372 | @ from the timeline starting from this check-in</label> |
| 2373 | @ </td></tr> |
| 2374 | } |
| 2375 | if( !fHasClosed ){ |
| 2376 | if( is_a_leaf(rid) ){ |
| 2377 | @ <tr><th align="right" valign="top">Leaf Closure:</th> |
| 2378 | @ <td valign="top"> |
| 2379 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2380 |
+4
-3
| --- src/shell.c | ||
| +++ src/shell.c | ||
| @@ -1834,11 +1834,11 @@ | ||
| 1834 | 1834 | ** + Store the character that terminates the field in p->cTerm. Store |
| 1835 | 1835 | ** EOF on end-of-file. |
| 1836 | 1836 | ** + Report syntax errors on stderr |
| 1837 | 1837 | */ |
| 1838 | 1838 | static char *csv_read_one_field(CSVReader *p){ |
| 1839 | - int c, pc; | |
| 1839 | + int c, pc, ppc; | |
| 1840 | 1840 | int cSep = p->cSeparator; |
| 1841 | 1841 | p->n = 0; |
| 1842 | 1842 | c = fgetc(p->in); |
| 1843 | 1843 | if( c==EOF || seenInterrupt ){ |
| 1844 | 1844 | p->cTerm = EOF; |
| @@ -1845,11 +1845,11 @@ | ||
| 1845 | 1845 | return 0; |
| 1846 | 1846 | } |
| 1847 | 1847 | if( c=='"' ){ |
| 1848 | 1848 | int startLine = p->nLine; |
| 1849 | 1849 | int cQuote = c; |
| 1850 | - pc = 0; | |
| 1850 | + pc = ppc = 0; | |
| 1851 | 1851 | while( 1 ){ |
| 1852 | 1852 | c = fgetc(p->in); |
| 1853 | 1853 | if( c=='\n' ) p->nLine++; |
| 1854 | 1854 | if( c==cQuote ){ |
| 1855 | 1855 | if( pc==cQuote ){ |
| @@ -1857,11 +1857,11 @@ | ||
| 1857 | 1857 | continue; |
| 1858 | 1858 | } |
| 1859 | 1859 | } |
| 1860 | 1860 | if( (c==cSep && pc==cQuote) |
| 1861 | 1861 | || (c=='\n' && pc==cQuote) |
| 1862 | - || (c=='\n' && pc=='\r' && p->n>=2 && p->z[p->n-2]==cQuote) | |
| 1862 | + || (c=='\n' && pc=='\r' && ppc==cQuote) | |
| 1863 | 1863 | || (c==EOF && pc==cQuote) |
| 1864 | 1864 | ){ |
| 1865 | 1865 | do{ p->n--; }while( p->z[p->n]!=cQuote ); |
| 1866 | 1866 | p->cTerm = c; |
| 1867 | 1867 | break; |
| @@ -1875,10 +1875,11 @@ | ||
| 1875 | 1875 | p->zFile, startLine, cQuote); |
| 1876 | 1876 | p->cTerm = EOF; |
| 1877 | 1877 | break; |
| 1878 | 1878 | } |
| 1879 | 1879 | csv_append_char(p, c); |
| 1880 | + ppc = pc; | |
| 1880 | 1881 | pc = c; |
| 1881 | 1882 | } |
| 1882 | 1883 | }else{ |
| 1883 | 1884 | while( c!=EOF && c!=cSep && c!='\n' ){ |
| 1884 | 1885 | csv_append_char(p, c); |
| 1885 | 1886 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -1834,11 +1834,11 @@ | |
| 1834 | ** + Store the character that terminates the field in p->cTerm. Store |
| 1835 | ** EOF on end-of-file. |
| 1836 | ** + Report syntax errors on stderr |
| 1837 | */ |
| 1838 | static char *csv_read_one_field(CSVReader *p){ |
| 1839 | int c, pc; |
| 1840 | int cSep = p->cSeparator; |
| 1841 | p->n = 0; |
| 1842 | c = fgetc(p->in); |
| 1843 | if( c==EOF || seenInterrupt ){ |
| 1844 | p->cTerm = EOF; |
| @@ -1845,11 +1845,11 @@ | |
| 1845 | return 0; |
| 1846 | } |
| 1847 | if( c=='"' ){ |
| 1848 | int startLine = p->nLine; |
| 1849 | int cQuote = c; |
| 1850 | pc = 0; |
| 1851 | while( 1 ){ |
| 1852 | c = fgetc(p->in); |
| 1853 | if( c=='\n' ) p->nLine++; |
| 1854 | if( c==cQuote ){ |
| 1855 | if( pc==cQuote ){ |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | continue; |
| 1858 | } |
| 1859 | } |
| 1860 | if( (c==cSep && pc==cQuote) |
| 1861 | || (c=='\n' && pc==cQuote) |
| 1862 | || (c=='\n' && pc=='\r' && p->n>=2 && p->z[p->n-2]==cQuote) |
| 1863 | || (c==EOF && pc==cQuote) |
| 1864 | ){ |
| 1865 | do{ p->n--; }while( p->z[p->n]!=cQuote ); |
| 1866 | p->cTerm = c; |
| 1867 | break; |
| @@ -1875,10 +1875,11 @@ | |
| 1875 | p->zFile, startLine, cQuote); |
| 1876 | p->cTerm = EOF; |
| 1877 | break; |
| 1878 | } |
| 1879 | csv_append_char(p, c); |
| 1880 | pc = c; |
| 1881 | } |
| 1882 | }else{ |
| 1883 | while( c!=EOF && c!=cSep && c!='\n' ){ |
| 1884 | csv_append_char(p, c); |
| 1885 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -1834,11 +1834,11 @@ | |
| 1834 | ** + Store the character that terminates the field in p->cTerm. Store |
| 1835 | ** EOF on end-of-file. |
| 1836 | ** + Report syntax errors on stderr |
| 1837 | */ |
| 1838 | static char *csv_read_one_field(CSVReader *p){ |
| 1839 | int c, pc, ppc; |
| 1840 | int cSep = p->cSeparator; |
| 1841 | p->n = 0; |
| 1842 | c = fgetc(p->in); |
| 1843 | if( c==EOF || seenInterrupt ){ |
| 1844 | p->cTerm = EOF; |
| @@ -1845,11 +1845,11 @@ | |
| 1845 | return 0; |
| 1846 | } |
| 1847 | if( c=='"' ){ |
| 1848 | int startLine = p->nLine; |
| 1849 | int cQuote = c; |
| 1850 | pc = ppc = 0; |
| 1851 | while( 1 ){ |
| 1852 | c = fgetc(p->in); |
| 1853 | if( c=='\n' ) p->nLine++; |
| 1854 | if( c==cQuote ){ |
| 1855 | if( pc==cQuote ){ |
| @@ -1857,11 +1857,11 @@ | |
| 1857 | continue; |
| 1858 | } |
| 1859 | } |
| 1860 | if( (c==cSep && pc==cQuote) |
| 1861 | || (c=='\n' && pc==cQuote) |
| 1862 | || (c=='\n' && pc=='\r' && ppc==cQuote) |
| 1863 | || (c==EOF && pc==cQuote) |
| 1864 | ){ |
| 1865 | do{ p->n--; }while( p->z[p->n]!=cQuote ); |
| 1866 | p->cTerm = c; |
| 1867 | break; |
| @@ -1875,10 +1875,11 @@ | |
| 1875 | p->zFile, startLine, cQuote); |
| 1876 | p->cTerm = EOF; |
| 1877 | break; |
| 1878 | } |
| 1879 | csv_append_char(p, c); |
| 1880 | ppc = pc; |
| 1881 | pc = c; |
| 1882 | } |
| 1883 | }else{ |
| 1884 | while( c!=EOF && c!=cSep && c!='\n' ){ |
| 1885 | csv_append_char(p, c); |
| 1886 |
+314
-151
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -135,11 +135,11 @@ | ||
| 135 | 135 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 136 | 136 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 137 | 137 | */ |
| 138 | 138 | #define SQLITE_VERSION "3.8.3" |
| 139 | 139 | #define SQLITE_VERSION_NUMBER 3008003 |
| 140 | -#define SQLITE_SOURCE_ID "2013-12-11 12:02:55 3e1d55f0bd84810a035bd6c54583eb373784a9a3" | |
| 140 | +#define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2" | |
| 141 | 141 | |
| 142 | 142 | /* |
| 143 | 143 | ** CAPI3REF: Run-Time Library Version Numbers |
| 144 | 144 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 145 | 145 | ** |
| @@ -817,19 +817,33 @@ | ||
| 817 | 817 | ** to the [sqlite3_file] object associated with a particular database |
| 818 | 818 | ** connection. See the [sqlite3_file_control()] documentation for |
| 819 | 819 | ** additional information. |
| 820 | 820 | ** |
| 821 | 821 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 822 | -** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by | |
| 823 | -** SQLite and sent to all VFSes in place of a call to the xSync method | |
| 824 | -** when the database connection has [PRAGMA synchronous] set to OFF.)^ | |
| 825 | -** Some specialized VFSes need this signal in order to operate correctly | |
| 826 | -** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most | |
| 827 | -** VFSes do not need this signal and should silently ignore this opcode. | |
| 828 | -** Applications should not call [sqlite3_file_control()] with this | |
| 829 | -** opcode as doing so may disrupt the operation of the specialized VFSes | |
| 830 | -** that do require it. | |
| 822 | +** No longer in use. | |
| 823 | +** | |
| 824 | +** <li>[[SQLITE_FCNTL_SYNC]] | |
| 825 | +** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and | |
| 826 | +** sent to the VFS immediately before the xSync method is invoked on a | |
| 827 | +** database file descriptor. Or, if the xSync method is not invoked | |
| 828 | +** because the user has configured SQLite with | |
| 829 | +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place | |
| 830 | +** of the xSync method. In most cases, the pointer argument passed with | |
| 831 | +** this file-control is NULL. However, if the database file is being synced | |
| 832 | +** as part of a multi-database commit, the argument points to a nul-terminated | |
| 833 | +** string containing the transactions master-journal file name. VFSes that | |
| 834 | +** do not need this signal should silently ignore this opcode. Applications | |
| 835 | +** should not call [sqlite3_file_control()] with this opcode as doing so may | |
| 836 | +** disrupt the operation of the specialized VFSes that do require it. | |
| 837 | +** | |
| 838 | +** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]] | |
| 839 | +** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite | |
| 840 | +** and sent to the VFS after a transaction has been committed immediately | |
| 841 | +** but before the database is unlocked. VFSes that do not need this signal | |
| 842 | +** should silently ignore this opcode. Applications should not call | |
| 843 | +** [sqlite3_file_control()] with this opcode as doing so may disrupt the | |
| 844 | +** operation of the specialized VFSes that do require it. | |
| 831 | 845 | ** |
| 832 | 846 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 833 | 847 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 834 | 848 | ** retry counts and intervals for certain disk I/O operations for the |
| 835 | 849 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -976,10 +990,12 @@ | ||
| 976 | 990 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 977 | 991 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 978 | 992 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 979 | 993 | #define SQLITE_FCNTL_TRACE 19 |
| 980 | 994 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 995 | +#define SQLITE_FCNTL_SYNC 21 | |
| 996 | +#define SQLITE_FCNTL_COMMIT_PHASETWO 22 | |
| 981 | 997 | |
| 982 | 998 | /* |
| 983 | 999 | ** CAPI3REF: Mutex Handle |
| 984 | 1000 | ** |
| 985 | 1001 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3992,19 +4008,28 @@ | ||
| 3992 | 4008 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 3993 | 4009 | ** undefined. |
| 3994 | 4010 | ** |
| 3995 | 4011 | ** ^The fourth parameter, eTextRep, specifies what |
| 3996 | 4012 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 3997 | -** its parameters. Every SQL function implementation must be able to work | |
| 3998 | -** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be | |
| 3999 | -** more efficient with one encoding than another. ^An application may | |
| 4000 | -** invoke sqlite3_create_function() or sqlite3_create_function16() multiple | |
| 4001 | -** times with the same function but with different values of eTextRep. | |
| 4013 | +** its parameters. The application should set this parameter to | |
| 4014 | +** [SQLITE_UTF16LE] if the function implementation invokes | |
| 4015 | +** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the | |
| 4016 | +** implementation invokes [sqlite3_value_text16be()] on an input, or | |
| 4017 | +** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] | |
| 4018 | +** otherwise. ^The same SQL function may be registered multiple times using | |
| 4019 | +** different preferred text encodings, with different implementations for | |
| 4020 | +** each encoding. | |
| 4002 | 4021 | ** ^When multiple implementations of the same function are available, SQLite |
| 4003 | 4022 | ** will pick the one that involves the least amount of data conversion. |
| 4004 | -** If there is only a single implementation which does not care what text | |
| 4005 | -** encoding is used, then the fourth argument should be [SQLITE_ANY]. | |
| 4023 | +** | |
| 4024 | +** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] | |
| 4025 | +** to signal that the function will always return the same result given | |
| 4026 | +** the same inputs within a single SQL statement. Most SQL functions are | |
| 4027 | +** deterministic. The built-in [random()] SQL function is an example of a | |
| 4028 | +** function that is not deterministic. The SQLite query planner is able to | |
| 4029 | +** perform additional optimizations on deterministic functions, so use | |
| 4030 | +** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. | |
| 4006 | 4031 | ** |
| 4007 | 4032 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 4008 | 4033 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 4009 | 4034 | ** |
| 4010 | 4035 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4086,13 +4111,23 @@ | ||
| 4086 | 4111 | */ |
| 4087 | 4112 | #define SQLITE_UTF8 1 |
| 4088 | 4113 | #define SQLITE_UTF16LE 2 |
| 4089 | 4114 | #define SQLITE_UTF16BE 3 |
| 4090 | 4115 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4091 | -#define SQLITE_ANY 5 /* sqlite3_create_function only */ | |
| 4116 | +#define SQLITE_ANY 5 /* Deprecated */ | |
| 4092 | 4117 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4093 | 4118 | |
| 4119 | +/* | |
| 4120 | +** CAPI3REF: Function Flags | |
| 4121 | +** | |
| 4122 | +** These constants may be ORed together with the | |
| 4123 | +** [SQLITE_UTF8 | preferred text encoding] as the fourth argument | |
| 4124 | +** to [sqlite3_create_function()], [sqlite3_create_function16()], or | |
| 4125 | +** [sqlite3_create_function_v2()]. | |
| 4126 | +*/ | |
| 4127 | +#define SQLITE_DETERMINISTIC 0x800 | |
| 4128 | + | |
| 4094 | 4129 | /* |
| 4095 | 4130 | ** CAPI3REF: Deprecated Functions |
| 4096 | 4131 | ** DEPRECATED |
| 4097 | 4132 | ** |
| 4098 | 4133 | ** These functions are [deprecated]. In order to maintain |
| @@ -8590,10 +8625,11 @@ | ||
| 8590 | 8625 | typedef struct Lookaside Lookaside; |
| 8591 | 8626 | typedef struct LookasideSlot LookasideSlot; |
| 8592 | 8627 | typedef struct Module Module; |
| 8593 | 8628 | typedef struct NameContext NameContext; |
| 8594 | 8629 | typedef struct Parse Parse; |
| 8630 | +typedef struct PrintfArguments PrintfArguments; | |
| 8595 | 8631 | typedef struct RowSet RowSet; |
| 8596 | 8632 | typedef struct Savepoint Savepoint; |
| 8597 | 8633 | typedef struct Select Select; |
| 8598 | 8634 | typedef struct SelectDest SelectDest; |
| 8599 | 8635 | typedef struct SrcList SrcList; |
| @@ -9448,10 +9484,11 @@ | ||
| 9448 | 9484 | SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); |
| 9449 | 9485 | #define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) |
| 9450 | 9486 | SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); |
| 9451 | 9487 | SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); |
| 9452 | 9488 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); |
| 9489 | +SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*); | |
| 9453 | 9490 | |
| 9454 | 9491 | /* Operations on page references. */ |
| 9455 | 9492 | SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); |
| 9456 | 9493 | SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); |
| 9457 | 9494 | SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); |
| @@ -9462,11 +9499,11 @@ | ||
| 9462 | 9499 | /* Functions used to manage pager transactions and savepoints. */ |
| 9463 | 9500 | SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); |
| 9464 | 9501 | SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); |
| 9465 | 9502 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); |
| 9466 | 9503 | SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); |
| 9467 | -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager); | |
| 9504 | +SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster); | |
| 9468 | 9505 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); |
| 9469 | 9506 | SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); |
| 9470 | 9507 | SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); |
| 9471 | 9508 | SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); |
| 9472 | 9509 | SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); |
| @@ -12043,14 +12080,24 @@ | ||
| 12043 | 12080 | SQLITE_PRIVATE int sqlite3IsNaN(double); |
| 12044 | 12081 | #else |
| 12045 | 12082 | # define sqlite3IsNaN(X) 0 |
| 12046 | 12083 | #endif |
| 12047 | 12084 | |
| 12048 | -SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, int, const char*, va_list); | |
| 12049 | -#ifndef SQLITE_OMIT_TRACE | |
| 12050 | -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, const char*, ...); | |
| 12051 | -#endif | |
| 12085 | +/* | |
| 12086 | +** An instance of the following structure holds information about SQL | |
| 12087 | +** functions arguments that are the parameters to the printf() function. | |
| 12088 | +*/ | |
| 12089 | +struct PrintfArguments { | |
| 12090 | + int nArg; /* Total number of arguments */ | |
| 12091 | + int nUsed; /* Number of arguments used so far */ | |
| 12092 | + sqlite3_value **apArg; /* The argument values */ | |
| 12093 | +}; | |
| 12094 | + | |
| 12095 | +#define SQLITE_PRINTF_INTERNAL 0x01 | |
| 12096 | +#define SQLITE_PRINTF_SQLFUNC 0x02 | |
| 12097 | +SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, u32, const char*, va_list); | |
| 12098 | +SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, u32, const char*, ...); | |
| 12052 | 12099 | SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); |
| 12053 | 12100 | SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); |
| 12054 | 12101 | SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3*,char*,const char*,...); |
| 12055 | 12102 | #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) |
| 12056 | 12103 | SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); |
| @@ -12436,10 +12483,11 @@ | ||
| 12436 | 12483 | |
| 12437 | 12484 | SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); |
| 12438 | 12485 | SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); |
| 12439 | 12486 | SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, |
| 12440 | 12487 | void(*)(void*)); |
| 12488 | +SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*); | |
| 12441 | 12489 | SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); |
| 12442 | 12490 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); |
| 12443 | 12491 | SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); |
| 12444 | 12492 | SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); |
| 12445 | 12493 | SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); |
| @@ -19894,14 +19942,31 @@ | ||
| 19894 | 19942 | } |
| 19895 | 19943 | |
| 19896 | 19944 | /* |
| 19897 | 19945 | ** Set the StrAccum object to an error mode. |
| 19898 | 19946 | */ |
| 19899 | -void setStrAccumError(StrAccum *p, u8 eError){ | |
| 19947 | +static void setStrAccumError(StrAccum *p, u8 eError){ | |
| 19900 | 19948 | p->accError = eError; |
| 19901 | 19949 | p->nAlloc = 0; |
| 19902 | 19950 | } |
| 19951 | + | |
| 19952 | +/* | |
| 19953 | +** Extra argument values from a PrintfArguments object | |
| 19954 | +*/ | |
| 19955 | +static sqlite3_int64 getIntArg(PrintfArguments *p){ | |
| 19956 | + if( p->nArg<=p->nUsed ) return 0; | |
| 19957 | + return sqlite3_value_int64(p->apArg[p->nUsed++]); | |
| 19958 | +} | |
| 19959 | +static double getDoubleArg(PrintfArguments *p){ | |
| 19960 | + if( p->nArg<=p->nUsed ) return 0.0; | |
| 19961 | + return sqlite3_value_double(p->apArg[p->nUsed++]); | |
| 19962 | +} | |
| 19963 | +static char *getTextArg(PrintfArguments *p){ | |
| 19964 | + if( p->nArg<=p->nUsed ) return 0; | |
| 19965 | + return (char*)sqlite3_value_text(p->apArg[p->nUsed++]); | |
| 19966 | +} | |
| 19967 | + | |
| 19903 | 19968 | |
| 19904 | 19969 | /* |
| 19905 | 19970 | ** On machines with a small stack size, you can redefine the |
| 19906 | 19971 | ** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. |
| 19907 | 19972 | */ |
| @@ -19912,14 +19977,14 @@ | ||
| 19912 | 19977 | |
| 19913 | 19978 | /* |
| 19914 | 19979 | ** Render a string given by "fmt" into the StrAccum object. |
| 19915 | 19980 | */ |
| 19916 | 19981 | SQLITE_PRIVATE void sqlite3VXPrintf( |
| 19917 | - StrAccum *pAccum, /* Accumulate results here */ | |
| 19918 | - int useExtended, /* Allow extended %-conversions */ | |
| 19919 | - const char *fmt, /* Format string */ | |
| 19920 | - va_list ap /* arguments */ | |
| 19982 | + StrAccum *pAccum, /* Accumulate results here */ | |
| 19983 | + u32 bFlags, /* SQLITE_PRINTF_* flags */ | |
| 19984 | + const char *fmt, /* Format string */ | |
| 19985 | + va_list ap /* arguments */ | |
| 19921 | 19986 | ){ |
| 19922 | 19987 | int c; /* Next character in the format string */ |
| 19923 | 19988 | char *bufpt; /* Pointer to the conversion buffer */ |
| 19924 | 19989 | int precision; /* Precision of the current field */ |
| 19925 | 19990 | int length; /* Length of the field */ |
| @@ -19933,10 +19998,12 @@ | ||
| 19933 | 19998 | etByte flag_zeropad; /* True if field width constant starts with zero */ |
| 19934 | 19999 | etByte flag_long; /* True if "l" flag is present */ |
| 19935 | 20000 | etByte flag_longlong; /* True if the "ll" flag is present */ |
| 19936 | 20001 | etByte done; /* Loop termination flag */ |
| 19937 | 20002 | etByte xtype = 0; /* Conversion paradigm */ |
| 20003 | + u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */ | |
| 20004 | + u8 useIntern; /* Ok to use internal conversions (ex: %T) */ | |
| 19938 | 20005 | char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ |
| 19939 | 20006 | sqlite_uint64 longvalue; /* Value for integer types */ |
| 19940 | 20007 | LONGDOUBLE_TYPE realvalue; /* Value for real types */ |
| 19941 | 20008 | const et_info *infop; /* Pointer to the appropriate info structure */ |
| 19942 | 20009 | char *zOut; /* Rendering buffer */ |
| @@ -19947,13 +20014,22 @@ | ||
| 19947 | 20014 | int nsd; /* Number of significant digits returned */ |
| 19948 | 20015 | double rounder; /* Used for rounding floating point values */ |
| 19949 | 20016 | etByte flag_dp; /* True if decimal point should be shown */ |
| 19950 | 20017 | etByte flag_rtz; /* True if trailing zeros should be removed */ |
| 19951 | 20018 | #endif |
| 20019 | + PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */ | |
| 19952 | 20020 | char buf[etBUFSIZE]; /* Conversion buffer */ |
| 19953 | 20021 | |
| 19954 | 20022 | bufpt = 0; |
| 20023 | + if( bFlags ){ | |
| 20024 | + if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){ | |
| 20025 | + pArgList = va_arg(ap, PrintfArguments*); | |
| 20026 | + } | |
| 20027 | + useIntern = bFlags & SQLITE_PRINTF_INTERNAL; | |
| 20028 | + }else{ | |
| 20029 | + bArgList = useIntern = 0; | |
| 20030 | + } | |
| 19955 | 20031 | for(; (c=(*fmt))!=0; ++fmt){ |
| 19956 | 20032 | if( c!='%' ){ |
| 19957 | 20033 | int amt; |
| 19958 | 20034 | bufpt = (char *)fmt; |
| 19959 | 20035 | amt = 1; |
| @@ -19981,11 +20057,15 @@ | ||
| 19981 | 20057 | } |
| 19982 | 20058 | }while( !done && (c=(*++fmt))!=0 ); |
| 19983 | 20059 | /* Get the field width */ |
| 19984 | 20060 | width = 0; |
| 19985 | 20061 | if( c=='*' ){ |
| 19986 | - width = va_arg(ap,int); | |
| 20062 | + if( bArgList ){ | |
| 20063 | + width = (int)getIntArg(pArgList); | |
| 20064 | + }else{ | |
| 20065 | + width = va_arg(ap,int); | |
| 20066 | + } | |
| 19987 | 20067 | if( width<0 ){ |
| 19988 | 20068 | flag_leftjustify = 1; |
| 19989 | 20069 | width = -width; |
| 19990 | 20070 | } |
| 19991 | 20071 | c = *++fmt; |
| @@ -19998,11 +20078,15 @@ | ||
| 19998 | 20078 | /* Get the precision */ |
| 19999 | 20079 | if( c=='.' ){ |
| 20000 | 20080 | precision = 0; |
| 20001 | 20081 | c = *++fmt; |
| 20002 | 20082 | if( c=='*' ){ |
| 20003 | - precision = va_arg(ap,int); | |
| 20083 | + if( bArgList ){ | |
| 20084 | + precision = (int)getIntArg(pArgList); | |
| 20085 | + }else{ | |
| 20086 | + precision = va_arg(ap,int); | |
| 20087 | + } | |
| 20004 | 20088 | if( precision<0 ) precision = -precision; |
| 20005 | 20089 | c = *++fmt; |
| 20006 | 20090 | }else{ |
| 20007 | 20091 | while( c>='0' && c<='9' ){ |
| 20008 | 20092 | precision = precision*10 + c - '0'; |
| @@ -20029,11 +20113,11 @@ | ||
| 20029 | 20113 | infop = &fmtinfo[0]; |
| 20030 | 20114 | xtype = etINVALID; |
| 20031 | 20115 | for(idx=0; idx<ArraySize(fmtinfo); idx++){ |
| 20032 | 20116 | if( c==fmtinfo[idx].fmttype ){ |
| 20033 | 20117 | infop = &fmtinfo[idx]; |
| 20034 | - if( useExtended || (infop->flags & FLAG_INTERN)==0 ){ | |
| 20118 | + if( useIntern || (infop->flags & FLAG_INTERN)==0 ){ | |
| 20035 | 20119 | xtype = infop->type; |
| 20036 | 20120 | }else{ |
| 20037 | 20121 | return; |
| 20038 | 20122 | } |
| 20039 | 20123 | break; |
| @@ -20069,11 +20153,13 @@ | ||
| 20069 | 20153 | /* Fall through into the next case */ |
| 20070 | 20154 | case etORDINAL: |
| 20071 | 20155 | case etRADIX: |
| 20072 | 20156 | if( infop->flags & FLAG_SIGNED ){ |
| 20073 | 20157 | i64 v; |
| 20074 | - if( flag_longlong ){ | |
| 20158 | + if( bArgList ){ | |
| 20159 | + v = getIntArg(pArgList); | |
| 20160 | + }else if( flag_longlong ){ | |
| 20075 | 20161 | v = va_arg(ap,i64); |
| 20076 | 20162 | }else if( flag_long ){ |
| 20077 | 20163 | v = va_arg(ap,long int); |
| 20078 | 20164 | }else{ |
| 20079 | 20165 | v = va_arg(ap,int); |
| @@ -20090,11 +20176,13 @@ | ||
| 20090 | 20176 | if( flag_plussign ) prefix = '+'; |
| 20091 | 20177 | else if( flag_blanksign ) prefix = ' '; |
| 20092 | 20178 | else prefix = 0; |
| 20093 | 20179 | } |
| 20094 | 20180 | }else{ |
| 20095 | - if( flag_longlong ){ | |
| 20181 | + if( bArgList ){ | |
| 20182 | + longvalue = (u64)getIntArg(pArgList); | |
| 20183 | + }else if( flag_longlong ){ | |
| 20096 | 20184 | longvalue = va_arg(ap,u64); |
| 20097 | 20185 | }else if( flag_long ){ |
| 20098 | 20186 | longvalue = va_arg(ap,unsigned long int); |
| 20099 | 20187 | }else{ |
| 20100 | 20188 | longvalue = va_arg(ap,unsigned int); |
| @@ -20150,11 +20238,15 @@ | ||
| 20150 | 20238 | length = (int)(&zOut[nOut-1]-bufpt); |
| 20151 | 20239 | break; |
| 20152 | 20240 | case etFLOAT: |
| 20153 | 20241 | case etEXP: |
| 20154 | 20242 | case etGENERIC: |
| 20155 | - realvalue = va_arg(ap,double); | |
| 20243 | + if( bArgList ){ | |
| 20244 | + realvalue = getDoubleArg(pArgList); | |
| 20245 | + }else{ | |
| 20246 | + realvalue = va_arg(ap,double); | |
| 20247 | + } | |
| 20156 | 20248 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 20157 | 20249 | length = 0; |
| 20158 | 20250 | #else |
| 20159 | 20251 | if( precision<0 ) precision = 6; /* Set default precision */ |
| 20160 | 20252 | if( realvalue<0.0 ){ |
| @@ -20305,20 +20397,27 @@ | ||
| 20305 | 20397 | length = width; |
| 20306 | 20398 | } |
| 20307 | 20399 | #endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */ |
| 20308 | 20400 | break; |
| 20309 | 20401 | case etSIZE: |
| 20310 | - *(va_arg(ap,int*)) = pAccum->nChar; | |
| 20402 | + if( !bArgList ){ | |
| 20403 | + *(va_arg(ap,int*)) = pAccum->nChar; | |
| 20404 | + } | |
| 20311 | 20405 | length = width = 0; |
| 20312 | 20406 | break; |
| 20313 | 20407 | case etPERCENT: |
| 20314 | 20408 | buf[0] = '%'; |
| 20315 | 20409 | bufpt = buf; |
| 20316 | 20410 | length = 1; |
| 20317 | 20411 | break; |
| 20318 | 20412 | case etCHARX: |
| 20319 | - c = va_arg(ap,int); | |
| 20413 | + if( bArgList ){ | |
| 20414 | + bufpt = getTextArg(pArgList); | |
| 20415 | + c = bufpt ? bufpt[0] : 0; | |
| 20416 | + }else{ | |
| 20417 | + c = va_arg(ap,int); | |
| 20418 | + } | |
| 20320 | 20419 | buf[0] = (char)c; |
| 20321 | 20420 | if( precision>=0 ){ |
| 20322 | 20421 | for(idx=1; idx<precision; idx++) buf[idx] = (char)c; |
| 20323 | 20422 | length = precision; |
| 20324 | 20423 | }else{ |
| @@ -20326,14 +20425,18 @@ | ||
| 20326 | 20425 | } |
| 20327 | 20426 | bufpt = buf; |
| 20328 | 20427 | break; |
| 20329 | 20428 | case etSTRING: |
| 20330 | 20429 | case etDYNSTRING: |
| 20331 | - bufpt = va_arg(ap,char*); | |
| 20430 | + if( bArgList ){ | |
| 20431 | + bufpt = getTextArg(pArgList); | |
| 20432 | + }else{ | |
| 20433 | + bufpt = va_arg(ap,char*); | |
| 20434 | + } | |
| 20332 | 20435 | if( bufpt==0 ){ |
| 20333 | 20436 | bufpt = ""; |
| 20334 | - }else if( xtype==etDYNSTRING ){ | |
| 20437 | + }else if( xtype==etDYNSTRING && !bArgList ){ | |
| 20335 | 20438 | zExtra = bufpt; |
| 20336 | 20439 | } |
| 20337 | 20440 | if( precision>=0 ){ |
| 20338 | 20441 | for(length=0; length<precision && bufpt[length]; length++){} |
| 20339 | 20442 | }else{ |
| @@ -20345,11 +20448,17 @@ | ||
| 20345 | 20448 | case etSQLESCAPE3: { |
| 20346 | 20449 | int i, j, k, n, isnull; |
| 20347 | 20450 | int needQuote; |
| 20348 | 20451 | char ch; |
| 20349 | 20452 | char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */ |
| 20350 | - char *escarg = va_arg(ap,char*); | |
| 20453 | + char *escarg; | |
| 20454 | + | |
| 20455 | + if( bArgList ){ | |
| 20456 | + escarg = getTextArg(pArgList); | |
| 20457 | + }else{ | |
| 20458 | + escarg = va_arg(ap,char*); | |
| 20459 | + } | |
| 20351 | 20460 | isnull = escarg==0; |
| 20352 | 20461 | if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); |
| 20353 | 20462 | k = precision; |
| 20354 | 20463 | for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){ |
| 20355 | 20464 | if( ch==q ) n++; |
| @@ -20380,10 +20489,11 @@ | ||
| 20380 | 20489 | ** if( precision>=0 && precision<length ) length = precision; */ |
| 20381 | 20490 | break; |
| 20382 | 20491 | } |
| 20383 | 20492 | case etTOKEN: { |
| 20384 | 20493 | Token *pToken = va_arg(ap, Token*); |
| 20494 | + assert( bArgList==0 ); | |
| 20385 | 20495 | if( pToken && pToken->n ){ |
| 20386 | 20496 | sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n); |
| 20387 | 20497 | } |
| 20388 | 20498 | length = width = 0; |
| 20389 | 20499 | break; |
| @@ -20390,10 +20500,11 @@ | ||
| 20390 | 20500 | } |
| 20391 | 20501 | case etSRCLIST: { |
| 20392 | 20502 | SrcList *pSrc = va_arg(ap, SrcList*); |
| 20393 | 20503 | int k = va_arg(ap, int); |
| 20394 | 20504 | struct SrcList_item *pItem = &pSrc->a[k]; |
| 20505 | + assert( bArgList==0 ); | |
| 20395 | 20506 | assert( k>=0 && k<pSrc->nSrc ); |
| 20396 | 20507 | if( pItem->zDatabase ){ |
| 20397 | 20508 | sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase); |
| 20398 | 20509 | sqlite3StrAccumAppend(pAccum, ".", 1); |
| 20399 | 20510 | } |
| @@ -20426,11 +20537,11 @@ | ||
| 20426 | 20537 | nspace = width-length; |
| 20427 | 20538 | if( nspace>0 ){ |
| 20428 | 20539 | sqlite3AppendSpace(pAccum, nspace); |
| 20429 | 20540 | } |
| 20430 | 20541 | } |
| 20431 | - sqlite3_free(zExtra); | |
| 20542 | + if( zExtra ) sqlite3_free(zExtra); | |
| 20432 | 20543 | }/* End for loop over the format string */ |
| 20433 | 20544 | } /* End of function */ |
| 20434 | 20545 | |
| 20435 | 20546 | /* |
| 20436 | 20547 | ** Append N bytes of text from z to the StrAccum object. |
| @@ -20553,11 +20664,11 @@ | ||
| 20553 | 20664 | StrAccum acc; |
| 20554 | 20665 | assert( db!=0 ); |
| 20555 | 20666 | sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), |
| 20556 | 20667 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 20557 | 20668 | acc.db = db; |
| 20558 | - sqlite3VXPrintf(&acc, 1, zFormat, ap); | |
| 20669 | + sqlite3VXPrintf(&acc, SQLITE_PRINTF_INTERNAL, zFormat, ap); | |
| 20559 | 20670 | z = sqlite3StrAccumFinish(&acc); |
| 20560 | 20671 | if( acc.accError==STRACCUM_NOMEM ){ |
| 20561 | 20672 | db->mallocFailed = 1; |
| 20562 | 20673 | } |
| 20563 | 20674 | return z; |
| @@ -20709,21 +20820,19 @@ | ||
| 20709 | 20820 | fprintf(stdout,"%s", zBuf); |
| 20710 | 20821 | fflush(stdout); |
| 20711 | 20822 | } |
| 20712 | 20823 | #endif |
| 20713 | 20824 | |
| 20714 | -#ifndef SQLITE_OMIT_TRACE | |
| 20715 | 20825 | /* |
| 20716 | 20826 | ** variable-argument wrapper around sqlite3VXPrintf(). |
| 20717 | 20827 | */ |
| 20718 | -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){ | |
| 20828 | +SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, u32 bFlags, const char *zFormat, ...){ | |
| 20719 | 20829 | va_list ap; |
| 20720 | 20830 | va_start(ap,zFormat); |
| 20721 | - sqlite3VXPrintf(p, 1, zFormat, ap); | |
| 20831 | + sqlite3VXPrintf(p, bFlags, zFormat, ap); | |
| 20722 | 20832 | va_end(ap); |
| 20723 | 20833 | } |
| 20724 | -#endif | |
| 20725 | 20834 | |
| 20726 | 20835 | /************** End of printf.c **********************************************/ |
| 20727 | 20836 | /************** Begin file random.c ******************************************/ |
| 20728 | 20837 | /* |
| 20729 | 20838 | ** 2001 September 15 |
| @@ -21494,22 +21603,21 @@ | ||
| 21494 | 21603 | ** To clear the most recent error for sqlite handle "db", sqlite3Error |
| 21495 | 21604 | ** should be called with err_code set to SQLITE_OK and zFormat set |
| 21496 | 21605 | ** to NULL. |
| 21497 | 21606 | */ |
| 21498 | 21607 | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ |
| 21499 | - if( db && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){ | |
| 21500 | - db->errCode = err_code; | |
| 21501 | - if( zFormat ){ | |
| 21502 | - char *z; | |
| 21503 | - va_list ap; | |
| 21504 | - va_start(ap, zFormat); | |
| 21505 | - z = sqlite3VMPrintf(db, zFormat, ap); | |
| 21506 | - va_end(ap); | |
| 21507 | - sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); | |
| 21508 | - }else{ | |
| 21509 | - sqlite3ValueSetStr(db->pErr, 0, 0, SQLITE_UTF8, SQLITE_STATIC); | |
| 21510 | - } | |
| 21608 | + assert( db!=0 ); | |
| 21609 | + db->errCode = err_code; | |
| 21610 | + if( zFormat && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){ | |
| 21611 | + char *z; | |
| 21612 | + va_list ap; | |
| 21613 | + va_start(ap, zFormat); | |
| 21614 | + z = sqlite3VMPrintf(db, zFormat, ap); | |
| 21615 | + va_end(ap); | |
| 21616 | + sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); | |
| 21617 | + }else if( db->pErr ){ | |
| 21618 | + sqlite3ValueSetNull(db->pErr); | |
| 21511 | 21619 | } |
| 21512 | 21620 | } |
| 21513 | 21621 | |
| 21514 | 21622 | /* |
| 21515 | 21623 | ** Add an error message to pParse->zErrMsg and increment pParse->nErr. |
| @@ -37558,10 +37666,11 @@ | ||
| 37558 | 37666 | ** in memory. |
| 37559 | 37667 | */ |
| 37560 | 37668 | struct PgHdr1 { |
| 37561 | 37669 | sqlite3_pcache_page page; |
| 37562 | 37670 | unsigned int iKey; /* Key value (page number) */ |
| 37671 | + u8 isPinned; /* Page in use, not on the LRU list */ | |
| 37563 | 37672 | PgHdr1 *pNext; /* Next in hash table chain */ |
| 37564 | 37673 | PCache1 *pCache; /* Cache that currently owns this page */ |
| 37565 | 37674 | PgHdr1 *pLruNext; /* Next in LRU list of unpinned pages */ |
| 37566 | 37675 | PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */ |
| 37567 | 37676 | }; |
| @@ -37886,38 +37995,36 @@ | ||
| 37886 | 37995 | ** This function is used internally to remove the page pPage from the |
| 37887 | 37996 | ** PGroup LRU list, if is part of it. If pPage is not part of the PGroup |
| 37888 | 37997 | ** LRU list, then this function is a no-op. |
| 37889 | 37998 | ** |
| 37890 | 37999 | ** The PGroup mutex must be held when this function is called. |
| 37891 | -** | |
| 37892 | -** If pPage is NULL then this routine is a no-op. | |
| 37893 | 38000 | */ |
| 37894 | 38001 | static void pcache1PinPage(PgHdr1 *pPage){ |
| 37895 | 38002 | PCache1 *pCache; |
| 37896 | 38003 | PGroup *pGroup; |
| 37897 | 38004 | |
| 37898 | - if( pPage==0 ) return; | |
| 38005 | + assert( pPage!=0 ); | |
| 38006 | + assert( pPage->isPinned==0 ); | |
| 37899 | 38007 | pCache = pPage->pCache; |
| 37900 | 38008 | pGroup = pCache->pGroup; |
| 38009 | + assert( pPage->pLruNext || pPage==pGroup->pLruTail ); | |
| 38010 | + assert( pPage->pLruPrev || pPage==pGroup->pLruHead ); | |
| 37901 | 38011 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 37902 | - if( pPage->pLruNext || pPage==pGroup->pLruTail ){ | |
| 37903 | - if( pPage->pLruPrev ){ | |
| 37904 | - pPage->pLruPrev->pLruNext = pPage->pLruNext; | |
| 37905 | - } | |
| 37906 | - if( pPage->pLruNext ){ | |
| 37907 | - pPage->pLruNext->pLruPrev = pPage->pLruPrev; | |
| 37908 | - } | |
| 37909 | - if( pGroup->pLruHead==pPage ){ | |
| 37910 | - pGroup->pLruHead = pPage->pLruNext; | |
| 37911 | - } | |
| 37912 | - if( pGroup->pLruTail==pPage ){ | |
| 37913 | - pGroup->pLruTail = pPage->pLruPrev; | |
| 37914 | - } | |
| 37915 | - pPage->pLruNext = 0; | |
| 37916 | - pPage->pLruPrev = 0; | |
| 37917 | - pPage->pCache->nRecyclable--; | |
| 37918 | - } | |
| 38012 | + if( pPage->pLruPrev ){ | |
| 38013 | + pPage->pLruPrev->pLruNext = pPage->pLruNext; | |
| 38014 | + }else{ | |
| 38015 | + pGroup->pLruHead = pPage->pLruNext; | |
| 38016 | + } | |
| 38017 | + if( pPage->pLruNext ){ | |
| 38018 | + pPage->pLruNext->pLruPrev = pPage->pLruPrev; | |
| 38019 | + }else{ | |
| 38020 | + pGroup->pLruTail = pPage->pLruPrev; | |
| 38021 | + } | |
| 38022 | + pPage->pLruNext = 0; | |
| 38023 | + pPage->pLruPrev = 0; | |
| 38024 | + pPage->isPinned = 1; | |
| 38025 | + pCache->nRecyclable--; | |
| 37919 | 38026 | } |
| 37920 | 38027 | |
| 37921 | 38028 | |
| 37922 | 38029 | /* |
| 37923 | 38030 | ** Remove the page supplied as an argument from the hash table |
| @@ -37945,10 +38052,11 @@ | ||
| 37945 | 38052 | static void pcache1EnforceMaxPage(PGroup *pGroup){ |
| 37946 | 38053 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 37947 | 38054 | while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){ |
| 37948 | 38055 | PgHdr1 *p = pGroup->pLruTail; |
| 37949 | 38056 | assert( p->pCache->pGroup==pGroup ); |
| 38057 | + assert( p->isPinned==0 ); | |
| 37950 | 38058 | pcache1PinPage(p); |
| 37951 | 38059 | pcache1RemoveFromHash(p); |
| 37952 | 38060 | pcache1FreePage(p); |
| 37953 | 38061 | } |
| 37954 | 38062 | } |
| @@ -37972,11 +38080,11 @@ | ||
| 37972 | 38080 | PgHdr1 *pPage; |
| 37973 | 38081 | while( (pPage = *pp)!=0 ){ |
| 37974 | 38082 | if( pPage->iKey>=iLimit ){ |
| 37975 | 38083 | pCache->nPage--; |
| 37976 | 38084 | *pp = pPage->pNext; |
| 37977 | - pcache1PinPage(pPage); | |
| 38085 | + if( !pPage->isPinned ) pcache1PinPage(pPage); | |
| 37978 | 38086 | pcache1FreePage(pPage); |
| 37979 | 38087 | }else{ |
| 37980 | 38088 | pp = &pPage->pNext; |
| 37981 | 38089 | TESTONLY( nPage++; ) |
| 37982 | 38090 | } |
| @@ -38195,12 +38303,15 @@ | ||
| 38195 | 38303 | unsigned int h = iKey % pCache->nHash; |
| 38196 | 38304 | for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage->pNext); |
| 38197 | 38305 | } |
| 38198 | 38306 | |
| 38199 | 38307 | /* Step 2: Abort if no existing page is found and createFlag is 0 */ |
| 38200 | - if( pPage || createFlag==0 ){ | |
| 38201 | - pcache1PinPage(pPage); | |
| 38308 | + if( pPage ){ | |
| 38309 | + if( !pPage->isPinned ) pcache1PinPage(pPage); | |
| 38310 | + goto fetch_out; | |
| 38311 | + } | |
| 38312 | + if( createFlag==0 ){ | |
| 38202 | 38313 | goto fetch_out; |
| 38203 | 38314 | } |
| 38204 | 38315 | |
| 38205 | 38316 | /* The pGroup local variable will normally be initialized by the |
| 38206 | 38317 | ** pcache1EnterMutex() macro above. But if SQLITE_MUTEX_OMIT is defined, |
| @@ -38237,10 +38348,11 @@ | ||
| 38237 | 38348 | || pGroup->nCurrentPage>=pGroup->nMaxPage |
| 38238 | 38349 | || pcache1UnderMemoryPressure(pCache) |
| 38239 | 38350 | )){ |
| 38240 | 38351 | PCache1 *pOther; |
| 38241 | 38352 | pPage = pGroup->pLruTail; |
| 38353 | + assert( pPage->isPinned==0 ); | |
| 38242 | 38354 | pcache1RemoveFromHash(pPage); |
| 38243 | 38355 | pcache1PinPage(pPage); |
| 38244 | 38356 | pOther = pPage->pCache; |
| 38245 | 38357 | |
| 38246 | 38358 | /* We want to verify that szPage and szExtra are the same for pOther |
| @@ -38273,10 +38385,11 @@ | ||
| 38273 | 38385 | pPage->iKey = iKey; |
| 38274 | 38386 | pPage->pNext = pCache->apHash[h]; |
| 38275 | 38387 | pPage->pCache = pCache; |
| 38276 | 38388 | pPage->pLruPrev = 0; |
| 38277 | 38389 | pPage->pLruNext = 0; |
| 38390 | + pPage->isPinned = 1; | |
| 38278 | 38391 | *(void **)pPage->page.pExtra = 0; |
| 38279 | 38392 | pCache->apHash[h] = pPage; |
| 38280 | 38393 | } |
| 38281 | 38394 | |
| 38282 | 38395 | fetch_out: |
| @@ -38308,10 +38421,11 @@ | ||
| 38308 | 38421 | /* It is an error to call this function if the page is already |
| 38309 | 38422 | ** part of the PGroup LRU list. |
| 38310 | 38423 | */ |
| 38311 | 38424 | assert( pPage->pLruPrev==0 && pPage->pLruNext==0 ); |
| 38312 | 38425 | assert( pGroup->pLruHead!=pPage && pGroup->pLruTail!=pPage ); |
| 38426 | + assert( pPage->isPinned==1 ); | |
| 38313 | 38427 | |
| 38314 | 38428 | if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){ |
| 38315 | 38429 | pcache1RemoveFromHash(pPage); |
| 38316 | 38430 | pcache1FreePage(pPage); |
| 38317 | 38431 | }else{ |
| @@ -38323,10 +38437,11 @@ | ||
| 38323 | 38437 | }else{ |
| 38324 | 38438 | pGroup->pLruTail = pPage; |
| 38325 | 38439 | pGroup->pLruHead = pPage; |
| 38326 | 38440 | } |
| 38327 | 38441 | pCache->nRecyclable++; |
| 38442 | + pPage->isPinned = 0; | |
| 38328 | 38443 | } |
| 38329 | 38444 | |
| 38330 | 38445 | pcache1LeaveMutex(pCache->pGroup); |
| 38331 | 38446 | } |
| 38332 | 38447 | |
| @@ -38449,10 +38564,11 @@ | ||
| 38449 | 38564 | while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){ |
| 38450 | 38565 | nFree += pcache1MemSize(p->page.pBuf); |
| 38451 | 38566 | #ifdef SQLITE_PCACHE_SEPARATE_HEADER |
| 38452 | 38567 | nFree += sqlite3MemSize(p); |
| 38453 | 38568 | #endif |
| 38569 | + assert( p->isPinned==0 ); | |
| 38454 | 38570 | pcache1PinPage(p); |
| 38455 | 38571 | pcache1RemoveFromHash(p); |
| 38456 | 38572 | pcache1FreePage(p); |
| 38457 | 38573 | } |
| 38458 | 38574 | pcache1LeaveMutex(&pcache1.grp); |
| @@ -38473,10 +38589,11 @@ | ||
| 38473 | 38589 | int *pnRecyclable /* OUT: Total number of pages available for recycling */ |
| 38474 | 38590 | ){ |
| 38475 | 38591 | PgHdr1 *p; |
| 38476 | 38592 | int nRecyclable = 0; |
| 38477 | 38593 | for(p=pcache1.grp.pLruHead; p; p=p->pLruNext){ |
| 38594 | + assert( p->isPinned==0 ); | |
| 38478 | 38595 | nRecyclable++; |
| 38479 | 38596 | } |
| 38480 | 38597 | *pnCurrent = pcache1.grp.nCurrentPage; |
| 38481 | 38598 | *pnMax = (int)pcache1.grp.nMaxPage; |
| 38482 | 38599 | *pnMin = (int)pcache1.grp.nMinPage; |
| @@ -40159,29 +40276,26 @@ | ||
| 40159 | 40276 | ** PagerSavepoint.pInSavepoint. |
| 40160 | 40277 | */ |
| 40161 | 40278 | static int subjRequiresPage(PgHdr *pPg){ |
| 40162 | 40279 | Pager *pPager = pPg->pPager; |
| 40163 | 40280 | PagerSavepoint *p; |
| 40164 | - Pgno pgno; | |
| 40281 | + Pgno pgno = pPg->pgno; | |
| 40165 | 40282 | int i; |
| 40166 | - if( pPager->nSavepoint ){ | |
| 40167 | - pgno = pPg->pgno; | |
| 40168 | - for(i=0; i<pPager->nSavepoint; i++){ | |
| 40169 | - p = &pPager->aSavepoint[i]; | |
| 40170 | - if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){ | |
| 40171 | - return 1; | |
| 40172 | - } | |
| 40283 | + for(i=0; i<pPager->nSavepoint; i++){ | |
| 40284 | + p = &pPager->aSavepoint[i]; | |
| 40285 | + if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){ | |
| 40286 | + return 1; | |
| 40173 | 40287 | } |
| 40174 | 40288 | } |
| 40175 | 40289 | return 0; |
| 40176 | 40290 | } |
| 40177 | 40291 | |
| 40178 | 40292 | /* |
| 40179 | 40293 | ** Return true if the page is already in the journal file. |
| 40180 | 40294 | */ |
| 40181 | -static int pageInJournal(PgHdr *pPg){ | |
| 40182 | - return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno); | |
| 40295 | +static int pageInJournal(Pager *pPager, PgHdr *pPg){ | |
| 40296 | + return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno); | |
| 40183 | 40297 | } |
| 40184 | 40298 | |
| 40185 | 40299 | /* |
| 40186 | 40300 | ** Read a 32-bit integer from the given file descriptor. Store the integer |
| 40187 | 40301 | ** that is read in *pRes. Return SQLITE_OK if everything worked, or an |
| @@ -40384,10 +40498,11 @@ | ||
| 40384 | 40498 | |
| 40385 | 40499 | if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ)) |
| 40386 | 40500 | || szJ<16 |
| 40387 | 40501 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len)) |
| 40388 | 40502 | || len>=nMaster |
| 40503 | + || len==0 | |
| 40389 | 40504 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum)) |
| 40390 | 40505 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) |
| 40391 | 40506 | || memcmp(aMagic, aJournalMagic, 8) |
| 40392 | 40507 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) |
| 40393 | 40508 | ){ |
| @@ -41124,11 +41239,11 @@ | ||
| 41124 | 41239 | sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); |
| 41125 | 41240 | if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ |
| 41126 | 41241 | PgHdr *p = pager_lookup(pPager, 1); |
| 41127 | 41242 | if( p ){ |
| 41128 | 41243 | p->pageHash = 0; |
| 41129 | - sqlite3PagerUnref(p); | |
| 41244 | + sqlite3PagerUnrefNotNull(p); | |
| 41130 | 41245 | } |
| 41131 | 41246 | } |
| 41132 | 41247 | #endif |
| 41133 | 41248 | |
| 41134 | 41249 | sqlite3BitvecDestroy(pPager->pInJournal); |
| @@ -41152,10 +41267,15 @@ | ||
| 41152 | 41267 | ** file. So it is safe to truncate the database file to its minimum |
| 41153 | 41268 | ** required size. */ |
| 41154 | 41269 | assert( pPager->eLock==EXCLUSIVE_LOCK ); |
| 41155 | 41270 | rc = pager_truncate(pPager, pPager->dbSize); |
| 41156 | 41271 | } |
| 41272 | + | |
| 41273 | + if( rc==SQLITE_OK && bCommit && isOpen(pPager->fd) ){ | |
| 41274 | + rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0); | |
| 41275 | + if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; | |
| 41276 | + } | |
| 41157 | 41277 | |
| 41158 | 41278 | if( !pPager->exclusiveMode |
| 41159 | 41279 | && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0)) |
| 41160 | 41280 | ){ |
| 41161 | 41281 | rc2 = pagerUnlockDb(pPager, SHARED_LOCK); |
| @@ -41966,11 +42086,11 @@ | ||
| 41966 | 42086 | testcase( rc!=SQLITE_OK ); |
| 41967 | 42087 | } |
| 41968 | 42088 | if( rc==SQLITE_OK |
| 41969 | 42089 | && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) |
| 41970 | 42090 | ){ |
| 41971 | - rc = sqlite3PagerSync(pPager); | |
| 42091 | + rc = sqlite3PagerSync(pPager, 0); | |
| 41972 | 42092 | } |
| 41973 | 42093 | if( rc==SQLITE_OK ){ |
| 41974 | 42094 | rc = pager_end_transaction(pPager, zMaster[0]!='\0', 0); |
| 41975 | 42095 | testcase( rc!=SQLITE_OK ); |
| 41976 | 42096 | } |
| @@ -42112,11 +42232,11 @@ | ||
| 42112 | 42232 | rc = readDbPage(pPg, iFrame); |
| 42113 | 42233 | } |
| 42114 | 42234 | if( rc==SQLITE_OK ){ |
| 42115 | 42235 | pPager->xReiniter(pPg); |
| 42116 | 42236 | } |
| 42117 | - sqlite3PagerUnref(pPg); | |
| 42237 | + sqlite3PagerUnrefNotNull(pPg); | |
| 42118 | 42238 | } |
| 42119 | 42239 | } |
| 42120 | 42240 | |
| 42121 | 42241 | /* Normally, if a transaction is rolled back, any backup processes are |
| 42122 | 42242 | ** updated as data is copied out of the rollback journal and into the |
| @@ -43467,11 +43587,11 @@ | ||
| 43467 | 43587 | /* Open the sub-journal, if it has not already been opened */ |
| 43468 | 43588 | assert( pPager->useJournal ); |
| 43469 | 43589 | assert( isOpen(pPager->jfd) || pagerUseWal(pPager) ); |
| 43470 | 43590 | assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 ); |
| 43471 | 43591 | assert( pagerUseWal(pPager) |
| 43472 | - || pageInJournal(pPg) | |
| 43592 | + || pageInJournal(pPager, pPg) | |
| 43473 | 43593 | || pPg->pgno>pPager->dbOrigSize |
| 43474 | 43594 | ); |
| 43475 | 43595 | rc = openSubJournal(pPager); |
| 43476 | 43596 | |
| 43477 | 43597 | /* If the sub-journal was opened successfully (or was already open), |
| @@ -44568,20 +44688,23 @@ | ||
| 44568 | 44688 | ** If the number of references to the page drop to zero, then the |
| 44569 | 44689 | ** page is added to the LRU list. When all references to all pages |
| 44570 | 44690 | ** are released, a rollback occurs and the lock on the database is |
| 44571 | 44691 | ** removed. |
| 44572 | 44692 | */ |
| 44693 | +SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){ | |
| 44694 | + Pager *pPager; | |
| 44695 | + assert( pPg!=0 ); | |
| 44696 | + pPager = pPg->pPager; | |
| 44697 | + if( pPg->flags & PGHDR_MMAP ){ | |
| 44698 | + pagerReleaseMapPage(pPg); | |
| 44699 | + }else{ | |
| 44700 | + sqlite3PcacheRelease(pPg); | |
| 44701 | + } | |
| 44702 | + pagerUnlockIfUnused(pPager); | |
| 44703 | +} | |
| 44573 | 44704 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){ |
| 44574 | - if( pPg ){ | |
| 44575 | - Pager *pPager = pPg->pPager; | |
| 44576 | - if( pPg->flags & PGHDR_MMAP ){ | |
| 44577 | - pagerReleaseMapPage(pPg); | |
| 44578 | - }else{ | |
| 44579 | - sqlite3PcacheRelease(pPg); | |
| 44580 | - } | |
| 44581 | - pagerUnlockIfUnused(pPager); | |
| 44582 | - } | |
| 44705 | + if( pPg ) sqlite3PagerUnrefNotNull(pPg); | |
| 44583 | 44706 | } |
| 44584 | 44707 | |
| 44585 | 44708 | /* |
| 44586 | 44709 | ** This function is called at the start of every write transaction. |
| 44587 | 44710 | ** There must already be a RESERVED or EXCLUSIVE lock on the database |
| @@ -44765,13 +44888,13 @@ | ||
| 44765 | 44888 | ** one of the journals, the corresponding bit is set in the |
| 44766 | 44889 | ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs |
| 44767 | 44890 | ** of any open savepoints as appropriate. |
| 44768 | 44891 | */ |
| 44769 | 44892 | static int pager_write(PgHdr *pPg){ |
| 44770 | - void *pData = pPg->pData; | |
| 44771 | 44893 | Pager *pPager = pPg->pPager; |
| 44772 | 44894 | int rc = SQLITE_OK; |
| 44895 | + int inJournal; | |
| 44773 | 44896 | |
| 44774 | 44897 | /* This routine is not called unless a write-transaction has already |
| 44775 | 44898 | ** been started. The journal file may or may not be open at this point. |
| 44776 | 44899 | ** It is never called in the ERROR state. |
| 44777 | 44900 | */ |
| @@ -44803,19 +44926,20 @@ | ||
| 44803 | 44926 | |
| 44804 | 44927 | /* Mark the page as dirty. If the page has already been written |
| 44805 | 44928 | ** to the journal then we can return right away. |
| 44806 | 44929 | */ |
| 44807 | 44930 | sqlite3PcacheMakeDirty(pPg); |
| 44808 | - if( pageInJournal(pPg) && !subjRequiresPage(pPg) ){ | |
| 44931 | + inJournal = pageInJournal(pPager, pPg); | |
| 44932 | + if( inJournal && (pPager->nSavepoint==0 || !subjRequiresPage(pPg)) ){ | |
| 44809 | 44933 | assert( !pagerUseWal(pPager) ); |
| 44810 | 44934 | }else{ |
| 44811 | 44935 | |
| 44812 | 44936 | /* The transaction journal now exists and we have a RESERVED or an |
| 44813 | 44937 | ** EXCLUSIVE lock on the main database file. Write the current page to |
| 44814 | 44938 | ** the transaction journal if it is not there already. |
| 44815 | 44939 | */ |
| 44816 | - if( !pageInJournal(pPg) && !pagerUseWal(pPager) ){ | |
| 44940 | + if( !inJournal && !pagerUseWal(pPager) ){ | |
| 44817 | 44941 | assert( pagerUseWal(pPager)==0 ); |
| 44818 | 44942 | if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){ |
| 44819 | 44943 | u32 cksum; |
| 44820 | 44944 | char *pData2; |
| 44821 | 44945 | i64 iOff = pPager->journalOff; |
| @@ -44824,11 +44948,11 @@ | ||
| 44824 | 44948 | ** contains the database locks. The following assert verifies |
| 44825 | 44949 | ** that we do not. */ |
| 44826 | 44950 | assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); |
| 44827 | 44951 | |
| 44828 | 44952 | assert( pPager->journalHdr<=pPager->journalOff ); |
| 44829 | - CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); | |
| 44953 | + CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); | |
| 44830 | 44954 | cksum = pager_cksum(pPager, (u8*)pData2); |
| 44831 | 44955 | |
| 44832 | 44956 | /* Even if an IO or diskfull error occurs while journalling the |
| 44833 | 44957 | ** page in the block above, set the need-sync flag for the page. |
| 44834 | 44958 | ** Otherwise, when the transaction is rolled back, the logic in |
| @@ -44876,11 +45000,11 @@ | ||
| 44876 | 45000 | /* If the statement journal is open and the page is not in it, |
| 44877 | 45001 | ** then write the current page to the statement journal. Note that |
| 44878 | 45002 | ** the statement journal format differs from the standard journal format |
| 44879 | 45003 | ** in that it omits the checksums and the header. |
| 44880 | 45004 | */ |
| 44881 | - if( subjRequiresPage(pPg) ){ | |
| 45005 | + if( pPager->nSavepoint>0 && subjRequiresPage(pPg) ){ | |
| 44882 | 45006 | rc = subjournalPage(pPg); |
| 44883 | 45007 | } |
| 44884 | 45008 | } |
| 44885 | 45009 | |
| 44886 | 45010 | /* Update the database size and return. |
| @@ -44959,18 +45083,18 @@ | ||
| 44959 | 45083 | if( rc==SQLITE_OK ){ |
| 44960 | 45084 | rc = pager_write(pPage); |
| 44961 | 45085 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 44962 | 45086 | needSync = 1; |
| 44963 | 45087 | } |
| 44964 | - sqlite3PagerUnref(pPage); | |
| 45088 | + sqlite3PagerUnrefNotNull(pPage); | |
| 44965 | 45089 | } |
| 44966 | 45090 | } |
| 44967 | 45091 | }else if( (pPage = pager_lookup(pPager, pg))!=0 ){ |
| 44968 | 45092 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 44969 | 45093 | needSync = 1; |
| 44970 | 45094 | } |
| 44971 | - sqlite3PagerUnref(pPage); | |
| 45095 | + sqlite3PagerUnrefNotNull(pPage); | |
| 44972 | 45096 | } |
| 44973 | 45097 | } |
| 44974 | 45098 | |
| 44975 | 45099 | /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages |
| 44976 | 45100 | ** starting at pg1, then it needs to be set for all of them. Because |
| @@ -44982,11 +45106,11 @@ | ||
| 44982 | 45106 | assert( !MEMDB ); |
| 44983 | 45107 | for(ii=0; ii<nPage; ii++){ |
| 44984 | 45108 | PgHdr *pPage = pager_lookup(pPager, pg1+ii); |
| 44985 | 45109 | if( pPage ){ |
| 44986 | 45110 | pPage->flags |= PGHDR_NEED_SYNC; |
| 44987 | - sqlite3PagerUnref(pPage); | |
| 45111 | + sqlite3PagerUnrefNotNull(pPage); | |
| 44988 | 45112 | } |
| 44989 | 45113 | } |
| 44990 | 45114 | } |
| 44991 | 45115 | |
| 44992 | 45116 | assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 ); |
| @@ -45135,21 +45259,21 @@ | ||
| 45135 | 45259 | ** or pages with the Pager.noSync flag set. |
| 45136 | 45260 | ** |
| 45137 | 45261 | ** If successful, or if called on a pager for which it is a no-op, this |
| 45138 | 45262 | ** function returns SQLITE_OK. Otherwise, an IO error code is returned. |
| 45139 | 45263 | */ |
| 45140 | -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager){ | |
| 45264 | +SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){ | |
| 45141 | 45265 | int rc = SQLITE_OK; |
| 45142 | - if( !pPager->noSync ){ | |
| 45266 | + | |
| 45267 | + if( isOpen(pPager->fd) ){ | |
| 45268 | + void *pArg = (void*)zMaster; | |
| 45269 | + rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg); | |
| 45270 | + if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; | |
| 45271 | + } | |
| 45272 | + if( rc==SQLITE_OK && !pPager->noSync ){ | |
| 45143 | 45273 | assert( !MEMDB ); |
| 45144 | 45274 | rc = sqlite3OsSync(pPager->fd, pPager->syncFlags); |
| 45145 | - }else if( isOpen(pPager->fd) ){ | |
| 45146 | - assert( !MEMDB ); | |
| 45147 | - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC_OMITTED, 0); | |
| 45148 | - if( rc==SQLITE_NOTFOUND ){ | |
| 45149 | - rc = SQLITE_OK; | |
| 45150 | - } | |
| 45151 | 45275 | } |
| 45152 | 45276 | return rc; |
| 45153 | 45277 | } |
| 45154 | 45278 | |
| 45155 | 45279 | /* |
| @@ -45344,11 +45468,11 @@ | ||
| 45344 | 45468 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 45345 | 45469 | } |
| 45346 | 45470 | |
| 45347 | 45471 | /* Finally, sync the database file. */ |
| 45348 | 45472 | if( !noSync ){ |
| 45349 | - rc = sqlite3PagerSync(pPager); | |
| 45473 | + rc = sqlite3PagerSync(pPager, zMaster); | |
| 45350 | 45474 | } |
| 45351 | 45475 | IOTRACE(("DBSYNC %p\n", pPager)) |
| 45352 | 45476 | } |
| 45353 | 45477 | } |
| 45354 | 45478 | |
| @@ -45473,11 +45597,13 @@ | ||
| 45473 | 45597 | rc = pager_playback(pPager, 0); |
| 45474 | 45598 | } |
| 45475 | 45599 | |
| 45476 | 45600 | assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK ); |
| 45477 | 45601 | assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT |
| 45478 | - || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR ); | |
| 45602 | + || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR | |
| 45603 | + || rc==SQLITE_CANTOPEN | |
| 45604 | + ); | |
| 45479 | 45605 | |
| 45480 | 45606 | /* If an error occurs during a ROLLBACK, we can no longer trust the pager |
| 45481 | 45607 | ** cache. So call pager_error() on the way out to make any error persistent. |
| 45482 | 45608 | */ |
| 45483 | 45609 | return pager_error(pPager, rc); |
| @@ -45876,11 +46002,11 @@ | ||
| 45876 | 46002 | ** can be written to. The caller has already promised not to write to it. |
| 45877 | 46003 | */ |
| 45878 | 46004 | if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){ |
| 45879 | 46005 | needSyncPgno = pPg->pgno; |
| 45880 | 46006 | assert( pPager->journalMode==PAGER_JOURNALMODE_OFF || |
| 45881 | - pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize ); | |
| 46007 | + pageInJournal(pPager, pPg) || pPg->pgno>pPager->dbOrigSize ); | |
| 45882 | 46008 | assert( pPg->flags&PGHDR_DIRTY ); |
| 45883 | 46009 | } |
| 45884 | 46010 | |
| 45885 | 46011 | /* If the cache contains a page with page-number pgno, remove it |
| 45886 | 46012 | ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for |
| @@ -45910,11 +46036,11 @@ | ||
| 45910 | 46036 | ** as the original page since it has already been allocated. |
| 45911 | 46037 | */ |
| 45912 | 46038 | if( MEMDB ){ |
| 45913 | 46039 | assert( pPgOld ); |
| 45914 | 46040 | sqlite3PcacheMove(pPgOld, origPgno); |
| 45915 | - sqlite3PagerUnref(pPgOld); | |
| 46041 | + sqlite3PagerUnrefNotNull(pPgOld); | |
| 45916 | 46042 | } |
| 45917 | 46043 | |
| 45918 | 46044 | if( needSyncPgno ){ |
| 45919 | 46045 | /* If needSyncPgno is non-zero, then the journal file needs to be |
| 45920 | 46046 | ** sync()ed before any data is written to database file page needSyncPgno. |
| @@ -45939,11 +46065,11 @@ | ||
| 45939 | 46065 | } |
| 45940 | 46066 | return rc; |
| 45941 | 46067 | } |
| 45942 | 46068 | pPgHdr->flags |= PGHDR_NEED_SYNC; |
| 45943 | 46069 | sqlite3PcacheMakeDirty(pPgHdr); |
| 45944 | - sqlite3PagerUnref(pPgHdr); | |
| 46070 | + sqlite3PagerUnrefNotNull(pPgHdr); | |
| 45945 | 46071 | } |
| 45946 | 46072 | |
| 45947 | 46073 | return SQLITE_OK; |
| 45948 | 46074 | } |
| 45949 | 46075 | #endif |
| @@ -52079,14 +52205,15 @@ | ||
| 52079 | 52205 | */ |
| 52080 | 52206 | static void releasePage(MemPage *pPage){ |
| 52081 | 52207 | if( pPage ){ |
| 52082 | 52208 | assert( pPage->aData ); |
| 52083 | 52209 | assert( pPage->pBt ); |
| 52210 | + assert( pPage->pDbPage!=0 ); | |
| 52084 | 52211 | assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); |
| 52085 | 52212 | assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); |
| 52086 | 52213 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 52087 | - sqlite3PagerUnref(pPage->pDbPage); | |
| 52214 | + sqlite3PagerUnrefNotNull(pPage->pDbPage); | |
| 52088 | 52215 | } |
| 52089 | 52216 | } |
| 52090 | 52217 | |
| 52091 | 52218 | /* |
| 52092 | 52219 | ** During a rollback, when the pager reloads information into the cache |
| @@ -59413,11 +59540,11 @@ | ||
| 59413 | 59540 | rc = backupTruncateFile(pFile, iSize); |
| 59414 | 59541 | } |
| 59415 | 59542 | |
| 59416 | 59543 | /* Sync the database file to disk. */ |
| 59417 | 59544 | if( rc==SQLITE_OK ){ |
| 59418 | - rc = sqlite3PagerSync(pDestPager); | |
| 59545 | + rc = sqlite3PagerSync(pDestPager, 0); | |
| 59419 | 59546 | } |
| 59420 | 59547 | }else{ |
| 59421 | 59548 | sqlite3PagerTruncateImage(pDestPager, nDestTruncate); |
| 59422 | 59549 | rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0); |
| 59423 | 59550 | } |
| @@ -59488,14 +59615,14 @@ | ||
| 59488 | 59615 | /* If a transaction is still open on the Btree, roll it back. */ |
| 59489 | 59616 | sqlite3BtreeRollback(p->pDest, SQLITE_OK); |
| 59490 | 59617 | |
| 59491 | 59618 | /* Set the error code of the destination database handle. */ |
| 59492 | 59619 | rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc; |
| 59493 | - sqlite3Error(p->pDestDb, rc, 0); | |
| 59494 | - | |
| 59495 | - /* Exit the mutexes and free the backup context structure. */ | |
| 59496 | 59620 | if( p->pDestDb ){ |
| 59621 | + sqlite3Error(p->pDestDb, rc, 0); | |
| 59622 | + | |
| 59623 | + /* Exit the mutexes and free the backup context structure. */ | |
| 59497 | 59624 | sqlite3LeaveMutexAndCloseZombie(p->pDestDb); |
| 59498 | 59625 | } |
| 59499 | 59626 | sqlite3BtreeLeave(p->pSrc); |
| 59500 | 59627 | if( p->pDestDb ){ |
| 59501 | 59628 | /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a |
| @@ -60117,10 +60244,13 @@ | ||
| 60117 | 60244 | if( pMem->flags & MEM_RowSet ){ |
| 60118 | 60245 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60119 | 60246 | } |
| 60120 | 60247 | MemSetTypeFlag(pMem, MEM_Null); |
| 60121 | 60248 | pMem->type = SQLITE_NULL; |
| 60249 | +} | |
| 60250 | +SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ | |
| 60251 | + sqlite3VdbeMemSetNull((Mem*)p); | |
| 60122 | 60252 | } |
| 60123 | 60253 | |
| 60124 | 60254 | /* |
| 60125 | 60255 | ** Delete any previous value and set the value to be a BLOB of length |
| 60126 | 60256 | ** n containing all zeros. |
| @@ -63440,10 +63570,11 @@ | ||
| 63440 | 63570 | sqlite3 *db = p->db; |
| 63441 | 63571 | int rc = p->rc; |
| 63442 | 63572 | if( p->zErrMsg ){ |
| 63443 | 63573 | u8 mallocFailed = db->mallocFailed; |
| 63444 | 63574 | sqlite3BeginBenignMalloc(); |
| 63575 | + if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); | |
| 63445 | 63576 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 63446 | 63577 | sqlite3EndBenignMalloc(); |
| 63447 | 63578 | db->mallocFailed = mallocFailed; |
| 63448 | 63579 | db->errCode = rc; |
| 63449 | 63580 | }else{ |
| @@ -63508,12 +63639,11 @@ | ||
| 63508 | 63639 | }else if( p->rc && p->expired ){ |
| 63509 | 63640 | /* The expired flag was set on the VDBE before the first call |
| 63510 | 63641 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 63511 | 63642 | ** called), set the database error in this case as well. |
| 63512 | 63643 | */ |
| 63513 | - sqlite3Error(db, p->rc, 0); | |
| 63514 | - sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); | |
| 63644 | + sqlite3Error(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg); | |
| 63515 | 63645 | sqlite3DbFree(db, p->zErrMsg); |
| 63516 | 63646 | p->zErrMsg = 0; |
| 63517 | 63647 | } |
| 63518 | 63648 | |
| 63519 | 63649 | /* Reclaim all memory used by the VDBE |
| @@ -64883,20 +65013,21 @@ | ||
| 64883 | 65013 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 64884 | 65014 | sqlite3_reset(pStmt); |
| 64885 | 65015 | v->doingRerun = 1; |
| 64886 | 65016 | assert( v->expired==0 ); |
| 64887 | 65017 | } |
| 64888 | - if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){ | |
| 65018 | + if( rc2!=SQLITE_OK ){ | |
| 64889 | 65019 | /* This case occurs after failing to recompile an sql statement. |
| 64890 | 65020 | ** The error message from the SQL compiler has already been loaded |
| 64891 | 65021 | ** into the database handle. This block copies the error message |
| 64892 | 65022 | ** from the database handle into the statement and sets the statement |
| 64893 | 65023 | ** program counter to 0 to ensure that when the statement is |
| 64894 | 65024 | ** finalized or reset the parser error message is available via |
| 64895 | 65025 | ** sqlite3_errmsg() and sqlite3_errcode(). |
| 64896 | 65026 | */ |
| 64897 | 65027 | const char *zErr = (const char *)sqlite3_value_text(db->pErr); |
| 65028 | + assert( zErr!=0 || db->mallocFailed ); | |
| 64898 | 65029 | sqlite3DbFree(db, v->zErrMsg); |
| 64899 | 65030 | if( !db->mallocFailed ){ |
| 64900 | 65031 | v->zErrMsg = sqlite3DbStrDup(db, zErr); |
| 64901 | 65032 | v->rc = rc2; |
| 64902 | 65033 | } else { |
| @@ -65841,13 +65972,13 @@ | ||
| 65841 | 65972 | assert( idx>0 && idx<=p->nVar ); |
| 65842 | 65973 | pVar = &p->aVar[idx-1]; |
| 65843 | 65974 | if( pVar->flags & MEM_Null ){ |
| 65844 | 65975 | sqlite3StrAccumAppend(&out, "NULL", 4); |
| 65845 | 65976 | }else if( pVar->flags & MEM_Int ){ |
| 65846 | - sqlite3XPrintf(&out, "%lld", pVar->u.i); | |
| 65977 | + sqlite3XPrintf(&out, 0, "%lld", pVar->u.i); | |
| 65847 | 65978 | }else if( pVar->flags & MEM_Real ){ |
| 65848 | - sqlite3XPrintf(&out, "%!.15g", pVar->r); | |
| 65979 | + sqlite3XPrintf(&out, 0, "%!.15g", pVar->r); | |
| 65849 | 65980 | }else if( pVar->flags & MEM_Str ){ |
| 65850 | 65981 | int nOut; /* Number of bytes of the string text to include in output */ |
| 65851 | 65982 | #ifndef SQLITE_OMIT_UTF16 |
| 65852 | 65983 | u8 enc = ENC(db); |
| 65853 | 65984 | Mem utf8; |
| @@ -65864,33 +65995,37 @@ | ||
| 65864 | 65995 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ){ |
| 65865 | 65996 | nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 65866 | 65997 | while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } |
| 65867 | 65998 | } |
| 65868 | 65999 | #endif |
| 65869 | - sqlite3XPrintf(&out, "'%.*q'", nOut, pVar->z); | |
| 66000 | + sqlite3XPrintf(&out, 0, "'%.*q'", nOut, pVar->z); | |
| 65870 | 66001 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65871 | - if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); | |
| 66002 | + if( nOut<pVar->n ){ | |
| 66003 | + sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); | |
| 66004 | + } | |
| 65872 | 66005 | #endif |
| 65873 | 66006 | #ifndef SQLITE_OMIT_UTF16 |
| 65874 | 66007 | if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); |
| 65875 | 66008 | #endif |
| 65876 | 66009 | }else if( pVar->flags & MEM_Zero ){ |
| 65877 | - sqlite3XPrintf(&out, "zeroblob(%d)", pVar->u.nZero); | |
| 66010 | + sqlite3XPrintf(&out, 0, "zeroblob(%d)", pVar->u.nZero); | |
| 65878 | 66011 | }else{ |
| 65879 | 66012 | int nOut; /* Number of bytes of the blob to include in output */ |
| 65880 | 66013 | assert( pVar->flags & MEM_Blob ); |
| 65881 | 66014 | sqlite3StrAccumAppend(&out, "x'", 2); |
| 65882 | 66015 | nOut = pVar->n; |
| 65883 | 66016 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65884 | 66017 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 65885 | 66018 | #endif |
| 65886 | 66019 | for(i=0; i<nOut; i++){ |
| 65887 | - sqlite3XPrintf(&out, "%02x", pVar->z[i]&0xff); | |
| 66020 | + sqlite3XPrintf(&out, 0, "%02x", pVar->z[i]&0xff); | |
| 65888 | 66021 | } |
| 65889 | 66022 | sqlite3StrAccumAppend(&out, "'", 1); |
| 65890 | 66023 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65891 | - if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); | |
| 66024 | + if( nOut<pVar->n ){ | |
| 66025 | + sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); | |
| 66026 | + } | |
| 65892 | 66027 | #endif |
| 65893 | 66028 | } |
| 65894 | 66029 | } |
| 65895 | 66030 | } |
| 65896 | 66031 | return sqlite3StrAccumFinish(&out); |
| @@ -65945,11 +66080,11 @@ | ||
| 65945 | 66080 | int n = p->nIndent; |
| 65946 | 66081 | if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent); |
| 65947 | 66082 | sqlite3AppendSpace(&p->str, p->aIndent[n-1]); |
| 65948 | 66083 | } |
| 65949 | 66084 | va_start(ap, zFormat); |
| 65950 | - sqlite3VXPrintf(&p->str, 1, zFormat, ap); | |
| 66085 | + sqlite3VXPrintf(&p->str, SQLITE_PRINTF_INTERNAL, zFormat, ap); | |
| 65951 | 66086 | va_end(ap); |
| 65952 | 66087 | } |
| 65953 | 66088 | } |
| 65954 | 66089 | |
| 65955 | 66090 | /* |
| @@ -88246,11 +88381,10 @@ | ||
| 88246 | 88381 | int bestScore = 0; /* Score of best match */ |
| 88247 | 88382 | int h; /* Hash value */ |
| 88248 | 88383 | |
| 88249 | 88384 | assert( nArg>=(-2) ); |
| 88250 | 88385 | assert( nArg>=(-1) || createFlag==0 ); |
| 88251 | - assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); | |
| 88252 | 88386 | h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a); |
| 88253 | 88387 | |
| 88254 | 88388 | /* First search for a match amongst the application-defined functions. |
| 88255 | 88389 | */ |
| 88256 | 88390 | p = functionSearch(&db->aFunc, h, zName, nName); |
| @@ -89397,10 +89531,36 @@ | ||
| 89397 | 89531 | }while( isText && (zHaystack[0]&0xc0)==0x80 ); |
| 89398 | 89532 | } |
| 89399 | 89533 | if( nNeedle>nHaystack ) N = 0; |
| 89400 | 89534 | sqlite3_result_int(context, N); |
| 89401 | 89535 | } |
| 89536 | + | |
| 89537 | +/* | |
| 89538 | +** Implementation of the printf() function. | |
| 89539 | +*/ | |
| 89540 | +static void printfFunc( | |
| 89541 | + sqlite3_context *context, | |
| 89542 | + int argc, | |
| 89543 | + sqlite3_value **argv | |
| 89544 | +){ | |
| 89545 | + PrintfArguments x; | |
| 89546 | + StrAccum str; | |
| 89547 | + const char *zFormat; | |
| 89548 | + int n; | |
| 89549 | + | |
| 89550 | + if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){ | |
| 89551 | + x.nArg = argc-1; | |
| 89552 | + x.nUsed = 0; | |
| 89553 | + x.apArg = argv+1; | |
| 89554 | + sqlite3StrAccumInit(&str, 0, 0, SQLITE_MAX_LENGTH); | |
| 89555 | + str.db = sqlite3_context_db_handle(context); | |
| 89556 | + sqlite3XPrintf(&str, SQLITE_PRINTF_SQLFUNC, zFormat, &x); | |
| 89557 | + n = str.nChar; | |
| 89558 | + sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, | |
| 89559 | + SQLITE_DYNAMIC); | |
| 89560 | + } | |
| 89561 | +} | |
| 89402 | 89562 | |
| 89403 | 89563 | /* |
| 89404 | 89564 | ** Implementation of the substr() function. |
| 89405 | 89565 | ** |
| 89406 | 89566 | ** substr(x,p1,p2) returns p2 characters of x[] beginning with p1. |
| @@ -90828,10 +90988,11 @@ | ||
| 90828 | 90988 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), |
| 90829 | 90989 | FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), |
| 90830 | 90990 | FUNCTION(instr, 2, 0, 0, instrFunc ), |
| 90831 | 90991 | FUNCTION(substr, 2, 0, 0, substrFunc ), |
| 90832 | 90992 | FUNCTION(substr, 3, 0, 0, substrFunc ), |
| 90993 | + FUNCTION(printf, -1, 0, 0, printfFunc ), | |
| 90833 | 90994 | FUNCTION(unicode, 1, 0, 0, unicodeFunc ), |
| 90834 | 90995 | FUNCTION(char, -1, 0, 0, charFunc ), |
| 90835 | 90996 | FUNCTION(abs, 1, 0, 0, absFunc ), |
| 90836 | 90997 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 90837 | 90998 | FUNCTION(round, 1, 0, 0, roundFunc ), |
| @@ -119433,13 +119594,11 @@ | ||
| 119433 | 119594 | } |
| 119434 | 119595 | sqlite3HashClear(&db->aModule); |
| 119435 | 119596 | #endif |
| 119436 | 119597 | |
| 119437 | 119598 | sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */ |
| 119438 | - if( db->pErr ){ | |
| 119439 | - sqlite3ValueFree(db->pErr); | |
| 119440 | - } | |
| 119599 | + sqlite3ValueFree(db->pErr); | |
| 119441 | 119600 | sqlite3CloseExtensions(db); |
| 119442 | 119601 | |
| 119443 | 119602 | db->magic = SQLITE_MAGIC_ERROR; |
| 119444 | 119603 | |
| 119445 | 119604 | /* The temp-database schema is allocated differently from the other schema |
| @@ -119818,10 +119977,11 @@ | ||
| 119818 | 119977 | void (*xFinal)(sqlite3_context*), |
| 119819 | 119978 | FuncDestructor *pDestructor |
| 119820 | 119979 | ){ |
| 119821 | 119980 | FuncDef *p; |
| 119822 | 119981 | int nName; |
| 119982 | + int extraFlags; | |
| 119823 | 119983 | |
| 119824 | 119984 | assert( sqlite3_mutex_held(db->mutex) ); |
| 119825 | 119985 | if( zFunctionName==0 || |
| 119826 | 119986 | (xFunc && (xFinal || xStep)) || |
| 119827 | 119987 | (!xFunc && (xFinal && !xStep)) || |
| @@ -119828,10 +119988,14 @@ | ||
| 119828 | 119988 | (!xFunc && (!xFinal && xStep)) || |
| 119829 | 119989 | (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) || |
| 119830 | 119990 | (255<(nName = sqlite3Strlen30( zFunctionName))) ){ |
| 119831 | 119991 | return SQLITE_MISUSE_BKPT; |
| 119832 | 119992 | } |
| 119993 | + | |
| 119994 | + assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC ); | |
| 119995 | + extraFlags = enc & SQLITE_DETERMINISTIC; | |
| 119996 | + enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY); | |
| 119833 | 119997 | |
| 119834 | 119998 | #ifndef SQLITE_OMIT_UTF16 |
| 119835 | 119999 | /* If SQLITE_UTF16 is specified as the encoding type, transform this |
| 119836 | 120000 | ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the |
| 119837 | 120001 | ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. |
| @@ -119841,14 +120005,14 @@ | ||
| 119841 | 120005 | */ |
| 119842 | 120006 | if( enc==SQLITE_UTF16 ){ |
| 119843 | 120007 | enc = SQLITE_UTF16NATIVE; |
| 119844 | 120008 | }else if( enc==SQLITE_ANY ){ |
| 119845 | 120009 | int rc; |
| 119846 | - rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8, | |
| 120010 | + rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8|extraFlags, | |
| 119847 | 120011 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 119848 | 120012 | if( rc==SQLITE_OK ){ |
| 119849 | - rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE, | |
| 120013 | + rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE|extraFlags, | |
| 119850 | 120014 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 119851 | 120015 | } |
| 119852 | 120016 | if( rc!=SQLITE_OK ){ |
| 119853 | 120017 | return rc; |
| 119854 | 120018 | } |
| @@ -119887,11 +120051,12 @@ | ||
| 119887 | 120051 | |
| 119888 | 120052 | if( pDestructor ){ |
| 119889 | 120053 | pDestructor->nRef++; |
| 119890 | 120054 | } |
| 119891 | 120055 | p->pDestructor = pDestructor; |
| 119892 | - p->funcFlags &= SQLITE_FUNC_ENCMASK; | |
| 120056 | + p->funcFlags = (p->funcFlags & SQLITE_FUNC_ENCMASK) | extraFlags; | |
| 120057 | + testcase( p->funcFlags & SQLITE_DETERMINISTIC ); | |
| 119893 | 120058 | p->xFunc = xFunc; |
| 119894 | 120059 | p->xStep = xStep; |
| 119895 | 120060 | p->xFinalize = xFinal; |
| 119896 | 120061 | p->pUserData = pUserData; |
| 119897 | 120062 | p->nArg = (u16)nArg; |
| @@ -120317,10 +120482,11 @@ | ||
| 120317 | 120482 | } |
| 120318 | 120483 | sqlite3_mutex_enter(db->mutex); |
| 120319 | 120484 | if( db->mallocFailed ){ |
| 120320 | 120485 | z = sqlite3ErrStr(SQLITE_NOMEM); |
| 120321 | 120486 | }else{ |
| 120487 | + testcase( db->pErr==0 ); | |
| 120322 | 120488 | z = (char*)sqlite3_value_text(db->pErr); |
| 120323 | 120489 | assert( !db->mallocFailed ); |
| 120324 | 120490 | if( z==0 ){ |
| 120325 | 120491 | z = sqlite3ErrStr(db->errCode); |
| 120326 | 120492 | } |
| @@ -120358,12 +120524,11 @@ | ||
| 120358 | 120524 | if( db->mallocFailed ){ |
| 120359 | 120525 | z = (void *)outOfMem; |
| 120360 | 120526 | }else{ |
| 120361 | 120527 | z = sqlite3_value_text16(db->pErr); |
| 120362 | 120528 | if( z==0 ){ |
| 120363 | - sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode), | |
| 120364 | - SQLITE_UTF8, SQLITE_STATIC); | |
| 120529 | + sqlite3Error(db, db->errCode, sqlite3ErrStr(db->errCode)); | |
| 120365 | 120530 | z = sqlite3_value_text16(db->pErr); |
| 120366 | 120531 | } |
| 120367 | 120532 | /* A malloc() may have failed within the call to sqlite3_value_text16() |
| 120368 | 120533 | ** above. If this is the case, then the db->mallocFailed flag needs to |
| 120369 | 120534 | ** be cleared before returning. Do this directly, instead of via |
| @@ -121073,12 +121238,10 @@ | ||
| 121073 | 121238 | if( !db->mallocFailed && rc==SQLITE_OK){ |
| 121074 | 121239 | rc = sqlite3RtreeInit(db); |
| 121075 | 121240 | } |
| 121076 | 121241 | #endif |
| 121077 | 121242 | |
| 121078 | - sqlite3Error(db, rc, 0); | |
| 121079 | - | |
| 121080 | 121243 | /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking |
| 121081 | 121244 | ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking |
| 121082 | 121245 | ** mode. Doing nothing at all also makes NORMAL the default. |
| 121083 | 121246 | */ |
| 121084 | 121247 | #ifdef SQLITE_DEFAULT_LOCKING_MODE |
| 121085 | 121248 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -135,11 +135,11 @@ | |
| 135 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 136 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 137 | */ |
| 138 | #define SQLITE_VERSION "3.8.3" |
| 139 | #define SQLITE_VERSION_NUMBER 3008003 |
| 140 | #define SQLITE_SOURCE_ID "2013-12-11 12:02:55 3e1d55f0bd84810a035bd6c54583eb373784a9a3" |
| 141 | |
| 142 | /* |
| 143 | ** CAPI3REF: Run-Time Library Version Numbers |
| 144 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 145 | ** |
| @@ -817,19 +817,33 @@ | |
| 817 | ** to the [sqlite3_file] object associated with a particular database |
| 818 | ** connection. See the [sqlite3_file_control()] documentation for |
| 819 | ** additional information. |
| 820 | ** |
| 821 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 822 | ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by |
| 823 | ** SQLite and sent to all VFSes in place of a call to the xSync method |
| 824 | ** when the database connection has [PRAGMA synchronous] set to OFF.)^ |
| 825 | ** Some specialized VFSes need this signal in order to operate correctly |
| 826 | ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most |
| 827 | ** VFSes do not need this signal and should silently ignore this opcode. |
| 828 | ** Applications should not call [sqlite3_file_control()] with this |
| 829 | ** opcode as doing so may disrupt the operation of the specialized VFSes |
| 830 | ** that do require it. |
| 831 | ** |
| 832 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 833 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 834 | ** retry counts and intervals for certain disk I/O operations for the |
| 835 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -976,10 +990,12 @@ | |
| 976 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 977 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 978 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 979 | #define SQLITE_FCNTL_TRACE 19 |
| 980 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 981 | |
| 982 | /* |
| 983 | ** CAPI3REF: Mutex Handle |
| 984 | ** |
| 985 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3992,19 +4008,28 @@ | |
| 3992 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 3993 | ** undefined. |
| 3994 | ** |
| 3995 | ** ^The fourth parameter, eTextRep, specifies what |
| 3996 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 3997 | ** its parameters. Every SQL function implementation must be able to work |
| 3998 | ** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be |
| 3999 | ** more efficient with one encoding than another. ^An application may |
| 4000 | ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple |
| 4001 | ** times with the same function but with different values of eTextRep. |
| 4002 | ** ^When multiple implementations of the same function are available, SQLite |
| 4003 | ** will pick the one that involves the least amount of data conversion. |
| 4004 | ** If there is only a single implementation which does not care what text |
| 4005 | ** encoding is used, then the fourth argument should be [SQLITE_ANY]. |
| 4006 | ** |
| 4007 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 4008 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 4009 | ** |
| 4010 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4086,13 +4111,23 @@ | |
| 4086 | */ |
| 4087 | #define SQLITE_UTF8 1 |
| 4088 | #define SQLITE_UTF16LE 2 |
| 4089 | #define SQLITE_UTF16BE 3 |
| 4090 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4091 | #define SQLITE_ANY 5 /* sqlite3_create_function only */ |
| 4092 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4093 | |
| 4094 | /* |
| 4095 | ** CAPI3REF: Deprecated Functions |
| 4096 | ** DEPRECATED |
| 4097 | ** |
| 4098 | ** These functions are [deprecated]. In order to maintain |
| @@ -8590,10 +8625,11 @@ | |
| 8590 | typedef struct Lookaside Lookaside; |
| 8591 | typedef struct LookasideSlot LookasideSlot; |
| 8592 | typedef struct Module Module; |
| 8593 | typedef struct NameContext NameContext; |
| 8594 | typedef struct Parse Parse; |
| 8595 | typedef struct RowSet RowSet; |
| 8596 | typedef struct Savepoint Savepoint; |
| 8597 | typedef struct Select Select; |
| 8598 | typedef struct SelectDest SelectDest; |
| 8599 | typedef struct SrcList SrcList; |
| @@ -9448,10 +9484,11 @@ | |
| 9448 | SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); |
| 9449 | #define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) |
| 9450 | SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); |
| 9451 | SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); |
| 9452 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); |
| 9453 | |
| 9454 | /* Operations on page references. */ |
| 9455 | SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); |
| 9456 | SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); |
| 9457 | SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); |
| @@ -9462,11 +9499,11 @@ | |
| 9462 | /* Functions used to manage pager transactions and savepoints. */ |
| 9463 | SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); |
| 9464 | SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); |
| 9465 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); |
| 9466 | SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); |
| 9467 | SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager); |
| 9468 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); |
| 9469 | SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); |
| 9470 | SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); |
| 9471 | SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); |
| 9472 | SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); |
| @@ -12043,14 +12080,24 @@ | |
| 12043 | SQLITE_PRIVATE int sqlite3IsNaN(double); |
| 12044 | #else |
| 12045 | # define sqlite3IsNaN(X) 0 |
| 12046 | #endif |
| 12047 | |
| 12048 | SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, int, const char*, va_list); |
| 12049 | #ifndef SQLITE_OMIT_TRACE |
| 12050 | SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, const char*, ...); |
| 12051 | #endif |
| 12052 | SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); |
| 12053 | SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); |
| 12054 | SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3*,char*,const char*,...); |
| 12055 | #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) |
| 12056 | SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); |
| @@ -12436,10 +12483,11 @@ | |
| 12436 | |
| 12437 | SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); |
| 12438 | SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); |
| 12439 | SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, |
| 12440 | void(*)(void*)); |
| 12441 | SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); |
| 12442 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); |
| 12443 | SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); |
| 12444 | SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); |
| 12445 | SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); |
| @@ -19894,14 +19942,31 @@ | |
| 19894 | } |
| 19895 | |
| 19896 | /* |
| 19897 | ** Set the StrAccum object to an error mode. |
| 19898 | */ |
| 19899 | void setStrAccumError(StrAccum *p, u8 eError){ |
| 19900 | p->accError = eError; |
| 19901 | p->nAlloc = 0; |
| 19902 | } |
| 19903 | |
| 19904 | /* |
| 19905 | ** On machines with a small stack size, you can redefine the |
| 19906 | ** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. |
| 19907 | */ |
| @@ -19912,14 +19977,14 @@ | |
| 19912 | |
| 19913 | /* |
| 19914 | ** Render a string given by "fmt" into the StrAccum object. |
| 19915 | */ |
| 19916 | SQLITE_PRIVATE void sqlite3VXPrintf( |
| 19917 | StrAccum *pAccum, /* Accumulate results here */ |
| 19918 | int useExtended, /* Allow extended %-conversions */ |
| 19919 | const char *fmt, /* Format string */ |
| 19920 | va_list ap /* arguments */ |
| 19921 | ){ |
| 19922 | int c; /* Next character in the format string */ |
| 19923 | char *bufpt; /* Pointer to the conversion buffer */ |
| 19924 | int precision; /* Precision of the current field */ |
| 19925 | int length; /* Length of the field */ |
| @@ -19933,10 +19998,12 @@ | |
| 19933 | etByte flag_zeropad; /* True if field width constant starts with zero */ |
| 19934 | etByte flag_long; /* True if "l" flag is present */ |
| 19935 | etByte flag_longlong; /* True if the "ll" flag is present */ |
| 19936 | etByte done; /* Loop termination flag */ |
| 19937 | etByte xtype = 0; /* Conversion paradigm */ |
| 19938 | char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ |
| 19939 | sqlite_uint64 longvalue; /* Value for integer types */ |
| 19940 | LONGDOUBLE_TYPE realvalue; /* Value for real types */ |
| 19941 | const et_info *infop; /* Pointer to the appropriate info structure */ |
| 19942 | char *zOut; /* Rendering buffer */ |
| @@ -19947,13 +20014,22 @@ | |
| 19947 | int nsd; /* Number of significant digits returned */ |
| 19948 | double rounder; /* Used for rounding floating point values */ |
| 19949 | etByte flag_dp; /* True if decimal point should be shown */ |
| 19950 | etByte flag_rtz; /* True if trailing zeros should be removed */ |
| 19951 | #endif |
| 19952 | char buf[etBUFSIZE]; /* Conversion buffer */ |
| 19953 | |
| 19954 | bufpt = 0; |
| 19955 | for(; (c=(*fmt))!=0; ++fmt){ |
| 19956 | if( c!='%' ){ |
| 19957 | int amt; |
| 19958 | bufpt = (char *)fmt; |
| 19959 | amt = 1; |
| @@ -19981,11 +20057,15 @@ | |
| 19981 | } |
| 19982 | }while( !done && (c=(*++fmt))!=0 ); |
| 19983 | /* Get the field width */ |
| 19984 | width = 0; |
| 19985 | if( c=='*' ){ |
| 19986 | width = va_arg(ap,int); |
| 19987 | if( width<0 ){ |
| 19988 | flag_leftjustify = 1; |
| 19989 | width = -width; |
| 19990 | } |
| 19991 | c = *++fmt; |
| @@ -19998,11 +20078,15 @@ | |
| 19998 | /* Get the precision */ |
| 19999 | if( c=='.' ){ |
| 20000 | precision = 0; |
| 20001 | c = *++fmt; |
| 20002 | if( c=='*' ){ |
| 20003 | precision = va_arg(ap,int); |
| 20004 | if( precision<0 ) precision = -precision; |
| 20005 | c = *++fmt; |
| 20006 | }else{ |
| 20007 | while( c>='0' && c<='9' ){ |
| 20008 | precision = precision*10 + c - '0'; |
| @@ -20029,11 +20113,11 @@ | |
| 20029 | infop = &fmtinfo[0]; |
| 20030 | xtype = etINVALID; |
| 20031 | for(idx=0; idx<ArraySize(fmtinfo); idx++){ |
| 20032 | if( c==fmtinfo[idx].fmttype ){ |
| 20033 | infop = &fmtinfo[idx]; |
| 20034 | if( useExtended || (infop->flags & FLAG_INTERN)==0 ){ |
| 20035 | xtype = infop->type; |
| 20036 | }else{ |
| 20037 | return; |
| 20038 | } |
| 20039 | break; |
| @@ -20069,11 +20153,13 @@ | |
| 20069 | /* Fall through into the next case */ |
| 20070 | case etORDINAL: |
| 20071 | case etRADIX: |
| 20072 | if( infop->flags & FLAG_SIGNED ){ |
| 20073 | i64 v; |
| 20074 | if( flag_longlong ){ |
| 20075 | v = va_arg(ap,i64); |
| 20076 | }else if( flag_long ){ |
| 20077 | v = va_arg(ap,long int); |
| 20078 | }else{ |
| 20079 | v = va_arg(ap,int); |
| @@ -20090,11 +20176,13 @@ | |
| 20090 | if( flag_plussign ) prefix = '+'; |
| 20091 | else if( flag_blanksign ) prefix = ' '; |
| 20092 | else prefix = 0; |
| 20093 | } |
| 20094 | }else{ |
| 20095 | if( flag_longlong ){ |
| 20096 | longvalue = va_arg(ap,u64); |
| 20097 | }else if( flag_long ){ |
| 20098 | longvalue = va_arg(ap,unsigned long int); |
| 20099 | }else{ |
| 20100 | longvalue = va_arg(ap,unsigned int); |
| @@ -20150,11 +20238,15 @@ | |
| 20150 | length = (int)(&zOut[nOut-1]-bufpt); |
| 20151 | break; |
| 20152 | case etFLOAT: |
| 20153 | case etEXP: |
| 20154 | case etGENERIC: |
| 20155 | realvalue = va_arg(ap,double); |
| 20156 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 20157 | length = 0; |
| 20158 | #else |
| 20159 | if( precision<0 ) precision = 6; /* Set default precision */ |
| 20160 | if( realvalue<0.0 ){ |
| @@ -20305,20 +20397,27 @@ | |
| 20305 | length = width; |
| 20306 | } |
| 20307 | #endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */ |
| 20308 | break; |
| 20309 | case etSIZE: |
| 20310 | *(va_arg(ap,int*)) = pAccum->nChar; |
| 20311 | length = width = 0; |
| 20312 | break; |
| 20313 | case etPERCENT: |
| 20314 | buf[0] = '%'; |
| 20315 | bufpt = buf; |
| 20316 | length = 1; |
| 20317 | break; |
| 20318 | case etCHARX: |
| 20319 | c = va_arg(ap,int); |
| 20320 | buf[0] = (char)c; |
| 20321 | if( precision>=0 ){ |
| 20322 | for(idx=1; idx<precision; idx++) buf[idx] = (char)c; |
| 20323 | length = precision; |
| 20324 | }else{ |
| @@ -20326,14 +20425,18 @@ | |
| 20326 | } |
| 20327 | bufpt = buf; |
| 20328 | break; |
| 20329 | case etSTRING: |
| 20330 | case etDYNSTRING: |
| 20331 | bufpt = va_arg(ap,char*); |
| 20332 | if( bufpt==0 ){ |
| 20333 | bufpt = ""; |
| 20334 | }else if( xtype==etDYNSTRING ){ |
| 20335 | zExtra = bufpt; |
| 20336 | } |
| 20337 | if( precision>=0 ){ |
| 20338 | for(length=0; length<precision && bufpt[length]; length++){} |
| 20339 | }else{ |
| @@ -20345,11 +20448,17 @@ | |
| 20345 | case etSQLESCAPE3: { |
| 20346 | int i, j, k, n, isnull; |
| 20347 | int needQuote; |
| 20348 | char ch; |
| 20349 | char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */ |
| 20350 | char *escarg = va_arg(ap,char*); |
| 20351 | isnull = escarg==0; |
| 20352 | if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); |
| 20353 | k = precision; |
| 20354 | for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){ |
| 20355 | if( ch==q ) n++; |
| @@ -20380,10 +20489,11 @@ | |
| 20380 | ** if( precision>=0 && precision<length ) length = precision; */ |
| 20381 | break; |
| 20382 | } |
| 20383 | case etTOKEN: { |
| 20384 | Token *pToken = va_arg(ap, Token*); |
| 20385 | if( pToken && pToken->n ){ |
| 20386 | sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n); |
| 20387 | } |
| 20388 | length = width = 0; |
| 20389 | break; |
| @@ -20390,10 +20500,11 @@ | |
| 20390 | } |
| 20391 | case etSRCLIST: { |
| 20392 | SrcList *pSrc = va_arg(ap, SrcList*); |
| 20393 | int k = va_arg(ap, int); |
| 20394 | struct SrcList_item *pItem = &pSrc->a[k]; |
| 20395 | assert( k>=0 && k<pSrc->nSrc ); |
| 20396 | if( pItem->zDatabase ){ |
| 20397 | sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase); |
| 20398 | sqlite3StrAccumAppend(pAccum, ".", 1); |
| 20399 | } |
| @@ -20426,11 +20537,11 @@ | |
| 20426 | nspace = width-length; |
| 20427 | if( nspace>0 ){ |
| 20428 | sqlite3AppendSpace(pAccum, nspace); |
| 20429 | } |
| 20430 | } |
| 20431 | sqlite3_free(zExtra); |
| 20432 | }/* End for loop over the format string */ |
| 20433 | } /* End of function */ |
| 20434 | |
| 20435 | /* |
| 20436 | ** Append N bytes of text from z to the StrAccum object. |
| @@ -20553,11 +20664,11 @@ | |
| 20553 | StrAccum acc; |
| 20554 | assert( db!=0 ); |
| 20555 | sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), |
| 20556 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 20557 | acc.db = db; |
| 20558 | sqlite3VXPrintf(&acc, 1, zFormat, ap); |
| 20559 | z = sqlite3StrAccumFinish(&acc); |
| 20560 | if( acc.accError==STRACCUM_NOMEM ){ |
| 20561 | db->mallocFailed = 1; |
| 20562 | } |
| 20563 | return z; |
| @@ -20709,21 +20820,19 @@ | |
| 20709 | fprintf(stdout,"%s", zBuf); |
| 20710 | fflush(stdout); |
| 20711 | } |
| 20712 | #endif |
| 20713 | |
| 20714 | #ifndef SQLITE_OMIT_TRACE |
| 20715 | /* |
| 20716 | ** variable-argument wrapper around sqlite3VXPrintf(). |
| 20717 | */ |
| 20718 | SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){ |
| 20719 | va_list ap; |
| 20720 | va_start(ap,zFormat); |
| 20721 | sqlite3VXPrintf(p, 1, zFormat, ap); |
| 20722 | va_end(ap); |
| 20723 | } |
| 20724 | #endif |
| 20725 | |
| 20726 | /************** End of printf.c **********************************************/ |
| 20727 | /************** Begin file random.c ******************************************/ |
| 20728 | /* |
| 20729 | ** 2001 September 15 |
| @@ -21494,22 +21603,21 @@ | |
| 21494 | ** To clear the most recent error for sqlite handle "db", sqlite3Error |
| 21495 | ** should be called with err_code set to SQLITE_OK and zFormat set |
| 21496 | ** to NULL. |
| 21497 | */ |
| 21498 | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ |
| 21499 | if( db && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){ |
| 21500 | db->errCode = err_code; |
| 21501 | if( zFormat ){ |
| 21502 | char *z; |
| 21503 | va_list ap; |
| 21504 | va_start(ap, zFormat); |
| 21505 | z = sqlite3VMPrintf(db, zFormat, ap); |
| 21506 | va_end(ap); |
| 21507 | sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); |
| 21508 | }else{ |
| 21509 | sqlite3ValueSetStr(db->pErr, 0, 0, SQLITE_UTF8, SQLITE_STATIC); |
| 21510 | } |
| 21511 | } |
| 21512 | } |
| 21513 | |
| 21514 | /* |
| 21515 | ** Add an error message to pParse->zErrMsg and increment pParse->nErr. |
| @@ -37558,10 +37666,11 @@ | |
| 37558 | ** in memory. |
| 37559 | */ |
| 37560 | struct PgHdr1 { |
| 37561 | sqlite3_pcache_page page; |
| 37562 | unsigned int iKey; /* Key value (page number) */ |
| 37563 | PgHdr1 *pNext; /* Next in hash table chain */ |
| 37564 | PCache1 *pCache; /* Cache that currently owns this page */ |
| 37565 | PgHdr1 *pLruNext; /* Next in LRU list of unpinned pages */ |
| 37566 | PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */ |
| 37567 | }; |
| @@ -37886,38 +37995,36 @@ | |
| 37886 | ** This function is used internally to remove the page pPage from the |
| 37887 | ** PGroup LRU list, if is part of it. If pPage is not part of the PGroup |
| 37888 | ** LRU list, then this function is a no-op. |
| 37889 | ** |
| 37890 | ** The PGroup mutex must be held when this function is called. |
| 37891 | ** |
| 37892 | ** If pPage is NULL then this routine is a no-op. |
| 37893 | */ |
| 37894 | static void pcache1PinPage(PgHdr1 *pPage){ |
| 37895 | PCache1 *pCache; |
| 37896 | PGroup *pGroup; |
| 37897 | |
| 37898 | if( pPage==0 ) return; |
| 37899 | pCache = pPage->pCache; |
| 37900 | pGroup = pCache->pGroup; |
| 37901 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 37902 | if( pPage->pLruNext || pPage==pGroup->pLruTail ){ |
| 37903 | if( pPage->pLruPrev ){ |
| 37904 | pPage->pLruPrev->pLruNext = pPage->pLruNext; |
| 37905 | } |
| 37906 | if( pPage->pLruNext ){ |
| 37907 | pPage->pLruNext->pLruPrev = pPage->pLruPrev; |
| 37908 | } |
| 37909 | if( pGroup->pLruHead==pPage ){ |
| 37910 | pGroup->pLruHead = pPage->pLruNext; |
| 37911 | } |
| 37912 | if( pGroup->pLruTail==pPage ){ |
| 37913 | pGroup->pLruTail = pPage->pLruPrev; |
| 37914 | } |
| 37915 | pPage->pLruNext = 0; |
| 37916 | pPage->pLruPrev = 0; |
| 37917 | pPage->pCache->nRecyclable--; |
| 37918 | } |
| 37919 | } |
| 37920 | |
| 37921 | |
| 37922 | /* |
| 37923 | ** Remove the page supplied as an argument from the hash table |
| @@ -37945,10 +38052,11 @@ | |
| 37945 | static void pcache1EnforceMaxPage(PGroup *pGroup){ |
| 37946 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 37947 | while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){ |
| 37948 | PgHdr1 *p = pGroup->pLruTail; |
| 37949 | assert( p->pCache->pGroup==pGroup ); |
| 37950 | pcache1PinPage(p); |
| 37951 | pcache1RemoveFromHash(p); |
| 37952 | pcache1FreePage(p); |
| 37953 | } |
| 37954 | } |
| @@ -37972,11 +38080,11 @@ | |
| 37972 | PgHdr1 *pPage; |
| 37973 | while( (pPage = *pp)!=0 ){ |
| 37974 | if( pPage->iKey>=iLimit ){ |
| 37975 | pCache->nPage--; |
| 37976 | *pp = pPage->pNext; |
| 37977 | pcache1PinPage(pPage); |
| 37978 | pcache1FreePage(pPage); |
| 37979 | }else{ |
| 37980 | pp = &pPage->pNext; |
| 37981 | TESTONLY( nPage++; ) |
| 37982 | } |
| @@ -38195,12 +38303,15 @@ | |
| 38195 | unsigned int h = iKey % pCache->nHash; |
| 38196 | for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage->pNext); |
| 38197 | } |
| 38198 | |
| 38199 | /* Step 2: Abort if no existing page is found and createFlag is 0 */ |
| 38200 | if( pPage || createFlag==0 ){ |
| 38201 | pcache1PinPage(pPage); |
| 38202 | goto fetch_out; |
| 38203 | } |
| 38204 | |
| 38205 | /* The pGroup local variable will normally be initialized by the |
| 38206 | ** pcache1EnterMutex() macro above. But if SQLITE_MUTEX_OMIT is defined, |
| @@ -38237,10 +38348,11 @@ | |
| 38237 | || pGroup->nCurrentPage>=pGroup->nMaxPage |
| 38238 | || pcache1UnderMemoryPressure(pCache) |
| 38239 | )){ |
| 38240 | PCache1 *pOther; |
| 38241 | pPage = pGroup->pLruTail; |
| 38242 | pcache1RemoveFromHash(pPage); |
| 38243 | pcache1PinPage(pPage); |
| 38244 | pOther = pPage->pCache; |
| 38245 | |
| 38246 | /* We want to verify that szPage and szExtra are the same for pOther |
| @@ -38273,10 +38385,11 @@ | |
| 38273 | pPage->iKey = iKey; |
| 38274 | pPage->pNext = pCache->apHash[h]; |
| 38275 | pPage->pCache = pCache; |
| 38276 | pPage->pLruPrev = 0; |
| 38277 | pPage->pLruNext = 0; |
| 38278 | *(void **)pPage->page.pExtra = 0; |
| 38279 | pCache->apHash[h] = pPage; |
| 38280 | } |
| 38281 | |
| 38282 | fetch_out: |
| @@ -38308,10 +38421,11 @@ | |
| 38308 | /* It is an error to call this function if the page is already |
| 38309 | ** part of the PGroup LRU list. |
| 38310 | */ |
| 38311 | assert( pPage->pLruPrev==0 && pPage->pLruNext==0 ); |
| 38312 | assert( pGroup->pLruHead!=pPage && pGroup->pLruTail!=pPage ); |
| 38313 | |
| 38314 | if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){ |
| 38315 | pcache1RemoveFromHash(pPage); |
| 38316 | pcache1FreePage(pPage); |
| 38317 | }else{ |
| @@ -38323,10 +38437,11 @@ | |
| 38323 | }else{ |
| 38324 | pGroup->pLruTail = pPage; |
| 38325 | pGroup->pLruHead = pPage; |
| 38326 | } |
| 38327 | pCache->nRecyclable++; |
| 38328 | } |
| 38329 | |
| 38330 | pcache1LeaveMutex(pCache->pGroup); |
| 38331 | } |
| 38332 | |
| @@ -38449,10 +38564,11 @@ | |
| 38449 | while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){ |
| 38450 | nFree += pcache1MemSize(p->page.pBuf); |
| 38451 | #ifdef SQLITE_PCACHE_SEPARATE_HEADER |
| 38452 | nFree += sqlite3MemSize(p); |
| 38453 | #endif |
| 38454 | pcache1PinPage(p); |
| 38455 | pcache1RemoveFromHash(p); |
| 38456 | pcache1FreePage(p); |
| 38457 | } |
| 38458 | pcache1LeaveMutex(&pcache1.grp); |
| @@ -38473,10 +38589,11 @@ | |
| 38473 | int *pnRecyclable /* OUT: Total number of pages available for recycling */ |
| 38474 | ){ |
| 38475 | PgHdr1 *p; |
| 38476 | int nRecyclable = 0; |
| 38477 | for(p=pcache1.grp.pLruHead; p; p=p->pLruNext){ |
| 38478 | nRecyclable++; |
| 38479 | } |
| 38480 | *pnCurrent = pcache1.grp.nCurrentPage; |
| 38481 | *pnMax = (int)pcache1.grp.nMaxPage; |
| 38482 | *pnMin = (int)pcache1.grp.nMinPage; |
| @@ -40159,29 +40276,26 @@ | |
| 40159 | ** PagerSavepoint.pInSavepoint. |
| 40160 | */ |
| 40161 | static int subjRequiresPage(PgHdr *pPg){ |
| 40162 | Pager *pPager = pPg->pPager; |
| 40163 | PagerSavepoint *p; |
| 40164 | Pgno pgno; |
| 40165 | int i; |
| 40166 | if( pPager->nSavepoint ){ |
| 40167 | pgno = pPg->pgno; |
| 40168 | for(i=0; i<pPager->nSavepoint; i++){ |
| 40169 | p = &pPager->aSavepoint[i]; |
| 40170 | if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){ |
| 40171 | return 1; |
| 40172 | } |
| 40173 | } |
| 40174 | } |
| 40175 | return 0; |
| 40176 | } |
| 40177 | |
| 40178 | /* |
| 40179 | ** Return true if the page is already in the journal file. |
| 40180 | */ |
| 40181 | static int pageInJournal(PgHdr *pPg){ |
| 40182 | return sqlite3BitvecTest(pPg->pPager->pInJournal, pPg->pgno); |
| 40183 | } |
| 40184 | |
| 40185 | /* |
| 40186 | ** Read a 32-bit integer from the given file descriptor. Store the integer |
| 40187 | ** that is read in *pRes. Return SQLITE_OK if everything worked, or an |
| @@ -40384,10 +40498,11 @@ | |
| 40384 | |
| 40385 | if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ)) |
| 40386 | || szJ<16 |
| 40387 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len)) |
| 40388 | || len>=nMaster |
| 40389 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum)) |
| 40390 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) |
| 40391 | || memcmp(aMagic, aJournalMagic, 8) |
| 40392 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) |
| 40393 | ){ |
| @@ -41124,11 +41239,11 @@ | |
| 41124 | sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); |
| 41125 | if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ |
| 41126 | PgHdr *p = pager_lookup(pPager, 1); |
| 41127 | if( p ){ |
| 41128 | p->pageHash = 0; |
| 41129 | sqlite3PagerUnref(p); |
| 41130 | } |
| 41131 | } |
| 41132 | #endif |
| 41133 | |
| 41134 | sqlite3BitvecDestroy(pPager->pInJournal); |
| @@ -41152,10 +41267,15 @@ | |
| 41152 | ** file. So it is safe to truncate the database file to its minimum |
| 41153 | ** required size. */ |
| 41154 | assert( pPager->eLock==EXCLUSIVE_LOCK ); |
| 41155 | rc = pager_truncate(pPager, pPager->dbSize); |
| 41156 | } |
| 41157 | |
| 41158 | if( !pPager->exclusiveMode |
| 41159 | && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0)) |
| 41160 | ){ |
| 41161 | rc2 = pagerUnlockDb(pPager, SHARED_LOCK); |
| @@ -41966,11 +42086,11 @@ | |
| 41966 | testcase( rc!=SQLITE_OK ); |
| 41967 | } |
| 41968 | if( rc==SQLITE_OK |
| 41969 | && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) |
| 41970 | ){ |
| 41971 | rc = sqlite3PagerSync(pPager); |
| 41972 | } |
| 41973 | if( rc==SQLITE_OK ){ |
| 41974 | rc = pager_end_transaction(pPager, zMaster[0]!='\0', 0); |
| 41975 | testcase( rc!=SQLITE_OK ); |
| 41976 | } |
| @@ -42112,11 +42232,11 @@ | |
| 42112 | rc = readDbPage(pPg, iFrame); |
| 42113 | } |
| 42114 | if( rc==SQLITE_OK ){ |
| 42115 | pPager->xReiniter(pPg); |
| 42116 | } |
| 42117 | sqlite3PagerUnref(pPg); |
| 42118 | } |
| 42119 | } |
| 42120 | |
| 42121 | /* Normally, if a transaction is rolled back, any backup processes are |
| 42122 | ** updated as data is copied out of the rollback journal and into the |
| @@ -43467,11 +43587,11 @@ | |
| 43467 | /* Open the sub-journal, if it has not already been opened */ |
| 43468 | assert( pPager->useJournal ); |
| 43469 | assert( isOpen(pPager->jfd) || pagerUseWal(pPager) ); |
| 43470 | assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 ); |
| 43471 | assert( pagerUseWal(pPager) |
| 43472 | || pageInJournal(pPg) |
| 43473 | || pPg->pgno>pPager->dbOrigSize |
| 43474 | ); |
| 43475 | rc = openSubJournal(pPager); |
| 43476 | |
| 43477 | /* If the sub-journal was opened successfully (or was already open), |
| @@ -44568,20 +44688,23 @@ | |
| 44568 | ** If the number of references to the page drop to zero, then the |
| 44569 | ** page is added to the LRU list. When all references to all pages |
| 44570 | ** are released, a rollback occurs and the lock on the database is |
| 44571 | ** removed. |
| 44572 | */ |
| 44573 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){ |
| 44574 | if( pPg ){ |
| 44575 | Pager *pPager = pPg->pPager; |
| 44576 | if( pPg->flags & PGHDR_MMAP ){ |
| 44577 | pagerReleaseMapPage(pPg); |
| 44578 | }else{ |
| 44579 | sqlite3PcacheRelease(pPg); |
| 44580 | } |
| 44581 | pagerUnlockIfUnused(pPager); |
| 44582 | } |
| 44583 | } |
| 44584 | |
| 44585 | /* |
| 44586 | ** This function is called at the start of every write transaction. |
| 44587 | ** There must already be a RESERVED or EXCLUSIVE lock on the database |
| @@ -44765,13 +44888,13 @@ | |
| 44765 | ** one of the journals, the corresponding bit is set in the |
| 44766 | ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs |
| 44767 | ** of any open savepoints as appropriate. |
| 44768 | */ |
| 44769 | static int pager_write(PgHdr *pPg){ |
| 44770 | void *pData = pPg->pData; |
| 44771 | Pager *pPager = pPg->pPager; |
| 44772 | int rc = SQLITE_OK; |
| 44773 | |
| 44774 | /* This routine is not called unless a write-transaction has already |
| 44775 | ** been started. The journal file may or may not be open at this point. |
| 44776 | ** It is never called in the ERROR state. |
| 44777 | */ |
| @@ -44803,19 +44926,20 @@ | |
| 44803 | |
| 44804 | /* Mark the page as dirty. If the page has already been written |
| 44805 | ** to the journal then we can return right away. |
| 44806 | */ |
| 44807 | sqlite3PcacheMakeDirty(pPg); |
| 44808 | if( pageInJournal(pPg) && !subjRequiresPage(pPg) ){ |
| 44809 | assert( !pagerUseWal(pPager) ); |
| 44810 | }else{ |
| 44811 | |
| 44812 | /* The transaction journal now exists and we have a RESERVED or an |
| 44813 | ** EXCLUSIVE lock on the main database file. Write the current page to |
| 44814 | ** the transaction journal if it is not there already. |
| 44815 | */ |
| 44816 | if( !pageInJournal(pPg) && !pagerUseWal(pPager) ){ |
| 44817 | assert( pagerUseWal(pPager)==0 ); |
| 44818 | if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){ |
| 44819 | u32 cksum; |
| 44820 | char *pData2; |
| 44821 | i64 iOff = pPager->journalOff; |
| @@ -44824,11 +44948,11 @@ | |
| 44824 | ** contains the database locks. The following assert verifies |
| 44825 | ** that we do not. */ |
| 44826 | assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); |
| 44827 | |
| 44828 | assert( pPager->journalHdr<=pPager->journalOff ); |
| 44829 | CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); |
| 44830 | cksum = pager_cksum(pPager, (u8*)pData2); |
| 44831 | |
| 44832 | /* Even if an IO or diskfull error occurs while journalling the |
| 44833 | ** page in the block above, set the need-sync flag for the page. |
| 44834 | ** Otherwise, when the transaction is rolled back, the logic in |
| @@ -44876,11 +45000,11 @@ | |
| 44876 | /* If the statement journal is open and the page is not in it, |
| 44877 | ** then write the current page to the statement journal. Note that |
| 44878 | ** the statement journal format differs from the standard journal format |
| 44879 | ** in that it omits the checksums and the header. |
| 44880 | */ |
| 44881 | if( subjRequiresPage(pPg) ){ |
| 44882 | rc = subjournalPage(pPg); |
| 44883 | } |
| 44884 | } |
| 44885 | |
| 44886 | /* Update the database size and return. |
| @@ -44959,18 +45083,18 @@ | |
| 44959 | if( rc==SQLITE_OK ){ |
| 44960 | rc = pager_write(pPage); |
| 44961 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 44962 | needSync = 1; |
| 44963 | } |
| 44964 | sqlite3PagerUnref(pPage); |
| 44965 | } |
| 44966 | } |
| 44967 | }else if( (pPage = pager_lookup(pPager, pg))!=0 ){ |
| 44968 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 44969 | needSync = 1; |
| 44970 | } |
| 44971 | sqlite3PagerUnref(pPage); |
| 44972 | } |
| 44973 | } |
| 44974 | |
| 44975 | /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages |
| 44976 | ** starting at pg1, then it needs to be set for all of them. Because |
| @@ -44982,11 +45106,11 @@ | |
| 44982 | assert( !MEMDB ); |
| 44983 | for(ii=0; ii<nPage; ii++){ |
| 44984 | PgHdr *pPage = pager_lookup(pPager, pg1+ii); |
| 44985 | if( pPage ){ |
| 44986 | pPage->flags |= PGHDR_NEED_SYNC; |
| 44987 | sqlite3PagerUnref(pPage); |
| 44988 | } |
| 44989 | } |
| 44990 | } |
| 44991 | |
| 44992 | assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 ); |
| @@ -45135,21 +45259,21 @@ | |
| 45135 | ** or pages with the Pager.noSync flag set. |
| 45136 | ** |
| 45137 | ** If successful, or if called on a pager for which it is a no-op, this |
| 45138 | ** function returns SQLITE_OK. Otherwise, an IO error code is returned. |
| 45139 | */ |
| 45140 | SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager){ |
| 45141 | int rc = SQLITE_OK; |
| 45142 | if( !pPager->noSync ){ |
| 45143 | assert( !MEMDB ); |
| 45144 | rc = sqlite3OsSync(pPager->fd, pPager->syncFlags); |
| 45145 | }else if( isOpen(pPager->fd) ){ |
| 45146 | assert( !MEMDB ); |
| 45147 | rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC_OMITTED, 0); |
| 45148 | if( rc==SQLITE_NOTFOUND ){ |
| 45149 | rc = SQLITE_OK; |
| 45150 | } |
| 45151 | } |
| 45152 | return rc; |
| 45153 | } |
| 45154 | |
| 45155 | /* |
| @@ -45344,11 +45468,11 @@ | |
| 45344 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 45345 | } |
| 45346 | |
| 45347 | /* Finally, sync the database file. */ |
| 45348 | if( !noSync ){ |
| 45349 | rc = sqlite3PagerSync(pPager); |
| 45350 | } |
| 45351 | IOTRACE(("DBSYNC %p\n", pPager)) |
| 45352 | } |
| 45353 | } |
| 45354 | |
| @@ -45473,11 +45597,13 @@ | |
| 45473 | rc = pager_playback(pPager, 0); |
| 45474 | } |
| 45475 | |
| 45476 | assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK ); |
| 45477 | assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT |
| 45478 | || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR ); |
| 45479 | |
| 45480 | /* If an error occurs during a ROLLBACK, we can no longer trust the pager |
| 45481 | ** cache. So call pager_error() on the way out to make any error persistent. |
| 45482 | */ |
| 45483 | return pager_error(pPager, rc); |
| @@ -45876,11 +46002,11 @@ | |
| 45876 | ** can be written to. The caller has already promised not to write to it. |
| 45877 | */ |
| 45878 | if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){ |
| 45879 | needSyncPgno = pPg->pgno; |
| 45880 | assert( pPager->journalMode==PAGER_JOURNALMODE_OFF || |
| 45881 | pageInJournal(pPg) || pPg->pgno>pPager->dbOrigSize ); |
| 45882 | assert( pPg->flags&PGHDR_DIRTY ); |
| 45883 | } |
| 45884 | |
| 45885 | /* If the cache contains a page with page-number pgno, remove it |
| 45886 | ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for |
| @@ -45910,11 +46036,11 @@ | |
| 45910 | ** as the original page since it has already been allocated. |
| 45911 | */ |
| 45912 | if( MEMDB ){ |
| 45913 | assert( pPgOld ); |
| 45914 | sqlite3PcacheMove(pPgOld, origPgno); |
| 45915 | sqlite3PagerUnref(pPgOld); |
| 45916 | } |
| 45917 | |
| 45918 | if( needSyncPgno ){ |
| 45919 | /* If needSyncPgno is non-zero, then the journal file needs to be |
| 45920 | ** sync()ed before any data is written to database file page needSyncPgno. |
| @@ -45939,11 +46065,11 @@ | |
| 45939 | } |
| 45940 | return rc; |
| 45941 | } |
| 45942 | pPgHdr->flags |= PGHDR_NEED_SYNC; |
| 45943 | sqlite3PcacheMakeDirty(pPgHdr); |
| 45944 | sqlite3PagerUnref(pPgHdr); |
| 45945 | } |
| 45946 | |
| 45947 | return SQLITE_OK; |
| 45948 | } |
| 45949 | #endif |
| @@ -52079,14 +52205,15 @@ | |
| 52079 | */ |
| 52080 | static void releasePage(MemPage *pPage){ |
| 52081 | if( pPage ){ |
| 52082 | assert( pPage->aData ); |
| 52083 | assert( pPage->pBt ); |
| 52084 | assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); |
| 52085 | assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); |
| 52086 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 52087 | sqlite3PagerUnref(pPage->pDbPage); |
| 52088 | } |
| 52089 | } |
| 52090 | |
| 52091 | /* |
| 52092 | ** During a rollback, when the pager reloads information into the cache |
| @@ -59413,11 +59540,11 @@ | |
| 59413 | rc = backupTruncateFile(pFile, iSize); |
| 59414 | } |
| 59415 | |
| 59416 | /* Sync the database file to disk. */ |
| 59417 | if( rc==SQLITE_OK ){ |
| 59418 | rc = sqlite3PagerSync(pDestPager); |
| 59419 | } |
| 59420 | }else{ |
| 59421 | sqlite3PagerTruncateImage(pDestPager, nDestTruncate); |
| 59422 | rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0); |
| 59423 | } |
| @@ -59488,14 +59615,14 @@ | |
| 59488 | /* If a transaction is still open on the Btree, roll it back. */ |
| 59489 | sqlite3BtreeRollback(p->pDest, SQLITE_OK); |
| 59490 | |
| 59491 | /* Set the error code of the destination database handle. */ |
| 59492 | rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc; |
| 59493 | sqlite3Error(p->pDestDb, rc, 0); |
| 59494 | |
| 59495 | /* Exit the mutexes and free the backup context structure. */ |
| 59496 | if( p->pDestDb ){ |
| 59497 | sqlite3LeaveMutexAndCloseZombie(p->pDestDb); |
| 59498 | } |
| 59499 | sqlite3BtreeLeave(p->pSrc); |
| 59500 | if( p->pDestDb ){ |
| 59501 | /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a |
| @@ -60117,10 +60244,13 @@ | |
| 60117 | if( pMem->flags & MEM_RowSet ){ |
| 60118 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60119 | } |
| 60120 | MemSetTypeFlag(pMem, MEM_Null); |
| 60121 | pMem->type = SQLITE_NULL; |
| 60122 | } |
| 60123 | |
| 60124 | /* |
| 60125 | ** Delete any previous value and set the value to be a BLOB of length |
| 60126 | ** n containing all zeros. |
| @@ -63440,10 +63570,11 @@ | |
| 63440 | sqlite3 *db = p->db; |
| 63441 | int rc = p->rc; |
| 63442 | if( p->zErrMsg ){ |
| 63443 | u8 mallocFailed = db->mallocFailed; |
| 63444 | sqlite3BeginBenignMalloc(); |
| 63445 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 63446 | sqlite3EndBenignMalloc(); |
| 63447 | db->mallocFailed = mallocFailed; |
| 63448 | db->errCode = rc; |
| 63449 | }else{ |
| @@ -63508,12 +63639,11 @@ | |
| 63508 | }else if( p->rc && p->expired ){ |
| 63509 | /* The expired flag was set on the VDBE before the first call |
| 63510 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 63511 | ** called), set the database error in this case as well. |
| 63512 | */ |
| 63513 | sqlite3Error(db, p->rc, 0); |
| 63514 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 63515 | sqlite3DbFree(db, p->zErrMsg); |
| 63516 | p->zErrMsg = 0; |
| 63517 | } |
| 63518 | |
| 63519 | /* Reclaim all memory used by the VDBE |
| @@ -64883,20 +65013,21 @@ | |
| 64883 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 64884 | sqlite3_reset(pStmt); |
| 64885 | v->doingRerun = 1; |
| 64886 | assert( v->expired==0 ); |
| 64887 | } |
| 64888 | if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){ |
| 64889 | /* This case occurs after failing to recompile an sql statement. |
| 64890 | ** The error message from the SQL compiler has already been loaded |
| 64891 | ** into the database handle. This block copies the error message |
| 64892 | ** from the database handle into the statement and sets the statement |
| 64893 | ** program counter to 0 to ensure that when the statement is |
| 64894 | ** finalized or reset the parser error message is available via |
| 64895 | ** sqlite3_errmsg() and sqlite3_errcode(). |
| 64896 | */ |
| 64897 | const char *zErr = (const char *)sqlite3_value_text(db->pErr); |
| 64898 | sqlite3DbFree(db, v->zErrMsg); |
| 64899 | if( !db->mallocFailed ){ |
| 64900 | v->zErrMsg = sqlite3DbStrDup(db, zErr); |
| 64901 | v->rc = rc2; |
| 64902 | } else { |
| @@ -65841,13 +65972,13 @@ | |
| 65841 | assert( idx>0 && idx<=p->nVar ); |
| 65842 | pVar = &p->aVar[idx-1]; |
| 65843 | if( pVar->flags & MEM_Null ){ |
| 65844 | sqlite3StrAccumAppend(&out, "NULL", 4); |
| 65845 | }else if( pVar->flags & MEM_Int ){ |
| 65846 | sqlite3XPrintf(&out, "%lld", pVar->u.i); |
| 65847 | }else if( pVar->flags & MEM_Real ){ |
| 65848 | sqlite3XPrintf(&out, "%!.15g", pVar->r); |
| 65849 | }else if( pVar->flags & MEM_Str ){ |
| 65850 | int nOut; /* Number of bytes of the string text to include in output */ |
| 65851 | #ifndef SQLITE_OMIT_UTF16 |
| 65852 | u8 enc = ENC(db); |
| 65853 | Mem utf8; |
| @@ -65864,33 +65995,37 @@ | |
| 65864 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ){ |
| 65865 | nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 65866 | while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } |
| 65867 | } |
| 65868 | #endif |
| 65869 | sqlite3XPrintf(&out, "'%.*q'", nOut, pVar->z); |
| 65870 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65871 | if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 65872 | #endif |
| 65873 | #ifndef SQLITE_OMIT_UTF16 |
| 65874 | if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); |
| 65875 | #endif |
| 65876 | }else if( pVar->flags & MEM_Zero ){ |
| 65877 | sqlite3XPrintf(&out, "zeroblob(%d)", pVar->u.nZero); |
| 65878 | }else{ |
| 65879 | int nOut; /* Number of bytes of the blob to include in output */ |
| 65880 | assert( pVar->flags & MEM_Blob ); |
| 65881 | sqlite3StrAccumAppend(&out, "x'", 2); |
| 65882 | nOut = pVar->n; |
| 65883 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65884 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 65885 | #endif |
| 65886 | for(i=0; i<nOut; i++){ |
| 65887 | sqlite3XPrintf(&out, "%02x", pVar->z[i]&0xff); |
| 65888 | } |
| 65889 | sqlite3StrAccumAppend(&out, "'", 1); |
| 65890 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 65891 | if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut); |
| 65892 | #endif |
| 65893 | } |
| 65894 | } |
| 65895 | } |
| 65896 | return sqlite3StrAccumFinish(&out); |
| @@ -65945,11 +66080,11 @@ | |
| 65945 | int n = p->nIndent; |
| 65946 | if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent); |
| 65947 | sqlite3AppendSpace(&p->str, p->aIndent[n-1]); |
| 65948 | } |
| 65949 | va_start(ap, zFormat); |
| 65950 | sqlite3VXPrintf(&p->str, 1, zFormat, ap); |
| 65951 | va_end(ap); |
| 65952 | } |
| 65953 | } |
| 65954 | |
| 65955 | /* |
| @@ -88246,11 +88381,10 @@ | |
| 88246 | int bestScore = 0; /* Score of best match */ |
| 88247 | int h; /* Hash value */ |
| 88248 | |
| 88249 | assert( nArg>=(-2) ); |
| 88250 | assert( nArg>=(-1) || createFlag==0 ); |
| 88251 | assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); |
| 88252 | h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a); |
| 88253 | |
| 88254 | /* First search for a match amongst the application-defined functions. |
| 88255 | */ |
| 88256 | p = functionSearch(&db->aFunc, h, zName, nName); |
| @@ -89397,10 +89531,36 @@ | |
| 89397 | }while( isText && (zHaystack[0]&0xc0)==0x80 ); |
| 89398 | } |
| 89399 | if( nNeedle>nHaystack ) N = 0; |
| 89400 | sqlite3_result_int(context, N); |
| 89401 | } |
| 89402 | |
| 89403 | /* |
| 89404 | ** Implementation of the substr() function. |
| 89405 | ** |
| 89406 | ** substr(x,p1,p2) returns p2 characters of x[] beginning with p1. |
| @@ -90828,10 +90988,11 @@ | |
| 90828 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), |
| 90829 | FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), |
| 90830 | FUNCTION(instr, 2, 0, 0, instrFunc ), |
| 90831 | FUNCTION(substr, 2, 0, 0, substrFunc ), |
| 90832 | FUNCTION(substr, 3, 0, 0, substrFunc ), |
| 90833 | FUNCTION(unicode, 1, 0, 0, unicodeFunc ), |
| 90834 | FUNCTION(char, -1, 0, 0, charFunc ), |
| 90835 | FUNCTION(abs, 1, 0, 0, absFunc ), |
| 90836 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 90837 | FUNCTION(round, 1, 0, 0, roundFunc ), |
| @@ -119433,13 +119594,11 @@ | |
| 119433 | } |
| 119434 | sqlite3HashClear(&db->aModule); |
| 119435 | #endif |
| 119436 | |
| 119437 | sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */ |
| 119438 | if( db->pErr ){ |
| 119439 | sqlite3ValueFree(db->pErr); |
| 119440 | } |
| 119441 | sqlite3CloseExtensions(db); |
| 119442 | |
| 119443 | db->magic = SQLITE_MAGIC_ERROR; |
| 119444 | |
| 119445 | /* The temp-database schema is allocated differently from the other schema |
| @@ -119818,10 +119977,11 @@ | |
| 119818 | void (*xFinal)(sqlite3_context*), |
| 119819 | FuncDestructor *pDestructor |
| 119820 | ){ |
| 119821 | FuncDef *p; |
| 119822 | int nName; |
| 119823 | |
| 119824 | assert( sqlite3_mutex_held(db->mutex) ); |
| 119825 | if( zFunctionName==0 || |
| 119826 | (xFunc && (xFinal || xStep)) || |
| 119827 | (!xFunc && (xFinal && !xStep)) || |
| @@ -119828,10 +119988,14 @@ | |
| 119828 | (!xFunc && (!xFinal && xStep)) || |
| 119829 | (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) || |
| 119830 | (255<(nName = sqlite3Strlen30( zFunctionName))) ){ |
| 119831 | return SQLITE_MISUSE_BKPT; |
| 119832 | } |
| 119833 | |
| 119834 | #ifndef SQLITE_OMIT_UTF16 |
| 119835 | /* If SQLITE_UTF16 is specified as the encoding type, transform this |
| 119836 | ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the |
| 119837 | ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. |
| @@ -119841,14 +120005,14 @@ | |
| 119841 | */ |
| 119842 | if( enc==SQLITE_UTF16 ){ |
| 119843 | enc = SQLITE_UTF16NATIVE; |
| 119844 | }else if( enc==SQLITE_ANY ){ |
| 119845 | int rc; |
| 119846 | rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8, |
| 119847 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 119848 | if( rc==SQLITE_OK ){ |
| 119849 | rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE, |
| 119850 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 119851 | } |
| 119852 | if( rc!=SQLITE_OK ){ |
| 119853 | return rc; |
| 119854 | } |
| @@ -119887,11 +120051,12 @@ | |
| 119887 | |
| 119888 | if( pDestructor ){ |
| 119889 | pDestructor->nRef++; |
| 119890 | } |
| 119891 | p->pDestructor = pDestructor; |
| 119892 | p->funcFlags &= SQLITE_FUNC_ENCMASK; |
| 119893 | p->xFunc = xFunc; |
| 119894 | p->xStep = xStep; |
| 119895 | p->xFinalize = xFinal; |
| 119896 | p->pUserData = pUserData; |
| 119897 | p->nArg = (u16)nArg; |
| @@ -120317,10 +120482,11 @@ | |
| 120317 | } |
| 120318 | sqlite3_mutex_enter(db->mutex); |
| 120319 | if( db->mallocFailed ){ |
| 120320 | z = sqlite3ErrStr(SQLITE_NOMEM); |
| 120321 | }else{ |
| 120322 | z = (char*)sqlite3_value_text(db->pErr); |
| 120323 | assert( !db->mallocFailed ); |
| 120324 | if( z==0 ){ |
| 120325 | z = sqlite3ErrStr(db->errCode); |
| 120326 | } |
| @@ -120358,12 +120524,11 @@ | |
| 120358 | if( db->mallocFailed ){ |
| 120359 | z = (void *)outOfMem; |
| 120360 | }else{ |
| 120361 | z = sqlite3_value_text16(db->pErr); |
| 120362 | if( z==0 ){ |
| 120363 | sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode), |
| 120364 | SQLITE_UTF8, SQLITE_STATIC); |
| 120365 | z = sqlite3_value_text16(db->pErr); |
| 120366 | } |
| 120367 | /* A malloc() may have failed within the call to sqlite3_value_text16() |
| 120368 | ** above. If this is the case, then the db->mallocFailed flag needs to |
| 120369 | ** be cleared before returning. Do this directly, instead of via |
| @@ -121073,12 +121238,10 @@ | |
| 121073 | if( !db->mallocFailed && rc==SQLITE_OK){ |
| 121074 | rc = sqlite3RtreeInit(db); |
| 121075 | } |
| 121076 | #endif |
| 121077 | |
| 121078 | sqlite3Error(db, rc, 0); |
| 121079 | |
| 121080 | /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking |
| 121081 | ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking |
| 121082 | ** mode. Doing nothing at all also makes NORMAL the default. |
| 121083 | */ |
| 121084 | #ifdef SQLITE_DEFAULT_LOCKING_MODE |
| 121085 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -135,11 +135,11 @@ | |
| 135 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 136 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 137 | */ |
| 138 | #define SQLITE_VERSION "3.8.3" |
| 139 | #define SQLITE_VERSION_NUMBER 3008003 |
| 140 | #define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2" |
| 141 | |
| 142 | /* |
| 143 | ** CAPI3REF: Run-Time Library Version Numbers |
| 144 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 145 | ** |
| @@ -817,19 +817,33 @@ | |
| 817 | ** to the [sqlite3_file] object associated with a particular database |
| 818 | ** connection. See the [sqlite3_file_control()] documentation for |
| 819 | ** additional information. |
| 820 | ** |
| 821 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 822 | ** No longer in use. |
| 823 | ** |
| 824 | ** <li>[[SQLITE_FCNTL_SYNC]] |
| 825 | ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and |
| 826 | ** sent to the VFS immediately before the xSync method is invoked on a |
| 827 | ** database file descriptor. Or, if the xSync method is not invoked |
| 828 | ** because the user has configured SQLite with |
| 829 | ** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place |
| 830 | ** of the xSync method. In most cases, the pointer argument passed with |
| 831 | ** this file-control is NULL. However, if the database file is being synced |
| 832 | ** as part of a multi-database commit, the argument points to a nul-terminated |
| 833 | ** string containing the transactions master-journal file name. VFSes that |
| 834 | ** do not need this signal should silently ignore this opcode. Applications |
| 835 | ** should not call [sqlite3_file_control()] with this opcode as doing so may |
| 836 | ** disrupt the operation of the specialized VFSes that do require it. |
| 837 | ** |
| 838 | ** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]] |
| 839 | ** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite |
| 840 | ** and sent to the VFS after a transaction has been committed immediately |
| 841 | ** but before the database is unlocked. VFSes that do not need this signal |
| 842 | ** should silently ignore this opcode. Applications should not call |
| 843 | ** [sqlite3_file_control()] with this opcode as doing so may disrupt the |
| 844 | ** operation of the specialized VFSes that do require it. |
| 845 | ** |
| 846 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 847 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 848 | ** retry counts and intervals for certain disk I/O operations for the |
| 849 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -976,10 +990,12 @@ | |
| 990 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 991 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 992 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 993 | #define SQLITE_FCNTL_TRACE 19 |
| 994 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 995 | #define SQLITE_FCNTL_SYNC 21 |
| 996 | #define SQLITE_FCNTL_COMMIT_PHASETWO 22 |
| 997 | |
| 998 | /* |
| 999 | ** CAPI3REF: Mutex Handle |
| 1000 | ** |
| 1001 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3992,19 +4008,28 @@ | |
| 4008 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 4009 | ** undefined. |
| 4010 | ** |
| 4011 | ** ^The fourth parameter, eTextRep, specifies what |
| 4012 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 4013 | ** its parameters. The application should set this parameter to |
| 4014 | ** [SQLITE_UTF16LE] if the function implementation invokes |
| 4015 | ** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the |
| 4016 | ** implementation invokes [sqlite3_value_text16be()] on an input, or |
| 4017 | ** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] |
| 4018 | ** otherwise. ^The same SQL function may be registered multiple times using |
| 4019 | ** different preferred text encodings, with different implementations for |
| 4020 | ** each encoding. |
| 4021 | ** ^When multiple implementations of the same function are available, SQLite |
| 4022 | ** will pick the one that involves the least amount of data conversion. |
| 4023 | ** |
| 4024 | ** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] |
| 4025 | ** to signal that the function will always return the same result given |
| 4026 | ** the same inputs within a single SQL statement. Most SQL functions are |
| 4027 | ** deterministic. The built-in [random()] SQL function is an example of a |
| 4028 | ** function that is not deterministic. The SQLite query planner is able to |
| 4029 | ** perform additional optimizations on deterministic functions, so use |
| 4030 | ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. |
| 4031 | ** |
| 4032 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 4033 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 4034 | ** |
| 4035 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4086,13 +4111,23 @@ | |
| 4111 | */ |
| 4112 | #define SQLITE_UTF8 1 |
| 4113 | #define SQLITE_UTF16LE 2 |
| 4114 | #define SQLITE_UTF16BE 3 |
| 4115 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4116 | #define SQLITE_ANY 5 /* Deprecated */ |
| 4117 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4118 | |
| 4119 | /* |
| 4120 | ** CAPI3REF: Function Flags |
| 4121 | ** |
| 4122 | ** These constants may be ORed together with the |
| 4123 | ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument |
| 4124 | ** to [sqlite3_create_function()], [sqlite3_create_function16()], or |
| 4125 | ** [sqlite3_create_function_v2()]. |
| 4126 | */ |
| 4127 | #define SQLITE_DETERMINISTIC 0x800 |
| 4128 | |
| 4129 | /* |
| 4130 | ** CAPI3REF: Deprecated Functions |
| 4131 | ** DEPRECATED |
| 4132 | ** |
| 4133 | ** These functions are [deprecated]. In order to maintain |
| @@ -8590,10 +8625,11 @@ | |
| 8625 | typedef struct Lookaside Lookaside; |
| 8626 | typedef struct LookasideSlot LookasideSlot; |
| 8627 | typedef struct Module Module; |
| 8628 | typedef struct NameContext NameContext; |
| 8629 | typedef struct Parse Parse; |
| 8630 | typedef struct PrintfArguments PrintfArguments; |
| 8631 | typedef struct RowSet RowSet; |
| 8632 | typedef struct Savepoint Savepoint; |
| 8633 | typedef struct Select Select; |
| 8634 | typedef struct SelectDest SelectDest; |
| 8635 | typedef struct SrcList SrcList; |
| @@ -9448,10 +9484,11 @@ | |
| 9484 | SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); |
| 9485 | #define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) |
| 9486 | SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); |
| 9487 | SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); |
| 9488 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); |
| 9489 | SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*); |
| 9490 | |
| 9491 | /* Operations on page references. */ |
| 9492 | SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); |
| 9493 | SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); |
| 9494 | SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); |
| @@ -9462,11 +9499,11 @@ | |
| 9499 | /* Functions used to manage pager transactions and savepoints. */ |
| 9500 | SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); |
| 9501 | SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); |
| 9502 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); |
| 9503 | SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); |
| 9504 | SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster); |
| 9505 | SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); |
| 9506 | SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); |
| 9507 | SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); |
| 9508 | SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); |
| 9509 | SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); |
| @@ -12043,14 +12080,24 @@ | |
| 12080 | SQLITE_PRIVATE int sqlite3IsNaN(double); |
| 12081 | #else |
| 12082 | # define sqlite3IsNaN(X) 0 |
| 12083 | #endif |
| 12084 | |
| 12085 | /* |
| 12086 | ** An instance of the following structure holds information about SQL |
| 12087 | ** functions arguments that are the parameters to the printf() function. |
| 12088 | */ |
| 12089 | struct PrintfArguments { |
| 12090 | int nArg; /* Total number of arguments */ |
| 12091 | int nUsed; /* Number of arguments used so far */ |
| 12092 | sqlite3_value **apArg; /* The argument values */ |
| 12093 | }; |
| 12094 | |
| 12095 | #define SQLITE_PRINTF_INTERNAL 0x01 |
| 12096 | #define SQLITE_PRINTF_SQLFUNC 0x02 |
| 12097 | SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, u32, const char*, va_list); |
| 12098 | SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, u32, const char*, ...); |
| 12099 | SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); |
| 12100 | SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); |
| 12101 | SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3*,char*,const char*,...); |
| 12102 | #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) |
| 12103 | SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); |
| @@ -12436,10 +12483,11 @@ | |
| 12483 | |
| 12484 | SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); |
| 12485 | SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); |
| 12486 | SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, |
| 12487 | void(*)(void*)); |
| 12488 | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*); |
| 12489 | SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); |
| 12490 | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); |
| 12491 | SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); |
| 12492 | SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); |
| 12493 | SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); |
| @@ -19894,14 +19942,31 @@ | |
| 19942 | } |
| 19943 | |
| 19944 | /* |
| 19945 | ** Set the StrAccum object to an error mode. |
| 19946 | */ |
| 19947 | static void setStrAccumError(StrAccum *p, u8 eError){ |
| 19948 | p->accError = eError; |
| 19949 | p->nAlloc = 0; |
| 19950 | } |
| 19951 | |
| 19952 | /* |
| 19953 | ** Extra argument values from a PrintfArguments object |
| 19954 | */ |
| 19955 | static sqlite3_int64 getIntArg(PrintfArguments *p){ |
| 19956 | if( p->nArg<=p->nUsed ) return 0; |
| 19957 | return sqlite3_value_int64(p->apArg[p->nUsed++]); |
| 19958 | } |
| 19959 | static double getDoubleArg(PrintfArguments *p){ |
| 19960 | if( p->nArg<=p->nUsed ) return 0.0; |
| 19961 | return sqlite3_value_double(p->apArg[p->nUsed++]); |
| 19962 | } |
| 19963 | static char *getTextArg(PrintfArguments *p){ |
| 19964 | if( p->nArg<=p->nUsed ) return 0; |
| 19965 | return (char*)sqlite3_value_text(p->apArg[p->nUsed++]); |
| 19966 | } |
| 19967 | |
| 19968 | |
| 19969 | /* |
| 19970 | ** On machines with a small stack size, you can redefine the |
| 19971 | ** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. |
| 19972 | */ |
| @@ -19912,14 +19977,14 @@ | |
| 19977 | |
| 19978 | /* |
| 19979 | ** Render a string given by "fmt" into the StrAccum object. |
| 19980 | */ |
| 19981 | SQLITE_PRIVATE void sqlite3VXPrintf( |
| 19982 | StrAccum *pAccum, /* Accumulate results here */ |
| 19983 | u32 bFlags, /* SQLITE_PRINTF_* flags */ |
| 19984 | const char *fmt, /* Format string */ |
| 19985 | va_list ap /* arguments */ |
| 19986 | ){ |
| 19987 | int c; /* Next character in the format string */ |
| 19988 | char *bufpt; /* Pointer to the conversion buffer */ |
| 19989 | int precision; /* Precision of the current field */ |
| 19990 | int length; /* Length of the field */ |
| @@ -19933,10 +19998,12 @@ | |
| 19998 | etByte flag_zeropad; /* True if field width constant starts with zero */ |
| 19999 | etByte flag_long; /* True if "l" flag is present */ |
| 20000 | etByte flag_longlong; /* True if the "ll" flag is present */ |
| 20001 | etByte done; /* Loop termination flag */ |
| 20002 | etByte xtype = 0; /* Conversion paradigm */ |
| 20003 | u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */ |
| 20004 | u8 useIntern; /* Ok to use internal conversions (ex: %T) */ |
| 20005 | char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ |
| 20006 | sqlite_uint64 longvalue; /* Value for integer types */ |
| 20007 | LONGDOUBLE_TYPE realvalue; /* Value for real types */ |
| 20008 | const et_info *infop; /* Pointer to the appropriate info structure */ |
| 20009 | char *zOut; /* Rendering buffer */ |
| @@ -19947,13 +20014,22 @@ | |
| 20014 | int nsd; /* Number of significant digits returned */ |
| 20015 | double rounder; /* Used for rounding floating point values */ |
| 20016 | etByte flag_dp; /* True if decimal point should be shown */ |
| 20017 | etByte flag_rtz; /* True if trailing zeros should be removed */ |
| 20018 | #endif |
| 20019 | PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */ |
| 20020 | char buf[etBUFSIZE]; /* Conversion buffer */ |
| 20021 | |
| 20022 | bufpt = 0; |
| 20023 | if( bFlags ){ |
| 20024 | if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){ |
| 20025 | pArgList = va_arg(ap, PrintfArguments*); |
| 20026 | } |
| 20027 | useIntern = bFlags & SQLITE_PRINTF_INTERNAL; |
| 20028 | }else{ |
| 20029 | bArgList = useIntern = 0; |
| 20030 | } |
| 20031 | for(; (c=(*fmt))!=0; ++fmt){ |
| 20032 | if( c!='%' ){ |
| 20033 | int amt; |
| 20034 | bufpt = (char *)fmt; |
| 20035 | amt = 1; |
| @@ -19981,11 +20057,15 @@ | |
| 20057 | } |
| 20058 | }while( !done && (c=(*++fmt))!=0 ); |
| 20059 | /* Get the field width */ |
| 20060 | width = 0; |
| 20061 | if( c=='*' ){ |
| 20062 | if( bArgList ){ |
| 20063 | width = (int)getIntArg(pArgList); |
| 20064 | }else{ |
| 20065 | width = va_arg(ap,int); |
| 20066 | } |
| 20067 | if( width<0 ){ |
| 20068 | flag_leftjustify = 1; |
| 20069 | width = -width; |
| 20070 | } |
| 20071 | c = *++fmt; |
| @@ -19998,11 +20078,15 @@ | |
| 20078 | /* Get the precision */ |
| 20079 | if( c=='.' ){ |
| 20080 | precision = 0; |
| 20081 | c = *++fmt; |
| 20082 | if( c=='*' ){ |
| 20083 | if( bArgList ){ |
| 20084 | precision = (int)getIntArg(pArgList); |
| 20085 | }else{ |
| 20086 | precision = va_arg(ap,int); |
| 20087 | } |
| 20088 | if( precision<0 ) precision = -precision; |
| 20089 | c = *++fmt; |
| 20090 | }else{ |
| 20091 | while( c>='0' && c<='9' ){ |
| 20092 | precision = precision*10 + c - '0'; |
| @@ -20029,11 +20113,11 @@ | |
| 20113 | infop = &fmtinfo[0]; |
| 20114 | xtype = etINVALID; |
| 20115 | for(idx=0; idx<ArraySize(fmtinfo); idx++){ |
| 20116 | if( c==fmtinfo[idx].fmttype ){ |
| 20117 | infop = &fmtinfo[idx]; |
| 20118 | if( useIntern || (infop->flags & FLAG_INTERN)==0 ){ |
| 20119 | xtype = infop->type; |
| 20120 | }else{ |
| 20121 | return; |
| 20122 | } |
| 20123 | break; |
| @@ -20069,11 +20153,13 @@ | |
| 20153 | /* Fall through into the next case */ |
| 20154 | case etORDINAL: |
| 20155 | case etRADIX: |
| 20156 | if( infop->flags & FLAG_SIGNED ){ |
| 20157 | i64 v; |
| 20158 | if( bArgList ){ |
| 20159 | v = getIntArg(pArgList); |
| 20160 | }else if( flag_longlong ){ |
| 20161 | v = va_arg(ap,i64); |
| 20162 | }else if( flag_long ){ |
| 20163 | v = va_arg(ap,long int); |
| 20164 | }else{ |
| 20165 | v = va_arg(ap,int); |
| @@ -20090,11 +20176,13 @@ | |
| 20176 | if( flag_plussign ) prefix = '+'; |
| 20177 | else if( flag_blanksign ) prefix = ' '; |
| 20178 | else prefix = 0; |
| 20179 | } |
| 20180 | }else{ |
| 20181 | if( bArgList ){ |
| 20182 | longvalue = (u64)getIntArg(pArgList); |
| 20183 | }else if( flag_longlong ){ |
| 20184 | longvalue = va_arg(ap,u64); |
| 20185 | }else if( flag_long ){ |
| 20186 | longvalue = va_arg(ap,unsigned long int); |
| 20187 | }else{ |
| 20188 | longvalue = va_arg(ap,unsigned int); |
| @@ -20150,11 +20238,15 @@ | |
| 20238 | length = (int)(&zOut[nOut-1]-bufpt); |
| 20239 | break; |
| 20240 | case etFLOAT: |
| 20241 | case etEXP: |
| 20242 | case etGENERIC: |
| 20243 | if( bArgList ){ |
| 20244 | realvalue = getDoubleArg(pArgList); |
| 20245 | }else{ |
| 20246 | realvalue = va_arg(ap,double); |
| 20247 | } |
| 20248 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 20249 | length = 0; |
| 20250 | #else |
| 20251 | if( precision<0 ) precision = 6; /* Set default precision */ |
| 20252 | if( realvalue<0.0 ){ |
| @@ -20305,20 +20397,27 @@ | |
| 20397 | length = width; |
| 20398 | } |
| 20399 | #endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */ |
| 20400 | break; |
| 20401 | case etSIZE: |
| 20402 | if( !bArgList ){ |
| 20403 | *(va_arg(ap,int*)) = pAccum->nChar; |
| 20404 | } |
| 20405 | length = width = 0; |
| 20406 | break; |
| 20407 | case etPERCENT: |
| 20408 | buf[0] = '%'; |
| 20409 | bufpt = buf; |
| 20410 | length = 1; |
| 20411 | break; |
| 20412 | case etCHARX: |
| 20413 | if( bArgList ){ |
| 20414 | bufpt = getTextArg(pArgList); |
| 20415 | c = bufpt ? bufpt[0] : 0; |
| 20416 | }else{ |
| 20417 | c = va_arg(ap,int); |
| 20418 | } |
| 20419 | buf[0] = (char)c; |
| 20420 | if( precision>=0 ){ |
| 20421 | for(idx=1; idx<precision; idx++) buf[idx] = (char)c; |
| 20422 | length = precision; |
| 20423 | }else{ |
| @@ -20326,14 +20425,18 @@ | |
| 20425 | } |
| 20426 | bufpt = buf; |
| 20427 | break; |
| 20428 | case etSTRING: |
| 20429 | case etDYNSTRING: |
| 20430 | if( bArgList ){ |
| 20431 | bufpt = getTextArg(pArgList); |
| 20432 | }else{ |
| 20433 | bufpt = va_arg(ap,char*); |
| 20434 | } |
| 20435 | if( bufpt==0 ){ |
| 20436 | bufpt = ""; |
| 20437 | }else if( xtype==etDYNSTRING && !bArgList ){ |
| 20438 | zExtra = bufpt; |
| 20439 | } |
| 20440 | if( precision>=0 ){ |
| 20441 | for(length=0; length<precision && bufpt[length]; length++){} |
| 20442 | }else{ |
| @@ -20345,11 +20448,17 @@ | |
| 20448 | case etSQLESCAPE3: { |
| 20449 | int i, j, k, n, isnull; |
| 20450 | int needQuote; |
| 20451 | char ch; |
| 20452 | char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */ |
| 20453 | char *escarg; |
| 20454 | |
| 20455 | if( bArgList ){ |
| 20456 | escarg = getTextArg(pArgList); |
| 20457 | }else{ |
| 20458 | escarg = va_arg(ap,char*); |
| 20459 | } |
| 20460 | isnull = escarg==0; |
| 20461 | if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); |
| 20462 | k = precision; |
| 20463 | for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){ |
| 20464 | if( ch==q ) n++; |
| @@ -20380,10 +20489,11 @@ | |
| 20489 | ** if( precision>=0 && precision<length ) length = precision; */ |
| 20490 | break; |
| 20491 | } |
| 20492 | case etTOKEN: { |
| 20493 | Token *pToken = va_arg(ap, Token*); |
| 20494 | assert( bArgList==0 ); |
| 20495 | if( pToken && pToken->n ){ |
| 20496 | sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n); |
| 20497 | } |
| 20498 | length = width = 0; |
| 20499 | break; |
| @@ -20390,10 +20500,11 @@ | |
| 20500 | } |
| 20501 | case etSRCLIST: { |
| 20502 | SrcList *pSrc = va_arg(ap, SrcList*); |
| 20503 | int k = va_arg(ap, int); |
| 20504 | struct SrcList_item *pItem = &pSrc->a[k]; |
| 20505 | assert( bArgList==0 ); |
| 20506 | assert( k>=0 && k<pSrc->nSrc ); |
| 20507 | if( pItem->zDatabase ){ |
| 20508 | sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase); |
| 20509 | sqlite3StrAccumAppend(pAccum, ".", 1); |
| 20510 | } |
| @@ -20426,11 +20537,11 @@ | |
| 20537 | nspace = width-length; |
| 20538 | if( nspace>0 ){ |
| 20539 | sqlite3AppendSpace(pAccum, nspace); |
| 20540 | } |
| 20541 | } |
| 20542 | if( zExtra ) sqlite3_free(zExtra); |
| 20543 | }/* End for loop over the format string */ |
| 20544 | } /* End of function */ |
| 20545 | |
| 20546 | /* |
| 20547 | ** Append N bytes of text from z to the StrAccum object. |
| @@ -20553,11 +20664,11 @@ | |
| 20664 | StrAccum acc; |
| 20665 | assert( db!=0 ); |
| 20666 | sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), |
| 20667 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 20668 | acc.db = db; |
| 20669 | sqlite3VXPrintf(&acc, SQLITE_PRINTF_INTERNAL, zFormat, ap); |
| 20670 | z = sqlite3StrAccumFinish(&acc); |
| 20671 | if( acc.accError==STRACCUM_NOMEM ){ |
| 20672 | db->mallocFailed = 1; |
| 20673 | } |
| 20674 | return z; |
| @@ -20709,21 +20820,19 @@ | |
| 20820 | fprintf(stdout,"%s", zBuf); |
| 20821 | fflush(stdout); |
| 20822 | } |
| 20823 | #endif |
| 20824 | |
| 20825 | /* |
| 20826 | ** variable-argument wrapper around sqlite3VXPrintf(). |
| 20827 | */ |
| 20828 | SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, u32 bFlags, const char *zFormat, ...){ |
| 20829 | va_list ap; |
| 20830 | va_start(ap,zFormat); |
| 20831 | sqlite3VXPrintf(p, bFlags, zFormat, ap); |
| 20832 | va_end(ap); |
| 20833 | } |
| 20834 | |
| 20835 | /************** End of printf.c **********************************************/ |
| 20836 | /************** Begin file random.c ******************************************/ |
| 20837 | /* |
| 20838 | ** 2001 September 15 |
| @@ -21494,22 +21603,21 @@ | |
| 21603 | ** To clear the most recent error for sqlite handle "db", sqlite3Error |
| 21604 | ** should be called with err_code set to SQLITE_OK and zFormat set |
| 21605 | ** to NULL. |
| 21606 | */ |
| 21607 | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ |
| 21608 | assert( db!=0 ); |
| 21609 | db->errCode = err_code; |
| 21610 | if( zFormat && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){ |
| 21611 | char *z; |
| 21612 | va_list ap; |
| 21613 | va_start(ap, zFormat); |
| 21614 | z = sqlite3VMPrintf(db, zFormat, ap); |
| 21615 | va_end(ap); |
| 21616 | sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); |
| 21617 | }else if( db->pErr ){ |
| 21618 | sqlite3ValueSetNull(db->pErr); |
| 21619 | } |
| 21620 | } |
| 21621 | |
| 21622 | /* |
| 21623 | ** Add an error message to pParse->zErrMsg and increment pParse->nErr. |
| @@ -37558,10 +37666,11 @@ | |
| 37666 | ** in memory. |
| 37667 | */ |
| 37668 | struct PgHdr1 { |
| 37669 | sqlite3_pcache_page page; |
| 37670 | unsigned int iKey; /* Key value (page number) */ |
| 37671 | u8 isPinned; /* Page in use, not on the LRU list */ |
| 37672 | PgHdr1 *pNext; /* Next in hash table chain */ |
| 37673 | PCache1 *pCache; /* Cache that currently owns this page */ |
| 37674 | PgHdr1 *pLruNext; /* Next in LRU list of unpinned pages */ |
| 37675 | PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */ |
| 37676 | }; |
| @@ -37886,38 +37995,36 @@ | |
| 37995 | ** This function is used internally to remove the page pPage from the |
| 37996 | ** PGroup LRU list, if is part of it. If pPage is not part of the PGroup |
| 37997 | ** LRU list, then this function is a no-op. |
| 37998 | ** |
| 37999 | ** The PGroup mutex must be held when this function is called. |
| 38000 | */ |
| 38001 | static void pcache1PinPage(PgHdr1 *pPage){ |
| 38002 | PCache1 *pCache; |
| 38003 | PGroup *pGroup; |
| 38004 | |
| 38005 | assert( pPage!=0 ); |
| 38006 | assert( pPage->isPinned==0 ); |
| 38007 | pCache = pPage->pCache; |
| 38008 | pGroup = pCache->pGroup; |
| 38009 | assert( pPage->pLruNext || pPage==pGroup->pLruTail ); |
| 38010 | assert( pPage->pLruPrev || pPage==pGroup->pLruHead ); |
| 38011 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 38012 | if( pPage->pLruPrev ){ |
| 38013 | pPage->pLruPrev->pLruNext = pPage->pLruNext; |
| 38014 | }else{ |
| 38015 | pGroup->pLruHead = pPage->pLruNext; |
| 38016 | } |
| 38017 | if( pPage->pLruNext ){ |
| 38018 | pPage->pLruNext->pLruPrev = pPage->pLruPrev; |
| 38019 | }else{ |
| 38020 | pGroup->pLruTail = pPage->pLruPrev; |
| 38021 | } |
| 38022 | pPage->pLruNext = 0; |
| 38023 | pPage->pLruPrev = 0; |
| 38024 | pPage->isPinned = 1; |
| 38025 | pCache->nRecyclable--; |
| 38026 | } |
| 38027 | |
| 38028 | |
| 38029 | /* |
| 38030 | ** Remove the page supplied as an argument from the hash table |
| @@ -37945,10 +38052,11 @@ | |
| 38052 | static void pcache1EnforceMaxPage(PGroup *pGroup){ |
| 38053 | assert( sqlite3_mutex_held(pGroup->mutex) ); |
| 38054 | while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){ |
| 38055 | PgHdr1 *p = pGroup->pLruTail; |
| 38056 | assert( p->pCache->pGroup==pGroup ); |
| 38057 | assert( p->isPinned==0 ); |
| 38058 | pcache1PinPage(p); |
| 38059 | pcache1RemoveFromHash(p); |
| 38060 | pcache1FreePage(p); |
| 38061 | } |
| 38062 | } |
| @@ -37972,11 +38080,11 @@ | |
| 38080 | PgHdr1 *pPage; |
| 38081 | while( (pPage = *pp)!=0 ){ |
| 38082 | if( pPage->iKey>=iLimit ){ |
| 38083 | pCache->nPage--; |
| 38084 | *pp = pPage->pNext; |
| 38085 | if( !pPage->isPinned ) pcache1PinPage(pPage); |
| 38086 | pcache1FreePage(pPage); |
| 38087 | }else{ |
| 38088 | pp = &pPage->pNext; |
| 38089 | TESTONLY( nPage++; ) |
| 38090 | } |
| @@ -38195,12 +38303,15 @@ | |
| 38303 | unsigned int h = iKey % pCache->nHash; |
| 38304 | for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage->pNext); |
| 38305 | } |
| 38306 | |
| 38307 | /* Step 2: Abort if no existing page is found and createFlag is 0 */ |
| 38308 | if( pPage ){ |
| 38309 | if( !pPage->isPinned ) pcache1PinPage(pPage); |
| 38310 | goto fetch_out; |
| 38311 | } |
| 38312 | if( createFlag==0 ){ |
| 38313 | goto fetch_out; |
| 38314 | } |
| 38315 | |
| 38316 | /* The pGroup local variable will normally be initialized by the |
| 38317 | ** pcache1EnterMutex() macro above. But if SQLITE_MUTEX_OMIT is defined, |
| @@ -38237,10 +38348,11 @@ | |
| 38348 | || pGroup->nCurrentPage>=pGroup->nMaxPage |
| 38349 | || pcache1UnderMemoryPressure(pCache) |
| 38350 | )){ |
| 38351 | PCache1 *pOther; |
| 38352 | pPage = pGroup->pLruTail; |
| 38353 | assert( pPage->isPinned==0 ); |
| 38354 | pcache1RemoveFromHash(pPage); |
| 38355 | pcache1PinPage(pPage); |
| 38356 | pOther = pPage->pCache; |
| 38357 | |
| 38358 | /* We want to verify that szPage and szExtra are the same for pOther |
| @@ -38273,10 +38385,11 @@ | |
| 38385 | pPage->iKey = iKey; |
| 38386 | pPage->pNext = pCache->apHash[h]; |
| 38387 | pPage->pCache = pCache; |
| 38388 | pPage->pLruPrev = 0; |
| 38389 | pPage->pLruNext = 0; |
| 38390 | pPage->isPinned = 1; |
| 38391 | *(void **)pPage->page.pExtra = 0; |
| 38392 | pCache->apHash[h] = pPage; |
| 38393 | } |
| 38394 | |
| 38395 | fetch_out: |
| @@ -38308,10 +38421,11 @@ | |
| 38421 | /* It is an error to call this function if the page is already |
| 38422 | ** part of the PGroup LRU list. |
| 38423 | */ |
| 38424 | assert( pPage->pLruPrev==0 && pPage->pLruNext==0 ); |
| 38425 | assert( pGroup->pLruHead!=pPage && pGroup->pLruTail!=pPage ); |
| 38426 | assert( pPage->isPinned==1 ); |
| 38427 | |
| 38428 | if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){ |
| 38429 | pcache1RemoveFromHash(pPage); |
| 38430 | pcache1FreePage(pPage); |
| 38431 | }else{ |
| @@ -38323,10 +38437,11 @@ | |
| 38437 | }else{ |
| 38438 | pGroup->pLruTail = pPage; |
| 38439 | pGroup->pLruHead = pPage; |
| 38440 | } |
| 38441 | pCache->nRecyclable++; |
| 38442 | pPage->isPinned = 0; |
| 38443 | } |
| 38444 | |
| 38445 | pcache1LeaveMutex(pCache->pGroup); |
| 38446 | } |
| 38447 | |
| @@ -38449,10 +38564,11 @@ | |
| 38564 | while( (nReq<0 || nFree<nReq) && ((p=pcache1.grp.pLruTail)!=0) ){ |
| 38565 | nFree += pcache1MemSize(p->page.pBuf); |
| 38566 | #ifdef SQLITE_PCACHE_SEPARATE_HEADER |
| 38567 | nFree += sqlite3MemSize(p); |
| 38568 | #endif |
| 38569 | assert( p->isPinned==0 ); |
| 38570 | pcache1PinPage(p); |
| 38571 | pcache1RemoveFromHash(p); |
| 38572 | pcache1FreePage(p); |
| 38573 | } |
| 38574 | pcache1LeaveMutex(&pcache1.grp); |
| @@ -38473,10 +38589,11 @@ | |
| 38589 | int *pnRecyclable /* OUT: Total number of pages available for recycling */ |
| 38590 | ){ |
| 38591 | PgHdr1 *p; |
| 38592 | int nRecyclable = 0; |
| 38593 | for(p=pcache1.grp.pLruHead; p; p=p->pLruNext){ |
| 38594 | assert( p->isPinned==0 ); |
| 38595 | nRecyclable++; |
| 38596 | } |
| 38597 | *pnCurrent = pcache1.grp.nCurrentPage; |
| 38598 | *pnMax = (int)pcache1.grp.nMaxPage; |
| 38599 | *pnMin = (int)pcache1.grp.nMinPage; |
| @@ -40159,29 +40276,26 @@ | |
| 40276 | ** PagerSavepoint.pInSavepoint. |
| 40277 | */ |
| 40278 | static int subjRequiresPage(PgHdr *pPg){ |
| 40279 | Pager *pPager = pPg->pPager; |
| 40280 | PagerSavepoint *p; |
| 40281 | Pgno pgno = pPg->pgno; |
| 40282 | int i; |
| 40283 | for(i=0; i<pPager->nSavepoint; i++){ |
| 40284 | p = &pPager->aSavepoint[i]; |
| 40285 | if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){ |
| 40286 | return 1; |
| 40287 | } |
| 40288 | } |
| 40289 | return 0; |
| 40290 | } |
| 40291 | |
| 40292 | /* |
| 40293 | ** Return true if the page is already in the journal file. |
| 40294 | */ |
| 40295 | static int pageInJournal(Pager *pPager, PgHdr *pPg){ |
| 40296 | return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno); |
| 40297 | } |
| 40298 | |
| 40299 | /* |
| 40300 | ** Read a 32-bit integer from the given file descriptor. Store the integer |
| 40301 | ** that is read in *pRes. Return SQLITE_OK if everything worked, or an |
| @@ -40384,10 +40498,11 @@ | |
| 40498 | |
| 40499 | if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ)) |
| 40500 | || szJ<16 |
| 40501 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len)) |
| 40502 | || len>=nMaster |
| 40503 | || len==0 |
| 40504 | || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum)) |
| 40505 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) |
| 40506 | || memcmp(aMagic, aJournalMagic, 8) |
| 40507 | || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) |
| 40508 | ){ |
| @@ -41124,11 +41239,11 @@ | |
| 41239 | sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); |
| 41240 | if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ |
| 41241 | PgHdr *p = pager_lookup(pPager, 1); |
| 41242 | if( p ){ |
| 41243 | p->pageHash = 0; |
| 41244 | sqlite3PagerUnrefNotNull(p); |
| 41245 | } |
| 41246 | } |
| 41247 | #endif |
| 41248 | |
| 41249 | sqlite3BitvecDestroy(pPager->pInJournal); |
| @@ -41152,10 +41267,15 @@ | |
| 41267 | ** file. So it is safe to truncate the database file to its minimum |
| 41268 | ** required size. */ |
| 41269 | assert( pPager->eLock==EXCLUSIVE_LOCK ); |
| 41270 | rc = pager_truncate(pPager, pPager->dbSize); |
| 41271 | } |
| 41272 | |
| 41273 | if( rc==SQLITE_OK && bCommit && isOpen(pPager->fd) ){ |
| 41274 | rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0); |
| 41275 | if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; |
| 41276 | } |
| 41277 | |
| 41278 | if( !pPager->exclusiveMode |
| 41279 | && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0)) |
| 41280 | ){ |
| 41281 | rc2 = pagerUnlockDb(pPager, SHARED_LOCK); |
| @@ -41966,11 +42086,11 @@ | |
| 42086 | testcase( rc!=SQLITE_OK ); |
| 42087 | } |
| 42088 | if( rc==SQLITE_OK |
| 42089 | && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) |
| 42090 | ){ |
| 42091 | rc = sqlite3PagerSync(pPager, 0); |
| 42092 | } |
| 42093 | if( rc==SQLITE_OK ){ |
| 42094 | rc = pager_end_transaction(pPager, zMaster[0]!='\0', 0); |
| 42095 | testcase( rc!=SQLITE_OK ); |
| 42096 | } |
| @@ -42112,11 +42232,11 @@ | |
| 42232 | rc = readDbPage(pPg, iFrame); |
| 42233 | } |
| 42234 | if( rc==SQLITE_OK ){ |
| 42235 | pPager->xReiniter(pPg); |
| 42236 | } |
| 42237 | sqlite3PagerUnrefNotNull(pPg); |
| 42238 | } |
| 42239 | } |
| 42240 | |
| 42241 | /* Normally, if a transaction is rolled back, any backup processes are |
| 42242 | ** updated as data is copied out of the rollback journal and into the |
| @@ -43467,11 +43587,11 @@ | |
| 43587 | /* Open the sub-journal, if it has not already been opened */ |
| 43588 | assert( pPager->useJournal ); |
| 43589 | assert( isOpen(pPager->jfd) || pagerUseWal(pPager) ); |
| 43590 | assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 ); |
| 43591 | assert( pagerUseWal(pPager) |
| 43592 | || pageInJournal(pPager, pPg) |
| 43593 | || pPg->pgno>pPager->dbOrigSize |
| 43594 | ); |
| 43595 | rc = openSubJournal(pPager); |
| 43596 | |
| 43597 | /* If the sub-journal was opened successfully (or was already open), |
| @@ -44568,20 +44688,23 @@ | |
| 44688 | ** If the number of references to the page drop to zero, then the |
| 44689 | ** page is added to the LRU list. When all references to all pages |
| 44690 | ** are released, a rollback occurs and the lock on the database is |
| 44691 | ** removed. |
| 44692 | */ |
| 44693 | SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){ |
| 44694 | Pager *pPager; |
| 44695 | assert( pPg!=0 ); |
| 44696 | pPager = pPg->pPager; |
| 44697 | if( pPg->flags & PGHDR_MMAP ){ |
| 44698 | pagerReleaseMapPage(pPg); |
| 44699 | }else{ |
| 44700 | sqlite3PcacheRelease(pPg); |
| 44701 | } |
| 44702 | pagerUnlockIfUnused(pPager); |
| 44703 | } |
| 44704 | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){ |
| 44705 | if( pPg ) sqlite3PagerUnrefNotNull(pPg); |
| 44706 | } |
| 44707 | |
| 44708 | /* |
| 44709 | ** This function is called at the start of every write transaction. |
| 44710 | ** There must already be a RESERVED or EXCLUSIVE lock on the database |
| @@ -44765,13 +44888,13 @@ | |
| 44888 | ** one of the journals, the corresponding bit is set in the |
| 44889 | ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs |
| 44890 | ** of any open savepoints as appropriate. |
| 44891 | */ |
| 44892 | static int pager_write(PgHdr *pPg){ |
| 44893 | Pager *pPager = pPg->pPager; |
| 44894 | int rc = SQLITE_OK; |
| 44895 | int inJournal; |
| 44896 | |
| 44897 | /* This routine is not called unless a write-transaction has already |
| 44898 | ** been started. The journal file may or may not be open at this point. |
| 44899 | ** It is never called in the ERROR state. |
| 44900 | */ |
| @@ -44803,19 +44926,20 @@ | |
| 44926 | |
| 44927 | /* Mark the page as dirty. If the page has already been written |
| 44928 | ** to the journal then we can return right away. |
| 44929 | */ |
| 44930 | sqlite3PcacheMakeDirty(pPg); |
| 44931 | inJournal = pageInJournal(pPager, pPg); |
| 44932 | if( inJournal && (pPager->nSavepoint==0 || !subjRequiresPage(pPg)) ){ |
| 44933 | assert( !pagerUseWal(pPager) ); |
| 44934 | }else{ |
| 44935 | |
| 44936 | /* The transaction journal now exists and we have a RESERVED or an |
| 44937 | ** EXCLUSIVE lock on the main database file. Write the current page to |
| 44938 | ** the transaction journal if it is not there already. |
| 44939 | */ |
| 44940 | if( !inJournal && !pagerUseWal(pPager) ){ |
| 44941 | assert( pagerUseWal(pPager)==0 ); |
| 44942 | if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){ |
| 44943 | u32 cksum; |
| 44944 | char *pData2; |
| 44945 | i64 iOff = pPager->journalOff; |
| @@ -44824,11 +44948,11 @@ | |
| 44948 | ** contains the database locks. The following assert verifies |
| 44949 | ** that we do not. */ |
| 44950 | assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); |
| 44951 | |
| 44952 | assert( pPager->journalHdr<=pPager->journalOff ); |
| 44953 | CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); |
| 44954 | cksum = pager_cksum(pPager, (u8*)pData2); |
| 44955 | |
| 44956 | /* Even if an IO or diskfull error occurs while journalling the |
| 44957 | ** page in the block above, set the need-sync flag for the page. |
| 44958 | ** Otherwise, when the transaction is rolled back, the logic in |
| @@ -44876,11 +45000,11 @@ | |
| 45000 | /* If the statement journal is open and the page is not in it, |
| 45001 | ** then write the current page to the statement journal. Note that |
| 45002 | ** the statement journal format differs from the standard journal format |
| 45003 | ** in that it omits the checksums and the header. |
| 45004 | */ |
| 45005 | if( pPager->nSavepoint>0 && subjRequiresPage(pPg) ){ |
| 45006 | rc = subjournalPage(pPg); |
| 45007 | } |
| 45008 | } |
| 45009 | |
| 45010 | /* Update the database size and return. |
| @@ -44959,18 +45083,18 @@ | |
| 45083 | if( rc==SQLITE_OK ){ |
| 45084 | rc = pager_write(pPage); |
| 45085 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 45086 | needSync = 1; |
| 45087 | } |
| 45088 | sqlite3PagerUnrefNotNull(pPage); |
| 45089 | } |
| 45090 | } |
| 45091 | }else if( (pPage = pager_lookup(pPager, pg))!=0 ){ |
| 45092 | if( pPage->flags&PGHDR_NEED_SYNC ){ |
| 45093 | needSync = 1; |
| 45094 | } |
| 45095 | sqlite3PagerUnrefNotNull(pPage); |
| 45096 | } |
| 45097 | } |
| 45098 | |
| 45099 | /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages |
| 45100 | ** starting at pg1, then it needs to be set for all of them. Because |
| @@ -44982,11 +45106,11 @@ | |
| 45106 | assert( !MEMDB ); |
| 45107 | for(ii=0; ii<nPage; ii++){ |
| 45108 | PgHdr *pPage = pager_lookup(pPager, pg1+ii); |
| 45109 | if( pPage ){ |
| 45110 | pPage->flags |= PGHDR_NEED_SYNC; |
| 45111 | sqlite3PagerUnrefNotNull(pPage); |
| 45112 | } |
| 45113 | } |
| 45114 | } |
| 45115 | |
| 45116 | assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 ); |
| @@ -45135,21 +45259,21 @@ | |
| 45259 | ** or pages with the Pager.noSync flag set. |
| 45260 | ** |
| 45261 | ** If successful, or if called on a pager for which it is a no-op, this |
| 45262 | ** function returns SQLITE_OK. Otherwise, an IO error code is returned. |
| 45263 | */ |
| 45264 | SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){ |
| 45265 | int rc = SQLITE_OK; |
| 45266 | |
| 45267 | if( isOpen(pPager->fd) ){ |
| 45268 | void *pArg = (void*)zMaster; |
| 45269 | rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg); |
| 45270 | if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; |
| 45271 | } |
| 45272 | if( rc==SQLITE_OK && !pPager->noSync ){ |
| 45273 | assert( !MEMDB ); |
| 45274 | rc = sqlite3OsSync(pPager->fd, pPager->syncFlags); |
| 45275 | } |
| 45276 | return rc; |
| 45277 | } |
| 45278 | |
| 45279 | /* |
| @@ -45344,11 +45468,11 @@ | |
| 45468 | if( rc!=SQLITE_OK ) goto commit_phase_one_exit; |
| 45469 | } |
| 45470 | |
| 45471 | /* Finally, sync the database file. */ |
| 45472 | if( !noSync ){ |
| 45473 | rc = sqlite3PagerSync(pPager, zMaster); |
| 45474 | } |
| 45475 | IOTRACE(("DBSYNC %p\n", pPager)) |
| 45476 | } |
| 45477 | } |
| 45478 | |
| @@ -45473,11 +45597,13 @@ | |
| 45597 | rc = pager_playback(pPager, 0); |
| 45598 | } |
| 45599 | |
| 45600 | assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK ); |
| 45601 | assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT |
| 45602 | || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR |
| 45603 | || rc==SQLITE_CANTOPEN |
| 45604 | ); |
| 45605 | |
| 45606 | /* If an error occurs during a ROLLBACK, we can no longer trust the pager |
| 45607 | ** cache. So call pager_error() on the way out to make any error persistent. |
| 45608 | */ |
| 45609 | return pager_error(pPager, rc); |
| @@ -45876,11 +46002,11 @@ | |
| 46002 | ** can be written to. The caller has already promised not to write to it. |
| 46003 | */ |
| 46004 | if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){ |
| 46005 | needSyncPgno = pPg->pgno; |
| 46006 | assert( pPager->journalMode==PAGER_JOURNALMODE_OFF || |
| 46007 | pageInJournal(pPager, pPg) || pPg->pgno>pPager->dbOrigSize ); |
| 46008 | assert( pPg->flags&PGHDR_DIRTY ); |
| 46009 | } |
| 46010 | |
| 46011 | /* If the cache contains a page with page-number pgno, remove it |
| 46012 | ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for |
| @@ -45910,11 +46036,11 @@ | |
| 46036 | ** as the original page since it has already been allocated. |
| 46037 | */ |
| 46038 | if( MEMDB ){ |
| 46039 | assert( pPgOld ); |
| 46040 | sqlite3PcacheMove(pPgOld, origPgno); |
| 46041 | sqlite3PagerUnrefNotNull(pPgOld); |
| 46042 | } |
| 46043 | |
| 46044 | if( needSyncPgno ){ |
| 46045 | /* If needSyncPgno is non-zero, then the journal file needs to be |
| 46046 | ** sync()ed before any data is written to database file page needSyncPgno. |
| @@ -45939,11 +46065,11 @@ | |
| 46065 | } |
| 46066 | return rc; |
| 46067 | } |
| 46068 | pPgHdr->flags |= PGHDR_NEED_SYNC; |
| 46069 | sqlite3PcacheMakeDirty(pPgHdr); |
| 46070 | sqlite3PagerUnrefNotNull(pPgHdr); |
| 46071 | } |
| 46072 | |
| 46073 | return SQLITE_OK; |
| 46074 | } |
| 46075 | #endif |
| @@ -52079,14 +52205,15 @@ | |
| 52205 | */ |
| 52206 | static void releasePage(MemPage *pPage){ |
| 52207 | if( pPage ){ |
| 52208 | assert( pPage->aData ); |
| 52209 | assert( pPage->pBt ); |
| 52210 | assert( pPage->pDbPage!=0 ); |
| 52211 | assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); |
| 52212 | assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); |
| 52213 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 52214 | sqlite3PagerUnrefNotNull(pPage->pDbPage); |
| 52215 | } |
| 52216 | } |
| 52217 | |
| 52218 | /* |
| 52219 | ** During a rollback, when the pager reloads information into the cache |
| @@ -59413,11 +59540,11 @@ | |
| 59540 | rc = backupTruncateFile(pFile, iSize); |
| 59541 | } |
| 59542 | |
| 59543 | /* Sync the database file to disk. */ |
| 59544 | if( rc==SQLITE_OK ){ |
| 59545 | rc = sqlite3PagerSync(pDestPager, 0); |
| 59546 | } |
| 59547 | }else{ |
| 59548 | sqlite3PagerTruncateImage(pDestPager, nDestTruncate); |
| 59549 | rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0); |
| 59550 | } |
| @@ -59488,14 +59615,14 @@ | |
| 59615 | /* If a transaction is still open on the Btree, roll it back. */ |
| 59616 | sqlite3BtreeRollback(p->pDest, SQLITE_OK); |
| 59617 | |
| 59618 | /* Set the error code of the destination database handle. */ |
| 59619 | rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc; |
| 59620 | if( p->pDestDb ){ |
| 59621 | sqlite3Error(p->pDestDb, rc, 0); |
| 59622 | |
| 59623 | /* Exit the mutexes and free the backup context structure. */ |
| 59624 | sqlite3LeaveMutexAndCloseZombie(p->pDestDb); |
| 59625 | } |
| 59626 | sqlite3BtreeLeave(p->pSrc); |
| 59627 | if( p->pDestDb ){ |
| 59628 | /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a |
| @@ -60117,10 +60244,13 @@ | |
| 60244 | if( pMem->flags & MEM_RowSet ){ |
| 60245 | sqlite3RowSetClear(pMem->u.pRowSet); |
| 60246 | } |
| 60247 | MemSetTypeFlag(pMem, MEM_Null); |
| 60248 | pMem->type = SQLITE_NULL; |
| 60249 | } |
| 60250 | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ |
| 60251 | sqlite3VdbeMemSetNull((Mem*)p); |
| 60252 | } |
| 60253 | |
| 60254 | /* |
| 60255 | ** Delete any previous value and set the value to be a BLOB of length |
| 60256 | ** n containing all zeros. |
| @@ -63440,10 +63570,11 @@ | |
| 63570 | sqlite3 *db = p->db; |
| 63571 | int rc = p->rc; |
| 63572 | if( p->zErrMsg ){ |
| 63573 | u8 mallocFailed = db->mallocFailed; |
| 63574 | sqlite3BeginBenignMalloc(); |
| 63575 | if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); |
| 63576 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 63577 | sqlite3EndBenignMalloc(); |
| 63578 | db->mallocFailed = mallocFailed; |
| 63579 | db->errCode = rc; |
| 63580 | }else{ |
| @@ -63508,12 +63639,11 @@ | |
| 63639 | }else if( p->rc && p->expired ){ |
| 63640 | /* The expired flag was set on the VDBE before the first call |
| 63641 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 63642 | ** called), set the database error in this case as well. |
| 63643 | */ |
| 63644 | sqlite3Error(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg); |
| 63645 | sqlite3DbFree(db, p->zErrMsg); |
| 63646 | p->zErrMsg = 0; |
| 63647 | } |
| 63648 | |
| 63649 | /* Reclaim all memory used by the VDBE |
| @@ -64883,20 +65013,21 @@ | |
| 65013 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 65014 | sqlite3_reset(pStmt); |
| 65015 | v->doingRerun = 1; |
| 65016 | assert( v->expired==0 ); |
| 65017 | } |
| 65018 | if( rc2!=SQLITE_OK ){ |
| 65019 | /* This case occurs after failing to recompile an sql statement. |
| 65020 | ** The error message from the SQL compiler has already been loaded |
| 65021 | ** into the database handle. This block copies the error message |
| 65022 | ** from the database handle into the statement and sets the statement |
| 65023 | ** program counter to 0 to ensure that when the statement is |
| 65024 | ** finalized or reset the parser error message is available via |
| 65025 | ** sqlite3_errmsg() and sqlite3_errcode(). |
| 65026 | */ |
| 65027 | const char *zErr = (const char *)sqlite3_value_text(db->pErr); |
| 65028 | assert( zErr!=0 || db->mallocFailed ); |
| 65029 | sqlite3DbFree(db, v->zErrMsg); |
| 65030 | if( !db->mallocFailed ){ |
| 65031 | v->zErrMsg = sqlite3DbStrDup(db, zErr); |
| 65032 | v->rc = rc2; |
| 65033 | } else { |
| @@ -65841,13 +65972,13 @@ | |
| 65972 | assert( idx>0 && idx<=p->nVar ); |
| 65973 | pVar = &p->aVar[idx-1]; |
| 65974 | if( pVar->flags & MEM_Null ){ |
| 65975 | sqlite3StrAccumAppend(&out, "NULL", 4); |
| 65976 | }else if( pVar->flags & MEM_Int ){ |
| 65977 | sqlite3XPrintf(&out, 0, "%lld", pVar->u.i); |
| 65978 | }else if( pVar->flags & MEM_Real ){ |
| 65979 | sqlite3XPrintf(&out, 0, "%!.15g", pVar->r); |
| 65980 | }else if( pVar->flags & MEM_Str ){ |
| 65981 | int nOut; /* Number of bytes of the string text to include in output */ |
| 65982 | #ifndef SQLITE_OMIT_UTF16 |
| 65983 | u8 enc = ENC(db); |
| 65984 | Mem utf8; |
| @@ -65864,33 +65995,37 @@ | |
| 65995 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ){ |
| 65996 | nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 65997 | while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } |
| 65998 | } |
| 65999 | #endif |
| 66000 | sqlite3XPrintf(&out, 0, "'%.*q'", nOut, pVar->z); |
| 66001 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 66002 | if( nOut<pVar->n ){ |
| 66003 | sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); |
| 66004 | } |
| 66005 | #endif |
| 66006 | #ifndef SQLITE_OMIT_UTF16 |
| 66007 | if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); |
| 66008 | #endif |
| 66009 | }else if( pVar->flags & MEM_Zero ){ |
| 66010 | sqlite3XPrintf(&out, 0, "zeroblob(%d)", pVar->u.nZero); |
| 66011 | }else{ |
| 66012 | int nOut; /* Number of bytes of the blob to include in output */ |
| 66013 | assert( pVar->flags & MEM_Blob ); |
| 66014 | sqlite3StrAccumAppend(&out, "x'", 2); |
| 66015 | nOut = pVar->n; |
| 66016 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 66017 | if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; |
| 66018 | #endif |
| 66019 | for(i=0; i<nOut; i++){ |
| 66020 | sqlite3XPrintf(&out, 0, "%02x", pVar->z[i]&0xff); |
| 66021 | } |
| 66022 | sqlite3StrAccumAppend(&out, "'", 1); |
| 66023 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| 66024 | if( nOut<pVar->n ){ |
| 66025 | sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); |
| 66026 | } |
| 66027 | #endif |
| 66028 | } |
| 66029 | } |
| 66030 | } |
| 66031 | return sqlite3StrAccumFinish(&out); |
| @@ -65945,11 +66080,11 @@ | |
| 66080 | int n = p->nIndent; |
| 66081 | if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent); |
| 66082 | sqlite3AppendSpace(&p->str, p->aIndent[n-1]); |
| 66083 | } |
| 66084 | va_start(ap, zFormat); |
| 66085 | sqlite3VXPrintf(&p->str, SQLITE_PRINTF_INTERNAL, zFormat, ap); |
| 66086 | va_end(ap); |
| 66087 | } |
| 66088 | } |
| 66089 | |
| 66090 | /* |
| @@ -88246,11 +88381,10 @@ | |
| 88381 | int bestScore = 0; /* Score of best match */ |
| 88382 | int h; /* Hash value */ |
| 88383 | |
| 88384 | assert( nArg>=(-2) ); |
| 88385 | assert( nArg>=(-1) || createFlag==0 ); |
| 88386 | h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a); |
| 88387 | |
| 88388 | /* First search for a match amongst the application-defined functions. |
| 88389 | */ |
| 88390 | p = functionSearch(&db->aFunc, h, zName, nName); |
| @@ -89397,10 +89531,36 @@ | |
| 89531 | }while( isText && (zHaystack[0]&0xc0)==0x80 ); |
| 89532 | } |
| 89533 | if( nNeedle>nHaystack ) N = 0; |
| 89534 | sqlite3_result_int(context, N); |
| 89535 | } |
| 89536 | |
| 89537 | /* |
| 89538 | ** Implementation of the printf() function. |
| 89539 | */ |
| 89540 | static void printfFunc( |
| 89541 | sqlite3_context *context, |
| 89542 | int argc, |
| 89543 | sqlite3_value **argv |
| 89544 | ){ |
| 89545 | PrintfArguments x; |
| 89546 | StrAccum str; |
| 89547 | const char *zFormat; |
| 89548 | int n; |
| 89549 | |
| 89550 | if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){ |
| 89551 | x.nArg = argc-1; |
| 89552 | x.nUsed = 0; |
| 89553 | x.apArg = argv+1; |
| 89554 | sqlite3StrAccumInit(&str, 0, 0, SQLITE_MAX_LENGTH); |
| 89555 | str.db = sqlite3_context_db_handle(context); |
| 89556 | sqlite3XPrintf(&str, SQLITE_PRINTF_SQLFUNC, zFormat, &x); |
| 89557 | n = str.nChar; |
| 89558 | sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, |
| 89559 | SQLITE_DYNAMIC); |
| 89560 | } |
| 89561 | } |
| 89562 | |
| 89563 | /* |
| 89564 | ** Implementation of the substr() function. |
| 89565 | ** |
| 89566 | ** substr(x,p1,p2) returns p2 characters of x[] beginning with p1. |
| @@ -90828,10 +90988,11 @@ | |
| 90988 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), |
| 90989 | FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), |
| 90990 | FUNCTION(instr, 2, 0, 0, instrFunc ), |
| 90991 | FUNCTION(substr, 2, 0, 0, substrFunc ), |
| 90992 | FUNCTION(substr, 3, 0, 0, substrFunc ), |
| 90993 | FUNCTION(printf, -1, 0, 0, printfFunc ), |
| 90994 | FUNCTION(unicode, 1, 0, 0, unicodeFunc ), |
| 90995 | FUNCTION(char, -1, 0, 0, charFunc ), |
| 90996 | FUNCTION(abs, 1, 0, 0, absFunc ), |
| 90997 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 90998 | FUNCTION(round, 1, 0, 0, roundFunc ), |
| @@ -119433,13 +119594,11 @@ | |
| 119594 | } |
| 119595 | sqlite3HashClear(&db->aModule); |
| 119596 | #endif |
| 119597 | |
| 119598 | sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */ |
| 119599 | sqlite3ValueFree(db->pErr); |
| 119600 | sqlite3CloseExtensions(db); |
| 119601 | |
| 119602 | db->magic = SQLITE_MAGIC_ERROR; |
| 119603 | |
| 119604 | /* The temp-database schema is allocated differently from the other schema |
| @@ -119818,10 +119977,11 @@ | |
| 119977 | void (*xFinal)(sqlite3_context*), |
| 119978 | FuncDestructor *pDestructor |
| 119979 | ){ |
| 119980 | FuncDef *p; |
| 119981 | int nName; |
| 119982 | int extraFlags; |
| 119983 | |
| 119984 | assert( sqlite3_mutex_held(db->mutex) ); |
| 119985 | if( zFunctionName==0 || |
| 119986 | (xFunc && (xFinal || xStep)) || |
| 119987 | (!xFunc && (xFinal && !xStep)) || |
| @@ -119828,10 +119988,14 @@ | |
| 119988 | (!xFunc && (!xFinal && xStep)) || |
| 119989 | (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) || |
| 119990 | (255<(nName = sqlite3Strlen30( zFunctionName))) ){ |
| 119991 | return SQLITE_MISUSE_BKPT; |
| 119992 | } |
| 119993 | |
| 119994 | assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC ); |
| 119995 | extraFlags = enc & SQLITE_DETERMINISTIC; |
| 119996 | enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY); |
| 119997 | |
| 119998 | #ifndef SQLITE_OMIT_UTF16 |
| 119999 | /* If SQLITE_UTF16 is specified as the encoding type, transform this |
| 120000 | ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the |
| 120001 | ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. |
| @@ -119841,14 +120005,14 @@ | |
| 120005 | */ |
| 120006 | if( enc==SQLITE_UTF16 ){ |
| 120007 | enc = SQLITE_UTF16NATIVE; |
| 120008 | }else if( enc==SQLITE_ANY ){ |
| 120009 | int rc; |
| 120010 | rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8|extraFlags, |
| 120011 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 120012 | if( rc==SQLITE_OK ){ |
| 120013 | rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE|extraFlags, |
| 120014 | pUserData, xFunc, xStep, xFinal, pDestructor); |
| 120015 | } |
| 120016 | if( rc!=SQLITE_OK ){ |
| 120017 | return rc; |
| 120018 | } |
| @@ -119887,11 +120051,12 @@ | |
| 120051 | |
| 120052 | if( pDestructor ){ |
| 120053 | pDestructor->nRef++; |
| 120054 | } |
| 120055 | p->pDestructor = pDestructor; |
| 120056 | p->funcFlags = (p->funcFlags & SQLITE_FUNC_ENCMASK) | extraFlags; |
| 120057 | testcase( p->funcFlags & SQLITE_DETERMINISTIC ); |
| 120058 | p->xFunc = xFunc; |
| 120059 | p->xStep = xStep; |
| 120060 | p->xFinalize = xFinal; |
| 120061 | p->pUserData = pUserData; |
| 120062 | p->nArg = (u16)nArg; |
| @@ -120317,10 +120482,11 @@ | |
| 120482 | } |
| 120483 | sqlite3_mutex_enter(db->mutex); |
| 120484 | if( db->mallocFailed ){ |
| 120485 | z = sqlite3ErrStr(SQLITE_NOMEM); |
| 120486 | }else{ |
| 120487 | testcase( db->pErr==0 ); |
| 120488 | z = (char*)sqlite3_value_text(db->pErr); |
| 120489 | assert( !db->mallocFailed ); |
| 120490 | if( z==0 ){ |
| 120491 | z = sqlite3ErrStr(db->errCode); |
| 120492 | } |
| @@ -120358,12 +120524,11 @@ | |
| 120524 | if( db->mallocFailed ){ |
| 120525 | z = (void *)outOfMem; |
| 120526 | }else{ |
| 120527 | z = sqlite3_value_text16(db->pErr); |
| 120528 | if( z==0 ){ |
| 120529 | sqlite3Error(db, db->errCode, sqlite3ErrStr(db->errCode)); |
| 120530 | z = sqlite3_value_text16(db->pErr); |
| 120531 | } |
| 120532 | /* A malloc() may have failed within the call to sqlite3_value_text16() |
| 120533 | ** above. If this is the case, then the db->mallocFailed flag needs to |
| 120534 | ** be cleared before returning. Do this directly, instead of via |
| @@ -121073,12 +121238,10 @@ | |
| 121238 | if( !db->mallocFailed && rc==SQLITE_OK){ |
| 121239 | rc = sqlite3RtreeInit(db); |
| 121240 | } |
| 121241 | #endif |
| 121242 | |
| 121243 | /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking |
| 121244 | ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking |
| 121245 | ** mode. Doing nothing at all also makes NORMAL the default. |
| 121246 | */ |
| 121247 | #ifdef SQLITE_DEFAULT_LOCKING_MODE |
| 121248 |
+53
-18
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.8.3" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3008003 |
| 112 | -#define SQLITE_SOURCE_ID "2013-12-11 12:02:55 3e1d55f0bd84810a035bd6c54583eb373784a9a3" | |
| 112 | +#define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -789,19 +789,33 @@ | ||
| 789 | 789 | ** to the [sqlite3_file] object associated with a particular database |
| 790 | 790 | ** connection. See the [sqlite3_file_control()] documentation for |
| 791 | 791 | ** additional information. |
| 792 | 792 | ** |
| 793 | 793 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 794 | -** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by | |
| 795 | -** SQLite and sent to all VFSes in place of a call to the xSync method | |
| 796 | -** when the database connection has [PRAGMA synchronous] set to OFF.)^ | |
| 797 | -** Some specialized VFSes need this signal in order to operate correctly | |
| 798 | -** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most | |
| 799 | -** VFSes do not need this signal and should silently ignore this opcode. | |
| 800 | -** Applications should not call [sqlite3_file_control()] with this | |
| 801 | -** opcode as doing so may disrupt the operation of the specialized VFSes | |
| 802 | -** that do require it. | |
| 794 | +** No longer in use. | |
| 795 | +** | |
| 796 | +** <li>[[SQLITE_FCNTL_SYNC]] | |
| 797 | +** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and | |
| 798 | +** sent to the VFS immediately before the xSync method is invoked on a | |
| 799 | +** database file descriptor. Or, if the xSync method is not invoked | |
| 800 | +** because the user has configured SQLite with | |
| 801 | +** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place | |
| 802 | +** of the xSync method. In most cases, the pointer argument passed with | |
| 803 | +** this file-control is NULL. However, if the database file is being synced | |
| 804 | +** as part of a multi-database commit, the argument points to a nul-terminated | |
| 805 | +** string containing the transactions master-journal file name. VFSes that | |
| 806 | +** do not need this signal should silently ignore this opcode. Applications | |
| 807 | +** should not call [sqlite3_file_control()] with this opcode as doing so may | |
| 808 | +** disrupt the operation of the specialized VFSes that do require it. | |
| 809 | +** | |
| 810 | +** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]] | |
| 811 | +** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite | |
| 812 | +** and sent to the VFS after a transaction has been committed immediately | |
| 813 | +** but before the database is unlocked. VFSes that do not need this signal | |
| 814 | +** should silently ignore this opcode. Applications should not call | |
| 815 | +** [sqlite3_file_control()] with this opcode as doing so may disrupt the | |
| 816 | +** operation of the specialized VFSes that do require it. | |
| 803 | 817 | ** |
| 804 | 818 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 805 | 819 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 806 | 820 | ** retry counts and intervals for certain disk I/O operations for the |
| 807 | 821 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -948,10 +962,12 @@ | ||
| 948 | 962 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 949 | 963 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 950 | 964 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 951 | 965 | #define SQLITE_FCNTL_TRACE 19 |
| 952 | 966 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 967 | +#define SQLITE_FCNTL_SYNC 21 | |
| 968 | +#define SQLITE_FCNTL_COMMIT_PHASETWO 22 | |
| 953 | 969 | |
| 954 | 970 | /* |
| 955 | 971 | ** CAPI3REF: Mutex Handle |
| 956 | 972 | ** |
| 957 | 973 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3964,19 +3980,28 @@ | ||
| 3964 | 3980 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 3965 | 3981 | ** undefined. |
| 3966 | 3982 | ** |
| 3967 | 3983 | ** ^The fourth parameter, eTextRep, specifies what |
| 3968 | 3984 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 3969 | -** its parameters. Every SQL function implementation must be able to work | |
| 3970 | -** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be | |
| 3971 | -** more efficient with one encoding than another. ^An application may | |
| 3972 | -** invoke sqlite3_create_function() or sqlite3_create_function16() multiple | |
| 3973 | -** times with the same function but with different values of eTextRep. | |
| 3985 | +** its parameters. The application should set this parameter to | |
| 3986 | +** [SQLITE_UTF16LE] if the function implementation invokes | |
| 3987 | +** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the | |
| 3988 | +** implementation invokes [sqlite3_value_text16be()] on an input, or | |
| 3989 | +** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] | |
| 3990 | +** otherwise. ^The same SQL function may be registered multiple times using | |
| 3991 | +** different preferred text encodings, with different implementations for | |
| 3992 | +** each encoding. | |
| 3974 | 3993 | ** ^When multiple implementations of the same function are available, SQLite |
| 3975 | 3994 | ** will pick the one that involves the least amount of data conversion. |
| 3976 | -** If there is only a single implementation which does not care what text | |
| 3977 | -** encoding is used, then the fourth argument should be [SQLITE_ANY]. | |
| 3995 | +** | |
| 3996 | +** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] | |
| 3997 | +** to signal that the function will always return the same result given | |
| 3998 | +** the same inputs within a single SQL statement. Most SQL functions are | |
| 3999 | +** deterministic. The built-in [random()] SQL function is an example of a | |
| 4000 | +** function that is not deterministic. The SQLite query planner is able to | |
| 4001 | +** perform additional optimizations on deterministic functions, so use | |
| 4002 | +** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. | |
| 3978 | 4003 | ** |
| 3979 | 4004 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 3980 | 4005 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 3981 | 4006 | ** |
| 3982 | 4007 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4058,13 +4083,23 @@ | ||
| 4058 | 4083 | */ |
| 4059 | 4084 | #define SQLITE_UTF8 1 |
| 4060 | 4085 | #define SQLITE_UTF16LE 2 |
| 4061 | 4086 | #define SQLITE_UTF16BE 3 |
| 4062 | 4087 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4063 | -#define SQLITE_ANY 5 /* sqlite3_create_function only */ | |
| 4088 | +#define SQLITE_ANY 5 /* Deprecated */ | |
| 4064 | 4089 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4065 | 4090 | |
| 4091 | +/* | |
| 4092 | +** CAPI3REF: Function Flags | |
| 4093 | +** | |
| 4094 | +** These constants may be ORed together with the | |
| 4095 | +** [SQLITE_UTF8 | preferred text encoding] as the fourth argument | |
| 4096 | +** to [sqlite3_create_function()], [sqlite3_create_function16()], or | |
| 4097 | +** [sqlite3_create_function_v2()]. | |
| 4098 | +*/ | |
| 4099 | +#define SQLITE_DETERMINISTIC 0x800 | |
| 4100 | + | |
| 4066 | 4101 | /* |
| 4067 | 4102 | ** CAPI3REF: Deprecated Functions |
| 4068 | 4103 | ** DEPRECATED |
| 4069 | 4104 | ** |
| 4070 | 4105 | ** These functions are [deprecated]. In order to maintain |
| 4071 | 4106 | |
| 4072 | 4107 | ADDED win/buildmsvc.bat |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.8.3" |
| 111 | #define SQLITE_VERSION_NUMBER 3008003 |
| 112 | #define SQLITE_SOURCE_ID "2013-12-11 12:02:55 3e1d55f0bd84810a035bd6c54583eb373784a9a3" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -789,19 +789,33 @@ | |
| 789 | ** to the [sqlite3_file] object associated with a particular database |
| 790 | ** connection. See the [sqlite3_file_control()] documentation for |
| 791 | ** additional information. |
| 792 | ** |
| 793 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 794 | ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by |
| 795 | ** SQLite and sent to all VFSes in place of a call to the xSync method |
| 796 | ** when the database connection has [PRAGMA synchronous] set to OFF.)^ |
| 797 | ** Some specialized VFSes need this signal in order to operate correctly |
| 798 | ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most |
| 799 | ** VFSes do not need this signal and should silently ignore this opcode. |
| 800 | ** Applications should not call [sqlite3_file_control()] with this |
| 801 | ** opcode as doing so may disrupt the operation of the specialized VFSes |
| 802 | ** that do require it. |
| 803 | ** |
| 804 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 805 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 806 | ** retry counts and intervals for certain disk I/O operations for the |
| 807 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -948,10 +962,12 @@ | |
| 948 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 949 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 950 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 951 | #define SQLITE_FCNTL_TRACE 19 |
| 952 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 953 | |
| 954 | /* |
| 955 | ** CAPI3REF: Mutex Handle |
| 956 | ** |
| 957 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3964,19 +3980,28 @@ | |
| 3964 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 3965 | ** undefined. |
| 3966 | ** |
| 3967 | ** ^The fourth parameter, eTextRep, specifies what |
| 3968 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 3969 | ** its parameters. Every SQL function implementation must be able to work |
| 3970 | ** with UTF-8, UTF-16le, or UTF-16be. But some implementations may be |
| 3971 | ** more efficient with one encoding than another. ^An application may |
| 3972 | ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple |
| 3973 | ** times with the same function but with different values of eTextRep. |
| 3974 | ** ^When multiple implementations of the same function are available, SQLite |
| 3975 | ** will pick the one that involves the least amount of data conversion. |
| 3976 | ** If there is only a single implementation which does not care what text |
| 3977 | ** encoding is used, then the fourth argument should be [SQLITE_ANY]. |
| 3978 | ** |
| 3979 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 3980 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 3981 | ** |
| 3982 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4058,13 +4083,23 @@ | |
| 4058 | */ |
| 4059 | #define SQLITE_UTF8 1 |
| 4060 | #define SQLITE_UTF16LE 2 |
| 4061 | #define SQLITE_UTF16BE 3 |
| 4062 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4063 | #define SQLITE_ANY 5 /* sqlite3_create_function only */ |
| 4064 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4065 | |
| 4066 | /* |
| 4067 | ** CAPI3REF: Deprecated Functions |
| 4068 | ** DEPRECATED |
| 4069 | ** |
| 4070 | ** These functions are [deprecated]. In order to maintain |
| 4071 | |
| 4072 | DDED win/buildmsvc.bat |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.8.3" |
| 111 | #define SQLITE_VERSION_NUMBER 3008003 |
| 112 | #define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -789,19 +789,33 @@ | |
| 789 | ** to the [sqlite3_file] object associated with a particular database |
| 790 | ** connection. See the [sqlite3_file_control()] documentation for |
| 791 | ** additional information. |
| 792 | ** |
| 793 | ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] |
| 794 | ** No longer in use. |
| 795 | ** |
| 796 | ** <li>[[SQLITE_FCNTL_SYNC]] |
| 797 | ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and |
| 798 | ** sent to the VFS immediately before the xSync method is invoked on a |
| 799 | ** database file descriptor. Or, if the xSync method is not invoked |
| 800 | ** because the user has configured SQLite with |
| 801 | ** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place |
| 802 | ** of the xSync method. In most cases, the pointer argument passed with |
| 803 | ** this file-control is NULL. However, if the database file is being synced |
| 804 | ** as part of a multi-database commit, the argument points to a nul-terminated |
| 805 | ** string containing the transactions master-journal file name. VFSes that |
| 806 | ** do not need this signal should silently ignore this opcode. Applications |
| 807 | ** should not call [sqlite3_file_control()] with this opcode as doing so may |
| 808 | ** disrupt the operation of the specialized VFSes that do require it. |
| 809 | ** |
| 810 | ** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]] |
| 811 | ** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite |
| 812 | ** and sent to the VFS after a transaction has been committed immediately |
| 813 | ** but before the database is unlocked. VFSes that do not need this signal |
| 814 | ** should silently ignore this opcode. Applications should not call |
| 815 | ** [sqlite3_file_control()] with this opcode as doing so may disrupt the |
| 816 | ** operation of the specialized VFSes that do require it. |
| 817 | ** |
| 818 | ** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]] |
| 819 | ** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic |
| 820 | ** retry counts and intervals for certain disk I/O operations for the |
| 821 | ** windows [VFS] in order to provide robustness in the presence of |
| @@ -948,10 +962,12 @@ | |
| 962 | #define SQLITE_FCNTL_BUSYHANDLER 15 |
| 963 | #define SQLITE_FCNTL_TEMPFILENAME 16 |
| 964 | #define SQLITE_FCNTL_MMAP_SIZE 18 |
| 965 | #define SQLITE_FCNTL_TRACE 19 |
| 966 | #define SQLITE_FCNTL_HAS_MOVED 20 |
| 967 | #define SQLITE_FCNTL_SYNC 21 |
| 968 | #define SQLITE_FCNTL_COMMIT_PHASETWO 22 |
| 969 | |
| 970 | /* |
| 971 | ** CAPI3REF: Mutex Handle |
| 972 | ** |
| 973 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -3964,19 +3980,28 @@ | |
| 3980 | ** parameter is less than -1 or greater than 127 then the behavior is |
| 3981 | ** undefined. |
| 3982 | ** |
| 3983 | ** ^The fourth parameter, eTextRep, specifies what |
| 3984 | ** [SQLITE_UTF8 | text encoding] this SQL function prefers for |
| 3985 | ** its parameters. The application should set this parameter to |
| 3986 | ** [SQLITE_UTF16LE] if the function implementation invokes |
| 3987 | ** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the |
| 3988 | ** implementation invokes [sqlite3_value_text16be()] on an input, or |
| 3989 | ** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] |
| 3990 | ** otherwise. ^The same SQL function may be registered multiple times using |
| 3991 | ** different preferred text encodings, with different implementations for |
| 3992 | ** each encoding. |
| 3993 | ** ^When multiple implementations of the same function are available, SQLite |
| 3994 | ** will pick the one that involves the least amount of data conversion. |
| 3995 | ** |
| 3996 | ** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] |
| 3997 | ** to signal that the function will always return the same result given |
| 3998 | ** the same inputs within a single SQL statement. Most SQL functions are |
| 3999 | ** deterministic. The built-in [random()] SQL function is an example of a |
| 4000 | ** function that is not deterministic. The SQLite query planner is able to |
| 4001 | ** perform additional optimizations on deterministic functions, so use |
| 4002 | ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. |
| 4003 | ** |
| 4004 | ** ^(The fifth parameter is an arbitrary pointer. The implementation of the |
| 4005 | ** function can gain access to this pointer using [sqlite3_user_data()].)^ |
| 4006 | ** |
| 4007 | ** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are |
| @@ -4058,13 +4083,23 @@ | |
| 4083 | */ |
| 4084 | #define SQLITE_UTF8 1 |
| 4085 | #define SQLITE_UTF16LE 2 |
| 4086 | #define SQLITE_UTF16BE 3 |
| 4087 | #define SQLITE_UTF16 4 /* Use native byte order */ |
| 4088 | #define SQLITE_ANY 5 /* Deprecated */ |
| 4089 | #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ |
| 4090 | |
| 4091 | /* |
| 4092 | ** CAPI3REF: Function Flags |
| 4093 | ** |
| 4094 | ** These constants may be ORed together with the |
| 4095 | ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument |
| 4096 | ** to [sqlite3_create_function()], [sqlite3_create_function16()], or |
| 4097 | ** [sqlite3_create_function_v2()]. |
| 4098 | */ |
| 4099 | #define SQLITE_DETERMINISTIC 0x800 |
| 4100 | |
| 4101 | /* |
| 4102 | ** CAPI3REF: Deprecated Functions |
| 4103 | ** DEPRECATED |
| 4104 | ** |
| 4105 | ** These functions are [deprecated]. In order to maintain |
| 4106 | |
| 4107 | DDED win/buildmsvc.bat |
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
No diff available
+1
| --- a/win/buildmsvc.bat | ||
| +++ b/win/buildmsvc.bat | ||
| @@ -0,0 +1 @@ | ||
| 1 | +\x64*\x64*Root = '%ROOT%' |
| --- a/win/buildmsvc.bat | |
| +++ b/win/buildmsvc.bat | |
| @@ -0,0 +1 @@ | |
| --- a/win/buildmsvc.bat | |
| +++ b/win/buildmsvc.bat | |
| @@ -0,0 +1 @@ | |
| 1 | \x64*\x64*Root = '%ROOT%' |
+4
-2
| --- www/build.wiki | ||
| +++ www/build.wiki | ||
| @@ -92,13 +92,15 @@ | ||
| 92 | 92 | "<b>make -f win/Makefile.mingw</b>". On a Windows box you will |
| 93 | 93 | need either Cygwin or Msys as build environment. On Cygwin, Linux |
| 94 | 94 | or Darwin you may want to make minor edits to win/Makefile.mingw |
| 95 | 95 | to configure the cross-compile environment. |
| 96 | 96 | |
| 97 | -<li><p><i>VC++</i> → Use the msc makefile. First | |
| 97 | +<li><p><i>MSVC</i> → Use the msc makefile. First | |
| 98 | 98 | change to the "win/" subdirectory ("<b>cd win</b>") then run |
| 99 | -"<b>nmake /f Makefile.msc</b>". | |
| 99 | +"<b>nmake /f Makefile.msc</b>". Alternatively, the batch file | |
| 100 | +"<b>win\buildmsvc.bat</b>" may be used and it will attempt to | |
| 101 | +detect and use the latest installed version of MSVC. | |
| 100 | 102 | </ol> |
| 101 | 103 | </ol> |
| 102 | 104 | |
| 103 | 105 | <h2>3.0 Installing</h2> |
| 104 | 106 | |
| 105 | 107 |
| --- www/build.wiki | |
| +++ www/build.wiki | |
| @@ -92,13 +92,15 @@ | |
| 92 | "<b>make -f win/Makefile.mingw</b>". On a Windows box you will |
| 93 | need either Cygwin or Msys as build environment. On Cygwin, Linux |
| 94 | or Darwin you may want to make minor edits to win/Makefile.mingw |
| 95 | to configure the cross-compile environment. |
| 96 | |
| 97 | <li><p><i>VC++</i> → Use the msc makefile. First |
| 98 | change to the "win/" subdirectory ("<b>cd win</b>") then run |
| 99 | "<b>nmake /f Makefile.msc</b>". |
| 100 | </ol> |
| 101 | </ol> |
| 102 | |
| 103 | <h2>3.0 Installing</h2> |
| 104 | |
| 105 |
| --- www/build.wiki | |
| +++ www/build.wiki | |
| @@ -92,13 +92,15 @@ | |
| 92 | "<b>make -f win/Makefile.mingw</b>". On a Windows box you will |
| 93 | need either Cygwin or Msys as build environment. On Cygwin, Linux |
| 94 | or Darwin you may want to make minor edits to win/Makefile.mingw |
| 95 | to configure the cross-compile environment. |
| 96 | |
| 97 | <li><p><i>MSVC</i> → Use the msc makefile. First |
| 98 | change to the "win/" subdirectory ("<b>cd win</b>") then run |
| 99 | "<b>nmake /f Makefile.msc</b>". Alternatively, the batch file |
| 100 | "<b>win\buildmsvc.bat</b>" may be used and it will attempt to |
| 101 | detect and use the latest installed version of MSVC. |
| 102 | </ol> |
| 103 | </ol> |
| 104 | |
| 105 | <h2>3.0 Installing</h2> |
| 106 | |
| 107 |
+6
-3
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -26,13 +26,16 @@ | ||
| 26 | 26 | specifies the number of entries, just like all other commands which |
| 27 | 27 | have the -n|--limit option. The various timeline-related functions |
| 28 | 28 | now output "--- ?? limit (??) reached ---" at the end whenever |
| 29 | 29 | appropriate. Use "-n 0" if no limit is desired. |
| 30 | 30 | * Fix handling of password embedded in Fossil URL. |
| 31 | - * New --once option to [/help?cmd=clone | fossil clone] command which does | |
| 32 | - not store the URL or password when cloning. | |
| 33 | - * Modify [/help?cmd=ui | fossil ui] to respect "default user" in open repository. | |
| 31 | + * New <tt>--once</tt> option to [/help?cmd=clone | fossil clone] command | |
| 32 | + which does not store the URL or password when cloning. | |
| 33 | + * Modify [/help?cmd=ui | fossil ui] to respect "default user" in an open | |
| 34 | + repository. | |
| 35 | + * Fossil now hides check-ins that have the "hidden" tag in timeline webpages. | |
| 36 | + * Enhance <tt>/ci_edit</tt> page to add the "hidden" tag to check-ins. | |
| 34 | 37 | |
| 35 | 38 | <h2>Changes For Version 1.27 (2013-09-11)</h2> |
| 36 | 39 | * Enhance the [/help?cmd=changes | fossil changes], |
| 37 | 40 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 38 | 41 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 39 | 42 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -26,13 +26,16 @@ | |
| 26 | specifies the number of entries, just like all other commands which |
| 27 | have the -n|--limit option. The various timeline-related functions |
| 28 | now output "--- ?? limit (??) reached ---" at the end whenever |
| 29 | appropriate. Use "-n 0" if no limit is desired. |
| 30 | * Fix handling of password embedded in Fossil URL. |
| 31 | * New --once option to [/help?cmd=clone | fossil clone] command which does |
| 32 | not store the URL or password when cloning. |
| 33 | * Modify [/help?cmd=ui | fossil ui] to respect "default user" in open repository. |
| 34 | |
| 35 | <h2>Changes For Version 1.27 (2013-09-11)</h2> |
| 36 | * Enhance the [/help?cmd=changes | fossil changes], |
| 37 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 38 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 39 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -26,13 +26,16 @@ | |
| 26 | specifies the number of entries, just like all other commands which |
| 27 | have the -n|--limit option. The various timeline-related functions |
| 28 | now output "--- ?? limit (??) reached ---" at the end whenever |
| 29 | appropriate. Use "-n 0" if no limit is desired. |
| 30 | * Fix handling of password embedded in Fossil URL. |
| 31 | * New <tt>--once</tt> option to [/help?cmd=clone | fossil clone] command |
| 32 | which does not store the URL or password when cloning. |
| 33 | * Modify [/help?cmd=ui | fossil ui] to respect "default user" in an open |
| 34 | repository. |
| 35 | * Fossil now hides check-ins that have the "hidden" tag in timeline webpages. |
| 36 | * Enhance <tt>/ci_edit</tt> page to add the "hidden" tag to check-ins. |
| 37 | |
| 38 | <h2>Changes For Version 1.27 (2013-09-11)</h2> |
| 39 | * Enhance the [/help?cmd=changes | fossil changes], |
| 40 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 41 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 42 |