Fossil SCM
merge trunk. Upgrade to latest SQLite, with experimental Cygwin fixes.
Commit
7f6019efcf37d7ed0050c2453d20ebeda1094827
Parent
498e4d3bccb1bb8…
16 files changed
+42
+5
-5
+8
-8
+1
+20
-7
+11
-10
+29
-29
+5
-7
+137
-111
+137
-111
+2
-1
+2
-1
+1
+2
-2
+1
-1
+5
+42
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -108,10 +108,14 @@ | ||
| 108 | 108 | }else if( isChnged ){ |
| 109 | 109 | if( isChnged==2 ){ |
| 110 | 110 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 111 | 111 | }else if( isChnged==3 ){ |
| 112 | 112 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 113 | + }else if( isChnged==4 ){ | |
| 114 | + blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName); | |
| 115 | + }else if( isChnged==5 ){ | |
| 116 | + blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName); | |
| 113 | 117 | }else if( file_contains_merge_marker(zFullName) ){ |
| 114 | 118 | blob_appendf(report, "CONFLICT %s\n", zDisplayName); |
| 115 | 119 | }else{ |
| 116 | 120 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 117 | 121 | } |
| @@ -129,10 +133,11 @@ | ||
| 129 | 133 | while( db_step(&q)==SQLITE_ROW ){ |
| 130 | 134 | const char *zLabel = "MERGED_WITH"; |
| 131 | 135 | switch( db_column_int(&q, 1) ){ |
| 132 | 136 | case -1: zLabel = "CHERRYPICK "; break; |
| 133 | 137 | case -2: zLabel = "BACKOUT "; break; |
| 138 | + case -4: zLabel = "INTEGRATE "; break; | |
| 134 | 139 | } |
| 135 | 140 | blob_append(report, zPrefix, nPrefix); |
| 136 | 141 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 137 | 142 | } |
| 138 | 143 | db_finalize(&q); |
| @@ -332,10 +337,14 @@ | ||
| 332 | 337 | }else if( chnged ){ |
| 333 | 338 | if( chnged==2 ){ |
| 334 | 339 | type = "UPDATED_BY_MERGE "; |
| 335 | 340 | }else if( chnged==3 ){ |
| 336 | 341 | type = "ADDED_BY_MERGE "; |
| 342 | + }else if( chnged==4 ){ | |
| 343 | + type = "UPDATED_BY_INTEGRATE "; | |
| 344 | + }else if( chnged==5 ){ | |
| 345 | + type = "ADDED_BY_INTEGRATE "; | |
| 337 | 346 | }else if( file_contains_merge_marker(zFullName) ){ |
| 338 | 347 | type = "CONFLICT "; |
| 339 | 348 | }else{ |
| 340 | 349 | type = "EDITED "; |
| 341 | 350 | } |
| @@ -1678,10 +1687,43 @@ | ||
| 1678 | 1687 | ** and rollback the transaction. |
| 1679 | 1688 | */ |
| 1680 | 1689 | if( dryRunFlag ){ |
| 1681 | 1690 | blob_write_to_file(&manifest, ""); |
| 1682 | 1691 | } |
| 1692 | + | |
| 1693 | + db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid" | |
| 1694 | + " WHERE id=-4"); | |
| 1695 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 1696 | + const char *zIntegrateUuid = db_column_text(&q, 0); | |
| 1697 | + int rid = db_column_int(&q, 1); | |
| 1698 | + if( !is_a_leaf(rid) ){ | |
| 1699 | + fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); | |
| 1700 | + }else{ | |
| 1701 | + if (!db_exists("SELECT 1 FROM tagxref " | |
| 1702 | + " WHERE tagid=%d AND rid=%d AND tagtype>0", | |
| 1703 | + TAG_CLOSED, rid) | |
| 1704 | + ){ | |
| 1705 | + Blob ctrl; | |
| 1706 | + Blob cksum; | |
| 1707 | + char *zDate; | |
| 1708 | + int nrid; | |
| 1709 | + | |
| 1710 | + blob_zero(&ctrl); | |
| 1711 | + zDate = date_in_standard_format(sCiInfo.zDateOvrd ? sCiInfo.zDateOvrd : "now"); | |
| 1712 | + blob_appendf(&ctrl, "D %s\n", zDate); | |
| 1713 | + blob_appendf(&ctrl, "T +closed %s\n", zIntegrateUuid); | |
| 1714 | + blob_appendf(&ctrl, "U %F\n", sCiInfo.zUserOvrd ? sCiInfo.zUserOvrd : g.zLogin); | |
| 1715 | + md5sum_blob(&ctrl, &cksum); | |
| 1716 | + blob_appendf(&ctrl, "Z %b\n", &cksum); | |
| 1717 | + nrid = content_put(&ctrl); | |
| 1718 | + manifest_crosslink(nrid, &ctrl); | |
| 1719 | + assert( blob_is_reset(&ctrl) ); | |
| 1720 | + } | |
| 1721 | + fossil_print("Closed: %s\n", zIntegrateUuid); | |
| 1722 | + } | |
| 1723 | + } | |
| 1724 | + db_finalize(&q); | |
| 1683 | 1725 | |
| 1684 | 1726 | if( outputManifest ){ |
| 1685 | 1727 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 1686 | 1728 | blob_write_to_file(&manifest, zManifestFile); |
| 1687 | 1729 | blob_reset(&manifest); |
| 1688 | 1730 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -108,10 +108,14 @@ | |
| 108 | }else if( isChnged ){ |
| 109 | if( isChnged==2 ){ |
| 110 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 111 | }else if( isChnged==3 ){ |
| 112 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 113 | }else if( file_contains_merge_marker(zFullName) ){ |
| 114 | blob_appendf(report, "CONFLICT %s\n", zDisplayName); |
| 115 | }else{ |
| 116 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 117 | } |
| @@ -129,10 +133,11 @@ | |
| 129 | while( db_step(&q)==SQLITE_ROW ){ |
| 130 | const char *zLabel = "MERGED_WITH"; |
| 131 | switch( db_column_int(&q, 1) ){ |
| 132 | case -1: zLabel = "CHERRYPICK "; break; |
| 133 | case -2: zLabel = "BACKOUT "; break; |
| 134 | } |
| 135 | blob_append(report, zPrefix, nPrefix); |
| 136 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 137 | } |
| 138 | db_finalize(&q); |
| @@ -332,10 +337,14 @@ | |
| 332 | }else if( chnged ){ |
| 333 | if( chnged==2 ){ |
| 334 | type = "UPDATED_BY_MERGE "; |
| 335 | }else if( chnged==3 ){ |
| 336 | type = "ADDED_BY_MERGE "; |
| 337 | }else if( file_contains_merge_marker(zFullName) ){ |
| 338 | type = "CONFLICT "; |
| 339 | }else{ |
| 340 | type = "EDITED "; |
| 341 | } |
| @@ -1678,10 +1687,43 @@ | |
| 1678 | ** and rollback the transaction. |
| 1679 | */ |
| 1680 | if( dryRunFlag ){ |
| 1681 | blob_write_to_file(&manifest, ""); |
| 1682 | } |
| 1683 | |
| 1684 | if( outputManifest ){ |
| 1685 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 1686 | blob_write_to_file(&manifest, zManifestFile); |
| 1687 | blob_reset(&manifest); |
| 1688 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -108,10 +108,14 @@ | |
| 108 | }else if( isChnged ){ |
| 109 | if( isChnged==2 ){ |
| 110 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 111 | }else if( isChnged==3 ){ |
| 112 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 113 | }else if( isChnged==4 ){ |
| 114 | blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName); |
| 115 | }else if( isChnged==5 ){ |
| 116 | blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName); |
| 117 | }else if( file_contains_merge_marker(zFullName) ){ |
| 118 | blob_appendf(report, "CONFLICT %s\n", zDisplayName); |
| 119 | }else{ |
| 120 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 121 | } |
| @@ -129,10 +133,11 @@ | |
| 133 | while( db_step(&q)==SQLITE_ROW ){ |
| 134 | const char *zLabel = "MERGED_WITH"; |
| 135 | switch( db_column_int(&q, 1) ){ |
| 136 | case -1: zLabel = "CHERRYPICK "; break; |
| 137 | case -2: zLabel = "BACKOUT "; break; |
| 138 | case -4: zLabel = "INTEGRATE "; break; |
| 139 | } |
| 140 | blob_append(report, zPrefix, nPrefix); |
| 141 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 142 | } |
| 143 | db_finalize(&q); |
| @@ -332,10 +337,14 @@ | |
| 337 | }else if( chnged ){ |
| 338 | if( chnged==2 ){ |
| 339 | type = "UPDATED_BY_MERGE "; |
| 340 | }else if( chnged==3 ){ |
| 341 | type = "ADDED_BY_MERGE "; |
| 342 | }else if( chnged==4 ){ |
| 343 | type = "UPDATED_BY_INTEGRATE "; |
| 344 | }else if( chnged==5 ){ |
| 345 | type = "ADDED_BY_INTEGRATE "; |
| 346 | }else if( file_contains_merge_marker(zFullName) ){ |
| 347 | type = "CONFLICT "; |
| 348 | }else{ |
| 349 | type = "EDITED "; |
| 350 | } |
| @@ -1678,10 +1687,43 @@ | |
| 1687 | ** and rollback the transaction. |
| 1688 | */ |
| 1689 | if( dryRunFlag ){ |
| 1690 | blob_write_to_file(&manifest, ""); |
| 1691 | } |
| 1692 | |
| 1693 | db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid" |
| 1694 | " WHERE id=-4"); |
| 1695 | while( db_step(&q)==SQLITE_ROW ){ |
| 1696 | const char *zIntegrateUuid = db_column_text(&q, 0); |
| 1697 | int rid = db_column_int(&q, 1); |
| 1698 | if( !is_a_leaf(rid) ){ |
| 1699 | fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); |
| 1700 | }else{ |
| 1701 | if (!db_exists("SELECT 1 FROM tagxref " |
| 1702 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 1703 | TAG_CLOSED, rid) |
| 1704 | ){ |
| 1705 | Blob ctrl; |
| 1706 | Blob cksum; |
| 1707 | char *zDate; |
| 1708 | int nrid; |
| 1709 | |
| 1710 | blob_zero(&ctrl); |
| 1711 | zDate = date_in_standard_format(sCiInfo.zDateOvrd ? sCiInfo.zDateOvrd : "now"); |
| 1712 | blob_appendf(&ctrl, "D %s\n", zDate); |
| 1713 | blob_appendf(&ctrl, "T +closed %s\n", zIntegrateUuid); |
| 1714 | blob_appendf(&ctrl, "U %F\n", sCiInfo.zUserOvrd ? sCiInfo.zUserOvrd : g.zLogin); |
| 1715 | md5sum_blob(&ctrl, &cksum); |
| 1716 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 1717 | nrid = content_put(&ctrl); |
| 1718 | manifest_crosslink(nrid, &ctrl); |
| 1719 | assert( blob_is_reset(&ctrl) ); |
| 1720 | } |
| 1721 | fossil_print("Closed: %s\n", zIntegrateUuid); |
| 1722 | } |
| 1723 | } |
| 1724 | db_finalize(&q); |
| 1725 | |
| 1726 | if( outputManifest ){ |
| 1727 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 1728 | blob_write_to_file(&manifest, zManifestFile); |
| 1729 | blob_reset(&manifest); |
| 1730 |
+5
-5
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -399,32 +399,32 @@ | ||
| 399 | 399 | @ <form method="post" action="%s(g.zTop)/eventedit"><div> |
| 400 | 400 | login_insert_csrf_secret(); |
| 401 | 401 | @ <input type="hidden" name="name" value="%h(zEventId)" /> |
| 402 | 402 | @ <table border="0" cellspacing="10"> |
| 403 | 403 | |
| 404 | - @ <tr><td align="right" valign="top"><b>Event Time:</b></td> | |
| 404 | + @ <tr><th align="right" valign="top">Event Time:</th> | |
| 405 | 405 | @ <td valign="top"> |
| 406 | 406 | @ <input type="text" name="t" size="25" value="%h(zETime)" /> |
| 407 | 407 | @ </td></tr> |
| 408 | 408 | |
| 409 | - @ <tr><td align="right" valign="top"><b>Timeline Comment:</b></td> | |
| 409 | + @ <tr><th align="right" valign="top">Timeline Comment:</th> | |
| 410 | 410 | @ <td valign="top"> |
| 411 | 411 | @ <textarea name="c" class="eventedit" cols="80" |
| 412 | 412 | @ rows="3" wrap="virtual">%h(zComment)</textarea> |
| 413 | 413 | @ </td></tr> |
| 414 | 414 | |
| 415 | - @ <tr><td align="right" valign="top"><b>Background Color:</b></td> | |
| 415 | + @ <tr><th align="right" valign="top">Background Color:</th> | |
| 416 | 416 | @ <td valign="top"> |
| 417 | 417 | render_color_chooser(0, zClr, 0, "clr", "cclr"); |
| 418 | 418 | @ </td></tr> |
| 419 | 419 | |
| 420 | - @ <tr><td align="right" valign="top"><b>Tags:</b></td> | |
| 420 | + @ <tr><th align="right" valign="top">Tags:</th> | |
| 421 | 421 | @ <td valign="top"> |
| 422 | 422 | @ <input type="text" name="g" size="40" value="%h(zTags)" /> |
| 423 | 423 | @ </td></tr> |
| 424 | 424 | |
| 425 | - @ <tr><td align="right" valign="top"><b>Page Content:</b></td> | |
| 425 | + @ <tr><th align="right" valign="top">Page Content:</th> | |
| 426 | 426 | @ <td valign="top"> |
| 427 | 427 | @ <textarea name="w" class="eventedit" cols="80" |
| 428 | 428 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 429 | 429 | @ </td></tr> |
| 430 | 430 | |
| 431 | 431 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -399,32 +399,32 @@ | |
| 399 | @ <form method="post" action="%s(g.zTop)/eventedit"><div> |
| 400 | login_insert_csrf_secret(); |
| 401 | @ <input type="hidden" name="name" value="%h(zEventId)" /> |
| 402 | @ <table border="0" cellspacing="10"> |
| 403 | |
| 404 | @ <tr><td align="right" valign="top"><b>Event Time:</b></td> |
| 405 | @ <td valign="top"> |
| 406 | @ <input type="text" name="t" size="25" value="%h(zETime)" /> |
| 407 | @ </td></tr> |
| 408 | |
| 409 | @ <tr><td align="right" valign="top"><b>Timeline Comment:</b></td> |
| 410 | @ <td valign="top"> |
| 411 | @ <textarea name="c" class="eventedit" cols="80" |
| 412 | @ rows="3" wrap="virtual">%h(zComment)</textarea> |
| 413 | @ </td></tr> |
| 414 | |
| 415 | @ <tr><td align="right" valign="top"><b>Background Color:</b></td> |
| 416 | @ <td valign="top"> |
| 417 | render_color_chooser(0, zClr, 0, "clr", "cclr"); |
| 418 | @ </td></tr> |
| 419 | |
| 420 | @ <tr><td align="right" valign="top"><b>Tags:</b></td> |
| 421 | @ <td valign="top"> |
| 422 | @ <input type="text" name="g" size="40" value="%h(zTags)" /> |
| 423 | @ </td></tr> |
| 424 | |
| 425 | @ <tr><td align="right" valign="top"><b>Page Content:</b></td> |
| 426 | @ <td valign="top"> |
| 427 | @ <textarea name="w" class="eventedit" cols="80" |
| 428 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 429 | @ </td></tr> |
| 430 | |
| 431 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -399,32 +399,32 @@ | |
| 399 | @ <form method="post" action="%s(g.zTop)/eventedit"><div> |
| 400 | login_insert_csrf_secret(); |
| 401 | @ <input type="hidden" name="name" value="%h(zEventId)" /> |
| 402 | @ <table border="0" cellspacing="10"> |
| 403 | |
| 404 | @ <tr><th align="right" valign="top">Event Time:</th> |
| 405 | @ <td valign="top"> |
| 406 | @ <input type="text" name="t" size="25" value="%h(zETime)" /> |
| 407 | @ </td></tr> |
| 408 | |
| 409 | @ <tr><th align="right" valign="top">Timeline Comment:</th> |
| 410 | @ <td valign="top"> |
| 411 | @ <textarea name="c" class="eventedit" cols="80" |
| 412 | @ rows="3" wrap="virtual">%h(zComment)</textarea> |
| 413 | @ </td></tr> |
| 414 | |
| 415 | @ <tr><th align="right" valign="top">Background Color:</th> |
| 416 | @ <td valign="top"> |
| 417 | render_color_chooser(0, zClr, 0, "clr", "cclr"); |
| 418 | @ </td></tr> |
| 419 | |
| 420 | @ <tr><th align="right" valign="top">Tags:</th> |
| 421 | @ <td valign="top"> |
| 422 | @ <input type="text" name="g" size="40" value="%h(zTags)" /> |
| 423 | @ </td></tr> |
| 424 | |
| 425 | @ <tr><th align="right" valign="top">Page Content:</th> |
| 426 | @ <td valign="top"> |
| 427 | @ <textarea name="w" class="eventedit" cols="80" |
| 428 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 429 | @ </td></tr> |
| 430 | |
| 431 |
+8
-8
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2221,38 +2221,38 @@ | ||
| 2221 | 2221 | form_begin(0, "%R/ci_edit"); |
| 2222 | 2222 | login_insert_csrf_secret(); |
| 2223 | 2223 | @ <div><input type="hidden" name="r" value="%S(zUuid)" /> |
| 2224 | 2224 | @ <table border="0" cellspacing="10"> |
| 2225 | 2225 | |
| 2226 | - @ <tr><td align="right" valign="top"><b>User:</b></td> | |
| 2226 | + @ <tr><th align="right" valign="top">User:</th> | |
| 2227 | 2227 | @ <td valign="top"> |
| 2228 | 2228 | @ <input type="text" name="u" size="20" value="%h(zNewUser)" /> |
| 2229 | 2229 | @ </td></tr> |
| 2230 | 2230 | |
| 2231 | - @ <tr><td align="right" valign="top"><b>Comment:</b></td> | |
| 2231 | + @ <tr><th align="right" valign="top">Comment:</th> | |
| 2232 | 2232 | @ <td valign="top"> |
| 2233 | 2233 | @ <textarea name="c" rows="10" cols="80">%h(zNewComment)</textarea> |
| 2234 | 2234 | @ </td></tr> |
| 2235 | 2235 | |
| 2236 | - @ <tr><td align="right" valign="top"><b>Check-in Time:</b></td> | |
| 2236 | + @ <tr><th align="right" valign="top">Check-in Time:</th> | |
| 2237 | 2237 | @ <td valign="top"> |
| 2238 | 2238 | @ <input type="text" name="dt" size="20" value="%h(zNewDate)" /> |
| 2239 | 2239 | @ </td></tr> |
| 2240 | 2240 | |
| 2241 | 2241 | if( zChngTime ){ |
| 2242 | - @ <tr><td align="right" valign="top"><b>Timestamp of this change:</b></td> | |
| 2242 | + @ <tr><th align="right" valign="top">Timestamp of this change:</th> | |
| 2243 | 2243 | @ <td valign="top"> |
| 2244 | 2244 | @ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" /> |
| 2245 | 2245 | @ </td></tr> |
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | - @ <tr><td align="right" valign="top"><b>Background Color:</b></td> | |
| 2248 | + @ <tr><th align="right" valign="top">Background Color:</th> | |
| 2249 | 2249 | @ <td valign="top"> |
| 2250 | 2250 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2251 | 2251 | @ </td></tr> |
| 2252 | 2252 | |
| 2253 | - @ <tr><td align="right" valign="top"><b>Tags:</b></td> | |
| 2253 | + @ <tr><th align="right" valign="top">Tags:</th> | |
| 2254 | 2254 | @ <td valign="top"> |
| 2255 | 2255 | @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) /> |
| 2256 | 2256 | @ Add the following new tag name to this check-in:</label> |
| 2257 | 2257 | @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" |
| 2258 | 2258 | @ onkeyup="gebi('newtag').checked=!!this.value" /> |
| @@ -2281,11 +2281,11 @@ | ||
| 2281 | 2281 | } |
| 2282 | 2282 | } |
| 2283 | 2283 | db_finalize(&q); |
| 2284 | 2284 | @ </td></tr> |
| 2285 | 2285 | |
| 2286 | - @ <tr><td align="right" valign="top"><b>Branching:</b></td> | |
| 2286 | + @ <tr><th align="right" valign="top">Branching:</th> | |
| 2287 | 2287 | @ <td valign="top"> |
| 2288 | 2288 | @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2289 | 2289 | @ Make this check-in the start of a new branch named:</label> |
| 2290 | 2290 | @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" |
| 2291 | 2291 | @ onkeyup="gebi('newbr').checked=!!this.value" /> |
| @@ -2294,11 +2294,11 @@ | ||
| 2294 | 2294 | if( is_a_leaf(rid) |
| 2295 | 2295 | && !db_exists("SELECT 1 FROM tagxref " |
| 2296 | 2296 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2297 | 2297 | TAG_CLOSED, rid) |
| 2298 | 2298 | ){ |
| 2299 | - @ <tr><td align="right" valign="top"><b>Leaf Closure:</b></td> | |
| 2299 | + @ <tr><th align="right" valign="top">Leaf Closure:</th> | |
| 2300 | 2300 | @ <td valign="top"> |
| 2301 | 2301 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2302 | 2302 | @ Mark this leaf as "closed" so that it no longer appears on the |
| 2303 | 2303 | @ "leaves" page and is no longer labeled as a "<b>Leaf</b>".</label> |
| 2304 | 2304 | @ </td></tr> |
| 2305 | 2305 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2221,38 +2221,38 @@ | |
| 2221 | form_begin(0, "%R/ci_edit"); |
| 2222 | login_insert_csrf_secret(); |
| 2223 | @ <div><input type="hidden" name="r" value="%S(zUuid)" /> |
| 2224 | @ <table border="0" cellspacing="10"> |
| 2225 | |
| 2226 | @ <tr><td align="right" valign="top"><b>User:</b></td> |
| 2227 | @ <td valign="top"> |
| 2228 | @ <input type="text" name="u" size="20" value="%h(zNewUser)" /> |
| 2229 | @ </td></tr> |
| 2230 | |
| 2231 | @ <tr><td align="right" valign="top"><b>Comment:</b></td> |
| 2232 | @ <td valign="top"> |
| 2233 | @ <textarea name="c" rows="10" cols="80">%h(zNewComment)</textarea> |
| 2234 | @ </td></tr> |
| 2235 | |
| 2236 | @ <tr><td align="right" valign="top"><b>Check-in Time:</b></td> |
| 2237 | @ <td valign="top"> |
| 2238 | @ <input type="text" name="dt" size="20" value="%h(zNewDate)" /> |
| 2239 | @ </td></tr> |
| 2240 | |
| 2241 | if( zChngTime ){ |
| 2242 | @ <tr><td align="right" valign="top"><b>Timestamp of this change:</b></td> |
| 2243 | @ <td valign="top"> |
| 2244 | @ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" /> |
| 2245 | @ </td></tr> |
| 2246 | } |
| 2247 | |
| 2248 | @ <tr><td align="right" valign="top"><b>Background Color:</b></td> |
| 2249 | @ <td valign="top"> |
| 2250 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2251 | @ </td></tr> |
| 2252 | |
| 2253 | @ <tr><td align="right" valign="top"><b>Tags:</b></td> |
| 2254 | @ <td valign="top"> |
| 2255 | @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) /> |
| 2256 | @ Add the following new tag name to this check-in:</label> |
| 2257 | @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" |
| 2258 | @ onkeyup="gebi('newtag').checked=!!this.value" /> |
| @@ -2281,11 +2281,11 @@ | |
| 2281 | } |
| 2282 | } |
| 2283 | db_finalize(&q); |
| 2284 | @ </td></tr> |
| 2285 | |
| 2286 | @ <tr><td align="right" valign="top"><b>Branching:</b></td> |
| 2287 | @ <td valign="top"> |
| 2288 | @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2289 | @ Make this check-in the start of a new branch named:</label> |
| 2290 | @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" |
| 2291 | @ onkeyup="gebi('newbr').checked=!!this.value" /> |
| @@ -2294,11 +2294,11 @@ | |
| 2294 | if( is_a_leaf(rid) |
| 2295 | && !db_exists("SELECT 1 FROM tagxref " |
| 2296 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2297 | TAG_CLOSED, rid) |
| 2298 | ){ |
| 2299 | @ <tr><td align="right" valign="top"><b>Leaf Closure:</b></td> |
| 2300 | @ <td valign="top"> |
| 2301 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2302 | @ Mark this leaf as "closed" so that it no longer appears on the |
| 2303 | @ "leaves" page and is no longer labeled as a "<b>Leaf</b>".</label> |
| 2304 | @ </td></tr> |
| 2305 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2221,38 +2221,38 @@ | |
| 2221 | form_begin(0, "%R/ci_edit"); |
| 2222 | login_insert_csrf_secret(); |
| 2223 | @ <div><input type="hidden" name="r" value="%S(zUuid)" /> |
| 2224 | @ <table border="0" cellspacing="10"> |
| 2225 | |
| 2226 | @ <tr><th align="right" valign="top">User:</th> |
| 2227 | @ <td valign="top"> |
| 2228 | @ <input type="text" name="u" size="20" value="%h(zNewUser)" /> |
| 2229 | @ </td></tr> |
| 2230 | |
| 2231 | @ <tr><th align="right" valign="top">Comment:</th> |
| 2232 | @ <td valign="top"> |
| 2233 | @ <textarea name="c" rows="10" cols="80">%h(zNewComment)</textarea> |
| 2234 | @ </td></tr> |
| 2235 | |
| 2236 | @ <tr><th align="right" valign="top">Check-in Time:</th> |
| 2237 | @ <td valign="top"> |
| 2238 | @ <input type="text" name="dt" size="20" value="%h(zNewDate)" /> |
| 2239 | @ </td></tr> |
| 2240 | |
| 2241 | if( zChngTime ){ |
| 2242 | @ <tr><th align="right" valign="top">Timestamp of this change:</th> |
| 2243 | @ <td valign="top"> |
| 2244 | @ <input type="text" name="chngtime" size="20" value="%h(zChngTime)" /> |
| 2245 | @ </td></tr> |
| 2246 | } |
| 2247 | |
| 2248 | @ <tr><th align="right" valign="top">Background Color:</th> |
| 2249 | @ <td valign="top"> |
| 2250 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2251 | @ </td></tr> |
| 2252 | |
| 2253 | @ <tr><th align="right" valign="top">Tags:</th> |
| 2254 | @ <td valign="top"> |
| 2255 | @ <label><input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) /> |
| 2256 | @ Add the following new tag name to this check-in:</label> |
| 2257 | @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" |
| 2258 | @ onkeyup="gebi('newtag').checked=!!this.value" /> |
| @@ -2281,11 +2281,11 @@ | |
| 2281 | } |
| 2282 | } |
| 2283 | db_finalize(&q); |
| 2284 | @ </td></tr> |
| 2285 | |
| 2286 | @ <tr><th align="right" valign="top">Branching:</th> |
| 2287 | @ <td valign="top"> |
| 2288 | @ <label><input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2289 | @ Make this check-in the start of a new branch named:</label> |
| 2290 | @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" |
| 2291 | @ onkeyup="gebi('newbr').checked=!!this.value" /> |
| @@ -2294,11 +2294,11 @@ | |
| 2294 | if( is_a_leaf(rid) |
| 2295 | && !db_exists("SELECT 1 FROM tagxref " |
| 2296 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2297 | TAG_CLOSED, rid) |
| 2298 | ){ |
| 2299 | @ <tr><th align="right" valign="top">Leaf Closure:</th> |
| 2300 | @ <td valign="top"> |
| 2301 | @ <label><input type="checkbox" name="close"%s(zCloseFlag) /> |
| 2302 | @ Mark this leaf as "closed" so that it no longer appears on the |
| 2303 | @ "leaves" page and is no longer labeled as a "<b>Leaf</b>".</label> |
| 2304 | @ </td></tr> |
| 2305 |
+1
| --- src/json_status.c | ||
| +++ src/json_status.c | ||
| @@ -157,10 +157,11 @@ | ||
| 157 | 157 | while( db_step(&q)==SQLITE_ROW ){ |
| 158 | 158 | const char *zLabel = "MERGED_WITH"; |
| 159 | 159 | switch( db_column_int(&q, 1) ){ |
| 160 | 160 | case -1: zLabel = "CHERRYPICK "; break; |
| 161 | 161 | case -2: zLabel = "BACKOUT "; break; |
| 162 | + case -4: zLabel = "INTEGRATE "; break; | |
| 162 | 163 | } |
| 163 | 164 | blob_append(report, zPrefix, nPrefix); |
| 164 | 165 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 165 | 166 | } |
| 166 | 167 | db_finalize(&q); |
| 167 | 168 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -157,10 +157,11 @@ | |
| 157 | while( db_step(&q)==SQLITE_ROW ){ |
| 158 | const char *zLabel = "MERGED_WITH"; |
| 159 | switch( db_column_int(&q, 1) ){ |
| 160 | case -1: zLabel = "CHERRYPICK "; break; |
| 161 | case -2: zLabel = "BACKOUT "; break; |
| 162 | } |
| 163 | blob_append(report, zPrefix, nPrefix); |
| 164 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 165 | } |
| 166 | db_finalize(&q); |
| 167 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -157,10 +157,11 @@ | |
| 157 | while( db_step(&q)==SQLITE_ROW ){ |
| 158 | const char *zLabel = "MERGED_WITH"; |
| 159 | switch( db_column_int(&q, 1) ){ |
| 160 | case -1: zLabel = "CHERRYPICK "; break; |
| 161 | case -2: zLabel = "BACKOUT "; break; |
| 162 | case -4: zLabel = "INTEGRATE "; break; |
| 163 | } |
| 164 | blob_append(report, zPrefix, nPrefix); |
| 165 | blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); |
| 166 | } |
| 167 | db_finalize(&q); |
| 168 |
+20
-7
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -91,19 +91,22 @@ | ||
| 91 | 91 | ** files whose names differ only in case are taken |
| 92 | 92 | ** to be the same file. |
| 93 | 93 | ** |
| 94 | 94 | ** -f|--force Force the merge even if it would be a no-op. |
| 95 | 95 | ** |
| 96 | +** --integrate Merged branch will be closed when committing. | |
| 97 | +** | |
| 96 | 98 | ** -n|--dry-run If given, display instead of run actions |
| 97 | 99 | ** |
| 98 | 100 | ** -v|--verbose Show additional details of the merge |
| 99 | 101 | */ |
| 100 | 102 | void merge_cmd(void){ |
| 101 | 103 | int vid; /* Current version "V" */ |
| 102 | 104 | int mid; /* Version we are merging from "M" */ |
| 103 | 105 | int pid; /* The pivot version - most recent common ancestor P */ |
| 104 | 106 | int verboseFlag; /* True if the -v|--verbose option is present */ |
| 107 | + int integrateFlag; /* True if the --integrate option is present */ | |
| 105 | 108 | int pickFlag; /* True if the --cherrypick option is present */ |
| 106 | 109 | int backoutFlag; /* True if the --backout option is present */ |
| 107 | 110 | int dryRunFlag; /* True if the --dry-run or -n option is present */ |
| 108 | 111 | int forceFlag; /* True if the --force or -f option is present */ |
| 109 | 112 | const char *zBinGlob; /* The value of --binary */ |
| @@ -128,10 +131,11 @@ | ||
| 128 | 131 | verboseFlag = find_option("verbose","v",0)!=0; |
| 129 | 132 | if( !verboseFlag ){ |
| 130 | 133 | verboseFlag = find_option("detail",0,0)!=0; /* deprecated */ |
| 131 | 134 | } |
| 132 | 135 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 136 | + integrateFlag = find_option("integrate",0,0)!=0; | |
| 133 | 137 | backoutFlag = find_option("backout",0,0)!=0; |
| 134 | 138 | debugFlag = find_option("debug",0,0)!=0; |
| 135 | 139 | zBinGlob = find_option("binary",0,1); |
| 136 | 140 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 137 | 141 | if( !dryRunFlag ){ |
| @@ -162,12 +166,12 @@ | ||
| 162 | 166 | ** has not already been merged into the current checkout and (3) |
| 163 | 167 | ** the leaf is not closed and (4) the leaf is in the same branch |
| 164 | 168 | ** as the current checkout. |
| 165 | 169 | */ |
| 166 | 170 | Stmt q; |
| 167 | - if( pickFlag || backoutFlag ){ | |
| 168 | - fossil_fatal("cannot use --cherrypick or --backout with a fork merge"); | |
| 171 | + if( pickFlag || backoutFlag || integrateFlag){ | |
| 172 | + fossil_fatal("cannot use --backout, --cherrypick or --integrate with a fork merge"); | |
| 169 | 173 | } |
| 170 | 174 | mid = db_int(0, |
| 171 | 175 | "SELECT leaf.rid" |
| 172 | 176 | " FROM leaf, event" |
| 173 | 177 | " WHERE leaf.rid=event.objid" |
| @@ -220,10 +224,13 @@ | ||
| 220 | 224 | } |
| 221 | 225 | if( pickFlag ){ |
| 222 | 226 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 223 | 227 | } |
| 224 | 228 | }else if( pickFlag || backoutFlag ){ |
| 229 | + if( integrateFlag ){ | |
| 230 | + fossil_fatal("incompatible options: --integrate & --cherrypick or --backout"); | |
| 231 | + } | |
| 225 | 232 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 226 | 233 | if( pid<=0 ){ |
| 227 | 234 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 228 | 235 | } |
| 229 | 236 | }else{ |
| @@ -251,12 +258,16 @@ | ||
| 251 | 258 | if( !forceFlag && mid==pid ){ |
| 252 | 259 | fossil_print("Merge skipped because it is a no-op. " |
| 253 | 260 | " Use --force to override.\n"); |
| 254 | 261 | return; |
| 255 | 262 | } |
| 263 | + if( integrateFlag && !is_a_leaf(mid) ){ | |
| 264 | + fossil_warning("ignoring --integrate: %s is not a leaf", g.argv[2]); | |
| 265 | + integrateFlag = 0; | |
| 266 | + } | |
| 256 | 267 | if( verboseFlag ){ |
| 257 | - print_checkin_description(mid, 12, "merge-from:"); | |
| 268 | + print_checkin_description(mid, 12, integrateFlag?"integrate:":"merge-from:"); | |
| 258 | 269 | print_checkin_description(pid, 12, "baseline:"); |
| 259 | 270 | } |
| 260 | 271 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 261 | 272 | db_begin_transaction(); |
| 262 | 273 | if( !dryRunFlag ) undo_begin(); |
| @@ -434,12 +445,12 @@ | ||
| 434 | 445 | int idv; |
| 435 | 446 | const char *zName; |
| 436 | 447 | char *zFullName; |
| 437 | 448 | db_multi_exec( |
| 438 | 449 | "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,islink,pathname)" |
| 439 | - " SELECT %d,3,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", | |
| 440 | - vid, idm | |
| 450 | + " SELECT %d,%d,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", | |
| 451 | + vid, integrateFlag?5:3, idm | |
| 441 | 452 | ); |
| 442 | 453 | idv = db_last_insert_rowid(); |
| 443 | 454 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 444 | 455 | zName = db_column_text(&q, 2); |
| 445 | 456 | zFullName = mprintf("%s%s", g.zLocalRoot, zName); |
| @@ -474,12 +485,12 @@ | ||
| 474 | 485 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 475 | 486 | fossil_print("UPDATE %s\n", zName); |
| 476 | 487 | if( !dryRunFlag ){ |
| 477 | 488 | undo_save(zName); |
| 478 | 489 | db_multi_exec( |
| 479 | - "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d " | |
| 480 | - " WHERE id=%d", ridm, islinkm, idv | |
| 490 | + "UPDATE vfile SET mtime=0, mrid=%d, chnged=%d, islink=%d " | |
| 491 | + " WHERE id=%d", ridm, integrateFlag?4:2, islinkm, idv | |
| 481 | 492 | ); |
| 482 | 493 | vfile_to_disk(0, idv, 0, 0); |
| 483 | 494 | } |
| 484 | 495 | } |
| 485 | 496 | db_finalize(&q); |
| @@ -644,11 +655,13 @@ | ||
| 644 | 655 | " WHERE type='ci' AND objid=%d", |
| 645 | 656 | mid |
| 646 | 657 | ); |
| 647 | 658 | }else if( backoutFlag ){ |
| 648 | 659 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid); |
| 660 | + }else if( integrateFlag ){ | |
| 661 | + db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-4,%d)",mid); | |
| 649 | 662 | }else{ |
| 650 | 663 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid); |
| 651 | 664 | } |
| 652 | 665 | undo_finish(); |
| 653 | 666 | db_end_transaction(dryRunFlag); |
| 654 | 667 | } |
| 655 | 668 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -91,19 +91,22 @@ | |
| 91 | ** files whose names differ only in case are taken |
| 92 | ** to be the same file. |
| 93 | ** |
| 94 | ** -f|--force Force the merge even if it would be a no-op. |
| 95 | ** |
| 96 | ** -n|--dry-run If given, display instead of run actions |
| 97 | ** |
| 98 | ** -v|--verbose Show additional details of the merge |
| 99 | */ |
| 100 | void merge_cmd(void){ |
| 101 | int vid; /* Current version "V" */ |
| 102 | int mid; /* Version we are merging from "M" */ |
| 103 | int pid; /* The pivot version - most recent common ancestor P */ |
| 104 | int verboseFlag; /* True if the -v|--verbose option is present */ |
| 105 | int pickFlag; /* True if the --cherrypick option is present */ |
| 106 | int backoutFlag; /* True if the --backout option is present */ |
| 107 | int dryRunFlag; /* True if the --dry-run or -n option is present */ |
| 108 | int forceFlag; /* True if the --force or -f option is present */ |
| 109 | const char *zBinGlob; /* The value of --binary */ |
| @@ -128,10 +131,11 @@ | |
| 128 | verboseFlag = find_option("verbose","v",0)!=0; |
| 129 | if( !verboseFlag ){ |
| 130 | verboseFlag = find_option("detail",0,0)!=0; /* deprecated */ |
| 131 | } |
| 132 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 133 | backoutFlag = find_option("backout",0,0)!=0; |
| 134 | debugFlag = find_option("debug",0,0)!=0; |
| 135 | zBinGlob = find_option("binary",0,1); |
| 136 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 137 | if( !dryRunFlag ){ |
| @@ -162,12 +166,12 @@ | |
| 162 | ** has not already been merged into the current checkout and (3) |
| 163 | ** the leaf is not closed and (4) the leaf is in the same branch |
| 164 | ** as the current checkout. |
| 165 | */ |
| 166 | Stmt q; |
| 167 | if( pickFlag || backoutFlag ){ |
| 168 | fossil_fatal("cannot use --cherrypick or --backout with a fork merge"); |
| 169 | } |
| 170 | mid = db_int(0, |
| 171 | "SELECT leaf.rid" |
| 172 | " FROM leaf, event" |
| 173 | " WHERE leaf.rid=event.objid" |
| @@ -220,10 +224,13 @@ | |
| 220 | } |
| 221 | if( pickFlag ){ |
| 222 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 223 | } |
| 224 | }else if( pickFlag || backoutFlag ){ |
| 225 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 226 | if( pid<=0 ){ |
| 227 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 228 | } |
| 229 | }else{ |
| @@ -251,12 +258,16 @@ | |
| 251 | if( !forceFlag && mid==pid ){ |
| 252 | fossil_print("Merge skipped because it is a no-op. " |
| 253 | " Use --force to override.\n"); |
| 254 | return; |
| 255 | } |
| 256 | if( verboseFlag ){ |
| 257 | print_checkin_description(mid, 12, "merge-from:"); |
| 258 | print_checkin_description(pid, 12, "baseline:"); |
| 259 | } |
| 260 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 261 | db_begin_transaction(); |
| 262 | if( !dryRunFlag ) undo_begin(); |
| @@ -434,12 +445,12 @@ | |
| 434 | int idv; |
| 435 | const char *zName; |
| 436 | char *zFullName; |
| 437 | db_multi_exec( |
| 438 | "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,islink,pathname)" |
| 439 | " SELECT %d,3,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", |
| 440 | vid, idm |
| 441 | ); |
| 442 | idv = db_last_insert_rowid(); |
| 443 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 444 | zName = db_column_text(&q, 2); |
| 445 | zFullName = mprintf("%s%s", g.zLocalRoot, zName); |
| @@ -474,12 +485,12 @@ | |
| 474 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 475 | fossil_print("UPDATE %s\n", zName); |
| 476 | if( !dryRunFlag ){ |
| 477 | undo_save(zName); |
| 478 | db_multi_exec( |
| 479 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d " |
| 480 | " WHERE id=%d", ridm, islinkm, idv |
| 481 | ); |
| 482 | vfile_to_disk(0, idv, 0, 0); |
| 483 | } |
| 484 | } |
| 485 | db_finalize(&q); |
| @@ -644,11 +655,13 @@ | |
| 644 | " WHERE type='ci' AND objid=%d", |
| 645 | mid |
| 646 | ); |
| 647 | }else if( backoutFlag ){ |
| 648 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid); |
| 649 | }else{ |
| 650 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid); |
| 651 | } |
| 652 | undo_finish(); |
| 653 | db_end_transaction(dryRunFlag); |
| 654 | } |
| 655 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -91,19 +91,22 @@ | |
| 91 | ** files whose names differ only in case are taken |
| 92 | ** to be the same file. |
| 93 | ** |
| 94 | ** -f|--force Force the merge even if it would be a no-op. |
| 95 | ** |
| 96 | ** --integrate Merged branch will be closed when committing. |
| 97 | ** |
| 98 | ** -n|--dry-run If given, display instead of run actions |
| 99 | ** |
| 100 | ** -v|--verbose Show additional details of the merge |
| 101 | */ |
| 102 | void merge_cmd(void){ |
| 103 | int vid; /* Current version "V" */ |
| 104 | int mid; /* Version we are merging from "M" */ |
| 105 | int pid; /* The pivot version - most recent common ancestor P */ |
| 106 | int verboseFlag; /* True if the -v|--verbose option is present */ |
| 107 | int integrateFlag; /* True if the --integrate option is present */ |
| 108 | int pickFlag; /* True if the --cherrypick option is present */ |
| 109 | int backoutFlag; /* True if the --backout option is present */ |
| 110 | int dryRunFlag; /* True if the --dry-run or -n option is present */ |
| 111 | int forceFlag; /* True if the --force or -f option is present */ |
| 112 | const char *zBinGlob; /* The value of --binary */ |
| @@ -128,10 +131,11 @@ | |
| 131 | verboseFlag = find_option("verbose","v",0)!=0; |
| 132 | if( !verboseFlag ){ |
| 133 | verboseFlag = find_option("detail",0,0)!=0; /* deprecated */ |
| 134 | } |
| 135 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 136 | integrateFlag = find_option("integrate",0,0)!=0; |
| 137 | backoutFlag = find_option("backout",0,0)!=0; |
| 138 | debugFlag = find_option("debug",0,0)!=0; |
| 139 | zBinGlob = find_option("binary",0,1); |
| 140 | dryRunFlag = find_option("dry-run","n",0)!=0; |
| 141 | if( !dryRunFlag ){ |
| @@ -162,12 +166,12 @@ | |
| 166 | ** has not already been merged into the current checkout and (3) |
| 167 | ** the leaf is not closed and (4) the leaf is in the same branch |
| 168 | ** as the current checkout. |
| 169 | */ |
| 170 | Stmt q; |
| 171 | if( pickFlag || backoutFlag || integrateFlag){ |
| 172 | fossil_fatal("cannot use --backout, --cherrypick or --integrate with a fork merge"); |
| 173 | } |
| 174 | mid = db_int(0, |
| 175 | "SELECT leaf.rid" |
| 176 | " FROM leaf, event" |
| 177 | " WHERE leaf.rid=event.objid" |
| @@ -220,10 +224,13 @@ | |
| 224 | } |
| 225 | if( pickFlag ){ |
| 226 | fossil_fatal("incompatible options: --cherrypick & --baseline"); |
| 227 | } |
| 228 | }else if( pickFlag || backoutFlag ){ |
| 229 | if( integrateFlag ){ |
| 230 | fossil_fatal("incompatible options: --integrate & --cherrypick or --backout"); |
| 231 | } |
| 232 | pid = db_int(0, "SELECT pid FROM plink WHERE cid=%d AND isprim", mid); |
| 233 | if( pid<=0 ){ |
| 234 | fossil_fatal("cannot find an ancestor for %s", g.argv[2]); |
| 235 | } |
| 236 | }else{ |
| @@ -251,12 +258,16 @@ | |
| 258 | if( !forceFlag && mid==pid ){ |
| 259 | fossil_print("Merge skipped because it is a no-op. " |
| 260 | " Use --force to override.\n"); |
| 261 | return; |
| 262 | } |
| 263 | if( integrateFlag && !is_a_leaf(mid) ){ |
| 264 | fossil_warning("ignoring --integrate: %s is not a leaf", g.argv[2]); |
| 265 | integrateFlag = 0; |
| 266 | } |
| 267 | if( verboseFlag ){ |
| 268 | print_checkin_description(mid, 12, integrateFlag?"integrate:":"merge-from:"); |
| 269 | print_checkin_description(pid, 12, "baseline:"); |
| 270 | } |
| 271 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 272 | db_begin_transaction(); |
| 273 | if( !dryRunFlag ) undo_begin(); |
| @@ -434,12 +445,12 @@ | |
| 445 | int idv; |
| 446 | const char *zName; |
| 447 | char *zFullName; |
| 448 | db_multi_exec( |
| 449 | "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,islink,pathname)" |
| 450 | " SELECT %d,%d,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", |
| 451 | vid, integrateFlag?5:3, idm |
| 452 | ); |
| 453 | idv = db_last_insert_rowid(); |
| 454 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 455 | zName = db_column_text(&q, 2); |
| 456 | zFullName = mprintf("%s%s", g.zLocalRoot, zName); |
| @@ -474,12 +485,12 @@ | |
| 485 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 486 | fossil_print("UPDATE %s\n", zName); |
| 487 | if( !dryRunFlag ){ |
| 488 | undo_save(zName); |
| 489 | db_multi_exec( |
| 490 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=%d, islink=%d " |
| 491 | " WHERE id=%d", ridm, integrateFlag?4:2, islinkm, idv |
| 492 | ); |
| 493 | vfile_to_disk(0, idv, 0, 0); |
| 494 | } |
| 495 | } |
| 496 | db_finalize(&q); |
| @@ -644,11 +655,13 @@ | |
| 655 | " WHERE type='ci' AND objid=%d", |
| 656 | mid |
| 657 | ); |
| 658 | }else if( backoutFlag ){ |
| 659 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-2,%d)",pid); |
| 660 | }else if( integrateFlag ){ |
| 661 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(-4,%d)",mid); |
| 662 | }else{ |
| 663 | db_multi_exec("INSERT OR IGNORE INTO vmerge(id,merge) VALUES(0,%d)", mid); |
| 664 | } |
| 665 | undo_finish(); |
| 666 | db_end_transaction(dryRunFlag); |
| 667 | } |
| 668 |
+11
-10
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -475,25 +475,25 @@ | ||
| 475 | 475 | @ -- |
| 476 | 476 | @ -- The file.rid field is 0 for files or folders that have been |
| 477 | 477 | @ -- added but not yet committed. |
| 478 | 478 | @ -- |
| 479 | 479 | @ -- Vfile.chnged is 0 for unmodified files, 1 for files that have |
| 480 | -@ -- been edited or which have been subjected to a 3-way merge. | |
| 480 | +@ -- been edited or which have been subjected to a 3-way merge. | |
| 481 | 481 | @ -- Vfile.chnged is 2 if the file has been replaced from a different |
| 482 | 482 | @ -- version by the merge and 3 if the file has been added by a merge. |
| 483 | -@ -- The difference between vfile.chnged==2 and a regular add is that | |
| 484 | -@ -- with vfile.chnged==2 we know that the current version of the file | |
| 485 | -@ -- is already in the repository. | |
| 486 | -@ -- | |
| 483 | +@ -- Vfile.chnged is 4|5 is the same as 2|3, but the operation has been | |
| 484 | +@ -- done by an --integrate merge. The difference between vfile.chnged==2|4 | |
| 485 | +@ -- and a regular add is that with vfile.chnged==2|4 we know that the | |
| 486 | +@ -- current version of the file is already in the repository. | |
| 487 | 487 | @ -- |
| 488 | 488 | @ CREATE TABLE vfile( |
| 489 | 489 | @ id INTEGER PRIMARY KEY, -- ID of the checked out file |
| 490 | 490 | @ vid INTEGER REFERENCES blob, -- The baseline this file is part of. |
| 491 | -@ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add | |
| 492 | -@ deleted BOOLEAN DEFAULT 0, -- True if deleted | |
| 491 | +@ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add 4:i-chng 5:i-add | |
| 492 | +@ deleted BOOLEAN DEFAULT 0, -- True if deleted | |
| 493 | 493 | @ isexe BOOLEAN, -- True if file should be executable |
| 494 | -@ islink BOOLEAN, -- True if file should be symlink | |
| 494 | +@ islink BOOLEAN, -- True if file should be symlink | |
| 495 | 495 | @ rid INTEGER, -- Originally from this repository record |
| 496 | 496 | @ mrid INTEGER, -- Based on this record due to a merge |
| 497 | 497 | @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 |
| 498 | 498 | @ pathname TEXT, -- Full pathname relative to root |
| 499 | 499 | @ origname TEXT, -- Original pathname. NULL if unchanged |
| @@ -502,12 +502,13 @@ | ||
| 502 | 502 | @ |
| 503 | 503 | @ -- This table holds a record of uncommitted merges in the local |
| 504 | 504 | @ -- file tree. If a VFILE entry with id has merged with another |
| 505 | 505 | @ -- record, there is an entry in this table with (id,merge) where |
| 506 | 506 | @ -- merge is the RECORD table entry that the file merged against. |
| 507 | -@ -- An id of 0 here means the version record itself. When id==(-1) | |
| 508 | -@ -- that is a cherrypick merge and id==(-2) is a backout merge. | |
| 507 | +@ -- An id of 0 or <-3 here means the version record itself. When | |
| 508 | +@ -- id==(-1) that is a cherrypick merge, id==(-2) that is a | |
| 509 | +@ -- backout merge and id==(-4) is a integrate merge. | |
| 509 | 510 | @ |
| 510 | 511 | @ CREATE TABLE vmerge( |
| 511 | 512 | @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged |
| 512 | 513 | @ merge INTEGER, -- Merged with this record |
| 513 | 514 | @ UNIQUE(id, merge) |
| 514 | 515 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -475,25 +475,25 @@ | |
| 475 | @ -- |
| 476 | @ -- The file.rid field is 0 for files or folders that have been |
| 477 | @ -- added but not yet committed. |
| 478 | @ -- |
| 479 | @ -- Vfile.chnged is 0 for unmodified files, 1 for files that have |
| 480 | @ -- been edited or which have been subjected to a 3-way merge. |
| 481 | @ -- Vfile.chnged is 2 if the file has been replaced from a different |
| 482 | @ -- version by the merge and 3 if the file has been added by a merge. |
| 483 | @ -- The difference between vfile.chnged==2 and a regular add is that |
| 484 | @ -- with vfile.chnged==2 we know that the current version of the file |
| 485 | @ -- is already in the repository. |
| 486 | @ -- |
| 487 | @ -- |
| 488 | @ CREATE TABLE vfile( |
| 489 | @ id INTEGER PRIMARY KEY, -- ID of the checked out file |
| 490 | @ vid INTEGER REFERENCES blob, -- The baseline this file is part of. |
| 491 | @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add |
| 492 | @ deleted BOOLEAN DEFAULT 0, -- True if deleted |
| 493 | @ isexe BOOLEAN, -- True if file should be executable |
| 494 | @ islink BOOLEAN, -- True if file should be symlink |
| 495 | @ rid INTEGER, -- Originally from this repository record |
| 496 | @ mrid INTEGER, -- Based on this record due to a merge |
| 497 | @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 |
| 498 | @ pathname TEXT, -- Full pathname relative to root |
| 499 | @ origname TEXT, -- Original pathname. NULL if unchanged |
| @@ -502,12 +502,13 @@ | |
| 502 | @ |
| 503 | @ -- This table holds a record of uncommitted merges in the local |
| 504 | @ -- file tree. If a VFILE entry with id has merged with another |
| 505 | @ -- record, there is an entry in this table with (id,merge) where |
| 506 | @ -- merge is the RECORD table entry that the file merged against. |
| 507 | @ -- An id of 0 here means the version record itself. When id==(-1) |
| 508 | @ -- that is a cherrypick merge and id==(-2) is a backout merge. |
| 509 | @ |
| 510 | @ CREATE TABLE vmerge( |
| 511 | @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged |
| 512 | @ merge INTEGER, -- Merged with this record |
| 513 | @ UNIQUE(id, merge) |
| 514 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -475,25 +475,25 @@ | |
| 475 | @ -- |
| 476 | @ -- The file.rid field is 0 for files or folders that have been |
| 477 | @ -- added but not yet committed. |
| 478 | @ -- |
| 479 | @ -- Vfile.chnged is 0 for unmodified files, 1 for files that have |
| 480 | @ -- been edited or which have been subjected to a 3-way merge. |
| 481 | @ -- Vfile.chnged is 2 if the file has been replaced from a different |
| 482 | @ -- version by the merge and 3 if the file has been added by a merge. |
| 483 | @ -- Vfile.chnged is 4|5 is the same as 2|3, but the operation has been |
| 484 | @ -- done by an --integrate merge. The difference between vfile.chnged==2|4 |
| 485 | @ -- and a regular add is that with vfile.chnged==2|4 we know that the |
| 486 | @ -- current version of the file is already in the repository. |
| 487 | @ -- |
| 488 | @ CREATE TABLE vfile( |
| 489 | @ id INTEGER PRIMARY KEY, -- ID of the checked out file |
| 490 | @ vid INTEGER REFERENCES blob, -- The baseline this file is part of. |
| 491 | @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add 4:i-chng 5:i-add |
| 492 | @ deleted BOOLEAN DEFAULT 0, -- True if deleted |
| 493 | @ isexe BOOLEAN, -- True if file should be executable |
| 494 | @ islink BOOLEAN, -- True if file should be symlink |
| 495 | @ rid INTEGER, -- Originally from this repository record |
| 496 | @ mrid INTEGER, -- Based on this record due to a merge |
| 497 | @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 |
| 498 | @ pathname TEXT, -- Full pathname relative to root |
| 499 | @ origname TEXT, -- Original pathname. NULL if unchanged |
| @@ -502,12 +502,13 @@ | |
| 502 | @ |
| 503 | @ -- This table holds a record of uncommitted merges in the local |
| 504 | @ -- file tree. If a VFILE entry with id has merged with another |
| 505 | @ -- record, there is an entry in this table with (id,merge) where |
| 506 | @ -- merge is the RECORD table entry that the file merged against. |
| 507 | @ -- An id of 0 or <-3 here means the version record itself. When |
| 508 | @ -- id==(-1) that is a cherrypick merge, id==(-2) that is a |
| 509 | @ -- backout merge and id==(-4) is a integrate merge. |
| 510 | @ |
| 511 | @ CREATE TABLE vmerge( |
| 512 | @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged |
| 513 | @ merge INTEGER, -- Merged with this record |
| 514 | @ UNIQUE(id, merge) |
| 515 |
+29
-29
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -197,62 +197,62 @@ | ||
| 197 | 197 | @ </td><td class="usetupColumnLayout"> |
| 198 | 198 | @ <span class="note">Notes:</span> |
| 199 | 199 | @ <ol> |
| 200 | 200 | @ <li><p>The permission flags are as follows:</p> |
| 201 | 201 | @ <table> |
| 202 | - @ <tr><td valign="top"><b>a</b></td> | |
| 202 | + @ <tr><th valign="top">a</th> | |
| 203 | 203 | @ <td><i>Admin:</i> Create and delete users</td></tr> |
| 204 | - @ <tr><td valign="top"><b>b</b></td> | |
| 204 | + @ <tr><th valign="top">b</th> | |
| 205 | 205 | @ <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr> |
| 206 | - @ <tr><td valign="top"><b>c</b></td> | |
| 206 | + @ <tr><th valign="top">c</th> | |
| 207 | 207 | @ <td><i>Append-Tkt:</i> Append to tickets</td></tr> |
| 208 | - @ <tr><td valign="top"><b>d</b></td> | |
| 208 | + @ <tr><th valign="top">d</th> | |
| 209 | 209 | @ <td><i>Delete:</i> Delete wiki and tickets</td></tr> |
| 210 | - @ <tr><td valign="top"><b>e</b></td> | |
| 210 | + @ <tr><th valign="top">e</th> | |
| 211 | 211 | @ <td><i>Email:</i> View sensitive data such as EMail addresses</td></tr> |
| 212 | - @ <tr><td valign="top"><b>f</b></td> | |
| 212 | + @ <tr><th valign="top">f</th> | |
| 213 | 213 | @ <td><i>New-Wiki:</i> Create new wiki pages</td></tr> |
| 214 | - @ <tr><td valign="top"><b>g</b></td> | |
| 214 | + @ <tr><th valign="top">g</th> | |
| 215 | 215 | @ <td><i>Clone:</i> Clone the repository</td></tr> |
| 216 | - @ <tr><td valign="top"><b>h</b></td> | |
| 216 | + @ <tr><th valign="top">h</th> | |
| 217 | 217 | @ <td><i>Hyperlinks:</i> Show hyperlinks to detailed |
| 218 | 218 | @ repository history</td></tr> |
| 219 | - @ <tr><td valign="top"><b>i</b></td> | |
| 219 | + @ <tr><th valign="top">i</th> | |
| 220 | 220 | @ <td><i>Check-In:</i> Commit new versions in the repository</td></tr> |
| 221 | - @ <tr><td valign="top"><b>j</b></td> | |
| 221 | + @ <tr><th valign="top">j</th> | |
| 222 | 222 | @ <td><i>Read-Wiki:</i> View wiki pages</td></tr> |
| 223 | - @ <tr><td valign="top"><b>k</b></td> | |
| 223 | + @ <tr><th valign="top">k</th> | |
| 224 | 224 | @ <td><i>Write-Wiki:</i> Edit wiki pages</td></tr> |
| 225 | - @ <tr><td valign="top"><b>l</b></td> | |
| 225 | + @ <tr><th valign="top">l</th> | |
| 226 | 226 | @ <td><i>Mod-Wiki:</i> Moderator for wiki pages</td></tr> |
| 227 | - @ <tr><td valign="top"><b>m</b></td> | |
| 227 | + @ <tr><th valign="top">m</th> | |
| 228 | 228 | @ <td><i>Append-Wiki:</i> Append to wiki pages</td></tr> |
| 229 | - @ <tr><td valign="top"><b>n</b></td> | |
| 229 | + @ <tr><th valign="top">n</th> | |
| 230 | 230 | @ <td><i>New-Tkt:</i> Create new tickets</td></tr> |
| 231 | - @ <tr><td valign="top"><b>o</b></td> | |
| 231 | + @ <tr><th valign="top">o</th> | |
| 232 | 232 | @ <td><i>Check-Out:</i> Check out versions</td></tr> |
| 233 | - @ <tr><td valign="top"><b>p</b></td> | |
| 233 | + @ <tr><th valign="top">p</th> | |
| 234 | 234 | @ <td><i>Password:</i> Change your own password</td></tr> |
| 235 | - @ <tr><td valign="top"><b>q</b></td> | |
| 235 | + @ <tr><th valign="top">q</th> | |
| 236 | 236 | @ <td><i>Mod-Tkt:</i> Moderator for tickets</td></tr> |
| 237 | - @ <tr><td valign="top"><b>r</b></td> | |
| 237 | + @ <tr><th valign="top">r</th> | |
| 238 | 238 | @ <td><i>Read-Tkt:</i> View tickets</td></tr> |
| 239 | - @ <tr><td valign="top"><b>s</b></td> | |
| 239 | + @ <tr><th valign="top">s</th> | |
| 240 | 240 | @ <td><i>Setup/Super-user:</i> Setup and configure this website</td></tr> |
| 241 | - @ <tr><td valign="top"><b>t</b></td> | |
| 241 | + @ <tr><th valign="top">t</th> | |
| 242 | 242 | @ <td><i>Tkt-Report:</i> Create new bug summary reports</td></tr> |
| 243 | - @ <tr><td valign="top"><b>u</b></td> | |
| 243 | + @ <tr><th valign="top">u</th> | |
| 244 | 244 | @ <td><i>Reader:</i> Inherit privileges of |
| 245 | 245 | @ user <tt>reader</tt></td></tr> |
| 246 | - @ <tr><td valign="top"><b>v</b></td> | |
| 246 | + @ <tr><th valign="top">v</th> | |
| 247 | 247 | @ <td><i>Developer:</i> Inherit privileges of |
| 248 | 248 | @ user <tt>developer</tt></td></tr> |
| 249 | - @ <tr><td valign="top"><b>w</b></td> | |
| 249 | + @ <tr><th valign="top">w</th> | |
| 250 | 250 | @ <td><i>Write-Tkt:</i> Edit tickets</td></tr> |
| 251 | - @ <tr><td valign="top"><b>x</b></td> | |
| 251 | + @ <tr><th valign="top">x</th> | |
| 252 | 252 | @ <td><i>Private:</i> Push and/or pull private branches</td></tr> |
| 253 | - @ <tr><td valign="top"><b>z</b></td> | |
| 253 | + @ <tr><th valign="top">z</th> | |
| 254 | 254 | @ <td><i>Zip download:</i> Download a baseline via the |
| 255 | 255 | @ <tt>/zip</tt> URL even without |
| 256 | 256 | @ check<span class="capability">o</span>ut |
| 257 | 257 | @ and <span class="capability">h</span>istory permissions</td></tr> |
| 258 | 258 | @ </table> |
| @@ -1062,23 +1062,23 @@ | ||
| 1062 | 1062 | @ |
| 1063 | 1063 | @ <form action="%s(g.zTop)/setup_login_group" method="post"><div> |
| 1064 | 1064 | login_insert_csrf_secret(); |
| 1065 | 1065 | @ <blockquote><table border="0"> |
| 1066 | 1066 | @ |
| 1067 | - @ <tr><td align="right"><b>Repository filename in group to join:</b></td> | |
| 1067 | + @ <tr><th align="right">Repository filename in group to join:</th> | |
| 1068 | 1068 | @ <td width="5"></td><td> |
| 1069 | 1069 | @ <input type="text" size="50" value="%h(zRepo)" name="repo"></td></tr> |
| 1070 | 1070 | @ |
| 1071 | - @ <tr><td align="right"><b>Login on the above repo:</b></td> | |
| 1071 | + @ <tr><th align="right">Login on the above repo:</th> | |
| 1072 | 1072 | @ <td width="5"></td><td> |
| 1073 | 1073 | @ <input type="text" size="20" value="%h(zLogin)" name="login"></td></tr> |
| 1074 | 1074 | @ |
| 1075 | - @ <tr><td align="right"><b>Password:</b></td> | |
| 1075 | + @ <tr><th align="right">Password:</th> | |
| 1076 | 1076 | @ <td width="5"></td><td> |
| 1077 | 1077 | @ <input type="password" size="20" name="pw"></td></tr> |
| 1078 | 1078 | @ |
| 1079 | - @ <tr><td align="right"><b>Name of login-group:</b></td> | |
| 1079 | + @ <tr><th align="right">Name of login-group:</th> | |
| 1080 | 1080 | @ <td width="5"></td><td> |
| 1081 | 1081 | @ <input type="text" size="30" value="%h(zNewName)" name="newname"> |
| 1082 | 1082 | @ (only used if creating a new login-group).</td></tr> |
| 1083 | 1083 | @ |
| 1084 | 1084 | @ <tr><td colspan="3" align="center"> |
| 1085 | 1085 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -197,62 +197,62 @@ | |
| 197 | @ </td><td class="usetupColumnLayout"> |
| 198 | @ <span class="note">Notes:</span> |
| 199 | @ <ol> |
| 200 | @ <li><p>The permission flags are as follows:</p> |
| 201 | @ <table> |
| 202 | @ <tr><td valign="top"><b>a</b></td> |
| 203 | @ <td><i>Admin:</i> Create and delete users</td></tr> |
| 204 | @ <tr><td valign="top"><b>b</b></td> |
| 205 | @ <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr> |
| 206 | @ <tr><td valign="top"><b>c</b></td> |
| 207 | @ <td><i>Append-Tkt:</i> Append to tickets</td></tr> |
| 208 | @ <tr><td valign="top"><b>d</b></td> |
| 209 | @ <td><i>Delete:</i> Delete wiki and tickets</td></tr> |
| 210 | @ <tr><td valign="top"><b>e</b></td> |
| 211 | @ <td><i>Email:</i> View sensitive data such as EMail addresses</td></tr> |
| 212 | @ <tr><td valign="top"><b>f</b></td> |
| 213 | @ <td><i>New-Wiki:</i> Create new wiki pages</td></tr> |
| 214 | @ <tr><td valign="top"><b>g</b></td> |
| 215 | @ <td><i>Clone:</i> Clone the repository</td></tr> |
| 216 | @ <tr><td valign="top"><b>h</b></td> |
| 217 | @ <td><i>Hyperlinks:</i> Show hyperlinks to detailed |
| 218 | @ repository history</td></tr> |
| 219 | @ <tr><td valign="top"><b>i</b></td> |
| 220 | @ <td><i>Check-In:</i> Commit new versions in the repository</td></tr> |
| 221 | @ <tr><td valign="top"><b>j</b></td> |
| 222 | @ <td><i>Read-Wiki:</i> View wiki pages</td></tr> |
| 223 | @ <tr><td valign="top"><b>k</b></td> |
| 224 | @ <td><i>Write-Wiki:</i> Edit wiki pages</td></tr> |
| 225 | @ <tr><td valign="top"><b>l</b></td> |
| 226 | @ <td><i>Mod-Wiki:</i> Moderator for wiki pages</td></tr> |
| 227 | @ <tr><td valign="top"><b>m</b></td> |
| 228 | @ <td><i>Append-Wiki:</i> Append to wiki pages</td></tr> |
| 229 | @ <tr><td valign="top"><b>n</b></td> |
| 230 | @ <td><i>New-Tkt:</i> Create new tickets</td></tr> |
| 231 | @ <tr><td valign="top"><b>o</b></td> |
| 232 | @ <td><i>Check-Out:</i> Check out versions</td></tr> |
| 233 | @ <tr><td valign="top"><b>p</b></td> |
| 234 | @ <td><i>Password:</i> Change your own password</td></tr> |
| 235 | @ <tr><td valign="top"><b>q</b></td> |
| 236 | @ <td><i>Mod-Tkt:</i> Moderator for tickets</td></tr> |
| 237 | @ <tr><td valign="top"><b>r</b></td> |
| 238 | @ <td><i>Read-Tkt:</i> View tickets</td></tr> |
| 239 | @ <tr><td valign="top"><b>s</b></td> |
| 240 | @ <td><i>Setup/Super-user:</i> Setup and configure this website</td></tr> |
| 241 | @ <tr><td valign="top"><b>t</b></td> |
| 242 | @ <td><i>Tkt-Report:</i> Create new bug summary reports</td></tr> |
| 243 | @ <tr><td valign="top"><b>u</b></td> |
| 244 | @ <td><i>Reader:</i> Inherit privileges of |
| 245 | @ user <tt>reader</tt></td></tr> |
| 246 | @ <tr><td valign="top"><b>v</b></td> |
| 247 | @ <td><i>Developer:</i> Inherit privileges of |
| 248 | @ user <tt>developer</tt></td></tr> |
| 249 | @ <tr><td valign="top"><b>w</b></td> |
| 250 | @ <td><i>Write-Tkt:</i> Edit tickets</td></tr> |
| 251 | @ <tr><td valign="top"><b>x</b></td> |
| 252 | @ <td><i>Private:</i> Push and/or pull private branches</td></tr> |
| 253 | @ <tr><td valign="top"><b>z</b></td> |
| 254 | @ <td><i>Zip download:</i> Download a baseline via the |
| 255 | @ <tt>/zip</tt> URL even without |
| 256 | @ check<span class="capability">o</span>ut |
| 257 | @ and <span class="capability">h</span>istory permissions</td></tr> |
| 258 | @ </table> |
| @@ -1062,23 +1062,23 @@ | |
| 1062 | @ |
| 1063 | @ <form action="%s(g.zTop)/setup_login_group" method="post"><div> |
| 1064 | login_insert_csrf_secret(); |
| 1065 | @ <blockquote><table border="0"> |
| 1066 | @ |
| 1067 | @ <tr><td align="right"><b>Repository filename in group to join:</b></td> |
| 1068 | @ <td width="5"></td><td> |
| 1069 | @ <input type="text" size="50" value="%h(zRepo)" name="repo"></td></tr> |
| 1070 | @ |
| 1071 | @ <tr><td align="right"><b>Login on the above repo:</b></td> |
| 1072 | @ <td width="5"></td><td> |
| 1073 | @ <input type="text" size="20" value="%h(zLogin)" name="login"></td></tr> |
| 1074 | @ |
| 1075 | @ <tr><td align="right"><b>Password:</b></td> |
| 1076 | @ <td width="5"></td><td> |
| 1077 | @ <input type="password" size="20" name="pw"></td></tr> |
| 1078 | @ |
| 1079 | @ <tr><td align="right"><b>Name of login-group:</b></td> |
| 1080 | @ <td width="5"></td><td> |
| 1081 | @ <input type="text" size="30" value="%h(zNewName)" name="newname"> |
| 1082 | @ (only used if creating a new login-group).</td></tr> |
| 1083 | @ |
| 1084 | @ <tr><td colspan="3" align="center"> |
| 1085 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -197,62 +197,62 @@ | |
| 197 | @ </td><td class="usetupColumnLayout"> |
| 198 | @ <span class="note">Notes:</span> |
| 199 | @ <ol> |
| 200 | @ <li><p>The permission flags are as follows:</p> |
| 201 | @ <table> |
| 202 | @ <tr><th valign="top">a</th> |
| 203 | @ <td><i>Admin:</i> Create and delete users</td></tr> |
| 204 | @ <tr><th valign="top">b</th> |
| 205 | @ <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr> |
| 206 | @ <tr><th valign="top">c</th> |
| 207 | @ <td><i>Append-Tkt:</i> Append to tickets</td></tr> |
| 208 | @ <tr><th valign="top">d</th> |
| 209 | @ <td><i>Delete:</i> Delete wiki and tickets</td></tr> |
| 210 | @ <tr><th valign="top">e</th> |
| 211 | @ <td><i>Email:</i> View sensitive data such as EMail addresses</td></tr> |
| 212 | @ <tr><th valign="top">f</th> |
| 213 | @ <td><i>New-Wiki:</i> Create new wiki pages</td></tr> |
| 214 | @ <tr><th valign="top">g</th> |
| 215 | @ <td><i>Clone:</i> Clone the repository</td></tr> |
| 216 | @ <tr><th valign="top">h</th> |
| 217 | @ <td><i>Hyperlinks:</i> Show hyperlinks to detailed |
| 218 | @ repository history</td></tr> |
| 219 | @ <tr><th valign="top">i</th> |
| 220 | @ <td><i>Check-In:</i> Commit new versions in the repository</td></tr> |
| 221 | @ <tr><th valign="top">j</th> |
| 222 | @ <td><i>Read-Wiki:</i> View wiki pages</td></tr> |
| 223 | @ <tr><th valign="top">k</th> |
| 224 | @ <td><i>Write-Wiki:</i> Edit wiki pages</td></tr> |
| 225 | @ <tr><th valign="top">l</th> |
| 226 | @ <td><i>Mod-Wiki:</i> Moderator for wiki pages</td></tr> |
| 227 | @ <tr><th valign="top">m</th> |
| 228 | @ <td><i>Append-Wiki:</i> Append to wiki pages</td></tr> |
| 229 | @ <tr><th valign="top">n</th> |
| 230 | @ <td><i>New-Tkt:</i> Create new tickets</td></tr> |
| 231 | @ <tr><th valign="top">o</th> |
| 232 | @ <td><i>Check-Out:</i> Check out versions</td></tr> |
| 233 | @ <tr><th valign="top">p</th> |
| 234 | @ <td><i>Password:</i> Change your own password</td></tr> |
| 235 | @ <tr><th valign="top">q</th> |
| 236 | @ <td><i>Mod-Tkt:</i> Moderator for tickets</td></tr> |
| 237 | @ <tr><th valign="top">r</th> |
| 238 | @ <td><i>Read-Tkt:</i> View tickets</td></tr> |
| 239 | @ <tr><th valign="top">s</th> |
| 240 | @ <td><i>Setup/Super-user:</i> Setup and configure this website</td></tr> |
| 241 | @ <tr><th valign="top">t</th> |
| 242 | @ <td><i>Tkt-Report:</i> Create new bug summary reports</td></tr> |
| 243 | @ <tr><th valign="top">u</th> |
| 244 | @ <td><i>Reader:</i> Inherit privileges of |
| 245 | @ user <tt>reader</tt></td></tr> |
| 246 | @ <tr><th valign="top">v</th> |
| 247 | @ <td><i>Developer:</i> Inherit privileges of |
| 248 | @ user <tt>developer</tt></td></tr> |
| 249 | @ <tr><th valign="top">w</th> |
| 250 | @ <td><i>Write-Tkt:</i> Edit tickets</td></tr> |
| 251 | @ <tr><th valign="top">x</th> |
| 252 | @ <td><i>Private:</i> Push and/or pull private branches</td></tr> |
| 253 | @ <tr><th valign="top">z</th> |
| 254 | @ <td><i>Zip download:</i> Download a baseline via the |
| 255 | @ <tt>/zip</tt> URL even without |
| 256 | @ check<span class="capability">o</span>ut |
| 257 | @ and <span class="capability">h</span>istory permissions</td></tr> |
| 258 | @ </table> |
| @@ -1062,23 +1062,23 @@ | |
| 1062 | @ |
| 1063 | @ <form action="%s(g.zTop)/setup_login_group" method="post"><div> |
| 1064 | login_insert_csrf_secret(); |
| 1065 | @ <blockquote><table border="0"> |
| 1066 | @ |
| 1067 | @ <tr><th align="right">Repository filename in group to join:</th> |
| 1068 | @ <td width="5"></td><td> |
| 1069 | @ <input type="text" size="50" value="%h(zRepo)" name="repo"></td></tr> |
| 1070 | @ |
| 1071 | @ <tr><th align="right">Login on the above repo:</th> |
| 1072 | @ <td width="5"></td><td> |
| 1073 | @ <input type="text" size="20" value="%h(zLogin)" name="login"></td></tr> |
| 1074 | @ |
| 1075 | @ <tr><th align="right">Password:</th> |
| 1076 | @ <td width="5"></td><td> |
| 1077 | @ <input type="password" size="20" name="pw"></td></tr> |
| 1078 | @ |
| 1079 | @ <tr><th align="right">Name of login-group:</th> |
| 1080 | @ <td width="5"></td><td> |
| 1081 | @ <input type="text" size="30" value="%h(zNewName)" name="newname"> |
| 1082 | @ (only used if creating a new login-group).</td></tr> |
| 1083 | @ |
| 1084 | @ <tr><td colspan="3" align="center"> |
| 1085 |
+5
-7
| --- src/shun.c | ||
| +++ src/shun.c | ||
| @@ -66,11 +66,10 @@ | ||
| 66 | 66 | zUuid = zCanonical; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | style_header("Shunned Artifacts"); |
| 70 | 70 | if( zUuid && P("sub") ){ |
| 71 | - login_verify_csrf_secret(); | |
| 72 | 71 | db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid); |
| 73 | 72 | if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){ |
| 74 | 73 | @ <p class="noMoreShun">Artifact |
| 75 | 74 | @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no |
| 76 | 75 | @ longer being shunned.</p> |
| @@ -141,11 +140,10 @@ | ||
| 141 | 140 | @ the formerly shunned artifact will be accepted on subsequent sync |
| 142 | 141 | @ operations.</p> |
| 143 | 142 | @ |
| 144 | 143 | @ <blockquote> |
| 145 | 144 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 146 | - login_insert_csrf_secret(); | |
| 147 | 145 | @ <input type="text" name="uuid" size="50" /> |
| 148 | 146 | @ <input type="submit" name="sub" value="Accept" /> |
| 149 | 147 | @ </div></form> |
| 150 | 148 | @ </blockquote> |
| 151 | 149 | @ |
| @@ -293,28 +291,28 @@ | ||
| 293 | 291 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 294 | 292 | " WHERE rcvid=%d", |
| 295 | 293 | rcvid |
| 296 | 294 | ); |
| 297 | 295 | @ <table cellspacing="15" cellpadding="0" border="0"> |
| 298 | - @ <tr><td valign="top" align="right"><b>rcvid:</b></td> | |
| 296 | + @ <tr><th valign="top" align="right">rcvid:</th> | |
| 299 | 297 | @ <td valign="top">%d(rcvid)</td></tr> |
| 300 | 298 | if( db_step(&q)==SQLITE_ROW ){ |
| 301 | 299 | const char *zUser = db_column_text(&q, 0); |
| 302 | 300 | const char *zDate = db_column_text(&q, 1); |
| 303 | 301 | const char *zIpAddr = db_column_text(&q, 2); |
| 304 | - @ <tr><td valign="top" align="right"><b>User:</b></td> | |
| 302 | + @ <tr><th valign="top" align="right">User:</th> | |
| 305 | 303 | @ <td valign="top">%s(zUser)</td></tr> |
| 306 | - @ <tr><td valign="top" align="right"><b>Date:</b></td> | |
| 304 | + @ <tr><th valign="top" align="right">Date:</th> | |
| 307 | 305 | @ <td valign="top">%s(zDate)</td></tr> |
| 308 | - @ <tr><td valign="top" align="right"><b>IP Address:</b></td> | |
| 306 | + @ <tr><th valign="top" align="right">IP Address:</th> | |
| 309 | 307 | @ <td valign="top">%s(zIpAddr)</td></tr> |
| 310 | 308 | } |
| 311 | 309 | db_finalize(&q); |
| 312 | 310 | db_prepare(&q, |
| 313 | 311 | "SELECT rid, uuid, size FROM blob WHERE rcvid=%d", rcvid |
| 314 | 312 | ); |
| 315 | - @ <tr><td valign="top" align="right"><b>Artifacts:</b></td> | |
| 313 | + @ <tr><th valign="top" align="right">Artifacts:</th> | |
| 316 | 314 | @ <td valign="top"> |
| 317 | 315 | while( db_step(&q)==SQLITE_ROW ){ |
| 318 | 316 | int rid = db_column_int(&q, 0); |
| 319 | 317 | const char *zUuid = db_column_text(&q, 1); |
| 320 | 318 | int size = db_column_int(&q, 2); |
| 321 | 319 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -66,11 +66,10 @@ | |
| 66 | zUuid = zCanonical; |
| 67 | } |
| 68 | } |
| 69 | style_header("Shunned Artifacts"); |
| 70 | if( zUuid && P("sub") ){ |
| 71 | login_verify_csrf_secret(); |
| 72 | db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid); |
| 73 | if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){ |
| 74 | @ <p class="noMoreShun">Artifact |
| 75 | @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no |
| 76 | @ longer being shunned.</p> |
| @@ -141,11 +140,10 @@ | |
| 141 | @ the formerly shunned artifact will be accepted on subsequent sync |
| 142 | @ operations.</p> |
| 143 | @ |
| 144 | @ <blockquote> |
| 145 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 146 | login_insert_csrf_secret(); |
| 147 | @ <input type="text" name="uuid" size="50" /> |
| 148 | @ <input type="submit" name="sub" value="Accept" /> |
| 149 | @ </div></form> |
| 150 | @ </blockquote> |
| 151 | @ |
| @@ -293,28 +291,28 @@ | |
| 293 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 294 | " WHERE rcvid=%d", |
| 295 | rcvid |
| 296 | ); |
| 297 | @ <table cellspacing="15" cellpadding="0" border="0"> |
| 298 | @ <tr><td valign="top" align="right"><b>rcvid:</b></td> |
| 299 | @ <td valign="top">%d(rcvid)</td></tr> |
| 300 | if( db_step(&q)==SQLITE_ROW ){ |
| 301 | const char *zUser = db_column_text(&q, 0); |
| 302 | const char *zDate = db_column_text(&q, 1); |
| 303 | const char *zIpAddr = db_column_text(&q, 2); |
| 304 | @ <tr><td valign="top" align="right"><b>User:</b></td> |
| 305 | @ <td valign="top">%s(zUser)</td></tr> |
| 306 | @ <tr><td valign="top" align="right"><b>Date:</b></td> |
| 307 | @ <td valign="top">%s(zDate)</td></tr> |
| 308 | @ <tr><td valign="top" align="right"><b>IP Address:</b></td> |
| 309 | @ <td valign="top">%s(zIpAddr)</td></tr> |
| 310 | } |
| 311 | db_finalize(&q); |
| 312 | db_prepare(&q, |
| 313 | "SELECT rid, uuid, size FROM blob WHERE rcvid=%d", rcvid |
| 314 | ); |
| 315 | @ <tr><td valign="top" align="right"><b>Artifacts:</b></td> |
| 316 | @ <td valign="top"> |
| 317 | while( db_step(&q)==SQLITE_ROW ){ |
| 318 | int rid = db_column_int(&q, 0); |
| 319 | const char *zUuid = db_column_text(&q, 1); |
| 320 | int size = db_column_int(&q, 2); |
| 321 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -66,11 +66,10 @@ | |
| 66 | zUuid = zCanonical; |
| 67 | } |
| 68 | } |
| 69 | style_header("Shunned Artifacts"); |
| 70 | if( zUuid && P("sub") ){ |
| 71 | db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid); |
| 72 | if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){ |
| 73 | @ <p class="noMoreShun">Artifact |
| 74 | @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no |
| 75 | @ longer being shunned.</p> |
| @@ -141,11 +140,10 @@ | |
| 140 | @ the formerly shunned artifact will be accepted on subsequent sync |
| 141 | @ operations.</p> |
| 142 | @ |
| 143 | @ <blockquote> |
| 144 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 145 | @ <input type="text" name="uuid" size="50" /> |
| 146 | @ <input type="submit" name="sub" value="Accept" /> |
| 147 | @ </div></form> |
| 148 | @ </blockquote> |
| 149 | @ |
| @@ -293,28 +291,28 @@ | |
| 291 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 292 | " WHERE rcvid=%d", |
| 293 | rcvid |
| 294 | ); |
| 295 | @ <table cellspacing="15" cellpadding="0" border="0"> |
| 296 | @ <tr><th valign="top" align="right">rcvid:</th> |
| 297 | @ <td valign="top">%d(rcvid)</td></tr> |
| 298 | if( db_step(&q)==SQLITE_ROW ){ |
| 299 | const char *zUser = db_column_text(&q, 0); |
| 300 | const char *zDate = db_column_text(&q, 1); |
| 301 | const char *zIpAddr = db_column_text(&q, 2); |
| 302 | @ <tr><th valign="top" align="right">User:</th> |
| 303 | @ <td valign="top">%s(zUser)</td></tr> |
| 304 | @ <tr><th valign="top" align="right">Date:</th> |
| 305 | @ <td valign="top">%s(zDate)</td></tr> |
| 306 | @ <tr><th valign="top" align="right">IP Address:</th> |
| 307 | @ <td valign="top">%s(zIpAddr)</td></tr> |
| 308 | } |
| 309 | db_finalize(&q); |
| 310 | db_prepare(&q, |
| 311 | "SELECT rid, uuid, size FROM blob WHERE rcvid=%d", rcvid |
| 312 | ); |
| 313 | @ <tr><th valign="top" align="right">Artifacts:</th> |
| 314 | @ <td valign="top"> |
| 315 | while( db_step(&q)==SQLITE_ROW ){ |
| 316 | int rid = db_column_int(&q, 0); |
| 317 | const char *zUuid = db_column_text(&q, 1); |
| 318 | int size = db_column_int(&q, 2); |
| 319 |
+137
-111
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -399,13 +399,10 @@ | ||
| 399 | 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | 402 | ** assertion will be triggered. |
| 403 | 403 | ** |
| 404 | -** (Historical note: There used to be several other options, but we've | |
| 405 | -** pared it down to just these three.) | |
| 406 | -** | |
| 407 | 404 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 408 | 405 | ** the default. |
| 409 | 406 | */ |
| 410 | 407 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 411 | 408 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | ||
| 439 | 436 | */ |
| 440 | 437 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 441 | 438 | # define _XOPEN_SOURCE 600 |
| 442 | 439 | #endif |
| 443 | 440 | |
| 444 | -/* | |
| 445 | -** The TCL headers are only needed when compiling the TCL bindings. | |
| 446 | -*/ | |
| 447 | -#if defined(SQLITE_TCL) || defined(TCLSH) | |
| 448 | -# include <tcl.h> | |
| 449 | -#endif | |
| 450 | - | |
| 451 | 441 | /* |
| 452 | 442 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 453 | 443 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 454 | 444 | ** make it true by defining or undefining NDEBUG. |
| 455 | 445 | ** |
| 456 | -** Setting NDEBUG makes the code smaller and run faster by disabling the | |
| 457 | -** number assert() statements in the code. So we want the default action | |
| 446 | +** Setting NDEBUG makes the code smaller and faster by disabling the | |
| 447 | +** assert() statements in the code. So we want the default action | |
| 458 | 448 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 459 | 449 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 460 | 450 | ** feature. |
| 461 | 451 | */ |
| 462 | 452 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | ||
| 522 | 512 | ** hint of unplanned behavior. |
| 523 | 513 | ** |
| 524 | 514 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 525 | 515 | ** |
| 526 | 516 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 527 | -** be true and false so that the unreachable code then specify will | |
| 517 | +** be true and false so that the unreachable code they specify will | |
| 528 | 518 | ** not be counted as untested code. |
| 529 | 519 | */ |
| 530 | 520 | #if defined(SQLITE_COVERAGE_TEST) |
| 531 | 521 | # define ALWAYS(X) (1) |
| 532 | 522 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | ||
| 546 | 536 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 547 | 537 | |
| 548 | 538 | /* |
| 549 | 539 | ** The macro unlikely() is a hint that surrounds a boolean |
| 550 | 540 | ** expression that is usually false. Macro likely() surrounds |
| 551 | -** a boolean expression that is usually true. GCC is able to | |
| 552 | -** use these hints to generate better code, sometimes. | |
| 541 | +** a boolean expression that is usually true. These hints could, | |
| 542 | +** in theory, be used by the compiler to generate better code, but | |
| 543 | +** currently they are just comments for human readers. | |
| 553 | 544 | */ |
| 554 | -#if defined(__GNUC__) && 0 | |
| 555 | -# define likely(X) __builtin_expect((X),1) | |
| 556 | -# define unlikely(X) __builtin_expect((X),0) | |
| 557 | -#else | |
| 558 | -# define likely(X) !!(X) | |
| 559 | -# define unlikely(X) !!(X) | |
| 560 | -#endif | |
| 545 | +#define likely(X) (X) | |
| 546 | +#define unlikely(X) (X) | |
| 561 | 547 | |
| 562 | 548 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 563 | 549 | /************** Begin file sqlite3.h *****************************************/ |
| 564 | 550 | /* |
| 565 | 551 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | ||
| 670 | 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 671 | 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 672 | 658 | */ |
| 673 | 659 | #define SQLITE_VERSION "3.8.0" |
| 674 | 660 | #define SQLITE_VERSION_NUMBER 3008000 |
| 675 | -#define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" | |
| 661 | +#define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" | |
| 676 | 662 | |
| 677 | 663 | /* |
| 678 | 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 679 | 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 680 | 666 | ** |
| @@ -1039,10 +1025,11 @@ | ||
| 1039 | 1025 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1040 | 1026 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1041 | 1027 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1042 | 1028 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1043 | 1029 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1030 | +#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) | |
| 1044 | 1031 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1045 | 1032 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1046 | 1033 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1047 | 1034 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1048 | 1035 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | ||
| 28374 | 28361 | */ |
| 28375 | 28362 | static const char *unixTempFileDir(void){ |
| 28376 | 28363 | static const char *azDirs[] = { |
| 28377 | 28364 | 0, |
| 28378 | 28365 | 0, |
| 28379 | -#ifdef __CYGWIN__ | |
| 28380 | 28366 | 0, |
| 28381 | 28367 | 0, |
| 28382 | -#endif | |
| 28383 | 28368 | "/var/tmp", |
| 28384 | 28369 | "/usr/tmp", |
| 28385 | 28370 | "/tmp", |
| 28386 | - 0 /* List terminator */ | |
| 28371 | + "." | |
| 28387 | 28372 | }; |
| 28388 | 28373 | unsigned int i; |
| 28389 | 28374 | struct stat buf; |
| 28390 | - const char *zDir = 0; | |
| 28375 | + const char *zDir; | |
| 28391 | 28376 | |
| 28392 | 28377 | azDirs[0] = sqlite3_temp_directory; |
| 28393 | 28378 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28394 | -#ifdef __CYGWIN__ | |
| 28395 | 28379 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28396 | 28380 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28397 | -#endif | |
| 28398 | - for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 28381 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ | |
| 28382 | + zDir = azDirs[i]; | |
| 28399 | 28383 | if( zDir==0 ) continue; |
| 28400 | 28384 | if( osStat(zDir, &buf) ) continue; |
| 28401 | 28385 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28402 | 28386 | if( osAccess(zDir, 07) ) continue; |
| 28403 | 28387 | break; |
| @@ -28423,11 +28407,10 @@ | ||
| 28423 | 28407 | ** function failing. |
| 28424 | 28408 | */ |
| 28425 | 28409 | SimulateIOError( return SQLITE_IOERR ); |
| 28426 | 28410 | |
| 28427 | 28411 | zDir = unixTempFileDir(); |
| 28428 | - if( zDir==0 ) zDir = "."; | |
| 28429 | 28412 | |
| 28430 | 28413 | /* Check that the output buffer is large enough for the temporary file |
| 28431 | 28414 | ** name. If it is not, return SQLITE_ERROR. |
| 28432 | 28415 | */ |
| 28433 | 28416 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | ||
| 30505 | 30488 | */ |
| 30506 | 30489 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30507 | 30490 | |
| 30508 | 30491 | #ifdef __CYGWIN__ |
| 30509 | 30492 | # include <sys/cygwin.h> |
| 30493 | +/* # include <errno.h> */ | |
| 30510 | 30494 | #endif |
| 30511 | 30495 | |
| 30512 | 30496 | /* |
| 30513 | 30497 | ** Include code that is common to all os_*.c files |
| 30514 | 30498 | */ |
| @@ -30925,10 +30909,11 @@ | ||
| 30925 | 30909 | * zero for the default behavior. |
| 30926 | 30910 | */ |
| 30927 | 30911 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30928 | 30912 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30929 | 30913 | #endif |
| 30914 | + | |
| 30930 | 30915 | |
| 30931 | 30916 | /* |
| 30932 | 30917 | ** The winMemData structure stores information required by the Win32-specific |
| 30933 | 30918 | ** sqlite3_mem_methods implementation. |
| 30934 | 30919 | */ |
| @@ -34390,14 +34375,14 @@ | ||
| 34390 | 34375 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34391 | 34376 | osGetCurrentProcessId(), pFd)); |
| 34392 | 34377 | return SQLITE_OK; |
| 34393 | 34378 | } |
| 34394 | 34379 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34395 | -#if SQLITE_OS_WINRT | |
| 34396 | - pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); | |
| 34397 | -#else | |
| 34398 | 34380 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34381 | +#if SQLITE_OS_WINRT | |
| 34382 | + pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); | |
| 34383 | +#else | |
| 34399 | 34384 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34400 | 34385 | #endif |
| 34401 | 34386 | if( pNew==NULL ){ |
| 34402 | 34387 | osCloseHandle(pFd->hMap); |
| 34403 | 34388 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | ||
| 34564 | 34549 | return zConverted; |
| 34565 | 34550 | } |
| 34566 | 34551 | |
| 34567 | 34552 | static int winIsDir(const void *zConverted); |
| 34568 | 34553 | |
| 34554 | +/* | |
| 34555 | +** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is | |
| 34556 | +** in characters, so we allocate 3 bytes per character assuming worst-case | |
| 34557 | +** 3-bytes-per-character UTF8. | |
| 34558 | +*/ | |
| 34559 | +#ifndef SQLITE_WIN32_MAX_PATH | |
| 34560 | +# define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) | |
| 34561 | +#endif | |
| 34562 | + | |
| 34569 | 34563 | /* |
| 34570 | 34564 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34571 | 34565 | ** hold at pVfs->mxPathname characters. |
| 34572 | 34566 | */ |
| 34573 | 34567 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | ||
| 34575 | 34569 | "abcdefghijklmnopqrstuvwxyz" |
| 34576 | 34570 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34577 | 34571 | "0123456789"; |
| 34578 | 34572 | size_t i, j; |
| 34579 | 34573 | int nTempPath; |
| 34580 | - char zTempPath[MAX_PATH+2]; | |
| 34574 | + char zTempPath[SQLITE_WIN32_MAX_PATH+2]; | |
| 34581 | 34575 | |
| 34582 | 34576 | /* It's odd to simulate an io-error here, but really this is just |
| 34583 | 34577 | ** using the io-error infrastructure to test that SQLite handles this |
| 34584 | 34578 | ** function failing. |
| 34585 | 34579 | */ |
| 34586 | 34580 | SimulateIOError( return SQLITE_IOERR ); |
| 34587 | 34581 | |
| 34588 | - memset(zTempPath, 0, MAX_PATH+2); | |
| 34589 | - | |
| 34590 | 34582 | if( sqlite3_temp_directory ){ |
| 34591 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); | |
| 34583 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", | |
| 34584 | + sqlite3_temp_directory); | |
| 34592 | 34585 | } |
| 34593 | 34586 | #if defined(__CYGWIN__) |
| 34594 | - static const char *azDirs[] = { | |
| 34595 | - 0, | |
| 34596 | - 0, | |
| 34597 | - 0, | |
| 34598 | - 0, | |
| 34599 | - "/var/tmp", | |
| 34600 | - "/usr/tmp", | |
| 34601 | - "/tmp", | |
| 34602 | - 0 | |
| 34603 | - }; | |
| 34604 | - const char *zDir = 0; | |
| 34605 | - char *zConverted; | |
| 34606 | - | |
| 34607 | - azDirs[0] = sqlite3_temp_directory; | |
| 34608 | - if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); | |
| 34609 | - if( !azDirs[2] ) azDirs[2] = getenv("TMP"); | |
| 34610 | - if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); | |
| 34611 | - for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 34612 | - if( zDir==0 || zDir[0]) continue; | |
| 34613 | - if( zDir[1]!=':' ){ | |
| 34614 | - WCHAR zWidePath[MAX_PATH]; | |
| 34615 | - cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); | |
| 34616 | - zDir = unicodeToUtf8(zWidePath); | |
| 34617 | - if( zDir==0 ){ | |
| 34618 | - OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); | |
| 34619 | - return SQLITE_IOERR_NOMEM; | |
| 34620 | - } | |
| 34621 | - } | |
| 34622 | - /* Convert the filename to the system encoding. */ | |
| 34623 | - zConverted = convertUtf8Filename(zDir); | |
| 34624 | - if( zConverted==0 ){ | |
| 34625 | - OSTRACE(("TEMP-FILENAME, rc=SQLITE_IOERR_NOMEM")); | |
| 34626 | - return SQLITE_IOERR_NOMEM; | |
| 34627 | - } | |
| 34628 | - if( winIsDir(zConverted) ){ | |
| 34629 | - sqlite3_free(zConverted); | |
| 34630 | - break; | |
| 34631 | - } | |
| 34632 | - sqlite3_free(zConverted); | |
| 34633 | - } | |
| 34634 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); | |
| 34587 | + else{ | |
| 34588 | + static const char *azDirs[] = { | |
| 34589 | + 0, | |
| 34590 | + 0, | |
| 34591 | + 0, | |
| 34592 | + 0, | |
| 34593 | + "/var/tmp", | |
| 34594 | + "/usr/tmp", | |
| 34595 | + "/tmp", | |
| 34596 | + "." | |
| 34597 | + }; | |
| 34598 | + const char *zDir; | |
| 34599 | + WCHAR zWidePath[MAX_PATH]; | |
| 34600 | + | |
| 34601 | + if( !azDirs[0] ) azDirs[0] = getenv("TMPDIR"); | |
| 34602 | + if( !azDirs[1] ) azDirs[1] = getenv("TMP"); | |
| 34603 | + if( !azDirs[2] ) azDirs[2] = getenv("TEMP"); | |
| 34604 | + if( !azDirs[3] ) azDirs[3] = getenv("USERPROFILE"); | |
| 34605 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ | |
| 34606 | + zDir = azDirs[i]; | |
| 34607 | + if( zDir==0 || zDir[0]==0 ) continue; | |
| 34608 | + if( zDir[1]!=':' ){ | |
| 34609 | + cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); | |
| 34610 | + zDir = azDirs[i] = unicodeToUtf8(zWidePath); | |
| 34611 | + if( zDir==0 ){ | |
| 34612 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); | |
| 34613 | + return SQLITE_IOERR_NOMEM; | |
| 34614 | + } | |
| 34615 | + }else{ | |
| 34616 | + /* Convert the filename to the system encoding. */ | |
| 34617 | + osMultiByteToWideChar(CP_UTF8, 0, zDir, -1, zWidePath, | |
| 34618 | + MAX_PATH); | |
| 34619 | + } | |
| 34620 | + if( winIsDir(zWidePath) ){ | |
| 34621 | + break; | |
| 34622 | + } | |
| 34623 | + azDirs[i] = ""; /* Don't retry in future call */ | |
| 34624 | + } | |
| 34625 | + sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); | |
| 34626 | + } | |
| 34635 | 34627 | #elif !SQLITE_OS_WINRT |
| 34636 | 34628 | else if( isNT() ){ |
| 34637 | 34629 | char *zMulti; |
| 34638 | 34630 | WCHAR zWidePath[MAX_PATH]; |
| 34639 | - osGetTempPathW(MAX_PATH-30, zWidePath); | |
| 34631 | + if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ | |
| 34632 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); | |
| 34633 | + return SQLITE_IOERR_GETTEMPPATH; | |
| 34634 | + } | |
| 34640 | 34635 | zMulti = unicodeToUtf8(zWidePath); |
| 34641 | 34636 | if( zMulti ){ |
| 34642 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti); | |
| 34637 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti); | |
| 34643 | 34638 | sqlite3_free(zMulti); |
| 34644 | 34639 | }else{ |
| 34645 | 34640 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34646 | 34641 | return SQLITE_IOERR_NOMEM; |
| 34647 | 34642 | } |
| 34648 | 34643 | } |
| 34649 | 34644 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34650 | 34645 | else{ |
| 34651 | 34646 | char *zUtf8; |
| 34652 | - char zMbcsPath[MAX_PATH]; | |
| 34653 | - osGetTempPathA(MAX_PATH-30, zMbcsPath); | |
| 34647 | + char zMbcsPath[SQLITE_WIN32_MAX_PATH]; | |
| 34648 | + if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){ | |
| 34649 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); | |
| 34650 | + return SQLITE_IOERR_GETTEMPPATH; | |
| 34651 | + } | |
| 34654 | 34652 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34655 | 34653 | if( zUtf8 ){ |
| 34656 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8); | |
| 34654 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8); | |
| 34657 | 34655 | sqlite3_free(zUtf8); |
| 34658 | 34656 | }else{ |
| 34659 | 34657 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34660 | 34658 | return SQLITE_IOERR_NOMEM; |
| 34661 | 34659 | } |
| 34662 | 34660 | } |
| 34663 | -#endif | |
| 34664 | -#endif | |
| 34661 | +#else | |
| 34662 | + else{ | |
| 34663 | + /* | |
| 34664 | + ** Compiled without ANSI support and the current operating system | |
| 34665 | + ** is not Windows NT; therefore, just zero the temporary buffer. | |
| 34666 | + */ | |
| 34667 | + memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); | |
| 34668 | + } | |
| 34669 | +#endif /* SQLITE_WIN32_HAS_ANSI */ | |
| 34670 | +#else | |
| 34671 | + else{ | |
| 34672 | + /* | |
| 34673 | + ** Compiled for WinRT and the sqlite3_temp_directory is not set; | |
| 34674 | + ** therefore, just zero the temporary buffer. | |
| 34675 | + */ | |
| 34676 | + memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); | |
| 34677 | + } | |
| 34678 | +#endif /* !SQLITE_OS_WINRT */ | |
| 34665 | 34679 | |
| 34666 | 34680 | /* Check that the output buffer is large enough for the temporary file |
| 34667 | 34681 | ** name. If it is not, return SQLITE_ERROR. |
| 34668 | 34682 | */ |
| 34669 | 34683 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | ||
| 34745 | 34759 | int cnt = 0; |
| 34746 | 34760 | |
| 34747 | 34761 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34748 | 34762 | ** a temporary file. Use this buffer to store the file name in. |
| 34749 | 34763 | */ |
| 34750 | - char zTmpname[MAX_PATH+2]; /* Buffer used to create temp filename */ | |
| 34764 | + char zTmpname[SQLITE_WIN32_MAX_PATH+2]; /* Buffer used to create temp filename */ | |
| 34751 | 34765 | |
| 34752 | 34766 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34753 | 34767 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34754 | 34768 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34755 | 34769 | #endif |
| @@ -34811,12 +34825,11 @@ | ||
| 34811 | 34825 | /* If the second argument to this function is NULL, generate a |
| 34812 | 34826 | ** temporary file name to use |
| 34813 | 34827 | */ |
| 34814 | 34828 | if( !zUtf8Name ){ |
| 34815 | 34829 | assert(isDelete && !isOpenJournal); |
| 34816 | - memset(zTmpname, 0, MAX_PATH+2); | |
| 34817 | - rc = getTempname(MAX_PATH+2, zTmpname); | |
| 34830 | + rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname); | |
| 34818 | 34831 | if( rc!=SQLITE_OK ){ |
| 34819 | 34832 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34820 | 34833 | return rc; |
| 34821 | 34834 | } |
| 34822 | 34835 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | ||
| 35243 | 35256 | ){ |
| 35244 | 35257 | |
| 35245 | 35258 | #if defined(__CYGWIN__) |
| 35246 | 35259 | SimulateIOError( return SQLITE_ERROR ); |
| 35247 | 35260 | UNUSED_PARAMETER(nFull); |
| 35248 | - assert( pVfs->mxPathname>=MAX_PATH ); | |
| 35261 | + assert( pVfs->mxPathname>=SQLITE_WIN32_MAX_PATH ); | |
| 35249 | 35262 | assert( nFull>=pVfs->mxPathname ); |
| 35250 | 35263 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35251 | 35264 | /* |
| 35252 | 35265 | ** NOTE: We are dealing with a relative path name and the data |
| 35253 | 35266 | ** directory has been set. Therefore, use it as the basis |
| 35254 | 35267 | ** for converting the relative path name to an absolute |
| 35255 | 35268 | ** one by prepending the data directory and a slash. |
| 35256 | 35269 | */ |
| 35257 | - char zOut[MAX_PATH+1]; | |
| 35258 | - memset(zOut, 0, MAX_PATH+1); | |
| 35259 | - cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, | |
| 35260 | - MAX_PATH+1); | |
| 35270 | + char zOut[SQLITE_WIN32_MAX_PATH+1]; | |
| 35271 | + if( cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, | |
| 35272 | + SQLITE_WIN32_MAX_PATH+1)<0 ){ | |
| 35273 | + winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", | |
| 35274 | + zRelative); | |
| 35275 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 35276 | + } | |
| 35261 | 35277 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35262 | 35278 | sqlite3_data_directory, zOut); |
| 35263 | 35279 | }else{ |
| 35264 | - cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); | |
| 35280 | + if( cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull)<0 ){ | |
| 35281 | + winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", | |
| 35282 | + zRelative); | |
| 35283 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 35284 | + } | |
| 35265 | 35285 | } |
| 35266 | 35286 | return SQLITE_OK; |
| 35267 | 35287 | #endif |
| 35268 | 35288 | |
| 35269 | 35289 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | ||
| 35601 | 35621 | */ |
| 35602 | 35622 | SQLITE_API int sqlite3_os_init(void){ |
| 35603 | 35623 | static sqlite3_vfs winVfs = { |
| 35604 | 35624 | 3, /* iVersion */ |
| 35605 | 35625 | sizeof(winFile), /* szOsFile */ |
| 35606 | - MAX_PATH, /* mxPathname */ | |
| 35626 | + SQLITE_WIN32_MAX_PATH, /* mxPathname */ | |
| 35607 | 35627 | 0, /* pNext */ |
| 35608 | 35628 | "win32", /* zName */ |
| 35609 | 35629 | 0, /* pAppData */ |
| 35610 | 35630 | winOpen, /* xOpen */ |
| 35611 | 35631 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | ||
| 107770 | 107790 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107771 | 107791 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107772 | 107792 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107773 | 107793 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107774 | 107794 | Parse *pParse; /* Parsing context */ |
| 107795 | + sqlite3 *db; /* Database connection */ | |
| 107775 | 107796 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107776 | 107797 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107777 | 107798 | int addrBrk; /* Jump here to break out of the loop */ |
| 107778 | 107799 | int addrCont; /* Jump here to continue with next cycle */ |
| 107779 | 107800 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | ||
| 107781 | 107802 | Bitmask newNotReady; /* Return value */ |
| 107782 | 107803 | |
| 107783 | 107804 | pParse = pWInfo->pParse; |
| 107784 | 107805 | v = pParse->pVdbe; |
| 107785 | 107806 | pWC = &pWInfo->sWC; |
| 107807 | + db = pParse->db; | |
| 107786 | 107808 | pLevel = &pWInfo->a[iLevel]; |
| 107787 | 107809 | pLoop = pLevel->pWLoop; |
| 107788 | 107810 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107789 | 107811 | iCur = pTabItem->iCursor; |
| 107790 | 107812 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | ||
| 108071 | 108093 | /* Generate code to evaluate all constraint terms using == or IN |
| 108072 | 108094 | ** and store the values of those terms in an array of registers |
| 108073 | 108095 | ** starting at regBase. |
| 108074 | 108096 | */ |
| 108075 | 108097 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108076 | - zEndAff = sqlite3DbStrDup(pParse->db, zStartAff); | |
| 108098 | + zEndAff = sqlite3DbStrDup(db, zStartAff); | |
| 108077 | 108099 | addrNxt = pLevel->addrNxt; |
| 108078 | 108100 | |
| 108079 | 108101 | /* If we are doing a reverse order scan on an ascending index, or |
| 108080 | 108102 | ** a forward order scan on a descending index, interchange the |
| 108081 | 108103 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | ||
| 108156 | 108178 | } |
| 108157 | 108179 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108158 | 108180 | nConstraint++; |
| 108159 | 108181 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108160 | 108182 | } |
| 108161 | - sqlite3DbFree(pParse->db, zStartAff); | |
| 108162 | - sqlite3DbFree(pParse->db, zEndAff); | |
| 108183 | + sqlite3DbFree(db, zStartAff); | |
| 108184 | + sqlite3DbFree(db, zEndAff); | |
| 108163 | 108185 | |
| 108164 | 108186 | /* Top of the loop body */ |
| 108165 | 108187 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108166 | 108188 | |
| 108167 | 108189 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | ||
| 108284 | 108306 | */ |
| 108285 | 108307 | if( pWInfo->nLevel>1 ){ |
| 108286 | 108308 | int nNotReady; /* The number of notReady tables */ |
| 108287 | 108309 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108288 | 108310 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108289 | - pOrTab = sqlite3StackAllocRaw(pParse->db, | |
| 108311 | + pOrTab = sqlite3StackAllocRaw(db, | |
| 108290 | 108312 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108291 | 108313 | if( pOrTab==0 ) return notReady; |
| 108292 | 108314 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108293 | 108315 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108294 | 108316 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | ||
| 108338 | 108360 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108339 | 108361 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108340 | 108362 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108341 | 108363 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108342 | 108364 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108343 | - pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); | |
| 108344 | - pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); | |
| 108365 | + pExpr = sqlite3ExprDup(db, pExpr, 0); | |
| 108366 | + pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); | |
| 108345 | 108367 | } |
| 108346 | 108368 | if( pAndExpr ){ |
| 108347 | 108369 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108348 | 108370 | } |
| 108349 | 108371 | } |
| @@ -108359,11 +108381,11 @@ | ||
| 108359 | 108381 | } |
| 108360 | 108382 | /* Loop through table entries that match term pOrTerm. */ |
| 108361 | 108383 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108362 | 108384 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108363 | 108385 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108364 | - assert( pSubWInfo || pParse->nErr || pParse->db->mallocFailed ); | |
| 108386 | + assert( pSubWInfo || pParse->nErr || db->mallocFailed ); | |
| 108365 | 108387 | if( pSubWInfo ){ |
| 108366 | 108388 | WhereLoop *pSubLoop; |
| 108367 | 108389 | explainOneScan( |
| 108368 | 108390 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108369 | 108391 | ); |
| @@ -108414,17 +108436,17 @@ | ||
| 108414 | 108436 | } |
| 108415 | 108437 | pLevel->u.pCovidx = pCov; |
| 108416 | 108438 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108417 | 108439 | if( pAndExpr ){ |
| 108418 | 108440 | pAndExpr->pLeft = 0; |
| 108419 | - sqlite3ExprDelete(pParse->db, pAndExpr); | |
| 108441 | + sqlite3ExprDelete(db, pAndExpr); | |
| 108420 | 108442 | } |
| 108421 | 108443 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108422 | 108444 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108423 | 108445 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108424 | 108446 | |
| 108425 | - if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab); | |
| 108447 | + if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); | |
| 108426 | 108448 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108427 | 108449 | }else |
| 108428 | 108450 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108429 | 108451 | |
| 108430 | 108452 | { |
| @@ -108475,13 +108497,12 @@ | ||
| 108475 | 108497 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108476 | 108498 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108477 | 108499 | ** the implied "t1.a=123" constraint. |
| 108478 | 108500 | */ |
| 108479 | 108501 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108480 | - Expr *pE; | |
| 108502 | + Expr *pE, *pEAlt; | |
| 108481 | 108503 | WhereTerm *pAlt; |
| 108482 | - Expr sEq; | |
| 108483 | 108504 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108484 | 108505 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108485 | 108506 | if( pTerm->leftCursor!=iCur ) continue; |
| 108486 | 108507 | if( pLevel->iLeftJoin ) continue; |
| 108487 | 108508 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | ||
| 108491 | 108512 | if( pAlt==0 ) continue; |
| 108492 | 108513 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108493 | 108514 | testcase( pAlt->eOperator & WO_EQ ); |
| 108494 | 108515 | testcase( pAlt->eOperator & WO_IN ); |
| 108495 | 108516 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108496 | - sEq = *pAlt->pExpr; | |
| 108497 | - sEq.pLeft = pE->pLeft; | |
| 108498 | - sqlite3ExprIfFalse(pParse, &sEq, addrCont, SQLITE_JUMPIFNULL); | |
| 108517 | + pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); | |
| 108518 | + if( pEAlt ){ | |
| 108519 | + *pEAlt = *pAlt->pExpr; | |
| 108520 | + pEAlt->pLeft = pE->pLeft; | |
| 108521 | + sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); | |
| 108522 | + sqlite3StackFree(db, pEAlt); | |
| 108523 | + } | |
| 108499 | 108524 | } |
| 108500 | 108525 | |
| 108501 | 108526 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108502 | 108527 | ** at least one row of the right table has matched the left table. |
| 108503 | 108528 | */ |
| @@ -116436,10 +116461,11 @@ | ||
| 116436 | 116461 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116437 | 116462 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116438 | 116463 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116439 | 116464 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116440 | 116465 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116466 | + case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; | |
| 116441 | 116467 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116442 | 116468 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116443 | 116469 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116444 | 116470 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116445 | 116471 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | ||
| 128264 | 128290 | } |
| 128265 | 128291 | |
| 128266 | 128292 | |
| 128267 | 128293 | #ifdef SQLITE_TEST |
| 128268 | 128294 | |
| 128269 | -/* #include <tcl.h> */ | |
| 128295 | +#include <tcl.h> | |
| 128270 | 128296 | /* #include <string.h> */ |
| 128271 | 128297 | |
| 128272 | 128298 | /* |
| 128273 | 128299 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128274 | 128300 | ** designed to be used in concert with the Tcl testing framework. This |
| 128275 | 128301 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -399,13 +399,10 @@ | |
| 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | ** assertion will be triggered. |
| 403 | ** |
| 404 | ** (Historical note: There used to be several other options, but we've |
| 405 | ** pared it down to just these three.) |
| 406 | ** |
| 407 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 408 | ** the default. |
| 409 | */ |
| 410 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 411 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | |
| 439 | */ |
| 440 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 441 | # define _XOPEN_SOURCE 600 |
| 442 | #endif |
| 443 | |
| 444 | /* |
| 445 | ** The TCL headers are only needed when compiling the TCL bindings. |
| 446 | */ |
| 447 | #if defined(SQLITE_TCL) || defined(TCLSH) |
| 448 | # include <tcl.h> |
| 449 | #endif |
| 450 | |
| 451 | /* |
| 452 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 453 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 454 | ** make it true by defining or undefining NDEBUG. |
| 455 | ** |
| 456 | ** Setting NDEBUG makes the code smaller and run faster by disabling the |
| 457 | ** number assert() statements in the code. So we want the default action |
| 458 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 459 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 460 | ** feature. |
| 461 | */ |
| 462 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | |
| 522 | ** hint of unplanned behavior. |
| 523 | ** |
| 524 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 525 | ** |
| 526 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 527 | ** be true and false so that the unreachable code then specify will |
| 528 | ** not be counted as untested code. |
| 529 | */ |
| 530 | #if defined(SQLITE_COVERAGE_TEST) |
| 531 | # define ALWAYS(X) (1) |
| 532 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | |
| 546 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 547 | |
| 548 | /* |
| 549 | ** The macro unlikely() is a hint that surrounds a boolean |
| 550 | ** expression that is usually false. Macro likely() surrounds |
| 551 | ** a boolean expression that is usually true. GCC is able to |
| 552 | ** use these hints to generate better code, sometimes. |
| 553 | */ |
| 554 | #if defined(__GNUC__) && 0 |
| 555 | # define likely(X) __builtin_expect((X),1) |
| 556 | # define unlikely(X) __builtin_expect((X),0) |
| 557 | #else |
| 558 | # define likely(X) !!(X) |
| 559 | # define unlikely(X) !!(X) |
| 560 | #endif |
| 561 | |
| 562 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 563 | /************** Begin file sqlite3.h *****************************************/ |
| 564 | /* |
| 565 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | |
| 670 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 671 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 672 | */ |
| 673 | #define SQLITE_VERSION "3.8.0" |
| 674 | #define SQLITE_VERSION_NUMBER 3008000 |
| 675 | #define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" |
| 676 | |
| 677 | /* |
| 678 | ** CAPI3REF: Run-Time Library Version Numbers |
| 679 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 680 | ** |
| @@ -1039,10 +1025,11 @@ | |
| 1039 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1040 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1041 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1042 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1043 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1044 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1045 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1046 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1047 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | |
| 28374 | */ |
| 28375 | static const char *unixTempFileDir(void){ |
| 28376 | static const char *azDirs[] = { |
| 28377 | 0, |
| 28378 | 0, |
| 28379 | #ifdef __CYGWIN__ |
| 28380 | 0, |
| 28381 | 0, |
| 28382 | #endif |
| 28383 | "/var/tmp", |
| 28384 | "/usr/tmp", |
| 28385 | "/tmp", |
| 28386 | 0 /* List terminator */ |
| 28387 | }; |
| 28388 | unsigned int i; |
| 28389 | struct stat buf; |
| 28390 | const char *zDir = 0; |
| 28391 | |
| 28392 | azDirs[0] = sqlite3_temp_directory; |
| 28393 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28394 | #ifdef __CYGWIN__ |
| 28395 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28396 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28397 | #endif |
| 28398 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 28399 | if( zDir==0 ) continue; |
| 28400 | if( osStat(zDir, &buf) ) continue; |
| 28401 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28402 | if( osAccess(zDir, 07) ) continue; |
| 28403 | break; |
| @@ -28423,11 +28407,10 @@ | |
| 28423 | ** function failing. |
| 28424 | */ |
| 28425 | SimulateIOError( return SQLITE_IOERR ); |
| 28426 | |
| 28427 | zDir = unixTempFileDir(); |
| 28428 | if( zDir==0 ) zDir = "."; |
| 28429 | |
| 28430 | /* Check that the output buffer is large enough for the temporary file |
| 28431 | ** name. If it is not, return SQLITE_ERROR. |
| 28432 | */ |
| 28433 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | |
| 30505 | */ |
| 30506 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30507 | |
| 30508 | #ifdef __CYGWIN__ |
| 30509 | # include <sys/cygwin.h> |
| 30510 | #endif |
| 30511 | |
| 30512 | /* |
| 30513 | ** Include code that is common to all os_*.c files |
| 30514 | */ |
| @@ -30925,10 +30909,11 @@ | |
| 30925 | * zero for the default behavior. |
| 30926 | */ |
| 30927 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30928 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30929 | #endif |
| 30930 | |
| 30931 | /* |
| 30932 | ** The winMemData structure stores information required by the Win32-specific |
| 30933 | ** sqlite3_mem_methods implementation. |
| 30934 | */ |
| @@ -34390,14 +34375,14 @@ | |
| 34390 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34391 | osGetCurrentProcessId(), pFd)); |
| 34392 | return SQLITE_OK; |
| 34393 | } |
| 34394 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34395 | #if SQLITE_OS_WINRT |
| 34396 | pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); |
| 34397 | #else |
| 34398 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34399 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34400 | #endif |
| 34401 | if( pNew==NULL ){ |
| 34402 | osCloseHandle(pFd->hMap); |
| 34403 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | |
| 34564 | return zConverted; |
| 34565 | } |
| 34566 | |
| 34567 | static int winIsDir(const void *zConverted); |
| 34568 | |
| 34569 | /* |
| 34570 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34571 | ** hold at pVfs->mxPathname characters. |
| 34572 | */ |
| 34573 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | |
| 34575 | "abcdefghijklmnopqrstuvwxyz" |
| 34576 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34577 | "0123456789"; |
| 34578 | size_t i, j; |
| 34579 | int nTempPath; |
| 34580 | char zTempPath[MAX_PATH+2]; |
| 34581 | |
| 34582 | /* It's odd to simulate an io-error here, but really this is just |
| 34583 | ** using the io-error infrastructure to test that SQLite handles this |
| 34584 | ** function failing. |
| 34585 | */ |
| 34586 | SimulateIOError( return SQLITE_IOERR ); |
| 34587 | |
| 34588 | memset(zTempPath, 0, MAX_PATH+2); |
| 34589 | |
| 34590 | if( sqlite3_temp_directory ){ |
| 34591 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 34592 | } |
| 34593 | #if defined(__CYGWIN__) |
| 34594 | static const char *azDirs[] = { |
| 34595 | 0, |
| 34596 | 0, |
| 34597 | 0, |
| 34598 | 0, |
| 34599 | "/var/tmp", |
| 34600 | "/usr/tmp", |
| 34601 | "/tmp", |
| 34602 | 0 |
| 34603 | }; |
| 34604 | const char *zDir = 0; |
| 34605 | char *zConverted; |
| 34606 | |
| 34607 | azDirs[0] = sqlite3_temp_directory; |
| 34608 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 34609 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 34610 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 34611 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 34612 | if( zDir==0 || zDir[0]) continue; |
| 34613 | if( zDir[1]!=':' ){ |
| 34614 | WCHAR zWidePath[MAX_PATH]; |
| 34615 | cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); |
| 34616 | zDir = unicodeToUtf8(zWidePath); |
| 34617 | if( zDir==0 ){ |
| 34618 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34619 | return SQLITE_IOERR_NOMEM; |
| 34620 | } |
| 34621 | } |
| 34622 | /* Convert the filename to the system encoding. */ |
| 34623 | zConverted = convertUtf8Filename(zDir); |
| 34624 | if( zConverted==0 ){ |
| 34625 | OSTRACE(("TEMP-FILENAME, rc=SQLITE_IOERR_NOMEM")); |
| 34626 | return SQLITE_IOERR_NOMEM; |
| 34627 | } |
| 34628 | if( winIsDir(zConverted) ){ |
| 34629 | sqlite3_free(zConverted); |
| 34630 | break; |
| 34631 | } |
| 34632 | sqlite3_free(zConverted); |
| 34633 | } |
| 34634 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); |
| 34635 | #elif !SQLITE_OS_WINRT |
| 34636 | else if( isNT() ){ |
| 34637 | char *zMulti; |
| 34638 | WCHAR zWidePath[MAX_PATH]; |
| 34639 | osGetTempPathW(MAX_PATH-30, zWidePath); |
| 34640 | zMulti = unicodeToUtf8(zWidePath); |
| 34641 | if( zMulti ){ |
| 34642 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34643 | sqlite3_free(zMulti); |
| 34644 | }else{ |
| 34645 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34646 | return SQLITE_IOERR_NOMEM; |
| 34647 | } |
| 34648 | } |
| 34649 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34650 | else{ |
| 34651 | char *zUtf8; |
| 34652 | char zMbcsPath[MAX_PATH]; |
| 34653 | osGetTempPathA(MAX_PATH-30, zMbcsPath); |
| 34654 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34655 | if( zUtf8 ){ |
| 34656 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34657 | sqlite3_free(zUtf8); |
| 34658 | }else{ |
| 34659 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34660 | return SQLITE_IOERR_NOMEM; |
| 34661 | } |
| 34662 | } |
| 34663 | #endif |
| 34664 | #endif |
| 34665 | |
| 34666 | /* Check that the output buffer is large enough for the temporary file |
| 34667 | ** name. If it is not, return SQLITE_ERROR. |
| 34668 | */ |
| 34669 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | |
| 34745 | int cnt = 0; |
| 34746 | |
| 34747 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34748 | ** a temporary file. Use this buffer to store the file name in. |
| 34749 | */ |
| 34750 | char zTmpname[MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34751 | |
| 34752 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34753 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34754 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34755 | #endif |
| @@ -34811,12 +34825,11 @@ | |
| 34811 | /* If the second argument to this function is NULL, generate a |
| 34812 | ** temporary file name to use |
| 34813 | */ |
| 34814 | if( !zUtf8Name ){ |
| 34815 | assert(isDelete && !isOpenJournal); |
| 34816 | memset(zTmpname, 0, MAX_PATH+2); |
| 34817 | rc = getTempname(MAX_PATH+2, zTmpname); |
| 34818 | if( rc!=SQLITE_OK ){ |
| 34819 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34820 | return rc; |
| 34821 | } |
| 34822 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | |
| 35243 | ){ |
| 35244 | |
| 35245 | #if defined(__CYGWIN__) |
| 35246 | SimulateIOError( return SQLITE_ERROR ); |
| 35247 | UNUSED_PARAMETER(nFull); |
| 35248 | assert( pVfs->mxPathname>=MAX_PATH ); |
| 35249 | assert( nFull>=pVfs->mxPathname ); |
| 35250 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35251 | /* |
| 35252 | ** NOTE: We are dealing with a relative path name and the data |
| 35253 | ** directory has been set. Therefore, use it as the basis |
| 35254 | ** for converting the relative path name to an absolute |
| 35255 | ** one by prepending the data directory and a slash. |
| 35256 | */ |
| 35257 | char zOut[MAX_PATH+1]; |
| 35258 | memset(zOut, 0, MAX_PATH+1); |
| 35259 | cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35260 | MAX_PATH+1); |
| 35261 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35262 | sqlite3_data_directory, zOut); |
| 35263 | }else{ |
| 35264 | cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); |
| 35265 | } |
| 35266 | return SQLITE_OK; |
| 35267 | #endif |
| 35268 | |
| 35269 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | |
| 35601 | */ |
| 35602 | SQLITE_API int sqlite3_os_init(void){ |
| 35603 | static sqlite3_vfs winVfs = { |
| 35604 | 3, /* iVersion */ |
| 35605 | sizeof(winFile), /* szOsFile */ |
| 35606 | MAX_PATH, /* mxPathname */ |
| 35607 | 0, /* pNext */ |
| 35608 | "win32", /* zName */ |
| 35609 | 0, /* pAppData */ |
| 35610 | winOpen, /* xOpen */ |
| 35611 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | |
| 107770 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107771 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107772 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107773 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107774 | Parse *pParse; /* Parsing context */ |
| 107775 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107776 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107777 | int addrBrk; /* Jump here to break out of the loop */ |
| 107778 | int addrCont; /* Jump here to continue with next cycle */ |
| 107779 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | |
| 107781 | Bitmask newNotReady; /* Return value */ |
| 107782 | |
| 107783 | pParse = pWInfo->pParse; |
| 107784 | v = pParse->pVdbe; |
| 107785 | pWC = &pWInfo->sWC; |
| 107786 | pLevel = &pWInfo->a[iLevel]; |
| 107787 | pLoop = pLevel->pWLoop; |
| 107788 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107789 | iCur = pTabItem->iCursor; |
| 107790 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | |
| 108071 | /* Generate code to evaluate all constraint terms using == or IN |
| 108072 | ** and store the values of those terms in an array of registers |
| 108073 | ** starting at regBase. |
| 108074 | */ |
| 108075 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108076 | zEndAff = sqlite3DbStrDup(pParse->db, zStartAff); |
| 108077 | addrNxt = pLevel->addrNxt; |
| 108078 | |
| 108079 | /* If we are doing a reverse order scan on an ascending index, or |
| 108080 | ** a forward order scan on a descending index, interchange the |
| 108081 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | |
| 108156 | } |
| 108157 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108158 | nConstraint++; |
| 108159 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108160 | } |
| 108161 | sqlite3DbFree(pParse->db, zStartAff); |
| 108162 | sqlite3DbFree(pParse->db, zEndAff); |
| 108163 | |
| 108164 | /* Top of the loop body */ |
| 108165 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108166 | |
| 108167 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | |
| 108284 | */ |
| 108285 | if( pWInfo->nLevel>1 ){ |
| 108286 | int nNotReady; /* The number of notReady tables */ |
| 108287 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108288 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108289 | pOrTab = sqlite3StackAllocRaw(pParse->db, |
| 108290 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108291 | if( pOrTab==0 ) return notReady; |
| 108292 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108293 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108294 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | |
| 108338 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108339 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108340 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108341 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108342 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108343 | pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| 108344 | pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); |
| 108345 | } |
| 108346 | if( pAndExpr ){ |
| 108347 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108348 | } |
| 108349 | } |
| @@ -108359,11 +108381,11 @@ | |
| 108359 | } |
| 108360 | /* Loop through table entries that match term pOrTerm. */ |
| 108361 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108362 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108363 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108364 | assert( pSubWInfo || pParse->nErr || pParse->db->mallocFailed ); |
| 108365 | if( pSubWInfo ){ |
| 108366 | WhereLoop *pSubLoop; |
| 108367 | explainOneScan( |
| 108368 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108369 | ); |
| @@ -108414,17 +108436,17 @@ | |
| 108414 | } |
| 108415 | pLevel->u.pCovidx = pCov; |
| 108416 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108417 | if( pAndExpr ){ |
| 108418 | pAndExpr->pLeft = 0; |
| 108419 | sqlite3ExprDelete(pParse->db, pAndExpr); |
| 108420 | } |
| 108421 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108422 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108423 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108424 | |
| 108425 | if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab); |
| 108426 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108427 | }else |
| 108428 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108429 | |
| 108430 | { |
| @@ -108475,13 +108497,12 @@ | |
| 108475 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108476 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108477 | ** the implied "t1.a=123" constraint. |
| 108478 | */ |
| 108479 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108480 | Expr *pE; |
| 108481 | WhereTerm *pAlt; |
| 108482 | Expr sEq; |
| 108483 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108484 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108485 | if( pTerm->leftCursor!=iCur ) continue; |
| 108486 | if( pLevel->iLeftJoin ) continue; |
| 108487 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | |
| 108491 | if( pAlt==0 ) continue; |
| 108492 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108493 | testcase( pAlt->eOperator & WO_EQ ); |
| 108494 | testcase( pAlt->eOperator & WO_IN ); |
| 108495 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108496 | sEq = *pAlt->pExpr; |
| 108497 | sEq.pLeft = pE->pLeft; |
| 108498 | sqlite3ExprIfFalse(pParse, &sEq, addrCont, SQLITE_JUMPIFNULL); |
| 108499 | } |
| 108500 | |
| 108501 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108502 | ** at least one row of the right table has matched the left table. |
| 108503 | */ |
| @@ -116436,10 +116461,11 @@ | |
| 116436 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116437 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116438 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116439 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116440 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116441 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116442 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116443 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116444 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116445 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | |
| 128264 | } |
| 128265 | |
| 128266 | |
| 128267 | #ifdef SQLITE_TEST |
| 128268 | |
| 128269 | /* #include <tcl.h> */ |
| 128270 | /* #include <string.h> */ |
| 128271 | |
| 128272 | /* |
| 128273 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128274 | ** designed to be used in concert with the Tcl testing framework. This |
| 128275 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -399,13 +399,10 @@ | |
| 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | ** assertion will be triggered. |
| 403 | ** |
| 404 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 405 | ** the default. |
| 406 | */ |
| 407 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 408 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | |
| 436 | */ |
| 437 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 438 | # define _XOPEN_SOURCE 600 |
| 439 | #endif |
| 440 | |
| 441 | /* |
| 442 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 443 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 444 | ** make it true by defining or undefining NDEBUG. |
| 445 | ** |
| 446 | ** Setting NDEBUG makes the code smaller and faster by disabling the |
| 447 | ** assert() statements in the code. So we want the default action |
| 448 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 449 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 450 | ** feature. |
| 451 | */ |
| 452 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | |
| 512 | ** hint of unplanned behavior. |
| 513 | ** |
| 514 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 515 | ** |
| 516 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 517 | ** be true and false so that the unreachable code they specify will |
| 518 | ** not be counted as untested code. |
| 519 | */ |
| 520 | #if defined(SQLITE_COVERAGE_TEST) |
| 521 | # define ALWAYS(X) (1) |
| 522 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | |
| 536 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 537 | |
| 538 | /* |
| 539 | ** The macro unlikely() is a hint that surrounds a boolean |
| 540 | ** expression that is usually false. Macro likely() surrounds |
| 541 | ** a boolean expression that is usually true. These hints could, |
| 542 | ** in theory, be used by the compiler to generate better code, but |
| 543 | ** currently they are just comments for human readers. |
| 544 | */ |
| 545 | #define likely(X) (X) |
| 546 | #define unlikely(X) (X) |
| 547 | |
| 548 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 549 | /************** Begin file sqlite3.h *****************************************/ |
| 550 | /* |
| 551 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | |
| 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | */ |
| 659 | #define SQLITE_VERSION "3.8.0" |
| 660 | #define SQLITE_VERSION_NUMBER 3008000 |
| 661 | #define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" |
| 662 | |
| 663 | /* |
| 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | ** |
| @@ -1039,10 +1025,11 @@ | |
| 1025 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1026 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1027 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1028 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1029 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1030 | #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
| 1031 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1032 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1033 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1034 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1035 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | |
| 28361 | */ |
| 28362 | static const char *unixTempFileDir(void){ |
| 28363 | static const char *azDirs[] = { |
| 28364 | 0, |
| 28365 | 0, |
| 28366 | 0, |
| 28367 | 0, |
| 28368 | "/var/tmp", |
| 28369 | "/usr/tmp", |
| 28370 | "/tmp", |
| 28371 | "." |
| 28372 | }; |
| 28373 | unsigned int i; |
| 28374 | struct stat buf; |
| 28375 | const char *zDir; |
| 28376 | |
| 28377 | azDirs[0] = sqlite3_temp_directory; |
| 28378 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28379 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28380 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28381 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ |
| 28382 | zDir = azDirs[i]; |
| 28383 | if( zDir==0 ) continue; |
| 28384 | if( osStat(zDir, &buf) ) continue; |
| 28385 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28386 | if( osAccess(zDir, 07) ) continue; |
| 28387 | break; |
| @@ -28423,11 +28407,10 @@ | |
| 28407 | ** function failing. |
| 28408 | */ |
| 28409 | SimulateIOError( return SQLITE_IOERR ); |
| 28410 | |
| 28411 | zDir = unixTempFileDir(); |
| 28412 | |
| 28413 | /* Check that the output buffer is large enough for the temporary file |
| 28414 | ** name. If it is not, return SQLITE_ERROR. |
| 28415 | */ |
| 28416 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | |
| 30488 | */ |
| 30489 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30490 | |
| 30491 | #ifdef __CYGWIN__ |
| 30492 | # include <sys/cygwin.h> |
| 30493 | /* # include <errno.h> */ |
| 30494 | #endif |
| 30495 | |
| 30496 | /* |
| 30497 | ** Include code that is common to all os_*.c files |
| 30498 | */ |
| @@ -30925,10 +30909,11 @@ | |
| 30909 | * zero for the default behavior. |
| 30910 | */ |
| 30911 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30912 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30913 | #endif |
| 30914 | |
| 30915 | |
| 30916 | /* |
| 30917 | ** The winMemData structure stores information required by the Win32-specific |
| 30918 | ** sqlite3_mem_methods implementation. |
| 30919 | */ |
| @@ -34390,14 +34375,14 @@ | |
| 34375 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34376 | osGetCurrentProcessId(), pFd)); |
| 34377 | return SQLITE_OK; |
| 34378 | } |
| 34379 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34380 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34381 | #if SQLITE_OS_WINRT |
| 34382 | pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); |
| 34383 | #else |
| 34384 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34385 | #endif |
| 34386 | if( pNew==NULL ){ |
| 34387 | osCloseHandle(pFd->hMap); |
| 34388 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | |
| 34549 | return zConverted; |
| 34550 | } |
| 34551 | |
| 34552 | static int winIsDir(const void *zConverted); |
| 34553 | |
| 34554 | /* |
| 34555 | ** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is |
| 34556 | ** in characters, so we allocate 3 bytes per character assuming worst-case |
| 34557 | ** 3-bytes-per-character UTF8. |
| 34558 | */ |
| 34559 | #ifndef SQLITE_WIN32_MAX_PATH |
| 34560 | # define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) |
| 34561 | #endif |
| 34562 | |
| 34563 | /* |
| 34564 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34565 | ** hold at pVfs->mxPathname characters. |
| 34566 | */ |
| 34567 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | |
| 34569 | "abcdefghijklmnopqrstuvwxyz" |
| 34570 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34571 | "0123456789"; |
| 34572 | size_t i, j; |
| 34573 | int nTempPath; |
| 34574 | char zTempPath[SQLITE_WIN32_MAX_PATH+2]; |
| 34575 | |
| 34576 | /* It's odd to simulate an io-error here, but really this is just |
| 34577 | ** using the io-error infrastructure to test that SQLite handles this |
| 34578 | ** function failing. |
| 34579 | */ |
| 34580 | SimulateIOError( return SQLITE_IOERR ); |
| 34581 | |
| 34582 | if( sqlite3_temp_directory ){ |
| 34583 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", |
| 34584 | sqlite3_temp_directory); |
| 34585 | } |
| 34586 | #if defined(__CYGWIN__) |
| 34587 | else{ |
| 34588 | static const char *azDirs[] = { |
| 34589 | 0, |
| 34590 | 0, |
| 34591 | 0, |
| 34592 | 0, |
| 34593 | "/var/tmp", |
| 34594 | "/usr/tmp", |
| 34595 | "/tmp", |
| 34596 | "." |
| 34597 | }; |
| 34598 | const char *zDir; |
| 34599 | WCHAR zWidePath[MAX_PATH]; |
| 34600 | |
| 34601 | if( !azDirs[0] ) azDirs[0] = getenv("TMPDIR"); |
| 34602 | if( !azDirs[1] ) azDirs[1] = getenv("TMP"); |
| 34603 | if( !azDirs[2] ) azDirs[2] = getenv("TEMP"); |
| 34604 | if( !azDirs[3] ) azDirs[3] = getenv("USERPROFILE"); |
| 34605 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ |
| 34606 | zDir = azDirs[i]; |
| 34607 | if( zDir==0 || zDir[0]==0 ) continue; |
| 34608 | if( zDir[1]!=':' ){ |
| 34609 | cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); |
| 34610 | zDir = azDirs[i] = unicodeToUtf8(zWidePath); |
| 34611 | if( zDir==0 ){ |
| 34612 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34613 | return SQLITE_IOERR_NOMEM; |
| 34614 | } |
| 34615 | }else{ |
| 34616 | /* Convert the filename to the system encoding. */ |
| 34617 | osMultiByteToWideChar(CP_UTF8, 0, zDir, -1, zWidePath, |
| 34618 | MAX_PATH); |
| 34619 | } |
| 34620 | if( winIsDir(zWidePath) ){ |
| 34621 | break; |
| 34622 | } |
| 34623 | azDirs[i] = ""; /* Don't retry in future call */ |
| 34624 | } |
| 34625 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); |
| 34626 | } |
| 34627 | #elif !SQLITE_OS_WINRT |
| 34628 | else if( isNT() ){ |
| 34629 | char *zMulti; |
| 34630 | WCHAR zWidePath[MAX_PATH]; |
| 34631 | if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ |
| 34632 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34633 | return SQLITE_IOERR_GETTEMPPATH; |
| 34634 | } |
| 34635 | zMulti = unicodeToUtf8(zWidePath); |
| 34636 | if( zMulti ){ |
| 34637 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34638 | sqlite3_free(zMulti); |
| 34639 | }else{ |
| 34640 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34641 | return SQLITE_IOERR_NOMEM; |
| 34642 | } |
| 34643 | } |
| 34644 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34645 | else{ |
| 34646 | char *zUtf8; |
| 34647 | char zMbcsPath[SQLITE_WIN32_MAX_PATH]; |
| 34648 | if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){ |
| 34649 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34650 | return SQLITE_IOERR_GETTEMPPATH; |
| 34651 | } |
| 34652 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34653 | if( zUtf8 ){ |
| 34654 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34655 | sqlite3_free(zUtf8); |
| 34656 | }else{ |
| 34657 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34658 | return SQLITE_IOERR_NOMEM; |
| 34659 | } |
| 34660 | } |
| 34661 | #else |
| 34662 | else{ |
| 34663 | /* |
| 34664 | ** Compiled without ANSI support and the current operating system |
| 34665 | ** is not Windows NT; therefore, just zero the temporary buffer. |
| 34666 | */ |
| 34667 | memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34668 | } |
| 34669 | #endif /* SQLITE_WIN32_HAS_ANSI */ |
| 34670 | #else |
| 34671 | else{ |
| 34672 | /* |
| 34673 | ** Compiled for WinRT and the sqlite3_temp_directory is not set; |
| 34674 | ** therefore, just zero the temporary buffer. |
| 34675 | */ |
| 34676 | memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34677 | } |
| 34678 | #endif /* !SQLITE_OS_WINRT */ |
| 34679 | |
| 34680 | /* Check that the output buffer is large enough for the temporary file |
| 34681 | ** name. If it is not, return SQLITE_ERROR. |
| 34682 | */ |
| 34683 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | |
| 34759 | int cnt = 0; |
| 34760 | |
| 34761 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34762 | ** a temporary file. Use this buffer to store the file name in. |
| 34763 | */ |
| 34764 | char zTmpname[SQLITE_WIN32_MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34765 | |
| 34766 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34767 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34768 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34769 | #endif |
| @@ -34811,12 +34825,11 @@ | |
| 34825 | /* If the second argument to this function is NULL, generate a |
| 34826 | ** temporary file name to use |
| 34827 | */ |
| 34828 | if( !zUtf8Name ){ |
| 34829 | assert(isDelete && !isOpenJournal); |
| 34830 | rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname); |
| 34831 | if( rc!=SQLITE_OK ){ |
| 34832 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34833 | return rc; |
| 34834 | } |
| 34835 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | |
| 35256 | ){ |
| 35257 | |
| 35258 | #if defined(__CYGWIN__) |
| 35259 | SimulateIOError( return SQLITE_ERROR ); |
| 35260 | UNUSED_PARAMETER(nFull); |
| 35261 | assert( pVfs->mxPathname>=SQLITE_WIN32_MAX_PATH ); |
| 35262 | assert( nFull>=pVfs->mxPathname ); |
| 35263 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35264 | /* |
| 35265 | ** NOTE: We are dealing with a relative path name and the data |
| 35266 | ** directory has been set. Therefore, use it as the basis |
| 35267 | ** for converting the relative path name to an absolute |
| 35268 | ** one by prepending the data directory and a slash. |
| 35269 | */ |
| 35270 | char zOut[SQLITE_WIN32_MAX_PATH+1]; |
| 35271 | if( cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35272 | SQLITE_WIN32_MAX_PATH+1)<0 ){ |
| 35273 | winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35274 | zRelative); |
| 35275 | return SQLITE_CANTOPEN_FULLPATH; |
| 35276 | } |
| 35277 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35278 | sqlite3_data_directory, zOut); |
| 35279 | }else{ |
| 35280 | if( cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull)<0 ){ |
| 35281 | winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35282 | zRelative); |
| 35283 | return SQLITE_CANTOPEN_FULLPATH; |
| 35284 | } |
| 35285 | } |
| 35286 | return SQLITE_OK; |
| 35287 | #endif |
| 35288 | |
| 35289 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | |
| 35621 | */ |
| 35622 | SQLITE_API int sqlite3_os_init(void){ |
| 35623 | static sqlite3_vfs winVfs = { |
| 35624 | 3, /* iVersion */ |
| 35625 | sizeof(winFile), /* szOsFile */ |
| 35626 | SQLITE_WIN32_MAX_PATH, /* mxPathname */ |
| 35627 | 0, /* pNext */ |
| 35628 | "win32", /* zName */ |
| 35629 | 0, /* pAppData */ |
| 35630 | winOpen, /* xOpen */ |
| 35631 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | |
| 107790 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107791 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107792 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107793 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107794 | Parse *pParse; /* Parsing context */ |
| 107795 | sqlite3 *db; /* Database connection */ |
| 107796 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107797 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107798 | int addrBrk; /* Jump here to break out of the loop */ |
| 107799 | int addrCont; /* Jump here to continue with next cycle */ |
| 107800 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | |
| 107802 | Bitmask newNotReady; /* Return value */ |
| 107803 | |
| 107804 | pParse = pWInfo->pParse; |
| 107805 | v = pParse->pVdbe; |
| 107806 | pWC = &pWInfo->sWC; |
| 107807 | db = pParse->db; |
| 107808 | pLevel = &pWInfo->a[iLevel]; |
| 107809 | pLoop = pLevel->pWLoop; |
| 107810 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107811 | iCur = pTabItem->iCursor; |
| 107812 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | |
| 108093 | /* Generate code to evaluate all constraint terms using == or IN |
| 108094 | ** and store the values of those terms in an array of registers |
| 108095 | ** starting at regBase. |
| 108096 | */ |
| 108097 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108098 | zEndAff = sqlite3DbStrDup(db, zStartAff); |
| 108099 | addrNxt = pLevel->addrNxt; |
| 108100 | |
| 108101 | /* If we are doing a reverse order scan on an ascending index, or |
| 108102 | ** a forward order scan on a descending index, interchange the |
| 108103 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | |
| 108178 | } |
| 108179 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108180 | nConstraint++; |
| 108181 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108182 | } |
| 108183 | sqlite3DbFree(db, zStartAff); |
| 108184 | sqlite3DbFree(db, zEndAff); |
| 108185 | |
| 108186 | /* Top of the loop body */ |
| 108187 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108188 | |
| 108189 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | |
| 108306 | */ |
| 108307 | if( pWInfo->nLevel>1 ){ |
| 108308 | int nNotReady; /* The number of notReady tables */ |
| 108309 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108310 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108311 | pOrTab = sqlite3StackAllocRaw(db, |
| 108312 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108313 | if( pOrTab==0 ) return notReady; |
| 108314 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108315 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108316 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | |
| 108360 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108361 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108362 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108363 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108364 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108365 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 108366 | pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); |
| 108367 | } |
| 108368 | if( pAndExpr ){ |
| 108369 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108370 | } |
| 108371 | } |
| @@ -108359,11 +108381,11 @@ | |
| 108381 | } |
| 108382 | /* Loop through table entries that match term pOrTerm. */ |
| 108383 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108384 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108385 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108386 | assert( pSubWInfo || pParse->nErr || db->mallocFailed ); |
| 108387 | if( pSubWInfo ){ |
| 108388 | WhereLoop *pSubLoop; |
| 108389 | explainOneScan( |
| 108390 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108391 | ); |
| @@ -108414,17 +108436,17 @@ | |
| 108436 | } |
| 108437 | pLevel->u.pCovidx = pCov; |
| 108438 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108439 | if( pAndExpr ){ |
| 108440 | pAndExpr->pLeft = 0; |
| 108441 | sqlite3ExprDelete(db, pAndExpr); |
| 108442 | } |
| 108443 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108444 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108445 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108446 | |
| 108447 | if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); |
| 108448 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108449 | }else |
| 108450 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108451 | |
| 108452 | { |
| @@ -108475,13 +108497,12 @@ | |
| 108497 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108498 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108499 | ** the implied "t1.a=123" constraint. |
| 108500 | */ |
| 108501 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108502 | Expr *pE, *pEAlt; |
| 108503 | WhereTerm *pAlt; |
| 108504 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108505 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108506 | if( pTerm->leftCursor!=iCur ) continue; |
| 108507 | if( pLevel->iLeftJoin ) continue; |
| 108508 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | |
| 108512 | if( pAlt==0 ) continue; |
| 108513 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108514 | testcase( pAlt->eOperator & WO_EQ ); |
| 108515 | testcase( pAlt->eOperator & WO_IN ); |
| 108516 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108517 | pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); |
| 108518 | if( pEAlt ){ |
| 108519 | *pEAlt = *pAlt->pExpr; |
| 108520 | pEAlt->pLeft = pE->pLeft; |
| 108521 | sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); |
| 108522 | sqlite3StackFree(db, pEAlt); |
| 108523 | } |
| 108524 | } |
| 108525 | |
| 108526 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108527 | ** at least one row of the right table has matched the left table. |
| 108528 | */ |
| @@ -116436,10 +116461,11 @@ | |
| 116461 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116462 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116463 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116464 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116465 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116466 | case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; |
| 116467 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116468 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116469 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116470 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116471 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | |
| 128290 | } |
| 128291 | |
| 128292 | |
| 128293 | #ifdef SQLITE_TEST |
| 128294 | |
| 128295 | #include <tcl.h> |
| 128296 | /* #include <string.h> */ |
| 128297 | |
| 128298 | /* |
| 128299 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128300 | ** designed to be used in concert with the Tcl testing framework. This |
| 128301 |
+137
-111
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -399,13 +399,10 @@ | ||
| 399 | 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | 402 | ** assertion will be triggered. |
| 403 | 403 | ** |
| 404 | -** (Historical note: There used to be several other options, but we've | |
| 405 | -** pared it down to just these three.) | |
| 406 | -** | |
| 407 | 404 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 408 | 405 | ** the default. |
| 409 | 406 | */ |
| 410 | 407 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 411 | 408 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | ||
| 439 | 436 | */ |
| 440 | 437 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 441 | 438 | # define _XOPEN_SOURCE 600 |
| 442 | 439 | #endif |
| 443 | 440 | |
| 444 | -/* | |
| 445 | -** The TCL headers are only needed when compiling the TCL bindings. | |
| 446 | -*/ | |
| 447 | -#if defined(SQLITE_TCL) || defined(TCLSH) | |
| 448 | -# include <tcl.h> | |
| 449 | -#endif | |
| 450 | - | |
| 451 | 441 | /* |
| 452 | 442 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 453 | 443 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 454 | 444 | ** make it true by defining or undefining NDEBUG. |
| 455 | 445 | ** |
| 456 | -** Setting NDEBUG makes the code smaller and run faster by disabling the | |
| 457 | -** number assert() statements in the code. So we want the default action | |
| 446 | +** Setting NDEBUG makes the code smaller and faster by disabling the | |
| 447 | +** assert() statements in the code. So we want the default action | |
| 458 | 448 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 459 | 449 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 460 | 450 | ** feature. |
| 461 | 451 | */ |
| 462 | 452 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | ||
| 522 | 512 | ** hint of unplanned behavior. |
| 523 | 513 | ** |
| 524 | 514 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 525 | 515 | ** |
| 526 | 516 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 527 | -** be true and false so that the unreachable code then specify will | |
| 517 | +** be true and false so that the unreachable code they specify will | |
| 528 | 518 | ** not be counted as untested code. |
| 529 | 519 | */ |
| 530 | 520 | #if defined(SQLITE_COVERAGE_TEST) |
| 531 | 521 | # define ALWAYS(X) (1) |
| 532 | 522 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | ||
| 546 | 536 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 547 | 537 | |
| 548 | 538 | /* |
| 549 | 539 | ** The macro unlikely() is a hint that surrounds a boolean |
| 550 | 540 | ** expression that is usually false. Macro likely() surrounds |
| 551 | -** a boolean expression that is usually true. GCC is able to | |
| 552 | -** use these hints to generate better code, sometimes. | |
| 541 | +** a boolean expression that is usually true. These hints could, | |
| 542 | +** in theory, be used by the compiler to generate better code, but | |
| 543 | +** currently they are just comments for human readers. | |
| 553 | 544 | */ |
| 554 | -#if defined(__GNUC__) && 0 | |
| 555 | -# define likely(X) __builtin_expect((X),1) | |
| 556 | -# define unlikely(X) __builtin_expect((X),0) | |
| 557 | -#else | |
| 558 | -# define likely(X) !!(X) | |
| 559 | -# define unlikely(X) !!(X) | |
| 560 | -#endif | |
| 545 | +#define likely(X) (X) | |
| 546 | +#define unlikely(X) (X) | |
| 561 | 547 | |
| 562 | 548 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 563 | 549 | /************** Begin file sqlite3.h *****************************************/ |
| 564 | 550 | /* |
| 565 | 551 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | ||
| 670 | 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 671 | 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 672 | 658 | */ |
| 673 | 659 | #define SQLITE_VERSION "3.8.0" |
| 674 | 660 | #define SQLITE_VERSION_NUMBER 3008000 |
| 675 | -#define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" | |
| 661 | +#define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" | |
| 676 | 662 | |
| 677 | 663 | /* |
| 678 | 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 679 | 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 680 | 666 | ** |
| @@ -1039,10 +1025,11 @@ | ||
| 1039 | 1025 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1040 | 1026 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1041 | 1027 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1042 | 1028 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1043 | 1029 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1030 | +#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) | |
| 1044 | 1031 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1045 | 1032 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1046 | 1033 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1047 | 1034 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1048 | 1035 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | ||
| 28374 | 28361 | */ |
| 28375 | 28362 | static const char *unixTempFileDir(void){ |
| 28376 | 28363 | static const char *azDirs[] = { |
| 28377 | 28364 | 0, |
| 28378 | 28365 | 0, |
| 28379 | -#ifdef __CYGWIN__ | |
| 28380 | 28366 | 0, |
| 28381 | 28367 | 0, |
| 28382 | -#endif | |
| 28383 | 28368 | "/var/tmp", |
| 28384 | 28369 | "/usr/tmp", |
| 28385 | 28370 | "/tmp", |
| 28386 | - 0 /* List terminator */ | |
| 28371 | + "." | |
| 28387 | 28372 | }; |
| 28388 | 28373 | unsigned int i; |
| 28389 | 28374 | struct stat buf; |
| 28390 | - const char *zDir = 0; | |
| 28375 | + const char *zDir; | |
| 28391 | 28376 | |
| 28392 | 28377 | azDirs[0] = sqlite3_temp_directory; |
| 28393 | 28378 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28394 | -#ifdef __CYGWIN__ | |
| 28395 | 28379 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28396 | 28380 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28397 | -#endif | |
| 28398 | - for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 28381 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ | |
| 28382 | + zDir = azDirs[i]; | |
| 28399 | 28383 | if( zDir==0 ) continue; |
| 28400 | 28384 | if( osStat(zDir, &buf) ) continue; |
| 28401 | 28385 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28402 | 28386 | if( osAccess(zDir, 07) ) continue; |
| 28403 | 28387 | break; |
| @@ -28423,11 +28407,10 @@ | ||
| 28423 | 28407 | ** function failing. |
| 28424 | 28408 | */ |
| 28425 | 28409 | SimulateIOError( return SQLITE_IOERR ); |
| 28426 | 28410 | |
| 28427 | 28411 | zDir = unixTempFileDir(); |
| 28428 | - if( zDir==0 ) zDir = "."; | |
| 28429 | 28412 | |
| 28430 | 28413 | /* Check that the output buffer is large enough for the temporary file |
| 28431 | 28414 | ** name. If it is not, return SQLITE_ERROR. |
| 28432 | 28415 | */ |
| 28433 | 28416 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | ||
| 30505 | 30488 | */ |
| 30506 | 30489 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30507 | 30490 | |
| 30508 | 30491 | #ifdef __CYGWIN__ |
| 30509 | 30492 | # include <sys/cygwin.h> |
| 30493 | +/* # include <errno.h> */ | |
| 30510 | 30494 | #endif |
| 30511 | 30495 | |
| 30512 | 30496 | /* |
| 30513 | 30497 | ** Include code that is common to all os_*.c files |
| 30514 | 30498 | */ |
| @@ -30925,10 +30909,11 @@ | ||
| 30925 | 30909 | * zero for the default behavior. |
| 30926 | 30910 | */ |
| 30927 | 30911 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30928 | 30912 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30929 | 30913 | #endif |
| 30914 | + | |
| 30930 | 30915 | |
| 30931 | 30916 | /* |
| 30932 | 30917 | ** The winMemData structure stores information required by the Win32-specific |
| 30933 | 30918 | ** sqlite3_mem_methods implementation. |
| 30934 | 30919 | */ |
| @@ -34390,14 +34375,14 @@ | ||
| 34390 | 34375 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34391 | 34376 | osGetCurrentProcessId(), pFd)); |
| 34392 | 34377 | return SQLITE_OK; |
| 34393 | 34378 | } |
| 34394 | 34379 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34395 | -#if SQLITE_OS_WINRT | |
| 34396 | - pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); | |
| 34397 | -#else | |
| 34398 | 34380 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34381 | +#if SQLITE_OS_WINRT | |
| 34382 | + pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); | |
| 34383 | +#else | |
| 34399 | 34384 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34400 | 34385 | #endif |
| 34401 | 34386 | if( pNew==NULL ){ |
| 34402 | 34387 | osCloseHandle(pFd->hMap); |
| 34403 | 34388 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | ||
| 34564 | 34549 | return zConverted; |
| 34565 | 34550 | } |
| 34566 | 34551 | |
| 34567 | 34552 | static int winIsDir(const void *zConverted); |
| 34568 | 34553 | |
| 34554 | +/* | |
| 34555 | +** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is | |
| 34556 | +** in characters, so we allocate 3 bytes per character assuming worst-case | |
| 34557 | +** 3-bytes-per-character UTF8. | |
| 34558 | +*/ | |
| 34559 | +#ifndef SQLITE_WIN32_MAX_PATH | |
| 34560 | +# define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) | |
| 34561 | +#endif | |
| 34562 | + | |
| 34569 | 34563 | /* |
| 34570 | 34564 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34571 | 34565 | ** hold at pVfs->mxPathname characters. |
| 34572 | 34566 | */ |
| 34573 | 34567 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | ||
| 34575 | 34569 | "abcdefghijklmnopqrstuvwxyz" |
| 34576 | 34570 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34577 | 34571 | "0123456789"; |
| 34578 | 34572 | size_t i, j; |
| 34579 | 34573 | int nTempPath; |
| 34580 | - char zTempPath[MAX_PATH+2]; | |
| 34574 | + char zTempPath[SQLITE_WIN32_MAX_PATH+2]; | |
| 34581 | 34575 | |
| 34582 | 34576 | /* It's odd to simulate an io-error here, but really this is just |
| 34583 | 34577 | ** using the io-error infrastructure to test that SQLite handles this |
| 34584 | 34578 | ** function failing. |
| 34585 | 34579 | */ |
| 34586 | 34580 | SimulateIOError( return SQLITE_IOERR ); |
| 34587 | 34581 | |
| 34588 | - memset(zTempPath, 0, MAX_PATH+2); | |
| 34589 | - | |
| 34590 | 34582 | if( sqlite3_temp_directory ){ |
| 34591 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); | |
| 34583 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", | |
| 34584 | + sqlite3_temp_directory); | |
| 34592 | 34585 | } |
| 34593 | 34586 | #if defined(__CYGWIN__) |
| 34594 | - static const char *azDirs[] = { | |
| 34595 | - 0, | |
| 34596 | - 0, | |
| 34597 | - 0, | |
| 34598 | - 0, | |
| 34599 | - "/var/tmp", | |
| 34600 | - "/usr/tmp", | |
| 34601 | - "/tmp", | |
| 34602 | - 0 | |
| 34603 | - }; | |
| 34604 | - const char *zDir = 0; | |
| 34605 | - char *zConverted; | |
| 34606 | - | |
| 34607 | - azDirs[0] = sqlite3_temp_directory; | |
| 34608 | - if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); | |
| 34609 | - if( !azDirs[2] ) azDirs[2] = getenv("TMP"); | |
| 34610 | - if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); | |
| 34611 | - for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ | |
| 34612 | - if( zDir==0 || zDir[0]) continue; | |
| 34613 | - if( zDir[1]!=':' ){ | |
| 34614 | - WCHAR zWidePath[MAX_PATH]; | |
| 34615 | - cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); | |
| 34616 | - zDir = unicodeToUtf8(zWidePath); | |
| 34617 | - if( zDir==0 ){ | |
| 34618 | - OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); | |
| 34619 | - return SQLITE_IOERR_NOMEM; | |
| 34620 | - } | |
| 34621 | - } | |
| 34622 | - /* Convert the filename to the system encoding. */ | |
| 34623 | - zConverted = convertUtf8Filename(zDir); | |
| 34624 | - if( zConverted==0 ){ | |
| 34625 | - OSTRACE(("TEMP-FILENAME, rc=SQLITE_IOERR_NOMEM")); | |
| 34626 | - return SQLITE_IOERR_NOMEM; | |
| 34627 | - } | |
| 34628 | - if( winIsDir(zConverted) ){ | |
| 34629 | - sqlite3_free(zConverted); | |
| 34630 | - break; | |
| 34631 | - } | |
| 34632 | - sqlite3_free(zConverted); | |
| 34633 | - } | |
| 34634 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); | |
| 34587 | + else{ | |
| 34588 | + static const char *azDirs[] = { | |
| 34589 | + 0, | |
| 34590 | + 0, | |
| 34591 | + 0, | |
| 34592 | + 0, | |
| 34593 | + "/var/tmp", | |
| 34594 | + "/usr/tmp", | |
| 34595 | + "/tmp", | |
| 34596 | + "." | |
| 34597 | + }; | |
| 34598 | + const char *zDir; | |
| 34599 | + WCHAR zWidePath[MAX_PATH]; | |
| 34600 | + | |
| 34601 | + if( !azDirs[0] ) azDirs[0] = getenv("TMPDIR"); | |
| 34602 | + if( !azDirs[1] ) azDirs[1] = getenv("TMP"); | |
| 34603 | + if( !azDirs[2] ) azDirs[2] = getenv("TEMP"); | |
| 34604 | + if( !azDirs[3] ) azDirs[3] = getenv("USERPROFILE"); | |
| 34605 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ | |
| 34606 | + zDir = azDirs[i]; | |
| 34607 | + if( zDir==0 || zDir[0]==0 ) continue; | |
| 34608 | + if( zDir[1]!=':' ){ | |
| 34609 | + cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); | |
| 34610 | + zDir = azDirs[i] = unicodeToUtf8(zWidePath); | |
| 34611 | + if( zDir==0 ){ | |
| 34612 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); | |
| 34613 | + return SQLITE_IOERR_NOMEM; | |
| 34614 | + } | |
| 34615 | + }else{ | |
| 34616 | + /* Convert the filename to the system encoding. */ | |
| 34617 | + osMultiByteToWideChar(CP_UTF8, 0, zDir, -1, zWidePath, | |
| 34618 | + MAX_PATH); | |
| 34619 | + } | |
| 34620 | + if( winIsDir(zWidePath) ){ | |
| 34621 | + break; | |
| 34622 | + } | |
| 34623 | + azDirs[i] = ""; /* Don't retry in future call */ | |
| 34624 | + } | |
| 34625 | + sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); | |
| 34626 | + } | |
| 34635 | 34627 | #elif !SQLITE_OS_WINRT |
| 34636 | 34628 | else if( isNT() ){ |
| 34637 | 34629 | char *zMulti; |
| 34638 | 34630 | WCHAR zWidePath[MAX_PATH]; |
| 34639 | - osGetTempPathW(MAX_PATH-30, zWidePath); | |
| 34631 | + if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ | |
| 34632 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); | |
| 34633 | + return SQLITE_IOERR_GETTEMPPATH; | |
| 34634 | + } | |
| 34640 | 34635 | zMulti = unicodeToUtf8(zWidePath); |
| 34641 | 34636 | if( zMulti ){ |
| 34642 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti); | |
| 34637 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti); | |
| 34643 | 34638 | sqlite3_free(zMulti); |
| 34644 | 34639 | }else{ |
| 34645 | 34640 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34646 | 34641 | return SQLITE_IOERR_NOMEM; |
| 34647 | 34642 | } |
| 34648 | 34643 | } |
| 34649 | 34644 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34650 | 34645 | else{ |
| 34651 | 34646 | char *zUtf8; |
| 34652 | - char zMbcsPath[MAX_PATH]; | |
| 34653 | - osGetTempPathA(MAX_PATH-30, zMbcsPath); | |
| 34647 | + char zMbcsPath[SQLITE_WIN32_MAX_PATH]; | |
| 34648 | + if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){ | |
| 34649 | + OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); | |
| 34650 | + return SQLITE_IOERR_GETTEMPPATH; | |
| 34651 | + } | |
| 34654 | 34652 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34655 | 34653 | if( zUtf8 ){ |
| 34656 | - sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8); | |
| 34654 | + sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8); | |
| 34657 | 34655 | sqlite3_free(zUtf8); |
| 34658 | 34656 | }else{ |
| 34659 | 34657 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34660 | 34658 | return SQLITE_IOERR_NOMEM; |
| 34661 | 34659 | } |
| 34662 | 34660 | } |
| 34663 | -#endif | |
| 34664 | -#endif | |
| 34661 | +#else | |
| 34662 | + else{ | |
| 34663 | + /* | |
| 34664 | + ** Compiled without ANSI support and the current operating system | |
| 34665 | + ** is not Windows NT; therefore, just zero the temporary buffer. | |
| 34666 | + */ | |
| 34667 | + memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); | |
| 34668 | + } | |
| 34669 | +#endif /* SQLITE_WIN32_HAS_ANSI */ | |
| 34670 | +#else | |
| 34671 | + else{ | |
| 34672 | + /* | |
| 34673 | + ** Compiled for WinRT and the sqlite3_temp_directory is not set; | |
| 34674 | + ** therefore, just zero the temporary buffer. | |
| 34675 | + */ | |
| 34676 | + memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); | |
| 34677 | + } | |
| 34678 | +#endif /* !SQLITE_OS_WINRT */ | |
| 34665 | 34679 | |
| 34666 | 34680 | /* Check that the output buffer is large enough for the temporary file |
| 34667 | 34681 | ** name. If it is not, return SQLITE_ERROR. |
| 34668 | 34682 | */ |
| 34669 | 34683 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | ||
| 34745 | 34759 | int cnt = 0; |
| 34746 | 34760 | |
| 34747 | 34761 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34748 | 34762 | ** a temporary file. Use this buffer to store the file name in. |
| 34749 | 34763 | */ |
| 34750 | - char zTmpname[MAX_PATH+2]; /* Buffer used to create temp filename */ | |
| 34764 | + char zTmpname[SQLITE_WIN32_MAX_PATH+2]; /* Buffer used to create temp filename */ | |
| 34751 | 34765 | |
| 34752 | 34766 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34753 | 34767 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34754 | 34768 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34755 | 34769 | #endif |
| @@ -34811,12 +34825,11 @@ | ||
| 34811 | 34825 | /* If the second argument to this function is NULL, generate a |
| 34812 | 34826 | ** temporary file name to use |
| 34813 | 34827 | */ |
| 34814 | 34828 | if( !zUtf8Name ){ |
| 34815 | 34829 | assert(isDelete && !isOpenJournal); |
| 34816 | - memset(zTmpname, 0, MAX_PATH+2); | |
| 34817 | - rc = getTempname(MAX_PATH+2, zTmpname); | |
| 34830 | + rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname); | |
| 34818 | 34831 | if( rc!=SQLITE_OK ){ |
| 34819 | 34832 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34820 | 34833 | return rc; |
| 34821 | 34834 | } |
| 34822 | 34835 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | ||
| 35243 | 35256 | ){ |
| 35244 | 35257 | |
| 35245 | 35258 | #if defined(__CYGWIN__) |
| 35246 | 35259 | SimulateIOError( return SQLITE_ERROR ); |
| 35247 | 35260 | UNUSED_PARAMETER(nFull); |
| 35248 | - assert( pVfs->mxPathname>=MAX_PATH ); | |
| 35261 | + assert( pVfs->mxPathname>=SQLITE_WIN32_MAX_PATH ); | |
| 35249 | 35262 | assert( nFull>=pVfs->mxPathname ); |
| 35250 | 35263 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35251 | 35264 | /* |
| 35252 | 35265 | ** NOTE: We are dealing with a relative path name and the data |
| 35253 | 35266 | ** directory has been set. Therefore, use it as the basis |
| 35254 | 35267 | ** for converting the relative path name to an absolute |
| 35255 | 35268 | ** one by prepending the data directory and a slash. |
| 35256 | 35269 | */ |
| 35257 | - char zOut[MAX_PATH+1]; | |
| 35258 | - memset(zOut, 0, MAX_PATH+1); | |
| 35259 | - cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, | |
| 35260 | - MAX_PATH+1); | |
| 35270 | + char zOut[SQLITE_WIN32_MAX_PATH+1]; | |
| 35271 | + if( cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, | |
| 35272 | + SQLITE_WIN32_MAX_PATH+1)<0 ){ | |
| 35273 | + winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", | |
| 35274 | + zRelative); | |
| 35275 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 35276 | + } | |
| 35261 | 35277 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35262 | 35278 | sqlite3_data_directory, zOut); |
| 35263 | 35279 | }else{ |
| 35264 | - cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); | |
| 35280 | + if( cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull)<0 ){ | |
| 35281 | + winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", | |
| 35282 | + zRelative); | |
| 35283 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 35284 | + } | |
| 35265 | 35285 | } |
| 35266 | 35286 | return SQLITE_OK; |
| 35267 | 35287 | #endif |
| 35268 | 35288 | |
| 35269 | 35289 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | ||
| 35601 | 35621 | */ |
| 35602 | 35622 | SQLITE_API int sqlite3_os_init(void){ |
| 35603 | 35623 | static sqlite3_vfs winVfs = { |
| 35604 | 35624 | 3, /* iVersion */ |
| 35605 | 35625 | sizeof(winFile), /* szOsFile */ |
| 35606 | - MAX_PATH, /* mxPathname */ | |
| 35626 | + SQLITE_WIN32_MAX_PATH, /* mxPathname */ | |
| 35607 | 35627 | 0, /* pNext */ |
| 35608 | 35628 | "win32", /* zName */ |
| 35609 | 35629 | 0, /* pAppData */ |
| 35610 | 35630 | winOpen, /* xOpen */ |
| 35611 | 35631 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | ||
| 107770 | 107790 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107771 | 107791 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107772 | 107792 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107773 | 107793 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107774 | 107794 | Parse *pParse; /* Parsing context */ |
| 107795 | + sqlite3 *db; /* Database connection */ | |
| 107775 | 107796 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107776 | 107797 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107777 | 107798 | int addrBrk; /* Jump here to break out of the loop */ |
| 107778 | 107799 | int addrCont; /* Jump here to continue with next cycle */ |
| 107779 | 107800 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | ||
| 107781 | 107802 | Bitmask newNotReady; /* Return value */ |
| 107782 | 107803 | |
| 107783 | 107804 | pParse = pWInfo->pParse; |
| 107784 | 107805 | v = pParse->pVdbe; |
| 107785 | 107806 | pWC = &pWInfo->sWC; |
| 107807 | + db = pParse->db; | |
| 107786 | 107808 | pLevel = &pWInfo->a[iLevel]; |
| 107787 | 107809 | pLoop = pLevel->pWLoop; |
| 107788 | 107810 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107789 | 107811 | iCur = pTabItem->iCursor; |
| 107790 | 107812 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | ||
| 108071 | 108093 | /* Generate code to evaluate all constraint terms using == or IN |
| 108072 | 108094 | ** and store the values of those terms in an array of registers |
| 108073 | 108095 | ** starting at regBase. |
| 108074 | 108096 | */ |
| 108075 | 108097 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108076 | - zEndAff = sqlite3DbStrDup(pParse->db, zStartAff); | |
| 108098 | + zEndAff = sqlite3DbStrDup(db, zStartAff); | |
| 108077 | 108099 | addrNxt = pLevel->addrNxt; |
| 108078 | 108100 | |
| 108079 | 108101 | /* If we are doing a reverse order scan on an ascending index, or |
| 108080 | 108102 | ** a forward order scan on a descending index, interchange the |
| 108081 | 108103 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | ||
| 108156 | 108178 | } |
| 108157 | 108179 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108158 | 108180 | nConstraint++; |
| 108159 | 108181 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108160 | 108182 | } |
| 108161 | - sqlite3DbFree(pParse->db, zStartAff); | |
| 108162 | - sqlite3DbFree(pParse->db, zEndAff); | |
| 108183 | + sqlite3DbFree(db, zStartAff); | |
| 108184 | + sqlite3DbFree(db, zEndAff); | |
| 108163 | 108185 | |
| 108164 | 108186 | /* Top of the loop body */ |
| 108165 | 108187 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108166 | 108188 | |
| 108167 | 108189 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | ||
| 108284 | 108306 | */ |
| 108285 | 108307 | if( pWInfo->nLevel>1 ){ |
| 108286 | 108308 | int nNotReady; /* The number of notReady tables */ |
| 108287 | 108309 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108288 | 108310 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108289 | - pOrTab = sqlite3StackAllocRaw(pParse->db, | |
| 108311 | + pOrTab = sqlite3StackAllocRaw(db, | |
| 108290 | 108312 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108291 | 108313 | if( pOrTab==0 ) return notReady; |
| 108292 | 108314 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108293 | 108315 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108294 | 108316 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | ||
| 108338 | 108360 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108339 | 108361 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108340 | 108362 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108341 | 108363 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108342 | 108364 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108343 | - pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); | |
| 108344 | - pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); | |
| 108365 | + pExpr = sqlite3ExprDup(db, pExpr, 0); | |
| 108366 | + pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); | |
| 108345 | 108367 | } |
| 108346 | 108368 | if( pAndExpr ){ |
| 108347 | 108369 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108348 | 108370 | } |
| 108349 | 108371 | } |
| @@ -108359,11 +108381,11 @@ | ||
| 108359 | 108381 | } |
| 108360 | 108382 | /* Loop through table entries that match term pOrTerm. */ |
| 108361 | 108383 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108362 | 108384 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108363 | 108385 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108364 | - assert( pSubWInfo || pParse->nErr || pParse->db->mallocFailed ); | |
| 108386 | + assert( pSubWInfo || pParse->nErr || db->mallocFailed ); | |
| 108365 | 108387 | if( pSubWInfo ){ |
| 108366 | 108388 | WhereLoop *pSubLoop; |
| 108367 | 108389 | explainOneScan( |
| 108368 | 108390 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108369 | 108391 | ); |
| @@ -108414,17 +108436,17 @@ | ||
| 108414 | 108436 | } |
| 108415 | 108437 | pLevel->u.pCovidx = pCov; |
| 108416 | 108438 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108417 | 108439 | if( pAndExpr ){ |
| 108418 | 108440 | pAndExpr->pLeft = 0; |
| 108419 | - sqlite3ExprDelete(pParse->db, pAndExpr); | |
| 108441 | + sqlite3ExprDelete(db, pAndExpr); | |
| 108420 | 108442 | } |
| 108421 | 108443 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108422 | 108444 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108423 | 108445 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108424 | 108446 | |
| 108425 | - if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab); | |
| 108447 | + if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); | |
| 108426 | 108448 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108427 | 108449 | }else |
| 108428 | 108450 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108429 | 108451 | |
| 108430 | 108452 | { |
| @@ -108475,13 +108497,12 @@ | ||
| 108475 | 108497 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108476 | 108498 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108477 | 108499 | ** the implied "t1.a=123" constraint. |
| 108478 | 108500 | */ |
| 108479 | 108501 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108480 | - Expr *pE; | |
| 108502 | + Expr *pE, *pEAlt; | |
| 108481 | 108503 | WhereTerm *pAlt; |
| 108482 | - Expr sEq; | |
| 108483 | 108504 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108484 | 108505 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108485 | 108506 | if( pTerm->leftCursor!=iCur ) continue; |
| 108486 | 108507 | if( pLevel->iLeftJoin ) continue; |
| 108487 | 108508 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | ||
| 108491 | 108512 | if( pAlt==0 ) continue; |
| 108492 | 108513 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108493 | 108514 | testcase( pAlt->eOperator & WO_EQ ); |
| 108494 | 108515 | testcase( pAlt->eOperator & WO_IN ); |
| 108495 | 108516 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108496 | - sEq = *pAlt->pExpr; | |
| 108497 | - sEq.pLeft = pE->pLeft; | |
| 108498 | - sqlite3ExprIfFalse(pParse, &sEq, addrCont, SQLITE_JUMPIFNULL); | |
| 108517 | + pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); | |
| 108518 | + if( pEAlt ){ | |
| 108519 | + *pEAlt = *pAlt->pExpr; | |
| 108520 | + pEAlt->pLeft = pE->pLeft; | |
| 108521 | + sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); | |
| 108522 | + sqlite3StackFree(db, pEAlt); | |
| 108523 | + } | |
| 108499 | 108524 | } |
| 108500 | 108525 | |
| 108501 | 108526 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108502 | 108527 | ** at least one row of the right table has matched the left table. |
| 108503 | 108528 | */ |
| @@ -116436,10 +116461,11 @@ | ||
| 116436 | 116461 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116437 | 116462 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116438 | 116463 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116439 | 116464 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116440 | 116465 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116466 | + case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; | |
| 116441 | 116467 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116442 | 116468 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116443 | 116469 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116444 | 116470 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116445 | 116471 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | ||
| 128264 | 128290 | } |
| 128265 | 128291 | |
| 128266 | 128292 | |
| 128267 | 128293 | #ifdef SQLITE_TEST |
| 128268 | 128294 | |
| 128269 | -/* #include <tcl.h> */ | |
| 128295 | +#include <tcl.h> | |
| 128270 | 128296 | /* #include <string.h> */ |
| 128271 | 128297 | |
| 128272 | 128298 | /* |
| 128273 | 128299 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128274 | 128300 | ** designed to be used in concert with the Tcl testing framework. This |
| 128275 | 128301 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -399,13 +399,10 @@ | |
| 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | ** assertion will be triggered. |
| 403 | ** |
| 404 | ** (Historical note: There used to be several other options, but we've |
| 405 | ** pared it down to just these three.) |
| 406 | ** |
| 407 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 408 | ** the default. |
| 409 | */ |
| 410 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 411 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | |
| 439 | */ |
| 440 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 441 | # define _XOPEN_SOURCE 600 |
| 442 | #endif |
| 443 | |
| 444 | /* |
| 445 | ** The TCL headers are only needed when compiling the TCL bindings. |
| 446 | */ |
| 447 | #if defined(SQLITE_TCL) || defined(TCLSH) |
| 448 | # include <tcl.h> |
| 449 | #endif |
| 450 | |
| 451 | /* |
| 452 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 453 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 454 | ** make it true by defining or undefining NDEBUG. |
| 455 | ** |
| 456 | ** Setting NDEBUG makes the code smaller and run faster by disabling the |
| 457 | ** number assert() statements in the code. So we want the default action |
| 458 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 459 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 460 | ** feature. |
| 461 | */ |
| 462 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | |
| 522 | ** hint of unplanned behavior. |
| 523 | ** |
| 524 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 525 | ** |
| 526 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 527 | ** be true and false so that the unreachable code then specify will |
| 528 | ** not be counted as untested code. |
| 529 | */ |
| 530 | #if defined(SQLITE_COVERAGE_TEST) |
| 531 | # define ALWAYS(X) (1) |
| 532 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | |
| 546 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 547 | |
| 548 | /* |
| 549 | ** The macro unlikely() is a hint that surrounds a boolean |
| 550 | ** expression that is usually false. Macro likely() surrounds |
| 551 | ** a boolean expression that is usually true. GCC is able to |
| 552 | ** use these hints to generate better code, sometimes. |
| 553 | */ |
| 554 | #if defined(__GNUC__) && 0 |
| 555 | # define likely(X) __builtin_expect((X),1) |
| 556 | # define unlikely(X) __builtin_expect((X),0) |
| 557 | #else |
| 558 | # define likely(X) !!(X) |
| 559 | # define unlikely(X) !!(X) |
| 560 | #endif |
| 561 | |
| 562 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 563 | /************** Begin file sqlite3.h *****************************************/ |
| 564 | /* |
| 565 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | |
| 670 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 671 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 672 | */ |
| 673 | #define SQLITE_VERSION "3.8.0" |
| 674 | #define SQLITE_VERSION_NUMBER 3008000 |
| 675 | #define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" |
| 676 | |
| 677 | /* |
| 678 | ** CAPI3REF: Run-Time Library Version Numbers |
| 679 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 680 | ** |
| @@ -1039,10 +1025,11 @@ | |
| 1039 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1040 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1041 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1042 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1043 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1044 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1045 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1046 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1047 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | |
| 28374 | */ |
| 28375 | static const char *unixTempFileDir(void){ |
| 28376 | static const char *azDirs[] = { |
| 28377 | 0, |
| 28378 | 0, |
| 28379 | #ifdef __CYGWIN__ |
| 28380 | 0, |
| 28381 | 0, |
| 28382 | #endif |
| 28383 | "/var/tmp", |
| 28384 | "/usr/tmp", |
| 28385 | "/tmp", |
| 28386 | 0 /* List terminator */ |
| 28387 | }; |
| 28388 | unsigned int i; |
| 28389 | struct stat buf; |
| 28390 | const char *zDir = 0; |
| 28391 | |
| 28392 | azDirs[0] = sqlite3_temp_directory; |
| 28393 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28394 | #ifdef __CYGWIN__ |
| 28395 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28396 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28397 | #endif |
| 28398 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 28399 | if( zDir==0 ) continue; |
| 28400 | if( osStat(zDir, &buf) ) continue; |
| 28401 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28402 | if( osAccess(zDir, 07) ) continue; |
| 28403 | break; |
| @@ -28423,11 +28407,10 @@ | |
| 28423 | ** function failing. |
| 28424 | */ |
| 28425 | SimulateIOError( return SQLITE_IOERR ); |
| 28426 | |
| 28427 | zDir = unixTempFileDir(); |
| 28428 | if( zDir==0 ) zDir = "."; |
| 28429 | |
| 28430 | /* Check that the output buffer is large enough for the temporary file |
| 28431 | ** name. If it is not, return SQLITE_ERROR. |
| 28432 | */ |
| 28433 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | |
| 30505 | */ |
| 30506 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30507 | |
| 30508 | #ifdef __CYGWIN__ |
| 30509 | # include <sys/cygwin.h> |
| 30510 | #endif |
| 30511 | |
| 30512 | /* |
| 30513 | ** Include code that is common to all os_*.c files |
| 30514 | */ |
| @@ -30925,10 +30909,11 @@ | |
| 30925 | * zero for the default behavior. |
| 30926 | */ |
| 30927 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30928 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30929 | #endif |
| 30930 | |
| 30931 | /* |
| 30932 | ** The winMemData structure stores information required by the Win32-specific |
| 30933 | ** sqlite3_mem_methods implementation. |
| 30934 | */ |
| @@ -34390,14 +34375,14 @@ | |
| 34390 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34391 | osGetCurrentProcessId(), pFd)); |
| 34392 | return SQLITE_OK; |
| 34393 | } |
| 34394 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34395 | #if SQLITE_OS_WINRT |
| 34396 | pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); |
| 34397 | #else |
| 34398 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34399 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34400 | #endif |
| 34401 | if( pNew==NULL ){ |
| 34402 | osCloseHandle(pFd->hMap); |
| 34403 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | |
| 34564 | return zConverted; |
| 34565 | } |
| 34566 | |
| 34567 | static int winIsDir(const void *zConverted); |
| 34568 | |
| 34569 | /* |
| 34570 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34571 | ** hold at pVfs->mxPathname characters. |
| 34572 | */ |
| 34573 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | |
| 34575 | "abcdefghijklmnopqrstuvwxyz" |
| 34576 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34577 | "0123456789"; |
| 34578 | size_t i, j; |
| 34579 | int nTempPath; |
| 34580 | char zTempPath[MAX_PATH+2]; |
| 34581 | |
| 34582 | /* It's odd to simulate an io-error here, but really this is just |
| 34583 | ** using the io-error infrastructure to test that SQLite handles this |
| 34584 | ** function failing. |
| 34585 | */ |
| 34586 | SimulateIOError( return SQLITE_IOERR ); |
| 34587 | |
| 34588 | memset(zTempPath, 0, MAX_PATH+2); |
| 34589 | |
| 34590 | if( sqlite3_temp_directory ){ |
| 34591 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 34592 | } |
| 34593 | #if defined(__CYGWIN__) |
| 34594 | static const char *azDirs[] = { |
| 34595 | 0, |
| 34596 | 0, |
| 34597 | 0, |
| 34598 | 0, |
| 34599 | "/var/tmp", |
| 34600 | "/usr/tmp", |
| 34601 | "/tmp", |
| 34602 | 0 |
| 34603 | }; |
| 34604 | const char *zDir = 0; |
| 34605 | char *zConverted; |
| 34606 | |
| 34607 | azDirs[0] = sqlite3_temp_directory; |
| 34608 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 34609 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 34610 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 34611 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 34612 | if( zDir==0 || zDir[0]) continue; |
| 34613 | if( zDir[1]!=':' ){ |
| 34614 | WCHAR zWidePath[MAX_PATH]; |
| 34615 | cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); |
| 34616 | zDir = unicodeToUtf8(zWidePath); |
| 34617 | if( zDir==0 ){ |
| 34618 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34619 | return SQLITE_IOERR_NOMEM; |
| 34620 | } |
| 34621 | } |
| 34622 | /* Convert the filename to the system encoding. */ |
| 34623 | zConverted = convertUtf8Filename(zDir); |
| 34624 | if( zConverted==0 ){ |
| 34625 | OSTRACE(("TEMP-FILENAME, rc=SQLITE_IOERR_NOMEM")); |
| 34626 | return SQLITE_IOERR_NOMEM; |
| 34627 | } |
| 34628 | if( winIsDir(zConverted) ){ |
| 34629 | sqlite3_free(zConverted); |
| 34630 | break; |
| 34631 | } |
| 34632 | sqlite3_free(zConverted); |
| 34633 | } |
| 34634 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); |
| 34635 | #elif !SQLITE_OS_WINRT |
| 34636 | else if( isNT() ){ |
| 34637 | char *zMulti; |
| 34638 | WCHAR zWidePath[MAX_PATH]; |
| 34639 | osGetTempPathW(MAX_PATH-30, zWidePath); |
| 34640 | zMulti = unicodeToUtf8(zWidePath); |
| 34641 | if( zMulti ){ |
| 34642 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34643 | sqlite3_free(zMulti); |
| 34644 | }else{ |
| 34645 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34646 | return SQLITE_IOERR_NOMEM; |
| 34647 | } |
| 34648 | } |
| 34649 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34650 | else{ |
| 34651 | char *zUtf8; |
| 34652 | char zMbcsPath[MAX_PATH]; |
| 34653 | osGetTempPathA(MAX_PATH-30, zMbcsPath); |
| 34654 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34655 | if( zUtf8 ){ |
| 34656 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34657 | sqlite3_free(zUtf8); |
| 34658 | }else{ |
| 34659 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34660 | return SQLITE_IOERR_NOMEM; |
| 34661 | } |
| 34662 | } |
| 34663 | #endif |
| 34664 | #endif |
| 34665 | |
| 34666 | /* Check that the output buffer is large enough for the temporary file |
| 34667 | ** name. If it is not, return SQLITE_ERROR. |
| 34668 | */ |
| 34669 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | |
| 34745 | int cnt = 0; |
| 34746 | |
| 34747 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34748 | ** a temporary file. Use this buffer to store the file name in. |
| 34749 | */ |
| 34750 | char zTmpname[MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34751 | |
| 34752 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34753 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34754 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34755 | #endif |
| @@ -34811,12 +34825,11 @@ | |
| 34811 | /* If the second argument to this function is NULL, generate a |
| 34812 | ** temporary file name to use |
| 34813 | */ |
| 34814 | if( !zUtf8Name ){ |
| 34815 | assert(isDelete && !isOpenJournal); |
| 34816 | memset(zTmpname, 0, MAX_PATH+2); |
| 34817 | rc = getTempname(MAX_PATH+2, zTmpname); |
| 34818 | if( rc!=SQLITE_OK ){ |
| 34819 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34820 | return rc; |
| 34821 | } |
| 34822 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | |
| 35243 | ){ |
| 35244 | |
| 35245 | #if defined(__CYGWIN__) |
| 35246 | SimulateIOError( return SQLITE_ERROR ); |
| 35247 | UNUSED_PARAMETER(nFull); |
| 35248 | assert( pVfs->mxPathname>=MAX_PATH ); |
| 35249 | assert( nFull>=pVfs->mxPathname ); |
| 35250 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35251 | /* |
| 35252 | ** NOTE: We are dealing with a relative path name and the data |
| 35253 | ** directory has been set. Therefore, use it as the basis |
| 35254 | ** for converting the relative path name to an absolute |
| 35255 | ** one by prepending the data directory and a slash. |
| 35256 | */ |
| 35257 | char zOut[MAX_PATH+1]; |
| 35258 | memset(zOut, 0, MAX_PATH+1); |
| 35259 | cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35260 | MAX_PATH+1); |
| 35261 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35262 | sqlite3_data_directory, zOut); |
| 35263 | }else{ |
| 35264 | cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); |
| 35265 | } |
| 35266 | return SQLITE_OK; |
| 35267 | #endif |
| 35268 | |
| 35269 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | |
| 35601 | */ |
| 35602 | SQLITE_API int sqlite3_os_init(void){ |
| 35603 | static sqlite3_vfs winVfs = { |
| 35604 | 3, /* iVersion */ |
| 35605 | sizeof(winFile), /* szOsFile */ |
| 35606 | MAX_PATH, /* mxPathname */ |
| 35607 | 0, /* pNext */ |
| 35608 | "win32", /* zName */ |
| 35609 | 0, /* pAppData */ |
| 35610 | winOpen, /* xOpen */ |
| 35611 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | |
| 107770 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107771 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107772 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107773 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107774 | Parse *pParse; /* Parsing context */ |
| 107775 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107776 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107777 | int addrBrk; /* Jump here to break out of the loop */ |
| 107778 | int addrCont; /* Jump here to continue with next cycle */ |
| 107779 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | |
| 107781 | Bitmask newNotReady; /* Return value */ |
| 107782 | |
| 107783 | pParse = pWInfo->pParse; |
| 107784 | v = pParse->pVdbe; |
| 107785 | pWC = &pWInfo->sWC; |
| 107786 | pLevel = &pWInfo->a[iLevel]; |
| 107787 | pLoop = pLevel->pWLoop; |
| 107788 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107789 | iCur = pTabItem->iCursor; |
| 107790 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | |
| 108071 | /* Generate code to evaluate all constraint terms using == or IN |
| 108072 | ** and store the values of those terms in an array of registers |
| 108073 | ** starting at regBase. |
| 108074 | */ |
| 108075 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108076 | zEndAff = sqlite3DbStrDup(pParse->db, zStartAff); |
| 108077 | addrNxt = pLevel->addrNxt; |
| 108078 | |
| 108079 | /* If we are doing a reverse order scan on an ascending index, or |
| 108080 | ** a forward order scan on a descending index, interchange the |
| 108081 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | |
| 108156 | } |
| 108157 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108158 | nConstraint++; |
| 108159 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108160 | } |
| 108161 | sqlite3DbFree(pParse->db, zStartAff); |
| 108162 | sqlite3DbFree(pParse->db, zEndAff); |
| 108163 | |
| 108164 | /* Top of the loop body */ |
| 108165 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108166 | |
| 108167 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | |
| 108284 | */ |
| 108285 | if( pWInfo->nLevel>1 ){ |
| 108286 | int nNotReady; /* The number of notReady tables */ |
| 108287 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108288 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108289 | pOrTab = sqlite3StackAllocRaw(pParse->db, |
| 108290 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108291 | if( pOrTab==0 ) return notReady; |
| 108292 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108293 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108294 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | |
| 108338 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108339 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108340 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108341 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108342 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108343 | pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| 108344 | pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); |
| 108345 | } |
| 108346 | if( pAndExpr ){ |
| 108347 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108348 | } |
| 108349 | } |
| @@ -108359,11 +108381,11 @@ | |
| 108359 | } |
| 108360 | /* Loop through table entries that match term pOrTerm. */ |
| 108361 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108362 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108363 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108364 | assert( pSubWInfo || pParse->nErr || pParse->db->mallocFailed ); |
| 108365 | if( pSubWInfo ){ |
| 108366 | WhereLoop *pSubLoop; |
| 108367 | explainOneScan( |
| 108368 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108369 | ); |
| @@ -108414,17 +108436,17 @@ | |
| 108414 | } |
| 108415 | pLevel->u.pCovidx = pCov; |
| 108416 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108417 | if( pAndExpr ){ |
| 108418 | pAndExpr->pLeft = 0; |
| 108419 | sqlite3ExprDelete(pParse->db, pAndExpr); |
| 108420 | } |
| 108421 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108422 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108423 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108424 | |
| 108425 | if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab); |
| 108426 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108427 | }else |
| 108428 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108429 | |
| 108430 | { |
| @@ -108475,13 +108497,12 @@ | |
| 108475 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108476 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108477 | ** the implied "t1.a=123" constraint. |
| 108478 | */ |
| 108479 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108480 | Expr *pE; |
| 108481 | WhereTerm *pAlt; |
| 108482 | Expr sEq; |
| 108483 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108484 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108485 | if( pTerm->leftCursor!=iCur ) continue; |
| 108486 | if( pLevel->iLeftJoin ) continue; |
| 108487 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | |
| 108491 | if( pAlt==0 ) continue; |
| 108492 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108493 | testcase( pAlt->eOperator & WO_EQ ); |
| 108494 | testcase( pAlt->eOperator & WO_IN ); |
| 108495 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108496 | sEq = *pAlt->pExpr; |
| 108497 | sEq.pLeft = pE->pLeft; |
| 108498 | sqlite3ExprIfFalse(pParse, &sEq, addrCont, SQLITE_JUMPIFNULL); |
| 108499 | } |
| 108500 | |
| 108501 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108502 | ** at least one row of the right table has matched the left table. |
| 108503 | */ |
| @@ -116436,10 +116461,11 @@ | |
| 116436 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116437 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116438 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116439 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116440 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116441 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116442 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116443 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116444 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116445 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | |
| 128264 | } |
| 128265 | |
| 128266 | |
| 128267 | #ifdef SQLITE_TEST |
| 128268 | |
| 128269 | /* #include <tcl.h> */ |
| 128270 | /* #include <string.h> */ |
| 128271 | |
| 128272 | /* |
| 128273 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128274 | ** designed to be used in concert with the Tcl testing framework. This |
| 128275 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -399,13 +399,10 @@ | |
| 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | ** assertion will be triggered. |
| 403 | ** |
| 404 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 405 | ** the default. |
| 406 | */ |
| 407 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| 408 | + defined(SQLITE_WIN32_MALLOC) \ |
| @@ -439,24 +436,17 @@ | |
| 436 | */ |
| 437 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 438 | # define _XOPEN_SOURCE 600 |
| 439 | #endif |
| 440 | |
| 441 | /* |
| 442 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 443 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 444 | ** make it true by defining or undefining NDEBUG. |
| 445 | ** |
| 446 | ** Setting NDEBUG makes the code smaller and faster by disabling the |
| 447 | ** assert() statements in the code. So we want the default action |
| 448 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 449 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 450 | ** feature. |
| 451 | */ |
| 452 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| @@ -522,11 +512,11 @@ | |
| 512 | ** hint of unplanned behavior. |
| 513 | ** |
| 514 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 515 | ** |
| 516 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 517 | ** be true and false so that the unreachable code they specify will |
| 518 | ** not be counted as untested code. |
| 519 | */ |
| 520 | #if defined(SQLITE_COVERAGE_TEST) |
| 521 | # define ALWAYS(X) (1) |
| 522 | # define NEVER(X) (0) |
| @@ -546,20 +536,16 @@ | |
| 536 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 537 | |
| 538 | /* |
| 539 | ** The macro unlikely() is a hint that surrounds a boolean |
| 540 | ** expression that is usually false. Macro likely() surrounds |
| 541 | ** a boolean expression that is usually true. These hints could, |
| 542 | ** in theory, be used by the compiler to generate better code, but |
| 543 | ** currently they are just comments for human readers. |
| 544 | */ |
| 545 | #define likely(X) (X) |
| 546 | #define unlikely(X) (X) |
| 547 | |
| 548 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 549 | /************** Begin file sqlite3.h *****************************************/ |
| 550 | /* |
| 551 | ** 2001 September 15 |
| @@ -670,11 +656,11 @@ | |
| 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | */ |
| 659 | #define SQLITE_VERSION "3.8.0" |
| 660 | #define SQLITE_VERSION_NUMBER 3008000 |
| 661 | #define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" |
| 662 | |
| 663 | /* |
| 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | ** |
| @@ -1039,10 +1025,11 @@ | |
| 1025 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1026 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1027 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1028 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1029 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1030 | #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
| 1031 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1032 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1033 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1034 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1035 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| @@ -28374,30 +28361,27 @@ | |
| 28361 | */ |
| 28362 | static const char *unixTempFileDir(void){ |
| 28363 | static const char *azDirs[] = { |
| 28364 | 0, |
| 28365 | 0, |
| 28366 | 0, |
| 28367 | 0, |
| 28368 | "/var/tmp", |
| 28369 | "/usr/tmp", |
| 28370 | "/tmp", |
| 28371 | "." |
| 28372 | }; |
| 28373 | unsigned int i; |
| 28374 | struct stat buf; |
| 28375 | const char *zDir; |
| 28376 | |
| 28377 | azDirs[0] = sqlite3_temp_directory; |
| 28378 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28379 | if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28380 | if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28381 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ |
| 28382 | zDir = azDirs[i]; |
| 28383 | if( zDir==0 ) continue; |
| 28384 | if( osStat(zDir, &buf) ) continue; |
| 28385 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28386 | if( osAccess(zDir, 07) ) continue; |
| 28387 | break; |
| @@ -28423,11 +28407,10 @@ | |
| 28407 | ** function failing. |
| 28408 | */ |
| 28409 | SimulateIOError( return SQLITE_IOERR ); |
| 28410 | |
| 28411 | zDir = unixTempFileDir(); |
| 28412 | |
| 28413 | /* Check that the output buffer is large enough for the temporary file |
| 28414 | ** name. If it is not, return SQLITE_ERROR. |
| 28415 | */ |
| 28416 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| @@ -30505,10 +30488,11 @@ | |
| 30488 | */ |
| 30489 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30490 | |
| 30491 | #ifdef __CYGWIN__ |
| 30492 | # include <sys/cygwin.h> |
| 30493 | /* # include <errno.h> */ |
| 30494 | #endif |
| 30495 | |
| 30496 | /* |
| 30497 | ** Include code that is common to all os_*.c files |
| 30498 | */ |
| @@ -30925,10 +30909,11 @@ | |
| 30909 | * zero for the default behavior. |
| 30910 | */ |
| 30911 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30912 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30913 | #endif |
| 30914 | |
| 30915 | |
| 30916 | /* |
| 30917 | ** The winMemData structure stores information required by the Win32-specific |
| 30918 | ** sqlite3_mem_methods implementation. |
| 30919 | */ |
| @@ -34390,14 +34375,14 @@ | |
| 34375 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34376 | osGetCurrentProcessId(), pFd)); |
| 34377 | return SQLITE_OK; |
| 34378 | } |
| 34379 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34380 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34381 | #if SQLITE_OS_WINRT |
| 34382 | pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); |
| 34383 | #else |
| 34384 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34385 | #endif |
| 34386 | if( pNew==NULL ){ |
| 34387 | osCloseHandle(pFd->hMap); |
| 34388 | pFd->hMap = NULL; |
| @@ -34564,10 +34549,19 @@ | |
| 34549 | return zConverted; |
| 34550 | } |
| 34551 | |
| 34552 | static int winIsDir(const void *zConverted); |
| 34553 | |
| 34554 | /* |
| 34555 | ** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is |
| 34556 | ** in characters, so we allocate 3 bytes per character assuming worst-case |
| 34557 | ** 3-bytes-per-character UTF8. |
| 34558 | */ |
| 34559 | #ifndef SQLITE_WIN32_MAX_PATH |
| 34560 | # define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) |
| 34561 | #endif |
| 34562 | |
| 34563 | /* |
| 34564 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34565 | ** hold at pVfs->mxPathname characters. |
| 34566 | */ |
| 34567 | static int getTempname(int nBuf, char *zBuf){ |
| @@ -34575,95 +34569,115 @@ | |
| 34569 | "abcdefghijklmnopqrstuvwxyz" |
| 34570 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34571 | "0123456789"; |
| 34572 | size_t i, j; |
| 34573 | int nTempPath; |
| 34574 | char zTempPath[SQLITE_WIN32_MAX_PATH+2]; |
| 34575 | |
| 34576 | /* It's odd to simulate an io-error here, but really this is just |
| 34577 | ** using the io-error infrastructure to test that SQLite handles this |
| 34578 | ** function failing. |
| 34579 | */ |
| 34580 | SimulateIOError( return SQLITE_IOERR ); |
| 34581 | |
| 34582 | if( sqlite3_temp_directory ){ |
| 34583 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", |
| 34584 | sqlite3_temp_directory); |
| 34585 | } |
| 34586 | #if defined(__CYGWIN__) |
| 34587 | else{ |
| 34588 | static const char *azDirs[] = { |
| 34589 | 0, |
| 34590 | 0, |
| 34591 | 0, |
| 34592 | 0, |
| 34593 | "/var/tmp", |
| 34594 | "/usr/tmp", |
| 34595 | "/tmp", |
| 34596 | "." |
| 34597 | }; |
| 34598 | const char *zDir; |
| 34599 | WCHAR zWidePath[MAX_PATH]; |
| 34600 | |
| 34601 | if( !azDirs[0] ) azDirs[0] = getenv("TMPDIR"); |
| 34602 | if( !azDirs[1] ) azDirs[1] = getenv("TMP"); |
| 34603 | if( !azDirs[2] ) azDirs[2] = getenv("TEMP"); |
| 34604 | if( !azDirs[3] ) azDirs[3] = getenv("USERPROFILE"); |
| 34605 | for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ |
| 34606 | zDir = azDirs[i]; |
| 34607 | if( zDir==0 || zDir[0]==0 ) continue; |
| 34608 | if( zDir[1]!=':' ){ |
| 34609 | cygwin_conv_path(CCP_POSIX_TO_WIN_W, zDir, zWidePath, MAX_PATH); |
| 34610 | zDir = azDirs[i] = unicodeToUtf8(zWidePath); |
| 34611 | if( zDir==0 ){ |
| 34612 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34613 | return SQLITE_IOERR_NOMEM; |
| 34614 | } |
| 34615 | }else{ |
| 34616 | /* Convert the filename to the system encoding. */ |
| 34617 | osMultiByteToWideChar(CP_UTF8, 0, zDir, -1, zWidePath, |
| 34618 | MAX_PATH); |
| 34619 | } |
| 34620 | if( winIsDir(zWidePath) ){ |
| 34621 | break; |
| 34622 | } |
| 34623 | azDirs[i] = ""; /* Don't retry in future call */ |
| 34624 | } |
| 34625 | sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zDir); |
| 34626 | } |
| 34627 | #elif !SQLITE_OS_WINRT |
| 34628 | else if( isNT() ){ |
| 34629 | char *zMulti; |
| 34630 | WCHAR zWidePath[MAX_PATH]; |
| 34631 | if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ |
| 34632 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34633 | return SQLITE_IOERR_GETTEMPPATH; |
| 34634 | } |
| 34635 | zMulti = unicodeToUtf8(zWidePath); |
| 34636 | if( zMulti ){ |
| 34637 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34638 | sqlite3_free(zMulti); |
| 34639 | }else{ |
| 34640 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34641 | return SQLITE_IOERR_NOMEM; |
| 34642 | } |
| 34643 | } |
| 34644 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34645 | else{ |
| 34646 | char *zUtf8; |
| 34647 | char zMbcsPath[SQLITE_WIN32_MAX_PATH]; |
| 34648 | if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){ |
| 34649 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34650 | return SQLITE_IOERR_GETTEMPPATH; |
| 34651 | } |
| 34652 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34653 | if( zUtf8 ){ |
| 34654 | sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34655 | sqlite3_free(zUtf8); |
| 34656 | }else{ |
| 34657 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34658 | return SQLITE_IOERR_NOMEM; |
| 34659 | } |
| 34660 | } |
| 34661 | #else |
| 34662 | else{ |
| 34663 | /* |
| 34664 | ** Compiled without ANSI support and the current operating system |
| 34665 | ** is not Windows NT; therefore, just zero the temporary buffer. |
| 34666 | */ |
| 34667 | memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34668 | } |
| 34669 | #endif /* SQLITE_WIN32_HAS_ANSI */ |
| 34670 | #else |
| 34671 | else{ |
| 34672 | /* |
| 34673 | ** Compiled for WinRT and the sqlite3_temp_directory is not set; |
| 34674 | ** therefore, just zero the temporary buffer. |
| 34675 | */ |
| 34676 | memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34677 | } |
| 34678 | #endif /* !SQLITE_OS_WINRT */ |
| 34679 | |
| 34680 | /* Check that the output buffer is large enough for the temporary file |
| 34681 | ** name. If it is not, return SQLITE_ERROR. |
| 34682 | */ |
| 34683 | nTempPath = sqlite3Strlen30(zTempPath); |
| @@ -34745,11 +34759,11 @@ | |
| 34759 | int cnt = 0; |
| 34760 | |
| 34761 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34762 | ** a temporary file. Use this buffer to store the file name in. |
| 34763 | */ |
| 34764 | char zTmpname[SQLITE_WIN32_MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34765 | |
| 34766 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34767 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34768 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34769 | #endif |
| @@ -34811,12 +34825,11 @@ | |
| 34825 | /* If the second argument to this function is NULL, generate a |
| 34826 | ** temporary file name to use |
| 34827 | */ |
| 34828 | if( !zUtf8Name ){ |
| 34829 | assert(isDelete && !isOpenJournal); |
| 34830 | rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname); |
| 34831 | if( rc!=SQLITE_OK ){ |
| 34832 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34833 | return rc; |
| 34834 | } |
| 34835 | zUtf8Name = zTmpname; |
| @@ -35243,27 +35256,34 @@ | |
| 35256 | ){ |
| 35257 | |
| 35258 | #if defined(__CYGWIN__) |
| 35259 | SimulateIOError( return SQLITE_ERROR ); |
| 35260 | UNUSED_PARAMETER(nFull); |
| 35261 | assert( pVfs->mxPathname>=SQLITE_WIN32_MAX_PATH ); |
| 35262 | assert( nFull>=pVfs->mxPathname ); |
| 35263 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35264 | /* |
| 35265 | ** NOTE: We are dealing with a relative path name and the data |
| 35266 | ** directory has been set. Therefore, use it as the basis |
| 35267 | ** for converting the relative path name to an absolute |
| 35268 | ** one by prepending the data directory and a slash. |
| 35269 | */ |
| 35270 | char zOut[SQLITE_WIN32_MAX_PATH+1]; |
| 35271 | if( cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35272 | SQLITE_WIN32_MAX_PATH+1)<0 ){ |
| 35273 | winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35274 | zRelative); |
| 35275 | return SQLITE_CANTOPEN_FULLPATH; |
| 35276 | } |
| 35277 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35278 | sqlite3_data_directory, zOut); |
| 35279 | }else{ |
| 35280 | if( cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull)<0 ){ |
| 35281 | winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35282 | zRelative); |
| 35283 | return SQLITE_CANTOPEN_FULLPATH; |
| 35284 | } |
| 35285 | } |
| 35286 | return SQLITE_OK; |
| 35287 | #endif |
| 35288 | |
| 35289 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| @@ -35601,11 +35621,11 @@ | |
| 35621 | */ |
| 35622 | SQLITE_API int sqlite3_os_init(void){ |
| 35623 | static sqlite3_vfs winVfs = { |
| 35624 | 3, /* iVersion */ |
| 35625 | sizeof(winFile), /* szOsFile */ |
| 35626 | SQLITE_WIN32_MAX_PATH, /* mxPathname */ |
| 35627 | 0, /* pNext */ |
| 35628 | "win32", /* zName */ |
| 35629 | 0, /* pAppData */ |
| 35630 | winOpen, /* xOpen */ |
| 35631 | winDelete, /* xDelete */ |
| @@ -107770,10 +107790,11 @@ | |
| 107790 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107791 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107792 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107793 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107794 | Parse *pParse; /* Parsing context */ |
| 107795 | sqlite3 *db; /* Database connection */ |
| 107796 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107797 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107798 | int addrBrk; /* Jump here to break out of the loop */ |
| 107799 | int addrCont; /* Jump here to continue with next cycle */ |
| 107800 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| @@ -107781,10 +107802,11 @@ | |
| 107802 | Bitmask newNotReady; /* Return value */ |
| 107803 | |
| 107804 | pParse = pWInfo->pParse; |
| 107805 | v = pParse->pVdbe; |
| 107806 | pWC = &pWInfo->sWC; |
| 107807 | db = pParse->db; |
| 107808 | pLevel = &pWInfo->a[iLevel]; |
| 107809 | pLoop = pLevel->pWLoop; |
| 107810 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107811 | iCur = pTabItem->iCursor; |
| 107812 | bRev = (pWInfo->revMask>>iLevel)&1; |
| @@ -108071,11 +108093,11 @@ | |
| 108093 | /* Generate code to evaluate all constraint terms using == or IN |
| 108094 | ** and store the values of those terms in an array of registers |
| 108095 | ** starting at regBase. |
| 108096 | */ |
| 108097 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108098 | zEndAff = sqlite3DbStrDup(db, zStartAff); |
| 108099 | addrNxt = pLevel->addrNxt; |
| 108100 | |
| 108101 | /* If we are doing a reverse order scan on an ascending index, or |
| 108102 | ** a forward order scan on a descending index, interchange the |
| 108103 | ** start and end terms (pRangeStart and pRangeEnd). |
| @@ -108156,12 +108178,12 @@ | |
| 108178 | } |
| 108179 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108180 | nConstraint++; |
| 108181 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108182 | } |
| 108183 | sqlite3DbFree(db, zStartAff); |
| 108184 | sqlite3DbFree(db, zEndAff); |
| 108185 | |
| 108186 | /* Top of the loop body */ |
| 108187 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108188 | |
| 108189 | /* Check if the index cursor is past the end of the range. */ |
| @@ -108284,11 +108306,11 @@ | |
| 108306 | */ |
| 108307 | if( pWInfo->nLevel>1 ){ |
| 108308 | int nNotReady; /* The number of notReady tables */ |
| 108309 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108310 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108311 | pOrTab = sqlite3StackAllocRaw(db, |
| 108312 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108313 | if( pOrTab==0 ) return notReady; |
| 108314 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108315 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108316 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| @@ -108338,12 +108360,12 @@ | |
| 108360 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108361 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108362 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108363 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108364 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108365 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 108366 | pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); |
| 108367 | } |
| 108368 | if( pAndExpr ){ |
| 108369 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108370 | } |
| 108371 | } |
| @@ -108359,11 +108381,11 @@ | |
| 108381 | } |
| 108382 | /* Loop through table entries that match term pOrTerm. */ |
| 108383 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108384 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108385 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108386 | assert( pSubWInfo || pParse->nErr || db->mallocFailed ); |
| 108387 | if( pSubWInfo ){ |
| 108388 | WhereLoop *pSubLoop; |
| 108389 | explainOneScan( |
| 108390 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108391 | ); |
| @@ -108414,17 +108436,17 @@ | |
| 108436 | } |
| 108437 | pLevel->u.pCovidx = pCov; |
| 108438 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108439 | if( pAndExpr ){ |
| 108440 | pAndExpr->pLeft = 0; |
| 108441 | sqlite3ExprDelete(db, pAndExpr); |
| 108442 | } |
| 108443 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108444 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108445 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108446 | |
| 108447 | if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); |
| 108448 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108449 | }else |
| 108450 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108451 | |
| 108452 | { |
| @@ -108475,13 +108497,12 @@ | |
| 108497 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108498 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108499 | ** the implied "t1.a=123" constraint. |
| 108500 | */ |
| 108501 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108502 | Expr *pE, *pEAlt; |
| 108503 | WhereTerm *pAlt; |
| 108504 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108505 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108506 | if( pTerm->leftCursor!=iCur ) continue; |
| 108507 | if( pLevel->iLeftJoin ) continue; |
| 108508 | pE = pTerm->pExpr; |
| @@ -108491,13 +108512,17 @@ | |
| 108512 | if( pAlt==0 ) continue; |
| 108513 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108514 | testcase( pAlt->eOperator & WO_EQ ); |
| 108515 | testcase( pAlt->eOperator & WO_IN ); |
| 108516 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108517 | pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); |
| 108518 | if( pEAlt ){ |
| 108519 | *pEAlt = *pAlt->pExpr; |
| 108520 | pEAlt->pLeft = pE->pLeft; |
| 108521 | sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); |
| 108522 | sqlite3StackFree(db, pEAlt); |
| 108523 | } |
| 108524 | } |
| 108525 | |
| 108526 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108527 | ** at least one row of the right table has matched the left table. |
| 108528 | */ |
| @@ -116436,10 +116461,11 @@ | |
| 116461 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116462 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116463 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116464 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116465 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116466 | case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; |
| 116467 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116468 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116469 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116470 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116471 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| @@ -128264,11 +128290,11 @@ | |
| 128290 | } |
| 128291 | |
| 128292 | |
| 128293 | #ifdef SQLITE_TEST |
| 128294 | |
| 128295 | #include <tcl.h> |
| 128296 | /* #include <string.h> */ |
| 128297 | |
| 128298 | /* |
| 128299 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128300 | ** designed to be used in concert with the Tcl testing framework. This |
| 128301 |
+2
-1
| --- 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.0" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | -#define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" | |
| 112 | +#define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -476,10 +476,11 @@ | ||
| 476 | 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | +#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) | |
| 481 | 482 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 482 | 483 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 483 | 484 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 484 | 485 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 485 | 486 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 486 | 487 |
| --- 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.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | #define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 482 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 483 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 484 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 485 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 486 |
| --- 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.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | #define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
| 482 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 483 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 484 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 485 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 486 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 487 |
+2
-1
| --- 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.0" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | -#define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" | |
| 112 | +#define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -476,10 +476,11 @@ | ||
| 476 | 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | +#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) | |
| 481 | 482 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 482 | 483 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 483 | 484 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 484 | 485 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 485 | 486 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 486 | 487 |
| --- 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.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | #define SQLITE_SOURCE_ID "2013-07-25 17:07:03 8bcbb33fd0a970e16a920e1d35571836dbb9ba50" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 482 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 483 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 484 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 485 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 486 |
| --- 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.0" |
| 111 | #define SQLITE_VERSION_NUMBER 3008000 |
| 112 | #define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 477 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 478 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 479 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 480 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 481 | #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
| 482 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 483 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 484 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 485 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 486 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 487 |
+1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2202,10 +2202,11 @@ | ||
| 2202 | 2202 | } |
| 2203 | 2203 | } |
| 2204 | 2204 | |
| 2205 | 2205 | /* |
| 2206 | 2206 | ** WEBPAGE: stats_report |
| 2207 | +** WEBPAGE: reports | |
| 2207 | 2208 | ** |
| 2208 | 2209 | ** Shows activity reports for the repository. |
| 2209 | 2210 | ** |
| 2210 | 2211 | ** Query Parameters: |
| 2211 | 2212 | ** |
| 2212 | 2213 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2202,10 +2202,11 @@ | |
| 2202 | } |
| 2203 | } |
| 2204 | |
| 2205 | /* |
| 2206 | ** WEBPAGE: stats_report |
| 2207 | ** |
| 2208 | ** Shows activity reports for the repository. |
| 2209 | ** |
| 2210 | ** Query Parameters: |
| 2211 | ** |
| 2212 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2202,10 +2202,11 @@ | |
| 2202 | } |
| 2203 | } |
| 2204 | |
| 2205 | /* |
| 2206 | ** WEBPAGE: stats_report |
| 2207 | ** WEBPAGE: reports |
| 2208 | ** |
| 2209 | ** Shows activity reports for the repository. |
| 2210 | ** |
| 2211 | ** Query Parameters: |
| 2212 | ** |
| 2213 |
+2
-2
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -213,11 +213,11 @@ | ||
| 213 | 213 | blob_zero(&fileCksum); |
| 214 | 214 | } |
| 215 | 215 | if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0; |
| 216 | 216 | blob_reset(&origCksum); |
| 217 | 217 | blob_reset(&fileCksum); |
| 218 | - }else if( (chnged==0 || chnged==2) | |
| 218 | + }else if( (chnged==0 || chnged==2 || chnged==4) | |
| 219 | 219 | && (useMtime==0 || currentMtime!=oldMtime) ){ |
| 220 | 220 | /* For files that were formerly believed to be unchanged or that were |
| 221 | 221 | ** changed by merging, if their mtime changes, or unconditionally |
| 222 | 222 | ** if --sha1sum is used, check to see if they have been edited by |
| 223 | 223 | ** looking at their SHA1 sum */ |
| @@ -230,11 +230,11 @@ | ||
| 230 | 230 | chnged = 1; |
| 231 | 231 | } |
| 232 | 232 | blob_reset(&origCksum); |
| 233 | 233 | blob_reset(&fileCksum); |
| 234 | 234 | } |
| 235 | - if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2) ){ | |
| 235 | + if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2 || chnged==4) ){ | |
| 236 | 236 | i64 desiredMtime; |
| 237 | 237 | if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ |
| 238 | 238 | if( currentMtime!=desiredMtime ){ |
| 239 | 239 | file_set_mtime(zName, desiredMtime); |
| 240 | 240 | currentMtime = file_wd_mtime(zName); |
| 241 | 241 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -213,11 +213,11 @@ | |
| 213 | blob_zero(&fileCksum); |
| 214 | } |
| 215 | if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0; |
| 216 | blob_reset(&origCksum); |
| 217 | blob_reset(&fileCksum); |
| 218 | }else if( (chnged==0 || chnged==2) |
| 219 | && (useMtime==0 || currentMtime!=oldMtime) ){ |
| 220 | /* For files that were formerly believed to be unchanged or that were |
| 221 | ** changed by merging, if their mtime changes, or unconditionally |
| 222 | ** if --sha1sum is used, check to see if they have been edited by |
| 223 | ** looking at their SHA1 sum */ |
| @@ -230,11 +230,11 @@ | |
| 230 | chnged = 1; |
| 231 | } |
| 232 | blob_reset(&origCksum); |
| 233 | blob_reset(&fileCksum); |
| 234 | } |
| 235 | if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2) ){ |
| 236 | i64 desiredMtime; |
| 237 | if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ |
| 238 | if( currentMtime!=desiredMtime ){ |
| 239 | file_set_mtime(zName, desiredMtime); |
| 240 | currentMtime = file_wd_mtime(zName); |
| 241 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -213,11 +213,11 @@ | |
| 213 | blob_zero(&fileCksum); |
| 214 | } |
| 215 | if( blob_compare(&fileCksum, &origCksum)==0 ) chnged = 0; |
| 216 | blob_reset(&origCksum); |
| 217 | blob_reset(&fileCksum); |
| 218 | }else if( (chnged==0 || chnged==2 || chnged==4) |
| 219 | && (useMtime==0 || currentMtime!=oldMtime) ){ |
| 220 | /* For files that were formerly believed to be unchanged or that were |
| 221 | ** changed by merging, if their mtime changes, or unconditionally |
| 222 | ** if --sha1sum is used, check to see if they have been edited by |
| 223 | ** looking at their SHA1 sum */ |
| @@ -230,11 +230,11 @@ | |
| 230 | chnged = 1; |
| 231 | } |
| 232 | blob_reset(&origCksum); |
| 233 | blob_reset(&fileCksum); |
| 234 | } |
| 235 | if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2 || chnged==4) ){ |
| 236 | i64 desiredMtime; |
| 237 | if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ |
| 238 | if( currentMtime!=desiredMtime ){ |
| 239 | file_set_mtime(zName, desiredMtime); |
| 240 | currentMtime = file_wd_mtime(zName); |
| 241 |
+1
-1
| --- www/adding_code.wiki | ||
| +++ www/adding_code.wiki | ||
| @@ -153,11 +153,11 @@ | ||
| 153 | 153 | the output text, if desired. But "fossil_print()" is recommended as |
| 154 | 154 | it has extra logic to insert \r characters at the right times on |
| 155 | 155 | windows systems. |
| 156 | 156 | |
| 157 | 157 | Once you have the command running, you can then start adding code to |
| 158 | -make it do useful things. There are logs of utility functions in | |
| 158 | +make it do useful things. There are lots of utility functions in | |
| 159 | 159 | Fossil for parsing command-line options and for |
| 160 | 160 | opening and accessing and manipulating the repository and |
| 161 | 161 | the working check-out. Study at the implementations of existing commands |
| 162 | 162 | to get an idea of how things are done. You can easily find the implementations |
| 163 | 163 | of existing commands by searching for "COMMAND: <i>name</i>" in the |
| 164 | 164 |
| --- www/adding_code.wiki | |
| +++ www/adding_code.wiki | |
| @@ -153,11 +153,11 @@ | |
| 153 | the output text, if desired. But "fossil_print()" is recommended as |
| 154 | it has extra logic to insert \r characters at the right times on |
| 155 | windows systems. |
| 156 | |
| 157 | Once you have the command running, you can then start adding code to |
| 158 | make it do useful things. There are logs of utility functions in |
| 159 | Fossil for parsing command-line options and for |
| 160 | opening and accessing and manipulating the repository and |
| 161 | the working check-out. Study at the implementations of existing commands |
| 162 | to get an idea of how things are done. You can easily find the implementations |
| 163 | of existing commands by searching for "COMMAND: <i>name</i>" in the |
| 164 |
| --- www/adding_code.wiki | |
| +++ www/adding_code.wiki | |
| @@ -153,11 +153,11 @@ | |
| 153 | the output text, if desired. But "fossil_print()" is recommended as |
| 154 | it has extra logic to insert \r characters at the right times on |
| 155 | windows systems. |
| 156 | |
| 157 | Once you have the command running, you can then start adding code to |
| 158 | make it do useful things. There are lots of utility functions in |
| 159 | Fossil for parsing command-line options and for |
| 160 | opening and accessing and manipulating the repository and |
| 161 | the working check-out. Study at the implementations of existing commands |
| 162 | to get an idea of how things are done. You can easily find the implementations |
| 163 | of existing commands by searching for "COMMAND: <i>name</i>" in the |
| 164 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -3,10 +3,15 @@ | ||
| 3 | 3 | <h2>Changes For Version 1.27 (as yet unreleased)</h2> |
| 4 | 4 | * Enhance the [/help?cmd=changes | fossil changes], |
| 5 | 5 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 6 | 6 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 7 | 7 | to restrict operation to files and directories named on the command-line. |
| 8 | + * New --integrate option to [/help?cmd=merge | fossil merge], which | |
| 9 | + automatically closes the merged branch when committing. | |
| 10 | + * Renamed <tt>/stats_report</tt> page to [/reports]. | |
| 11 | + * Added <tt>yw=YYYY-WW</tt> (year-week) filter to timeline to limit the results | |
| 12 | + to a specific year and calendar week number, e.g. [/timeline?yw=2013-01]. | |
| 8 | 13 | |
| 9 | 14 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 10 | 15 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 11 | 16 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 12 | 17 | to the port number, causing Fossil to bind to just that one IP address. |
| 13 | 18 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -3,10 +3,15 @@ | |
| 3 | <h2>Changes For Version 1.27 (as yet unreleased)</h2> |
| 4 | * Enhance the [/help?cmd=changes | fossil changes], |
| 5 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 6 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 7 | to restrict operation to files and directories named on the command-line. |
| 8 | |
| 9 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 10 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 11 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 12 | to the port number, causing Fossil to bind to just that one IP address. |
| 13 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -3,10 +3,15 @@ | |
| 3 | <h2>Changes For Version 1.27 (as yet unreleased)</h2> |
| 4 | * Enhance the [/help?cmd=changes | fossil changes], |
| 5 | [/help?cmd=clean | fossil clean], [/help?cmd=extras | fossil extras], |
| 6 | [/help?cmd=ls | fossil ls] and [/help?cmd=status | fossil status] commands |
| 7 | to restrict operation to files and directories named on the command-line. |
| 8 | * New --integrate option to [/help?cmd=merge | fossil merge], which |
| 9 | automatically closes the merged branch when committing. |
| 10 | * Renamed <tt>/stats_report</tt> page to [/reports]. |
| 11 | * Added <tt>yw=YYYY-WW</tt> (year-week) filter to timeline to limit the results |
| 12 | to a specific year and calendar week number, e.g. [/timeline?yw=2013-01]. |
| 13 | |
| 14 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 15 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 16 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 17 | to the port number, causing Fossil to bind to just that one IP address. |
| 18 |