Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge latest trunk changes into this branch. |
---|---|
Timelines: | family | ancestors | descendants | both | begin-concurrent |
Files: | files | file ages | folders |
SHA3-256: |
28a615a2e0f48b0fee3eaf7841ff902e |
User & Date: | dan 2018-11-26 07:21:06.879 |
Context
2018-12-03
| ||
18:15 | Bring up to date with version 3.26.0. (check-in: f0ddb358cc user: drh tags: begin-concurrent) | |
2018-11-26
| ||
07:34 | Merge latest begin-concurrent changes into this branch. (check-in: 76608f750a user: dan tags: begin-concurrent-pnu) | |
07:21 | Merge latest trunk changes into this branch. (check-in: 28a615a2e0 user: dan tags: begin-concurrent) | |
2018-11-24
| ||
20:44 | Fix a bug in the geopoly_ccw() function. Test cases in TH3. (check-in: 773c5c1d9c user: drh tags: trunk) | |
2018-09-28
| ||
20:58 | Merge latest trunk into this branch. (check-in: 86750c927c user: dan tags: begin-concurrent) | |
Changes
Changes to Makefile.in.
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + | TOP = @abs_srcdir@ # C Compiler and options for use in building executables that # will run on the platform that is doing the build. # BCC = @BUILD_CC@ @BUILD_CFLAGS@ |
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + - - + + | LIBREADLINE = @TARGET_READLINE_LIBS@ # Should the database engine be compiled threadsafe # TCC += -DSQLITE_THREADSAFE=@SQLITE_THREADSAFE@ # Any target libraries which libsqlite must be linked against |
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - - + + | # The suffix used on shared libraries. Ex: ".dll", ".so", ".dylib" # SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ # If gcov support was enabled by the configure script, add the appropriate # flags here. It's not always as easy as just having the user add the right # CFLAGS / LDFLAGS, because libtool wants to use CFLAGS when linking, which |
︙ | |||
421 422 423 424 425 426 427 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | - + | $(TOP)/src/test_vfs.c \ $(TOP)/src/test_windirent.c \ $(TOP)/src/test_window.c \ $(TOP)/src/test_wsd.c \ $(TOP)/ext/fts3/fts3_term.c \ $(TOP)/ext/fts3/fts3_test.c \ $(TOP)/ext/session/test_session.c \ |
︙ | |||
503 504 505 506 507 508 509 | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | - + | $(TOP)/ext/fts3/fts3_aux.c \ $(TOP)/ext/fts3/fts3_expr.c \ $(TOP)/ext/fts3/fts3_term.c \ $(TOP)/ext/fts3/fts3_tokenizer.c \ $(TOP)/ext/fts3/fts3_write.c \ $(TOP)/ext/async/sqlite3async.c \ $(TOP)/ext/session/sqlite3session.c \ |
︙ | |||
575 576 577 578 579 580 581 | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | - + + + - + | # FUZZDATA = \ $(TOP)/test/fuzzdata1.db \ $(TOP)/test/fuzzdata2.db \ $(TOP)/test/fuzzdata3.db \ $(TOP)/test/fuzzdata4.db \ $(TOP)/test/fuzzdata5.db \ |
︙ | |||
660 661 662 663 664 665 666 667 668 669 670 671 672 673 | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | + + + + + + + + + + + + + + + + | sessionfuzz$(TEXE): $(TOP)/test/sessionfuzz.c sqlite3.c sqlite3.h $(CC) $(CFLAGS) -I. -o $@ $(TOP)/test/sessionfuzz.c $(TLIBS) dbfuzz$(TEXE): $(TOP)/test/dbfuzz.c sqlite3.c sqlite3.h $(LTLINK) -o $@ $(DBFUZZ_OPT) $(TOP)/test/dbfuzz.c sqlite3.c $(TLIBS) DBFUZZ2_OPTS = \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_ENABLE_DESERIALIZE \ -DSQLITE_DEBUG \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_RTREE \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_EANBLE_FTS5 dbfuzz2: $(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h clang-6.0 -I. -g -O0 -fsanitize=fuzzer,undefined,address -o dbfuzz2 \ $(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c mkdir -p dbfuzz2-dir cp $(TOP)/test/dbfuzz2-seed* dbfuzz2-dir mptester$(TEXE): sqlite3.lo $(TOP)/mptest/mptest.c $(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.lo \ $(TLIBS) -rpath "$(libdir)" MPTEST1=./mptester$(TEXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20 MPTEST2=./mptester$(TEXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20 mptest: mptester$(TEXE) |
︙ | |||
1123 1124 1125 1126 1127 1128 1129 | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | - + | fts5parse.c fts5parse.h \ $(TOP)/ext/fts5/fts5_storage.c \ $(TOP)/ext/fts5/fts5_tokenize.c \ $(TOP)/ext/fts5/fts5_unicode2.c \ $(TOP)/ext/fts5/fts5_varint.c \ $(TOP)/ext/fts5/fts5_vocab.c \ |
︙ | |||
1150 1151 1152 1153 1154 1155 1156 | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | - + + + + + | # If using the amalgamation, use sqlite3.c directly to build the test # fixture. Otherwise link against libsqlite3.la. (This distinction is # necessary because the test fixture requires non-API symbols which are # hidden when the library is built via the amalgamation). # TESTFIXTURE_FLAGS = -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS += -DTCLSH_INIT_PROC=sqlite3TestInit |
︙ | |||
1225 1226 1227 1228 1229 1230 1231 | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | - + | sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c sqlite3_analyzer$(TEXE): sqlite3_analyzer.c $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) |
︙ | |||
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | + + + - + | showshm$(TEXE): $(TOP)/tool/showshm.c $(LTLINK) -o $@ $(TOP)/tool/showshm.c changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS) changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS) rollback-test$(TEXE): $(TOP)/tool/rollback-test.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/tool/rollback-test.c sqlite3.lo $(TLIBS) atrc$(TEXX): $(TOP)/test/atrc.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/test/atrc.c sqlite3.lo $(TLIBS) LogEst$(TEXE): $(TOP)/tool/logest.c sqlite3.h $(LTLINK) -I. -o $@ $(TOP)/tool/logest.c wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.lo $(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.lo $(TLIBS) speedtest1$(TEXE): $(TOP)/test/speedtest1.c sqlite3.c $(LTLINK) $(ST_OPT) -o $@ $(TOP)/test/speedtest1.c sqlite3.c $(TLIBS) KV_OPT += -DSQLITE_DIRECT_OVERFLOW_READ kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS) |
︙ | |||
1320 1321 1322 1323 1324 1325 1326 | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | - + - + - + - + | snapshot-tarball: sqlite3.c TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh --snapshot # The next two rules are used to support the "threadtest" target. Building # threadtest runs a few thread-safety tests that are implemented in C. This # target is invoked by the releasetest.tcl script. |
︙ |
Changes to Makefile.msc.
︙ | |||
1619 1620 1621 1622 1623 1624 1625 | 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | - + + + | # FUZZDATA = \ $(TOP)\test\fuzzdata1.db \ $(TOP)\test\fuzzdata2.db \ $(TOP)\test\fuzzdata3.db \ $(TOP)\test\fuzzdata4.db \ $(TOP)\test\fuzzdata5.db \ |
︙ | |||
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 | 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 | + + + + | $(TESTFIXTURE_SRC) \ /link $(LDFLAGS) $(LTLINKOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) $(LIBRESOBJS) $(TCLLIBS) $(LTLIBS) $(TLIBS) extensiontest: testfixture.exe testloadext.dll @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS) coretestprogs: $(TESTPROGS) testprogs: coretestprogs srcck1.exe fuzzcheck.exe sessionfuzz.exe fulltest: $(TESTPROGS) fuzztest @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\all.test $(TESTOPTS) soaktest: $(TESTPROGS) @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\all.test -soak=1 $(TESTOPTS) |
︙ | |||
2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 | + + + + + | $(LTLINK) $(NO_WARN) $(TOP)\tool\showshm.c /link $(LDFLAGS) $(LTLINKOPTS) changeset.exe: $(TOP)\ext\session\changeset.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 \ $(TOP)\ext\session\changeset.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) changesetfuzz.exe: $(TOP)\ext\session\changesetfuzz.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 \ $(TOP)\ext\session\changesetfuzz.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) fts3view.exe: $(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ $(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) rollback-test.exe: $(TOP)\tool\rollback-test.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ $(TOP)\tool\rollback-test.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) |
︙ |
Changes to ext/expert/sqlite3expert.c.
︙ | |||
640 641 642 643 644 645 646 647 648 649 650 651 652 653 | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | + | 0, /* xCommit - commit transaction */ 0, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ 0, /* xRename - rename the table */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); } /* ** End of virtual table implementation. *************************************************************************/ |
︙ |
Changes to ext/fts3/fts3.c.
︙ | |||
1817 1818 1819 1820 1821 1822 1823 | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | - + | sqlite3_int64 *piFirst, /* OUT: Selected child node */ sqlite3_int64 *piLast /* OUT: Selected child node */ ){ int rc = SQLITE_OK; /* Return code */ const char *zCsr = zNode; /* Cursor to iterate through node */ const char *zEnd = &zCsr[nNode];/* End of interior node buffer */ char *zBuffer = 0; /* Buffer to load terms into */ |
︙ | |||
1855 1856 1857 1858 1859 1860 1861 | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 | - + - + - - + + | if( !isFirstTerm ){ zCsr += fts3GetVarint32(zCsr, &nPrefix); } isFirstTerm = 0; zCsr += fts3GetVarint32(zCsr, &nSuffix); assert( nPrefix>=0 && nSuffix>=0 ); |
︙ | |||
3841 3842 3843 3844 3845 3846 3847 3848 3849 | 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 | + + + + + + + + + + + + + + + - + | UNUSED_PARAMETER(iSavepoint); assert( p->inTransaction ); assert( p->mxSavepoint >= iSavepoint ); TESTONLY( p->mxSavepoint = iSavepoint ); sqlite3Fts3PendingTermsClear(p); return SQLITE_OK; } /* ** Return true if zName is the extension on one of the shadow tables used ** by this module. */ static int fts3ShadowName(const char *zName){ static const char *azName[] = { "content", "docsize", "segdir", "segments", "stat", }; unsigned int i; for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ if( sqlite3_stricmp(zName, azName[i])==0 ) return 1; } return 0; } static const sqlite3_module fts3Module = { |
︙ | |||
3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 | 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 | + | /* xCommit */ fts3CommitMethod, /* xRollback */ fts3RollbackMethod, /* xFindFunction */ fts3FindFunctionMethod, /* xRename */ fts3RenameMethod, /* xSavepoint */ fts3SavepointMethod, /* xRelease */ fts3ReleaseMethod, /* xRollbackTo */ fts3RollbackToMethod, /* xShadowName */ fts3ShadowName, }; /* ** This function is registered as the module destructor (called when an ** FTS3 enabled database connection is closed). It frees the memory ** allocated for the tokenizer hash table. */ |
︙ |
Changes to ext/fts3/fts3_aux.c.
︙ | |||
535 536 537 538 539 540 541 | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/fts3/fts3_term.c.
︙ | |||
357 358 359 360 361 362 363 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/fts3/fts3_tokenize_vtab.c.
︙ | |||
439 440 441 442 443 444 445 | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/fts3/fts3_write.c.
︙ | |||
1370 1371 1372 1373 1374 1375 1376 | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | - - + + + + + + - - - + + + | rc = fts3SegReaderRequire(pReader, pNext, FTS3_VARINT_MAX*2); if( rc!=SQLITE_OK ) return rc; /* Because of the FTS3_NODE_PADDING bytes of padding, the following is ** safe (no risk of overread) even if the node data is corrupted. */ pNext += fts3GetVarint32(pNext, &nPrefix); pNext += fts3GetVarint32(pNext, &nSuffix); |
︙ | |||
1400 1401 1402 1403 1404 1405 1406 | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | - + | pReader->aDoclist = pNext; pReader->pOffsetList = 0; /* Check that the doclist does not appear to extend past the end of the ** b-tree node. And that the final byte of the doclist is 0x00. If either ** of these statements is untrue, then the data structure is corrupt. */ |
︙ | |||
3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 | 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 | + + + + + + - | p->aNode = 0; }else{ if( bFirst==0 ){ p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix); } p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix); if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){ return SQLITE_CORRUPT_VTAB; } blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc); if( rc==SQLITE_OK ){ memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix); p->term.n = nPrefix+nSuffix; p->iOff += nSuffix; if( p->iChild==0 ){ p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist); if( (p->nNode-p->iOff)<p->nDoclist ){ return SQLITE_CORRUPT_VTAB; } p->aDoclist = &p->aNode[p->iOff]; p->iOff += p->nDoclist; } } } assert( p->iOff<=p->nNode ); |
︙ |
Changes to ext/fts5/fts5_index.c.
︙ | |||
5398 5399 5400 5401 5402 5403 5404 | 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 | - + | if( p->rc ){ sqlite3Fts5IterClose((Fts5IndexIter*)pRet); pRet = 0; fts5CloseReader(p); } |
︙ |
Changes to ext/fts5/fts5_main.c.
︙ | |||
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 | 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 | + + + + + + + + + + + + + + + - + | int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); sqlite3_result_text(pCtx, "--FTS5-SOURCE-ID--", -1, SQLITE_TRANSIENT); } /* ** Return true if zName is the extension on one of the shadow tables used ** by this module. */ static int fts5ShadowName(const char *zName){ static const char *azName[] = { "config", "content", "data", "docsize", "idx" }; unsigned int i; for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ if( sqlite3_stricmp(zName, azName[i])==0 ) return 1; } return 0; } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { |
︙ | |||
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 | 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 | + | /* xCommit */ fts5CommitMethod, /* xRollback */ fts5RollbackMethod, /* xFindFunction */ fts5FindFunctionMethod, /* xRename */ fts5RenameMethod, /* xSavepoint */ fts5SavepointMethod, /* xRelease */ fts5ReleaseMethod, /* xRollbackTo */ fts5RollbackToMethod, /* xShadowName */ fts5ShadowName }; int rc; Fts5Global *pGlobal = 0; pGlobal = (Fts5Global*)sqlite3_malloc(sizeof(Fts5Global)); if( pGlobal==0 ){ |
︙ |
Changes to ext/fts5/fts5_test_tok.c.
︙ | |||
467 468 469 470 471 472 473 | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/fts5/fts5_vocab.c.
︙ | |||
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | + + - + | static int fts5VocabInstanceNext(Fts5VocabCursor *pCsr){ int eDetail = pCsr->pConfig->eDetail; int rc = SQLITE_OK; Fts5IndexIter *pIter = pCsr->pIter; i64 *pp = &pCsr->iInstPos; int *po = &pCsr->iInstOff; assert( sqlite3Fts5IterEof(pIter)==0 ); assert( pCsr->bEof==0 ); while( eDetail==FTS5_DETAIL_NONE || sqlite3Fts5PoslistNext64(pIter->pData, pIter->nData, po, pp) ){ pCsr->iInstPos = 0; pCsr->iInstOff = 0; rc = sqlite3Fts5IterNextScan(pCsr->pIter); if( rc==SQLITE_OK ){ rc = fts5VocabInstanceNewTerm(pCsr); |
︙ | |||
751 752 753 754 755 756 757 758 759 760 761 762 | 753 754 755 756 757 758 759 760 761 762 763 764 765 | + - - | /* xCommit */ 0, /* xRollback */ 0, /* xFindFunction */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ 0 }; void *p = (void*)pGlobal; return sqlite3_create_module_v2(db, "fts5vocab", &fts5Vocab, p, 0); } |
Changes to ext/fts5/test/fts5aa.test.
︙ | |||
405 406 407 408 409 410 411 412 413 414 415 416 417 418 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | + | } set nRow } {200} do_execsql_test 15.0 { INSERT INTO t1(t1) VALUES('integrity-check'); } sqlite3_db_config db DEFENSIVE 0 do_execsql_test 15.1 { UPDATE t1_content SET c1 = 'xyz xyz xyz xyz xyz abc' WHERE rowid = 1; } do_catchsql_test 15.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } {1 {database disk image is malformed}} |
︙ |
Changes to ext/fts5/test/fts5connect.test.
︙ | |||
240 241 242 243 244 245 246 | 240 241 242 243 244 245 246 | - | do_execsql_test 4.$tn.3 { INSERT INTO ft3(ft3) VALUES('integrity-check'); } } finish_test |
Changes to ext/fts5/test/fts5corrupt.test.
︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | + + | fts5_level_segs t1 } {1} db_save do_execsql_test 1.2 { INSERT INTO t1(t1) VALUES('integrity-check') } set segid [lindex [fts5_level_segids t1] 0] sqlite3_db_config db DEFENSIVE 0 do_test 1.3 { execsql { DELETE FROM t1_data WHERE rowid = fts5_rowid('segment', $segid, 4); } catchsql { INSERT INTO t1(t1) VALUES('integrity-check') } } {1 {database disk image is malformed}} do_test 1.4 { db_restore_and_reopen sqlite3_db_config db DEFENSIVE 0 execsql { UPDATE t1_data set block = X'00000000' || substr(block, 5) WHERE rowid = fts5_rowid('segment', $segid, 4); } catchsql { INSERT INTO t1(t1) VALUES('integrity-check') } } {1 {database disk image is malformed}} |
︙ | |||
85 86 87 88 89 90 91 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + | INSERT INTO t3 VALUES('three o'); INSERT INTO t3 VALUES('four e'); INSERT INTO t3 VALUES('five o'); } do_execsql_test 3.1 { SELECT * FROM t3 WHERE t3 MATCH 'o' } {{one o} {three o} {five o}} |
Changes to ext/fts5/test/fts5corrupt2.test.
︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | + | # Also tested is that "MATCH 'x*'" does not crash and sometimes reports # corruption. It may not report the db as corrupt because truncating the # final leaf to some sizes may create a valid leaf page. # set lrowid [db one {SELECT max(rowid) FROM t1_data WHERE (rowid & $mask)=0}] set nbyte [db one {SELECT length(block) FROM t1_data WHERE rowid=$lrowid}] set all [db eval {SELECT rowid FROM t1}] sqlite3_db_config db DEFENSIVE 0 for {set i [expr $nbyte-2]} {$i>=0} {incr i -1} { do_execsql_test 2.$i.1 { BEGIN; UPDATE t1_data SET block = substr(block, 1, $i) WHERE rowid=$lrowid; } do_catchsql_test 2.$i.2 { |
︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | + | execsql ROLLBACK } } #-------------------------------------------------------------------- reset_db sqlite3_db_config db DEFENSIVE 0 do_execsql_test 6.1 { CREATE VIRTUAL TABLE x5 USING fts5(tt); INSERT INTO x5 VALUES('a'); INSERT INTO x5 VALUES('a a'); INSERT INTO x5 VALUES('a a a'); INSERT INTO x5 VALUES('a a a a'); |
︙ |
Changes to ext/fts5/test/fts5corrupt3.test.
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | + | set rowid [db one { SELECT max(rowid) FROM t1_data WHERE ((rowid>>31) & 0x0F)==1 }] set L [db one {SELECT length(block) FROM t1_data WHERE rowid = $rowid}] set {} {} } {} sqlite3_db_config db DEFENSIVE 0 for {set i 0} {$i < $L} {incr i} { do_test 1.2.$i { catchsql { BEGIN; UPDATE t1_data SET block = substr(block, 1, $i) WHERE id = $rowid; INSERT INTO t1(t1) VALUES('integrity-check'); } |
︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + | #------------------------------------------------------------------------- # Test that missing leaf pages are recognized as corruption. # reset_db do_test 3.0 { create_t1 } {} sqlite3_db_config db DEFENSIVE 0 do_execsql_test 3.1 { SELECT count(*) FROM t1_data; } {105} proc do_3_test {tn} { set i 0 |
︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | + | do_3_test 3.10 #------------------------------------------------------------------------- # Test that segments that end unexpectedly are identified as corruption. # reset_db sqlite3_db_config db DEFENSIVE 0 do_test 4.0 { execsql { CREATE VIRTUAL TABLE t1 USING fts5(x); INSERT INTO t1(t1, rank) VALUES('pgsz', 32); } for {set i 0} {$i < 100} {incr i} { set rnd [expr int(rand() * 100)] |
︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | + | set end [lindex $var end] if {$end<=$i} break lset var end [expr $end - $i] set struct [binary format c* $var] db close sqlite3 db test.db sqlite3_db_config db DEFENSIVE 0 db eval { BEGIN; UPDATE t1_data SET block = $struct WHERE id=10; } do_test 4.1.$i { incr nErr [catch { db eval { SELECT rowid FROM t1 WHERE t1 MATCH 'x*' } }] |
︙ | |||
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | + + + | catch { db eval ROLLBACK } } } #------------------------------------------------------------------------ # reset_db sqlite3_db_config db DEFENSIVE 0 do_execsql_test 6.1.0 { CREATE VIRTUAL TABLE t1 USING fts5(a); INSERT INTO t1 VALUES('bbbbb ccccc'); SELECT quote(block) FROM t1_data WHERE rowid>100; } {X'000000180630626262626201020201056363636363010203040A'} do_execsql_test 6.1.1 { UPDATE t1_data SET block = X'000000180630626262626201020201056161616161010203040A' WHERE rowid>100; } do_catchsql_test 6.1.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } {1 {database disk image is malformed}} #------- reset_db sqlite3_db_config db DEFENSIVE 0 do_execsql_test 6.2.0 { CREATE VIRTUAL TABLE t1 USING fts5(a); INSERT INTO t1(t1, rank) VALUES('pgsz', 32); INSERT INTO t1 VALUES('aa bb cc dd ee'); SELECT pgno, quote(term) FROM t1_idx; } {2 X'' 4 X'3064'} do_execsql_test 6.2.1 { UPDATE t1_idx SET term = X'3065' WHERE pgno=4; } do_catchsql_test 6.2.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } {1 {database disk image is malformed}} #------- reset_db sqlite3_db_config db DEFENSIVE 0 do_execsql_test 6.3.0 { CREATE VIRTUAL TABLE t1 USING fts5(a); INSERT INTO t1 VALUES('abc abcdef abcdefghi'); SELECT quote(block) FROM t1_data WHERE id>100; } {X'0000001C043061626301020204036465660102030703676869010204040808'} do_execsql_test 6.3.1 { BEGIN; |
︙ | |||
358 359 360 361 362 363 364 365 366 367 368 369 370 371 | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | + | INSERT INTO t5 VALUES( rnddoc(10000) ); INSERT INTO t5 VALUES( rnddoc(10000) ); INSERT INTO t5 VALUES( rnddoc(10000) ); INSERT INTO t5(t5) VALUES('optimize'); } } {} sqlite3_db_config db DEFENSIVE 0 do_test 7.1 { foreach i [db eval { SELECT rowid FROM t5_data WHERE rowid>100 }] { db eval BEGIN db eval {DELETE FROM t5_data WHERE rowid = $i} set r [catchsql { INSERT INTO t5(t5) VALUES('integrity-check')} ] if {$r != "1 {database disk image is malformed}"} { error $r } db eval ROLLBACK |
︙ | |||
379 380 381 382 383 384 385 386 387 388 389 390 391 392 | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | + | # reset_db do_execsql_test 8.1 { CREATE VIRTUAL TABLE t1 USING fts5(x, y); INSERT INTO t1 VALUES('one', 'two'); } sqlite3_db_config db DEFENSIVE 0 do_test 9.1.1 { set blob "12345678" ;# cookie append blob "0105" ;# 1 level, total of 5 segments append blob "06" ;# write counter append blob "0002" ;# first level has 0 segments merging, 2 other. append blob "450108" ;# first segment execsql "REPLACE INTO t1_data VALUES(10, X'$blob')" |
︙ |
Changes to ext/fts5/test/fts5first.test.
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 | - | SELECT * FROM x2('a + b'); } {1 {fts5: phrase queries are not supported (detail!=full)}} do_catchsql_test 3.3 { SELECT * FROM x2('^a'); } {1 {fts5: phrase queries are not supported (detail!=full)}} finish_test |
Changes to ext/fts5/test/fts5integrity.test.
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | + | INSERT INTO aa(zz) VALUES('a'); SELECT length(sz) FROM aa_docsize; } {1 1 1 1 1} do_execsql_test 4.1 { INSERT INTO aa(aa) VALUES('integrity-check'); } sqlite3_db_config db DEFENSIVE 0 do_catchsql_test 4.2 { BEGIN; UPDATE aa_docsize SET sz = X'44' WHERE rowid = 3; INSERT INTO aa(aa) VALUES('integrity-check'); } {1 {database disk image is malformed}} do_catchsql_test 4.3 { |
︙ |
Changes to ext/fts5/test/fts5rank.test.
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 | - | } do_execsql_test 5.1 { SELECT rowid FROM ttt('word') WHERE rowid BETWEEN 30 AND 40 ORDER BY rank; } {30 31 32 33 34 35 36 37 38 39 40} finish_test |
Changes to ext/fts5/test/fts5rebuild.test.
︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | + | INSERT INTO f1(f1) VALUES('rebuild'); } {} do_execsql_test 1.4 { INSERT INTO f1(f1) VALUES('integrity-check'); } {} sqlite3_db_config db DEFENSIVE 0 do_execsql_test 1.5 { DELETE FROM f1_data; } {} do_catchsql_test 1.6 { INSERT INTO f1(f1) VALUES('integrity-check'); } {1 {database disk image is malformed}} |
︙ |
Changes to ext/fts5/test/fts5rowid.test.
︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | + | DELETE FROM x1 WHERE (rowid%2); } set res [db one {SELECT count(*) FROM x1_data}] do_execsql_test 2.3 { SELECT count(fts5_decode(rowid, block)) FROM x1_data; } $res sqlite3_db_config db DEFENSIVE 0 do_execsql_test 2.4 { UPDATE x1_data SET block = X''; SELECT count(fts5_decode(rowid, block)) FROM x1_data; } $res do_execsql_test 2.5 { INSERT INTO x1(x1, rank) VALUES('pgsz', 1024); |
︙ |
Changes to ext/fts5/test/fts5version.test.
︙ | |||
32 33 34 35 36 37 38 39 40 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + - + + | SELECT * FROM t1_config WHERE k='version' } {version 4} do_execsql_test 1.3 { SELECT rowid FROM t1 WHERE t1 MATCH 'a'; } {1} sqlite3_db_config db DEFENSIVE 0 do_execsql_test 1.4 { UPDATE t1_config set v=5 WHERE k='version'; |
Changes to ext/fts5/test/fts5vocab.test.
︙ | |||
416 417 418 419 420 421 422 423 424 425 426 427 428 429 | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | + | i a 1 1 i b 1 1 i c 1 1 }] if {[detail_is_none]} { set resc [row_to_col $resr] } do_execsql_test 8.1.1 { SELECT * FROM x1_r; } $resr do_execsql_test 8.1.2 { SELECT * FROM x1_c } $resc sqlite3_db_config db DEFENSIVE 0 do_execsql_test 8.2 { PRAGMA writable_schema = 1; UPDATE sqlite_master SET sql = 'CREATE VIRTUAL TABLE x1 USING fts5(a, detail=%DETAIL%)' WHERE name = 'x1'; } db close |
︙ | |||
477 478 479 480 481 482 483 | 478 479 480 481 482 483 484 | - | set e2 [db eval { EXPLAIN SELECT * FROM rrr ORDER BY term DESC }] expr [lsearch $e2 SorterSort]<0 } 0 finish_test |
Changes to ext/fts5/test/fts5vocab2.test.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | # #*********************************************************************** # # The tests in this file focus on testing the fts5vocab module. # source [file join [file dirname [info script]] fts5_common.tcl] |
︙ | |||
202 203 204 205 206 207 208 | 202 203 204 205 206 207 208 | - | do_execsql_test 3.5 { DELETE FROM t1; SELECT * FROM v1; } { } finish_test |
Changes to ext/misc/amatch.c.
︙ | |||
1469 1470 1471 1472 1473 1474 1475 | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/btreeinfo.c.
︙ | |||
407 408 409 410 411 412 413 414 415 416 417 418 419 420 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | + | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0 /* xShadowName */ }; return sqlite3_create_module(db, "sqlite_btreeinfo", &binfo_module, 0); } #ifdef _WIN32 __declspec(dllexport) #endif |
︙ |
Changes to ext/misc/closure.c.
︙ | |||
934 935 936 937 938 939 940 | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/completion.c.
︙ | |||
464 465 466 467 468 469 470 | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/csv.c.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - - - + + + - - - + + + | ** ** Usage: ** ** .load ./csv ** CREATE VIRTUAL TABLE temp.csv USING csv(filename=FILENAME); ** SELECT * FROM csv; ** |
︙ | |||
432 433 434 435 436 437 438 439 440 441 442 443 444 445 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | || (z[0]=='0' && z[1]==0) ){ return 0; } return -1; } /* Check to see if the string is of the form: "TAG = BOOLEAN" or just "TAG". ** If it is, set *pValue to be the value of the boolean ("true" if there is ** not "= BOOLEAN" component) and return non-zero. If the input string ** does not begin with TAG, return zero. */ static int csv_boolean_parameter( const char *zTag, /* Tag we are looking for */ int nTag, /* Size of the tag in bytes */ const char *z, /* Input parameter */ int *pValue /* Write boolean value here */ ){ int b; z = csv_skip_whitespace(z); if( strncmp(zTag, z, nTag)!=0 ) return 0; z = csv_skip_whitespace(z + nTag); if( z[0]==0 ){ *pValue = 1; return 1; } if( z[0]!='=' ) return 0; z = csv_skip_whitespace(z+1); b = csv_boolean(z); if( b>=0 ){ *pValue = b; return 1; } return 0; } /* ** Parameters: ** filename=FILENAME Name of file containing CSV content ** data=TEXT Direct CSV content. ** schema=SCHEMA Alternative CSV schema. ** header=YES|NO First row of CSV defines the names of |
︙ | |||
465 466 467 468 469 470 471 472 473 474 475 476 477 478 | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | + | CsvTable *pNew = 0; /* The CsvTable object to construct */ int bHeader = -1; /* header= flags. -1 means not seen yet */ int rc = SQLITE_OK; /* Result code from this routine */ int i, j; /* Loop counters */ #ifdef SQLITE_TEST int tstFlags = 0; /* Value for testflags=N parameter */ #endif int b; /* Value of a boolean parameter */ int nCol = -99; /* Value of the columns= parameter */ CsvReader sRdr; /* A CSV file reader used to store an error ** message and/or to count the number of columns */ static const char *azParam[] = { "filename", "data", "schema", }; char *azPValue[3]; /* Parameter values */ |
︙ | |||
489 490 491 492 493 494 495 | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | - + - - - - + - - - - - - - + - + - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + - + - - + - - - - + - - - + - + + + + - + + | const char *zValue; for(j=0; j<sizeof(azParam)/sizeof(azParam[0]); j++){ if( csv_string_parameter(&sRdr, azParam[j], z, &azPValue[j]) ) break; } if( j<sizeof(azParam)/sizeof(azParam[0]) ){ if( sRdr.zErr[0] ) goto csvtab_connect_error; }else |
︙ |
Changes to ext/misc/explain.c.
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | + + + + | ** EXPLAIN output from an SQL statement. ** ** Usage example: ** ** .load ./explain ** SELECT p2 FROM explain('SELECT * FROM sqlite_master') ** WHERE opcode='OpenRead'; ** ** This module was originally written to help simplify SQLite testing, ** by providing an easier means of verifying certain patterns in the ** generated bytecode. */ #if !defined(SQLITEINT_H) #include "sqlite3ext.h" #endif SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> |
︙ | |||
228 229 230 231 232 233 234 | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | - + + + - + - + - - - - - - - - + + + + + + + + + + + + + + + - | ** a query plan for each invocation and compute an estimated cost for that ** plan. */ static int explainBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ |
︙ | |||
276 277 278 279 280 281 282 283 284 285 286 287 288 289 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | + | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ int sqlite3ExplainVtabInit(sqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ |
Changes to ext/misc/fileio.c.
︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | + + + + + + + + + + + | # define mkdir(path,mode) _mkdir(path) # define lstat(path,buf) stat(path,buf) #endif #include <time.h> #include <errno.h> /* ** Structure of the fsdir() table-valued function */ /* 0 1 2 3 4 5 */ #define FSDIR_SCHEMA "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)" #define FSDIR_COLUMN_NAME 0 /* Name of the file */ #define FSDIR_COLUMN_MODE 1 /* Access mode */ #define FSDIR_COLUMN_MTIME 2 /* Last modification time */ #define FSDIR_COLUMN_DATA 3 /* File content */ #define FSDIR_COLUMN_PATH 4 /* Path to top of search */ #define FSDIR_COLUMN_DIR 5 /* Path is relative to this directory */ /* ** Set the result stored by context ctx to a blob containing the ** contents of file zName. */ static void readFileContents(sqlite3_context *ctx, const char *zName){ FILE *in; |
︙ | |||
691 692 693 694 695 696 697 | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | - + - + - + - + | static int fsdirColumn( sqlite3_vtab_cursor *cur, /* The cursor */ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ int i /* Which column to return */ ){ fsdir_cursor *pCur = (fsdir_cursor*)cur; switch( i ){ |
︙ | |||
734 735 736 737 738 739 740 741 742 743 744 745 746 747 | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | + + + + + + | sqlite3_result_text(ctx, aBuf, n, SQLITE_TRANSIENT); if( aBuf!=aStatic ) sqlite3_free(aBuf); #endif }else{ readFileContents(ctx, pCur->zPath); } } case FSDIR_COLUMN_PATH: default: { /* The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters. ** always return their values as NULL */ break; } } return SQLITE_OK; } /* ** Return the rowid for the current row. In this implementation, the ** first row returned is assigned rowid value 1, and each subsequent |
︙ | |||
760 761 762 763 764 765 766 767 768 769 770 771 772 773 | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | + + + | static int fsdirEof(sqlite3_vtab_cursor *cur){ fsdir_cursor *pCur = (fsdir_cursor*)cur; return (pCur->zPath==0); } /* ** xFilter callback. ** ** idxNum==1 PATH parameter only ** idxNum==2 Both PATH and DIR supplied */ static int fsdirFilter( sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ const char *zDir = 0; |
︙ | |||
812 813 814 815 816 817 818 | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | - + - - + + - - - - + + + + - + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + | ** that uses the generate_series virtual table. This routine needs to create ** a query plan for each invocation and compute an estimated cost for that ** plan. ** ** In this implementation idxNum is used to represent the ** query plan. idxStr is unused. ** |
︙ | |||
884 885 886 887 888 889 890 | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/json1.c.
︙ | |||
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 | 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | + + + | #define JEACH_VALUE 1 #define JEACH_TYPE 2 #define JEACH_ATOM 3 #define JEACH_ID 4 #define JEACH_PARENT 5 #define JEACH_FULLKEY 6 #define JEACH_PATH 7 /* The xBestIndex method assumes that the JSON and ROOT columns are ** the last two columns in the table. Should this ever changes, be ** sure to update the xBestIndex method. */ #define JEACH_JSON 8 #define JEACH_ROOT 9 UNUSED_PARAM(pzErr); UNUSED_PARAM(argv); UNUSED_PARAM(argc); UNUSED_PARAM(pAux); |
︙ | |||
2247 2248 2249 2250 2251 2252 2253 | 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 | - - - + + + + + + + + + + + + + + - - - - + + + + + - - + + + + + - + + + + - + - - - - + + + + + - - - + + + | ** 1 if the constraint is found, 3 if the constraint and zRoot are found, ** and 0 otherwise. */ static int jsonEachBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ |
︙ | |||
2384 2385 2386 2387 2388 2389 2390 | 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ | |||
2411 2412 2413 2414 2415 2416 2417 | 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/memstat.c.
︙ | |||
231 232 233 234 235 236 237 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | - + | */ static int memstatNext(sqlite3_vtab_cursor *cur){ memstat_cursor *pCur = (memstat_cursor*)cur; int i; assert( pCur->iRowid<=MSV_NROW ); while(1){ i = (int)pCur->iRowid - 1; |
︙ | |||
391 392 393 394 395 396 397 398 399 400 401 402 403 404 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | + | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ int sqlite3MemstatVtabInit(sqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ |
Changes to ext/misc/series.c.
︙ | |||
309 310 311 312 313 314 315 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | - + - + - - - + + + + + + + - - - - - - - + + + + + + + + + - - - + + - - - + - - + - - - - + + + + - - - - - - + + + + + - | ** (4) step = $value -- constraint exists ** (8) output in descending order */ static int seriesBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ |
︙ |
Changes to ext/misc/stmt.c.
︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ int sqlite3StmtVtabInit(sqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ |
Changes to ext/misc/templatevtab.c.
︙ | |||
244 245 246 247 248 249 250 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + + | /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, |
︙ |
Changes to ext/misc/unionvtab.c.
︙ | |||
1346 1347 1348 1349 1350 1351 1352 | 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | - + + | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ |
︙ |
Changes to ext/misc/vtablog.c.
︙ | |||
488 489 490 491 492 493 494 495 496 497 498 499 500 501 | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | + | 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; #ifdef _WIN32 __declspec(dllexport) #endif int sqlite3_vtablog_init( sqlite3 *db, |
︙ |
Changes to ext/misc/zipfile.c.
︙ | |||
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | + + + - - + + + - - - - - - - + + + + + + - + - - + - | ** xBestIndex callback. */ static int zipfileBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ int i; int idx = -1; int unusable = 0; for(i=0; i<pIdxInfo->nConstraint; i++){ const struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i]; if( pCons->iColumn!=ZIPFILE_F_COLUMN_IDX ) continue; |
︙ |
Changes to ext/rbu/rbu1.test.
︙ | |||
666 667 668 669 670 671 672 | 666 667 668 669 670 671 672 | - | catch { db close } eval $destroy_vfs } finish_test |
Changes to ext/rbu/rbu10.test.
︙ | |||
181 182 183 184 185 186 187 | 181 182 183 184 185 186 187 | - | INSERT INTO data_t3 VALUES(1, 'abc', '-6.0', 0); } list [catch { apply_rbu $rbu } msg] $msg } {0 SQLITE_DONE} finish_test |
Changes to ext/rbu/rbu11.test.
︙ | |||
191 192 193 194 195 196 197 | 191 192 193 194 195 196 197 | - | rbu step } {SQLITE_ERROR} do_test 4.7.2 { list [catch {rbu close} msg] $msg } {1 {SQLITE_ERROR - rbu_state mismatch error}} finish_test |
Changes to ext/rbu/rbu12.test.
︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 | - | do_test 2.$tn.6 { list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}] } [list $V1 $V2] } finish_test |
Changes to ext/rbu/rbu13.test.
︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 | - | do_execsql_test 1.4 { SELECT count(*) FROM t1 WHERE a == ( (b<<6) + (c<<5) + (d<<4) + (e<<3) + (f<<2) + (g<<1) + (h<<0) ) } {128} finish_test |
Changes to ext/rbu/rbu14.test.
︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 | - | } {4 5 6 50 50 50} integrity_check $tn.4 } finish_test |
Changes to ext/rbu/rbu3.test.
︙ | |||
199 200 201 202 203 204 205 | 199 200 201 202 203 204 205 | - - | do_test 5.3 { expr {[file size test.db-wal] > (1024 * 1200)} } 1 do_test 6.1 { sqlite3rbu_internal_test } {} finish_test |
Changes to ext/rbu/rbu5.test.
︙ | |||
296 297 298 299 300 301 302 | 296 297 298 299 300 301 302 | - - - - | db close } } finish_test |
Changes to ext/rbu/rbu6.test.
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 | - | do_execsql_test 1.$nStep.5 { SELECT * FROM t1; } {1 t1 5 hello} } finish_test |
Changes to ext/rbu/rbu7.test.
︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 | - - | 2 2 d 3 1 e 3 2 f } } finish_test |
Changes to ext/rbu/rbu8.test.
︙ | |||
68 69 70 71 72 73 74 | 68 69 70 71 72 73 74 | - | {} 2 2 _iii 3 three-III } integrity_check 1.3.3 finish_test |
Changes to ext/rbu/rbu9.test.
︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 | - | } integrity_check 2.$tn.4 } finish_test |
Changes to ext/rbu/rbuA.test.
︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 | - | do_test 2.2 { list [catch { rbu close } msg] $msg } {1 {SQLITE_ERROR - cannot update wal mode database}} finish_test |
Changes to ext/rbu/rbuB.test.
︙ | |||
55 56 57 58 59 60 61 | 55 56 57 58 59 60 61 | - | } {1 2 3 4 5 6 7 8 9} db close sqlite3_shutdown test_sqlite3_log sqlite3_initialize finish_test |
Changes to ext/rbu/rbuC.test.
︙ | |||
135 136 137 138 139 140 141 | 135 136 137 138 139 140 141 | - | integrity_check 3.$tn.4 } finish_test |
Changes to ext/rbu/rbucollate.test.
︙ | |||
56 57 58 59 60 61 62 | 56 57 58 59 60 61 62 | - | } rbu close db eval { SELECT * FROM t1 } } {a one 1 b two 2 c three 3} #forcedelete testrbu.db finish_test |
Changes to ext/rbu/rbucrash.test.
︙ | |||
141 142 143 144 145 146 147 | 141 142 143 144 145 146 147 | - | for {set nPre 0} {$nPre < $rbu_num_steps} {incr nPre} { for {set is 1} {$is <= ($rbu_num_steps - $nPre)} {incr is} { do_rbu_crash_test 2.pre=$nPre.step=$is $nPre $is } } finish_test |
Changes to ext/rbu/rbucrash2.test.
︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 | - | sqlite3rbu rbu test.db test.db2 } rbu close } } finish_test |
Changes to ext/rbu/rbudiff.test.
︙ | |||
296 297 298 299 300 301 302 | 296 297 298 299 300 301 302 | - | db close db2 close } } finish_test |
Changes to ext/rbu/rbudor.test.
︙ | |||
52 53 54 55 56 57 58 | 52 53 54 55 56 57 58 | - | } {SQLITE_DONE} do_execsql_test 1.4 { SELECT * FROM t1 } [list 1 $bigA 2 $bigB] finish_test |
Changes to ext/rbu/rbufault.test.
︙ | |||
230 231 232 233 234 235 236 | 230 231 232 233 234 235 236 | - | } } } } } finish_test |
Changes to ext/rbu/rbufault2.test.
︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 | - | {1 {SQLITE_NOMEM - out of memory}} } finish_test |
Changes to ext/rbu/rbufault3.test.
︙ | |||
91 92 93 94 95 96 97 | 91 92 93 94 95 96 97 | - | } -test { eval [list faultsim_test_result {0 SQLITE_OK} {*}$::errlist] } } finish_test |
Changes to ext/rbu/rbufault4.test.
︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 | - | if {$rc!="ok"} { error "Got $rc instead of ok!" } } } finish_test |
Changes to ext/rbu/rbufts.test.
︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 | - | INSERT INTO data_ft VALUES('7 8 9', 1, 'x'); } } msg] $msg] } {1 {SQLITE_ERROR - SQL logic error]}} finish_test |
Changes to ext/rbu/rbumulti.test.
︙ | |||
168 169 170 171 172 173 174 | 168 169 170 171 172 173 174 | - | sqlite3rbu_destroy_vfs myrbu } } finish_test |
Changes to ext/rbu/rbuprogress.test.
︙ | |||
412 413 414 415 416 417 418 | 412 413 414 415 416 417 418 | - | do_sp_test 5.$tn.$bReopen.$tn2.1 $bReopen test.db rbu.db $R($tn) } } } finish_test |
Changes to ext/rbu/rburesume.test.
︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 | - | PRAGMA integrity_check; } } {60 ok} db2 close } finish_test |
Changes to ext/rbu/rbusave.test.
︙ | |||
98 99 100 101 102 103 104 | 98 99 100 101 102 103 104 | - | do_execsql_test 1.5 { SELECT * FROM t1; SELECT * FROM t2; } {1 one 1 3 3 3 4 4 4 1 one 1 3 3 3 4 4 4} finish_test |
Changes to ext/rbu/rbusplit.test.
︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 | - | 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 } } finish_test |
Changes to ext/rbu/rbutemplimit.test.
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 | - | setup_databases unset -nocomplain ::A step_rbu_cachesize test.db test.db2 1000 10 1400000 } {1 SQLITE_FULL} do_test 1.6.2 { info commands rbu } {} finish_test |
Changes to ext/rbu/rbuvacuum.test.
︙ | |||
393 394 395 396 397 398 399 | 393 394 395 396 397 398 399 | - | while {[rbu step]=="SQLITE_OK"} {} list [catch { rbu close } msg] $msg } {0 SQLITE_DONE} catch { db close } finish_test |
Changes to ext/rbu/rbuvacuum2.test.
︙ | |||
228 229 230 231 232 233 234 | 228 229 230 231 232 233 234 | - | sqlite3rbu_vacuum rbu test.db test.db2 while {[rbu step]!="SQLITE_DONE"} { rbu step } rbu close execsql { PRAGMA integrity_check } } {ok} finish_test |
Changes to ext/rbu/sqlite3rbu.c.
︙ | |||
401 402 403 404 405 406 407 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | - + + | ** space used by the RBU handle. */ struct rbu_vfs { sqlite3_vfs base; /* rbu VFS shim methods */ sqlite3_vfs *pRealVfs; /* Underlying VFS */ sqlite3_mutex *mutex; /* Mutex to protect pMain */ sqlite3rbu *pRbu; /* Owner RBU object */ |
︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | + | int nShm; /* Number of entries in apShm[] array */ char **apShm; /* Array of mmap'd *-shm regions */ char *zDel; /* Delete this when closing file */ const char *zWal; /* Wal filename for this main db file */ rbu_file *pWalFd; /* Wal file descriptor for this main db */ rbu_file *pMainNext; /* Next MAIN_DB file */ rbu_file *pMainRbuNext; /* Next MAIN_DB file with pRbu!=0 */ }; /* ** True for an RBU vacuum handle, or false otherwise. */ #define rbuIsVacuum(p) ((p)->zTarget==0) |
︙ | |||
4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 | 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - + | i64 nDiff = nNew - pFd->sz; pRbu->szTemp += nDiff; pFd->sz = nNew; assert( pRbu->szTemp>=0 ); if( pRbu->szTempLimit && pRbu->szTemp>pRbu->szTempLimit ) return SQLITE_FULL; return SQLITE_OK; } /* ** Add an item to the main-db lists, if it is not already present. ** ** There are two main-db lists. One for all file descriptors, and one ** for all file descriptors with rbu_file.pDb!=0. If the argument has ** rbu_file.pDb!=0, then it is assumed to already be present on the ** main list and is only added to the pDb!=0 list. */ static void rbuMainlistAdd(rbu_file *p){ rbu_vfs *pRbuVfs = p->pRbuVfs; rbu_file *pIter; assert( (p->openFlags & SQLITE_OPEN_MAIN_DB) ); sqlite3_mutex_enter(pRbuVfs->mutex); if( p->pRbu==0 ){ for(pIter=pRbuVfs->pMain; pIter; pIter=pIter->pMainNext); p->pMainNext = pRbuVfs->pMain; pRbuVfs->pMain = p; }else{ for(pIter=pRbuVfs->pMainRbu; pIter && pIter!=p; pIter=pIter->pMainRbuNext){} if( pIter==0 ){ p->pMainRbuNext = pRbuVfs->pMainRbu; pRbuVfs->pMainRbu = p; } } sqlite3_mutex_leave(pRbuVfs->mutex); } /* ** Remove an item from the main-db lists. */ static void rbuMainlistRemove(rbu_file *p){ rbu_file **pp; sqlite3_mutex_enter(p->pRbuVfs->mutex); for(pp=&p->pRbuVfs->pMain; *pp && *pp!=p; pp=&((*pp)->pMainNext)){} if( *pp ) *pp = p->pMainNext; p->pMainNext = 0; for(pp=&p->pRbuVfs->pMainRbu; *pp && *pp!=p; pp=&((*pp)->pMainRbuNext)){} if( *pp ) *pp = p->pMainRbuNext; p->pMainRbuNext = 0; sqlite3_mutex_leave(p->pRbuVfs->mutex); } /* ** Given that zWal points to a buffer containing a wal file name passed to ** either the xOpen() or xAccess() VFS method, search the main-db list for ** a file-handle opened by the same database connection on the corresponding ** database file. ** ** If parameter bRbu is true, only search for file-descriptors with ** rbu_file.pDb!=0. */ static rbu_file *rbuFindMaindb(rbu_vfs *pRbuVfs, const char *zWal, int bRbu){ rbu_file *pDb; sqlite3_mutex_enter(pRbuVfs->mutex); if( bRbu ){ for(pDb=pRbuVfs->pMainRbu; pDb && pDb->zWal!=zWal; pDb=pDb->pMainRbuNext){} }else{ for(pDb=pRbuVfs->pMain; pDb && pDb->zWal!=zWal; pDb=pDb->pMainNext){} } sqlite3_mutex_leave(pRbuVfs->mutex); return pDb; } /* ** Close an rbu file. */ static int rbuVfsClose(sqlite3_file *pFile){ rbu_file *p = (rbu_file*)pFile; int rc; int i; /* Free the contents of the apShm[] array. And the array itself. */ for(i=0; i<p->nShm; i++){ sqlite3_free(p->apShm[i]); } sqlite3_free(p->apShm); p->apShm = 0; sqlite3_free(p->zDel); if( p->openFlags & SQLITE_OPEN_MAIN_DB ){ |
︙ | |||
4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 | 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 | + + + | rc = xControl(p->pReal, SQLITE_FCNTL_ZIPVFS, &dummy); if( rc==SQLITE_OK ){ rc = SQLITE_ERROR; pRbu->zErrmsg = sqlite3_mprintf("rbu/zipvfs setup error"); }else if( rc==SQLITE_NOTFOUND ){ pRbu->pTargetFd = p; p->pRbu = pRbu; if( p->openFlags & SQLITE_OPEN_MAIN_DB ){ rbuMainlistAdd(p); } if( p->pWalFd ) p->pWalFd->pRbu = pRbu; rc = SQLITE_OK; } } return rc; } else if( op==SQLITE_FCNTL_RBUCNT ){ |
︙ | |||
4473 4474 4475 4476 4477 4478 4479 | 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 | - - - - - - - - - - - - - - | /* Release the checkpointer and writer locks */ rbuUnlockShm(p); rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag); } return rc; } |
︙ | |||
4565 4566 4567 4568 4569 4570 4571 | 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 | - + | ** (pFd->zWal) to point to a buffer owned by SQLite that contains ** the name of the *-wal file this db connection will use. SQLite ** happens to pass a pointer to this buffer when using xAccess() ** or xOpen() to operate on the *-wal file. */ pFd->zWal = rbuMainToWal(zName, flags); } else if( flags & SQLITE_OPEN_WAL ){ |
︙ | |||
4617 4618 4619 4620 4621 4622 4623 | 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 | - - - + - | } if( pFd->pReal->pMethods ){ /* The xOpen() operation has succeeded. Set the sqlite3_file.pMethods ** pointer and, if the file is a main database file, link it into the ** mutex protected linked list of all such files. */ pFile->pMethods = &rbuvfs_io_methods; if( flags & SQLITE_OPEN_MAIN_DB ){ |
︙ | |||
4668 4669 4670 4671 4672 4673 4674 | 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 | - + | ** ** b) if the *-wal file does not exist, claim that it does anyway, ** causing SQLite to call xOpen() to open it. This call will also ** be intercepted (see the rbuVfsOpen() function) and the *-oal ** file opened instead. */ if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){ |
︙ |
Changes to ext/repair/test/checkindex01.test.
︙ | |||
343 344 345 346 347 348 349 | 343 344 345 346 347 348 349 | - - | } do_index_check_test 7.3 t7i3 { {} 1,1 {} 3,3 } do_index_check_test 7.4 t7i4 { {} 1,1 {} 3,3 } |
Changes to ext/rtree/geopoly.c.
︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | + + + + + - + + + + + + | ** each segment is "outside" and the area to the left is "inside". ** ** The on-disk representation consists of a 4-byte header followed by ** the values. The 4-byte header is: ** ** encoding (1 byte) 0=big-endian, 1=little-endian ** nvertex (3 bytes) Number of vertexes as a big-endian integer ** ** Enough space is allocated for 4 coordinates, to work around over-zealous ** warnings coming from some compiler (notably, clang). In reality, the size ** of each GeoPoly memory allocate is adjusted as necessary so that the ** GeoPoly.a[] array at the end is the appropriate size. */ typedef struct GeoPoly GeoPoly; struct GeoPoly { int nVertex; /* Number of vertexes */ unsigned char hdr[4]; /* Header for on-disk representation */ |
︙ | |||
244 245 246 247 248 249 250 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - - - + | } if( geopolySkipSpace(&s)==']' && s.nVertex>=4 && s.a[0]==s.a[s.nVertex*2-2] && s.a[1]==s.a[s.nVertex*2-1] && (s.z++, geopolySkipSpace(&s)==0) ){ |
︙ | |||
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + | p->a[ii*2+1] = y1; } sqlite3_result_blob(context, p->hdr, 4+8*p->nVertex, SQLITE_TRANSIENT); sqlite3_free(p); } } /* ** Compute the area enclosed by the polygon. ** ** This routine can also be used to detect polygons that rotate in ** the wrong direction. Polygons are suppose to be counter-clockwise (CCW). ** This routine returns a negative value for clockwise (CW) polygons. */ static double geopolyArea(GeoPoly *p){ double rArea = 0.0; int ii; for(ii=0; ii<p->nVertex-1; ii++){ rArea += (p->a[ii*2] - p->a[ii*2+2]) /* (x0 - x1) */ * (p->a[ii*2+1] + p->a[ii*2+3]) /* (y0 + y1) */ * 0.5; } rArea += (p->a[ii*2] - p->a[0]) /* (xN - x0) */ * (p->a[ii*2+1] + p->a[1]) /* (yN + y0) */ * 0.5; return rArea; } /* ** Implementation of the geopoly_area(X) function. ** ** If the input is a well-formed Geopoly BLOB then return the area ** enclosed by the polygon. If the polygon circulates clockwise instead ** of counterclockwise (as it should) then return the negative of the ** enclosed area. Otherwise return NULL. */ static void geopolyAreaFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ GeoPoly *p = geopolyFuncParam(context, argv[0], 0); if( p ){ sqlite3_result_double(context, geopolyArea(p)); sqlite3_free(p); } } |
︙ | |||
584 585 586 587 588 589 590 | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | - + | r = p->a[ii*2+1]; if( r<mnY ) mnY = (float)r; else if( r>mxY ) mxY = (float)r; } if( pRc ) *pRc = SQLITE_OK; if( aCoord==0 ){ geopolyBboxFill: |
︙ | |||
1665 1666 1667 1668 1669 1670 1671 | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | - + | return SQLITE_INDEX_CONSTRAINT_FUNCTION+1; } return 0; } static sqlite3_module geopolyModule = { |
︙ | |||
1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 | + | rtreeEndTransaction, /* xCommit - commit transaction */ rtreeEndTransaction, /* xRollback - rollback transaction */ geopolyFindFunction, /* xFindFunction - function overloading */ rtreeRename, /* xRename - rename the table */ rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ rtreeShadowName /* xShadowName */ }; static int sqlite3_geopoly_init(sqlite3 *db){ int rc = SQLITE_OK; static const struct { void (*xFunc)(sqlite3_context*,int,sqlite3_value**); signed char nArg; |
︙ | |||
1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | + | { geopolyWithinFunc, 2, 1, "geopoly_within" }, { geopolyContainsPointFunc, 3, 1, "geopoly_contains_point" }, { geopolyOverlapFunc, 2, 1, "geopoly_overlap" }, { geopolyDebugFunc, 1, 0, "geopoly_debug" }, { geopolyBBoxFunc, 1, 1, "geopoly_bbox" }, { geopolyXformFunc, 7, 1, "geopoly_xform" }, { geopolyRegularFunc, 4, 1, "geopoly_regular" }, { geopolyCcwFunc, 1, 1, "geopoly_ccw" }, }; static const struct { void (*xStep)(sqlite3_context*,int,sqlite3_value**); void (*xFinal)(sqlite3_context*); const char *zName; } aAgg[] = { { geopolyBBoxStep, geopolyBBoxFinal, "geopoly_group_bbox" }, |
︙ |
Changes to ext/rtree/rtree.c.
︙ | |||
3321 3322 3323 3324 3325 3326 3327 3328 | 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 | + + + + + + + + + + + + + + + + - + | } sqlite3_free(zSql); } return rc; } /* ** Return true if zName is the extension on one of the shadow tables used ** by this module. */ static int rtreeShadowName(const char *zName){ static const char *azName[] = { "node", "parent", "rowid" }; unsigned int i; for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){ if( sqlite3_stricmp(zName, azName[i])==0 ) return 1; } return 0; } static sqlite3_module rtreeModule = { |
︙ | |||
3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 | 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 | + | rtreeEndTransaction, /* xCommit - commit transaction */ rtreeEndTransaction, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ rtreeRename, /* xRename - rename the table */ rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ rtreeShadowName /* xShadowName */ }; static int rtreeSqlInit( Rtree *pRtree, sqlite3 *db, const char *zDb, const char *zPrefix, |
︙ |
Changes to ext/rtree/rtree8.test.
︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | + + | # The following block of tests - rtree8-2.* - test a couple of database # corruption cases. In this case things are not corrupted at the b-tree # level, but the contents of the various tables used internally by an # r-tree table are inconsistent. # populate_t1 50 do_execsql_test rtree8-2.1.1 { SELECT max(nodeno) FROM t1_node } {5} sqlite3_db_config db DEFENSIVE 0 do_execsql_test rtree8-2.1.2 { DELETE FROM t1_node } {} for {set i 1} {$i <= 50} {incr i} { do_catchsql_test rtree8-2.1.3.$i { SELECT * FROM t1 WHERE id = $i } {1 {database disk image is malformed}} } do_catchsql_test rtree8-2.1.4 { SELECT * FROM t1 } {1 {database disk image is malformed}} do_catchsql_test rtree8-2.1.5 { DELETE FROM t1 } {1 {database disk image is malformed}} do_execsql_test rtree8-2.1.6 { DROP TABLE t1; CREATE VIRTUAL TABLE t1 USING rtree_i32(id, x1, x2); } {} populate_t1 50 sqlite3_db_config db DEFENSIVE 0 do_execsql_test rtree8-2.2.1 { DELETE FROM t1_parent } {} do_catchsql_test rtree8-2.2.2 { DELETE FROM t1 WHERE id=25 } {1 {database disk image is malformed}} do_execsql_test rtree8-2.2.3 { |
︙ |
Changes to ext/rtree/rtreeA.test.
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + | execsql BEGIN for {set i 0} {$i < 500} {incr i} { set x2 [expr $i+5] set y2 [expr $i+5] execsql { INSERT INTO t1 VALUES($i, $i, $x2, $i, $y2) } } execsql COMMIT sqlite3_db_config db DEFENSIVE 0 } proc truncate_node {nodeno nTrunc} { set blob [db one {SELECT data FROM t1_node WHERE nodeno=$nodeno}] if {$nTrunc<0} {set nTrunc "end-$nTrunc"} set blob [string range $blob 0 $nTrunc] db eval { UPDATE t1_node SET data = $blob WHERE nodeno=$nodeno } |
︙ | |||
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | + - | #------------------------------------------------------------------------- # Truncated blobs in the _node table. # create_t1 populate_t1 sqlite3 db test.db sqlite3_db_config db DEFENSIVE 0 do_execsql_test rtreeA-7.100 { UPDATE t1_node SET data=x'' WHERE rowid=1; } {} do_catchsql_test rtreeA-7.110 { SELECT * FROM t1 WHERE x1>0 AND x1<100 AND x2>0 AND x2<100; } {1 {undersize RTree blobs in "t1_node"}} do_test rtreeA-7.120 { sqlite3_extended_errcode db } {SQLITE_CORRUPT_VTAB} finish_test |
Changes to ext/rtree/rtreecheck.test.
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + | CREATE VIRTUAL TABLE r1 USING $module (id, x1, x2, y1, y2); INSERT INTO r1 VALUES(1, 5, 5, 5, 5); -- 3 INSERT INTO r1 VALUES(2, 6, 6, 6, 6); -- 9 INSERT INTO r1 VALUES(3, 7, 7, 7, 7); -- 15 INSERT INTO r1 VALUES(4, 8, 8, 8, 8); -- 21 INSERT INTO r1 VALUES(5, 9, 9, 9, 9); -- 27 " sqlite3_db_config db DEFENSIVE 0 } setup_simple_db do_execsql_test 2.1 { SELECT rtreecheck('r1') } {ok} |
︙ | |||
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | + | do_execsql_test 3.1 { CREATE VIRTUAL TABLE r2 USING rtree_i32(id, x1, x2); INSERT INTO r2 VALUES(2, -1*(1<<31), -1*(1<<31)+5); SELECT rtreecheck('r2') } {ok} sqlite3_db_config db DEFENSIVE 0 do_execsql_test 3.2 { BEGIN; UPDATE r2_node SET data = X'123456'; SELECT rtreecheck('r2')!="ok"; } {1} do_execsql_test 3.3 { |
︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | + - | do_execsql_test 5.0 { CREATE VIRTUAL TABLE r3 USING rtree_i32(id, x1, x2, y1, y2); WITH x(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM x WHERE i<1000 ) INSERT INTO r3 SELECT i, i, i, i, i FROM x; } sqlite3_db_config db DEFENSIVE 0 do_execsql_test 5.1 { BEGIN; UPDATE r3_node SET data = set_int32(data, 3, 5000); UPDATE r3_node SET data = set_int32(data, 4, 5000); SELECT rtreecheck('r3')=='ok' } 0 do_execsql_test 5.2 { ROLLBACK; BEGIN; UPDATE r3_node SET data = set_int32(data, 3, 0); UPDATE r3_node SET data = set_int32(data, 4, 0); SELECT rtreecheck('r3')=='ok' } 0 finish_test |
Added ext/session/changesetfuzz.c.