Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch branch-3.46 Excluding Merge-Ins
This is equivalent to a diff from 96c92aba00 to f9a90a0d2c
2024-11-04
| ||
17:33 | Avoid loading the entire record into memory for an sqlite3_preupdate_old() call that retrieves an IPK value. (Leaf check-in: f9a90a0d2c user: dan tags: branch-3.46) | |
16:59 | Avoid loading the entire record into memory for an sqlite3_preupdate_old() call that retrieves an IPK value. (check-in: 7f4de43733 user: dan tags: trunk) | |
2024-10-17
| ||
12:17 | Fix the OPFS VFS's xOpen() to honor the read-only flag. Fix the OPFS SAHPool VFS to enable re-installation of the VFS after calling OpfsSAHPoolUtil.removeVfs(). (check-in: 63ee358420 user: stephan tags: branch-3.46) | |
2024-05-23
| ||
23:30 | Fix the window-function group_concat() so that it returns an empty string if it has one or more empty string inputs. (check-in: 7fe11274fc user: drh tags: branch-3.46) | |
14:58 | Increase the version number to 3.47.0 to begin the next development cycle. (check-in: 20e228a22e user: drh tags: trunk) | |
14:09 | Version 3.46.0 for the reuse-schema branch (check-in: 8f6b859413 user: drh tags: reuse-schema) | |
14:05 | Version 3.46.0 for the wal2 branch. (check-in: fdc0e1480a user: drh tags: wal2) | |
14:04 | Version 3.46.0 for the begin-concurrent branch (check-in: e3f8c70ef5 user: drh tags: begin-concurrent) | |
13:25 | Version 3.46.0 (check-in: 96c92aba00 user: drh tags: trunk, release, major-release, version-3.46.0) | |
2024-05-21
| ||
17:37 | Ensure an sqlite_dbdata cursor is properly reset before being used again, even if it has already encountered database corruption. (check-in: 3210e1ca4d user: dan tags: trunk) | |
Changes to VERSION.
| 1 | - + |
|
Changes to autoconf/tea/configure.ac.
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - + | # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION # set as provided. These will also be added as -D defs in your Makefile # so you can encode the package version directly into the source files. # This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME> # so that we create the export library with the dll. #----------------------------------------------------------------------- |
︙ |
Changes to configure.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. |
︙ | |||
722 723 724 725 726 727 728 | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | - - + + | subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' |
︙ | |||
1468 1469 1470 1471 1472 1473 1474 | 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - + | # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF |
︙ | |||
1533 1534 1535 1536 1537 1538 1539 | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 | - + | --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in |
︙ | |||
1664 1665 1666 1667 1668 1669 1670 | 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 | - + | cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF |
︙ | |||
2083 2084 2085 2086 2087 2088 2089 | 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 | - + | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. |
︙ | |||
12477 12478 12479 12480 12481 12482 12483 | 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 | - + | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" |
︙ | |||
12543 12544 12545 12546 12547 12548 12549 | 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 | - + | Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ |
︙ |
Changes to ext/consio/console_io.c.
︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - - - - - | # endif # define CIO_WIN_WC_XLATE 0 /* Use plain C library stream I/O at console */ # endif #else # define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */ #endif |
︙ |
Changes to ext/expert/expert1.test.
︙ | |||
461 462 463 464 465 466 467 468 469 470 471 472 473 474 | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | + + + + + + + | t1 t1_idx_00000062 {100 20} t1 t1_idx_000123a7 {100 50 17} t2 t2_idx_00000063 {100 20} t2 t2_idx_00000064 {100 5} t2 t2_idx_0001295b {100 20 5} } do_catchsql_test 5.4 { SELECT sqlite_expert_rem(123, 123); } {1 {no such function: sqlite_expert_rem}} do_catchsql_test 5.5 { SELECT sqlite_expert_sample(); } {1 {no such function: sqlite_expert_sample}} if 0 { do_test expert1-6.0 { catchcmd :memory: { .expert select base64(''); .expert select name from pragma_collation_list order by name collate uint; |
︙ |
Changes to ext/expert/sqlite3expert.c.
︙ | |||
622 623 624 625 626 627 628 | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | - + | (void)idxStr; (void)argc; (void)argv; rc = sqlite3_finalize(pCsr->pData); pCsr->pData = 0; if( rc==SQLITE_OK ){ rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg, |
︙ | |||
1496 1497 1498 1499 1500 1501 1502 | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | - + - + | int nByte; /* Bytes of space allocated at z */ int n; /* Size of buffer z */ char *z; /* SQLITE_TEXT/BLOB value */ } aSlot[1]; }; /* |
︙ | |||
1620 1621 1622 1623 1624 1625 1626 | 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | + - + | /* Formulate the query text */ sqlite3_bind_text(pIndexXInfo, 1, zIdx, -1, SQLITE_STATIC); while( SQLITE_OK==rc && SQLITE_ROW==sqlite3_step(pIndexXInfo) ){ const char *zComma = zCols==0 ? "" : ", "; const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0); const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1); zCols = idxAppendText(&rc, zCols, "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s", |
︙ | |||
1753 1754 1755 1756 1757 1758 1759 | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | - - + + - - + + | if( rc==SQLITE_OK ){ int nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax); pCtx = (struct IdxRemCtx*)idxMalloc(&rc, nByte); } if( rc==SQLITE_OK ){ sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); |
︙ | |||
1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 | + + + | sqlite3_free(pCtx); } if( rc==SQLITE_OK ){ rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0); } sqlite3_create_function(p->db, "sqlite_expert_rem", 2, SQLITE_UTF8, 0,0,0,0); sqlite3_create_function(p->db, "sqlite_expert_sample", 0,SQLITE_UTF8,0,0,0,0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); return rc; } /* ** Define and possibly pretend to use a useless collation sequence. ** This pretense allows expert to accept SQL using custom collations. |
︙ |
Changes to ext/fts5/fts5_expr.c.
︙ | |||
320 321 322 323 324 325 326 | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | + - + + + + | sParse.apPhrase = 0; } }else{ sqlite3Fts5ParseNodeFree(sParse.pExpr); } sqlite3_free(sParse.apPhrase); if( 0==*pzErr ){ |
︙ | |||
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 | 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 | + | || pLeft->eType==FTS5_TERM || pLeft->eType==FTS5_EOF || pLeft->eType==FTS5_AND ); assert( pRight->eType==FTS5_STRING || pRight->eType==FTS5_TERM || pRight->eType==FTS5_EOF || (pRight->eType==FTS5_AND && pParse->bPhraseToAnd) ); if( pLeft->eType==FTS5_AND ){ pPrev = pLeft->apChild[pLeft->nChild-1]; }else{ pPrev = pLeft; } |
︙ |
Changes to ext/fts5/fts5_main.c.
︙ | |||
1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 | 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 | + | if( pConfig->bContentlessDelete ){ fts5SetVtabError(pTab, "'delete' may not be used with a contentless_delete=1 table" ); rc = SQLITE_ERROR; }else{ rc = fts5SpecialDelete(pTab, apVal); bUpdateOrDelete = 1; } }else{ rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]); } }else{ /* A regular INSERT, UPDATE or DELETE statement. The trick here is that ** any conflict on the rowid value must be detected before any |
︙ | |||
2870 2871 2872 2873 2874 2875 2876 | 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 | - + + - + + | Fts5TokenizerModule *pMod; int rc = SQLITE_OK; pMod = fts5LocateTokenizer(pGlobal, nArg==0 ? 0 : azArg[0]); if( pMod==0 ){ assert( nArg>0 ); rc = SQLITE_ERROR; |
︙ | |||
2971 2972 2973 2974 2975 2976 2977 2978 | 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 | + + + - - - - - - - - - + + + + + + + + + + + + | char **pzErr /* Write error message here */ ){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; int rc; assert( pzErr!=0 && *pzErr==0 ); UNUSED_PARAM(isQuick); assert( pTab->p.pConfig->pzErrmsg==0 ); pTab->p.pConfig->pzErrmsg = pzErr; rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0); if( *pzErr==0 && rc!=SQLITE_OK ){ |
︙ |
Changes to ext/fts5/fts5_tokenize.c.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + + | p = sqlite3_malloc(sizeof(AsciiTokenizer)); if( p==0 ){ rc = SQLITE_NOMEM; }else{ int i; memset(p, 0, sizeof(AsciiTokenizer)); memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar)); |
︙ | |||
377 378 379 380 381 382 383 | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - + - - + | p->nFold = 64; p->aFold = sqlite3_malloc64(p->nFold * sizeof(char)); if( p->aFold==0 ){ rc = SQLITE_NOMEM; } /* Search for a "categories" argument */ |
︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | + | }else if( 0==sqlite3_stricmp(azArg[i], "categories") ){ /* no-op */ }else{ rc = SQLITE_ERROR; } } if( i<nArg && rc==SQLITE_OK ) rc = SQLITE_ERROR; }else{ rc = SQLITE_NOMEM; } if( rc!=SQLITE_OK ){ fts5UnicodeDelete((Fts5Tokenizer*)p); p = 0; |
︙ | |||
1294 1295 1296 1297 1298 1299 1300 | 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 | - + + | UNUSED_PARAM(pUnused); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ int i; pNew->bFold = 1; pNew->iFoldParam = 0; |
︙ |
Changes to ext/fts5/test/fts5aux.test.
︙ | |||
372 373 374 375 376 377 378 379 380 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | + + + + + + + + + + + + + + + + + + + + + + + + | } {1 SQLITE_RANGE} do_catchsql_test 12.3.2 { SELECT fts5_collist(t1, 2) FROM t1('one AND two'); } {1 SQLITE_RANGE} do_catchsql_test 12.3.3 { SELECT fts5_collist(t1, 1) FROM t1('one AND two'); } {0 1} #------------------------------------------------------------------------- reset_db do_execsql_test 13.1 { CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=ascii); INSERT INTO t1 VALUES('a b c'), ('d e f'); PRAGMA integrity_check; } {ok} do_catchsql_test 13.2 { SELECT highlight(t1, 0, '[', ']') FROM t1 } {0 {{a b c} {d e f}}} do_execsql_test 13.3 { PRAGMA writable_schema = 1; UPDATE sqlite_schema SET sql = 'CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=blah)' WHERE name = 't1'; } db close sqlite3 db test.db do_catchsql_test 13.4 { SELECT highlight(t1, 0, '[', ']') FROM t1 } {1 {no such tokenizer: blah}} finish_test |
Changes to ext/fts5/test/fts5integrity.test.
︙ | |||
375 376 377 378 379 380 381 382 383 384 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | + + + + + + + + + + + + + + + + + + + + + + + + + + + | explain_i { PRAGMA integrity_check } do_execsql_test 12.3 { PRAGMA integrity_check } {ok} #------------------------------------------------------------------- reset_db do_execsql_test 13.1 { CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=ascii); INSERT INTO t1 VALUES('a b c'), ('d e f'); PRAGMA integrity_check; } {ok} db close sqlite3 db test.db do_catchsql_test 13.2 { PRAGMA integrity_check; } {0 ok} do_execsql_test 13.3 { PRAGMA writable_schema = 1; UPDATE sqlite_schema SET sql = 'CREATE VIRTUAL TABLE t1 USING fts5(a, tokenize=blah)' WHERE name = 't1'; } db close sqlite3 db test.db breakpoint do_catchsql_test 13.4 { PRAGMA integrity_check; } {1 {no such tokenizer: blah}} finish_test |
Changes to ext/fts5/test/fts5secure8.test.
︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 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 66 | + + + + + + + + + + + + + + + + | INSERT INTO ft(ft, rank) VALUES('secure-delete', 1); DELETE FROM ft WHERE rowid=100; } do_execsql_test 1.2 { PRAGMA integrity_check; } {ok} do_execsql_test 2.0 { CREATE VIRTUAL TABLE xyz USING fts5 ( name, content='' ); INSERT INTO xyz(xyz, rank) VALUES('secure-delete', 1); INSERT INTO xyz (rowid, name) VALUES(1, 'A'); INSERT INTO xyz (rowid, name) VALUES(2, 'A'); INSERT INTO xyz(xyz, rowid, name) VALUES('delete', 2, 'A'); } do_execsql_test 2.1 { pragma quick_check; } {ok} finish_test |
︙ |
Changes to ext/fts5/test/fts5tokenizer2.test.
︙ | |||
80 81 82 83 84 85 86 87 88 89 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | + + + + + + + + + + + + + + + + + + + + | do_execsql_test 1.6 { SELECT highlight(t1, 0, '>', '<') FROM t1('mess'); } {AAdontBB>mess<} do_execsql_test 1.7 { SELECT highlight(t1, 0, '>', '<') FROM t1('BB mess'); } {AAdont>BBmess<} # 2024-08-06 https://sqlite.org/forum/forumpost/171bcc2bcd # Error handling of tokenize= arguments. # foreach {n tkz} { 1 {ascii none} 2 {unicode61 none} 3 {porter none} 4 {trigram none} 5 {ascii none 0} 6 {unicode61 none 0} 7 {porter none 0} 8 {trigram none 0} } { db eval {DROP TABLE IF EXISTS t2;} do_catchsql_test 2.$n " DROP TABLE IF EXISTS t2; CREATE VIRTUAL TABLE t2 USING fts5(a,b,c,tokenize='$tkz'); " {1 {error in tokenizer constructor}} } finish_test |
Changes to ext/fts5/test/fts5trigram.test.
︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | + + + | #------------------------------------------------------------------------- reset_db do_execsql_test 2.0 { CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize="trigram case_sensitive 1"); INSERT INTO t1 VALUES('abcdefghijklm'); INSERT INTO t1 VALUES('กรุงเทพมหานคร'); } do_catchsql_test 2.0.1 { CREATE VIRTUAL TABLE t2 USING fts5(z, tokenize='trigram case_sensitive'); } {1 {error in tokenizer constructor}} foreach {tn s res} { 1 abc "(abc)defghijklm" 2 defgh "abc(defgh)ijklm" 3 abcdefghijklm "(abcdefghijklm)" 4 กรุ "(กรุ)งเทพมหานคร" 5 งเทพมห "กรุ(งเทพมห)านคร" |
︙ | |||
202 203 204 205 206 207 208 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + | do_execsql_test 7.0 { CREATE VIRTUAL TABLE f USING FTS5(filename, tokenize="trigram"); INSERT INTO f (rowid, filename) VALUES (10, "giraffe.png"), (20, "жираф.png"), (30, "cat.png"), (40, "кот.png"), |
︙ |
Changes to ext/fts5/test/fts5trigram2.test.
︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | + + + | set ::testprefix fts5trigram2 do_execsql_test 1.0 " CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize='trigram remove_diacritics 1'); INSERT INTO t1 VALUES('abc\u0303defghijklm'); INSERT INTO t1 VALUES('a\u0303b\u0303c\u0303defghijklm'); " do_catchsql_test 1.0.1 { CREATE VIRTUAL TABLE t2 USING fts5(z, tokenize='trigram remove_diacritics'); } {1 {error in tokenizer constructor}} do_execsql_test 1.1 { SELECT highlight(t1, 0, '(', ')') FROM t1('abc'); } [list \ "(abc\u0303)defghijklm" \ "(a\u0303b\u0303c\u0303)defghijklm" \ ] |
︙ |
Changes to ext/recover/sqlite3recover.c.
︙ | |||
359 360 361 362 363 364 365 | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | - + | const char *zFmt, ... ){ char *z = 0; va_list ap; va_start(ap, zFmt); if( zFmt ){ z = sqlite3_vmprintf(zFmt, ap); |
︙ |
Added ext/session/sessionblob.test.
|
Changes to ext/wasm/api/sqlite3-opfs-async-proxy.js.
︙ | |||
83 84 85 86 87 88 89 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | }; const logImpl = (level,...args)=>{ if(state.verbose>level) loggers[level]("OPFS asyncer:",...args); }; const log = (...args)=>logImpl(2, ...args); const warn = (...args)=>logImpl(1, ...args); const error = (...args)=>logImpl(0, ...args); |
︙ | |||
261 262 263 264 265 266 267 268 | 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 270 271 272 273 | + + + + + + - - - - - - - - + + + + + + - - - + + + + + + + + - - - - - + + + + + + + | errorObject.message ].join(' '), { cause: errorObject }); this.name = 'GetSyncHandleError'; } }; /** Attempts to find a suitable SQLITE_xyz result code for Error object e. Returns either such a translation or rc if if it does not know how to translate the exception. */ GetSyncHandleError.convertRc = (e,rc)=>{ |
︙ | |||
343 344 345 346 347 348 349 | 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 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 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 453 454 455 456 457 458 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 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 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | /** Throws if fh is a file-holding object which is flagged as read-only. */ const affirmNotRO = function(opName,fh){ if(fh.readOnly) toss(opName+"(): File is read-only: "+fh.filenameAbs); }; |
︙ | |||
737 738 739 740 741 742 743 | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | - - | case TypeIds.bigint.id: return TypeIds.bigint; case TypeIds.boolean.id: return TypeIds.boolean; case TypeIds.string.id: return TypeIds.string; default: toss("Invalid type ID:",tid); } }; state.s11n.deserialize = function(clear=false){ |
︙ | |||
763 764 765 766 767 768 769 | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | - - - | offset += n; } rc.push(v); } } if(clear) viewU8[0] = 0; //log("deserialize:",argc, rc); |
︙ | |||
799 800 801 802 803 804 805 | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | - | offset += s.byteLength; } } //log("serialize() result:",viewU8.slice(0,offset)); }else{ viewU8[0] = 0; } |
︙ | |||
881 882 883 884 885 886 887 | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | - - - - | state.sabS11nView = new Uint8Array(state.sabIO, state.sabS11nOffset, state.sabS11nSize); Object.keys(vfsAsyncImpls).forEach((k)=>{ if(!Number.isFinite(state.opIds[k])){ toss("Maintenance required: missing state.opIds[",k,"]"); } }); initS11n(); |
︙ |
Changes to ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js.
︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + | major browsers released since March 2023). If that API is not detected, the VFS is not registered. */ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ 'use strict'; const toss = sqlite3.util.toss; const toss3 = sqlite3.util.toss3; |
︙ | |||
839 840 841 842 843 844 845 846 847 848 849 850 851 852 | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | + | Resolves to true if it did its job, false if the VFS has already been shut down. */ async removeVfs(){ if(!this.#cVfs.pointer || !this.#dhOpaque) return false; capi.sqlite3_vfs_unregister(this.#cVfs.pointer); this.#cVfs.dispose(); delete initPromises[this.vfsName]; try{ this.releaseAccessHandles(); await this.#dhVfsRoot.removeEntry(OPAQUE_DIR_NAME, {recursive: true}); this.#dhOpaque = undefined; await this.#dhVfsParent.removeEntry( this.#dhVfsRoot.name, {recursive: true} ); |
︙ |
Changes to ext/wasm/api/sqlite3-vfs-opfs.c-pp.js.
︙ | |||
388 389 390 391 392 393 394 395 396 397 398 399 400 401 | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | + | counterpart... */ state.sq3Codes = Object.create(null); [ 'SQLITE_ACCESS_EXISTS', 'SQLITE_ACCESS_READWRITE', 'SQLITE_BUSY', 'SQLITE_CANTOPEN', 'SQLITE_ERROR', 'SQLITE_IOERR', 'SQLITE_IOERR_ACCESS', 'SQLITE_IOERR_CLOSE', 'SQLITE_IOERR_DELETE', 'SQLITE_IOERR_FSYNC', 'SQLITE_IOERR_LOCK', |
︙ | |||
440 441 442 443 444 445 446 | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | - + | It goes without saying that deleting a file out from under another instance results in Undefined Behavior. */ OPFS_UNLINK_BEFORE_OPEN: 0x02, /** If true, any async routine which implicitly acquires a sync |
︙ | |||
467 468 469 470 471 472 473 | 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 | - - - + + + + + + + + + + + + + + + + | const opNdx = state.opIds[op] || toss("Invalid op ID:",op); state.s11n.serialize(...args); Atomics.store(state.sabOPView, state.opIds.rc, -1); Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx); Atomics.notify(state.sabOPView, state.opIds.whichOp) /* async thread will take over here */; const t = performance.now(); |
︙ | |||
716 717 718 719 720 721 722 723 | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | + + + + + + + + - - + + + - | As of late 2022, only a single lock can be held on an OPFS file. We have no way of checking whether any _other_ db connection has a lock except by trying to obtain and (on success) release a sync-handle for it, but doing so would involve an inherent race condition. For the time being, pending a better solution, we simply report whether the given pFile is open. Update 2024-06-12: based on forum discussions, this function now always sets pOut to 0 (false): https://sqlite.org/forum/forumpost/a2f573b00cda1372 */ if(1){ wasm.poke(pOut, 0, 'i32'); }else{ |
︙ | |||
903 904 905 906 907 908 909 910 911 912 913 914 915 916 | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | + + | //warn("xOpen zName =",zName, "opfsFlags =",opfsFlags); } const fh = Object.create(null); fh.fid = pFile; fh.filename = zName; fh.sab = new SharedArrayBuffer(state.fileBufferSize); fh.flags = flags; fh.readOnly = !(sqlite3.SQLITE_OPEN_CREATE & flags) && !!(flags & capi.SQLITE_OPEN_READONLY); const rc = opRun('xOpen', pFile, zName, flags, opfsFlags); if(!rc){ /* Recall that sqlite3_vfs::xClose() will be called, even on error, unless pFile->pMethods is NULL. */ if(fh.readOnly){ wasm.poke(pOutFlags, capi.SQLITE_OPEN_READONLY, 'i32'); } |
︙ |
Changes to ext/wasm/tester1.c-pp.js.
︙ | |||
3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 | 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | //dump('After deleting one entry via subquery'); rc = fetchEm(); T.assert(2===rc.length) .assert('abcghi'===rc.join('')); //log('rc =',rc); db.close(); } }) .t({ name: 'r/o connection recovery from write op error', predicate: ()=>hasOpfs() || "Requires OPFS to reproduce", //predicate: ()=>false, test: async function(sqlite3){ /* https://sqlite.org/forum/forumpost/cf37d5ff1182c31081 The "opfs" VFS (but not SAHPool) was formerly misbehaving after a write attempt was made on a db opened with mode=ro. This test ensures that that behavior is fixed and compares that behavior with other VFSes. */ const tryOne = function(vfsName,descr){ const uri = 'file:///foo.db'; let db = new sqlite3.oo1.DB(uri + (vfsName ? '?vfs='+vfsName : '')); db.exec([ "drop table if exists t;", "create table t(a);", "insert into t(a) values('abc'),('def'),('ghi');" ]); db.close(); db = new sqlite3.oo1.DB(uri+'?mode=ro'+ (vfsName ? '&vfs='+vfsName : '')); let err; try { db.exec('insert into t(a) values(1)'); }catch(e){ err = e; } T.assert(err && (err.message.indexOf('SQLITE_READONLY')===0)); try{ db.exec('select a from t'); }finally{ db.close(); } }; const poolConfig = JSON.parse(JSON.stringify(sahPoolConfig)); poolConfig.name = 'opfs-sahpool-cf37d5ff11'; let poolUtil; await sqlite3.installOpfsSAHPoolVfs(poolConfig).then(p=>poolUtil=p); T.assert(!!sqlite3.capi.sqlite3_vfs_find(poolConfig.name), "Expecting to find just-registered VFS"); try{ tryOne(false, "Emscripten filesystem"); tryOne(poolConfig.name); tryOne('opfs'); }finally{ await poolUtil.removeVfs(); } } }) ;/*end of Bug Reports group*/; //////////////////////////////////////////////////////////////////////// log("Loading and initializing sqlite3 WASM module..."); if(0){ globalThis.sqlite3ApiConfig = { |
︙ |
Changes to src/alter.c.
︙ | |||
1316 1317 1318 1319 1320 1321 1322 | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | - + | pParse->pTriggerTab = sqlite3FindTable(db, pNew->table, db->aDb[sqlite3SchemaToIndex(db, pNew->pTabSchema)].zDbSName ); pParse->eTriggerOp = pNew->op; /* ALWAYS() because if the table of the trigger does not exist, the ** error would have been hit before this point */ if( ALWAYS(pParse->pTriggerTab) ){ |
︙ |
Changes to src/btree.c.
︙ | |||
5985 5986 5987 5988 5989 5990 5991 | 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 | - + | *pRes = c; return SQLITE_OK; /* Cursor already pointing at the correct spot */ } if( pCur->iPage>0 && indexCellCompare(pCur, 0, pIdxKey, xRecordCompare)<=0 && pIdxKey->errCode==SQLITE_OK ){ |
︙ |
Changes to src/build.c.
︙ | |||
3060 3061 3062 3063 3064 3065 3066 | 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 | - - + + + | return; } #endif /* SQLITE_OMIT_VIEW */ #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) /* ** The Table structure pTable is really a VIEW. Fill in the names of |
︙ | |||
3184 3185 3186 3187 3188 3189 3190 | 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 | - + | nErr++; } pTable->pSchema->schemaFlags |= DB_UnresetViews; if( db->mallocFailed ){ sqlite3DeleteColumnNames(db, pTable); } #endif /* SQLITE_OMIT_VIEW */ |
︙ |
Changes to src/date.c.
︙ | |||
267 268 269 270 271 272 273 | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - - + + | datetimeError(p); return; } if( M<=2 ){ Y--; M += 12; } |
︙ | |||
452 453 454 455 456 457 458 | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | - + - - + + | return iJD>=0 && iJD<=INT_464269060799999; } /* ** Compute the Year, Month, and Day from the julian day number. */ static void computeYMD(DateTime *p){ |
︙ |
Changes to src/func.c.
︙ | |||
2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 | 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 | + + | = (GroupConcatCtx*)sqlite3_aggregate_context(context, 0); if( pGCC ){ StrAccum *pAccum = &pGCC->str; if( pAccum->accError==SQLITE_TOOBIG ){ sqlite3_result_error_toobig(context); }else if( pAccum->accError==SQLITE_NOMEM ){ sqlite3_result_error_nomem(context); }else if( pGCC->nAccum>0 && pAccum->nChar==0 ){ sqlite3_result_text(context, "", 1, SQLITE_STATIC); }else{ const char *zText = sqlite3_str_value(pAccum); sqlite3_result_text(context, zText, pAccum->nChar, SQLITE_TRANSIENT); } } } #else |
︙ |
Changes to src/insert.c.
︙ | |||
713 714 715 716 717 718 719 720 721 722 723 724 725 726 | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | + | } if( pRet ){ SelectDest dest; pRet->pSrc->nSrc = 1; pRet->pPrior = pLeft->pPrior; pRet->op = pLeft->op; if( pRet->pPrior ) pRet->selFlags |= SF_Values; pLeft->pPrior = 0; pLeft->op = TK_SELECT; assert( pLeft->pNext==0 ); assert( pRet->pNext==0 ); p = &pRet->pSrc->a[0]; p->pSelect = pLeft; p->fg.viaCoroutine = 1; |
︙ |
Changes to src/json.c.
︙ | |||
2843 2844 2845 2846 2847 2848 2849 | 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 | - + + + | } if( zPath[0]=='.' ){ int rawKey = 1; x = pParse->aBlob[iRoot]; zPath++; if( zPath[0]=='"' ){ zKey = zPath + 1; |
︙ |
Changes to src/parse.y.
︙ | |||
526 527 528 529 530 531 532 | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | - - - + + + | if( pLoop->pOrderBy || pLoop->pLimit ){ sqlite3ErrorMsg(pParse,"%s clause should come after %s not before", pLoop->pOrderBy!=0 ? "ORDER BY" : "LIMIT", sqlite3SelectOpName(pNext->op)); break; } } |
︙ |
Changes to src/resolve.c.
︙ | |||
224 225 226 227 228 229 230 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | - + - + | /* ** Return TRUE (non-zero) if zTab is a valid name for the schema table pTab. */ static SQLITE_NOINLINE int isValidSchemaTableName( const char *zTab, /* Name as it appears in the SQL */ Table *pTab, /* The schema table we are trying to match */ |
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + | } if( pItem->zAlias!=0 ){ if( sqlite3StrICmp(zTab, pItem->zAlias)!=0 ){ continue; } }else if( sqlite3StrICmp(zTab, pTab->zName)!=0 ){ if( pTab->tnum!=1 ) continue; |
︙ | |||
1292 1293 1294 1295 1296 1297 1298 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | - + | if( is_agg ){ if( pExpr->pLeft ){ assert( pExpr->pLeft->op==TK_ORDER ); assert( ExprUseXList(pExpr->pLeft) ); sqlite3WalkExprList(pWalker, pExpr->pLeft->x.pList); } #ifndef SQLITE_OMIT_WINDOWFUNC |
︙ | |||
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 | + + + - + - + - + - + | return pNC->nNcErr>0 || w.pParse->nErr>0; } /* ** Resolve all names for all expression in an expression list. This is ** just like sqlite3ResolveExprNames() except that it works for an expression ** list rather than a single expression. ** ** The return value is SQLITE_OK (0) for success or SQLITE_ERROR (1) for a ** failure. */ int sqlite3ResolveExprListNames( NameContext *pNC, /* Namespace to resolve expressions in. */ ExprList *pList /* The expression list to be analyzed. */ ){ int i; int savedHasAgg = 0; Walker w; |
︙ |
Changes to src/select.c.
︙ | |||
6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 | 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 | + | static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ Vdbe *v = pParse->pVdbe; int i; struct AggInfo_func *pF; for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){ ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); if( pParse->nErr ) return; pList = pF->pFExpr->x.pList; if( pF->iOBTab>=0 ){ /* For an ORDER BY aggregate, calls to OP_AggStep were deferred. Inputs ** were stored in emphermal table pF->iOBTab. Here, we extract those ** inputs (in ORDER BY order) and make all calls to OP_AggStep ** before doing the OP_AggFinal call. */ int iTop; /* Start of loop for extracting columns */ |
︙ | |||
6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 | 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 | + + | sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); sqlite3VdbeChangeP5(v, (u8)nArg); sqlite3ReleaseTempRange(pParse, regAgg, nArg); } if( addrNext ){ sqlite3VdbeResolveLabel(v, addrNext); } if( pParse->nErr ) return; } if( regHit==0 && pAggInfo->nAccumulator ){ regHit = regAcc; } if( regHit ){ addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v); } for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){ sqlite3ExprCode(pParse, pC->pCExpr, AggInfoColumnReg(pAggInfo,i)); if( pParse->nErr ) return; } pAggInfo->directMode = 0; if( addrHitTest ){ sqlite3VdbeJumpHereOrPopInst(v, addrHitTest); } } |
︙ |
Changes to src/shell.c.in.
︙ | |||
8973 8974 8975 8976 8977 8978 8979 | 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 | - + + + + + - + - + - + + | } zSql = sqlite3_mprintf("SELECT count(*) FROM pragma_table_info(%Q,%Q);", zTable, zSchema); if( zSql==0 ){ import_cleanup(&sCtx); shell_out_of_memory(); } |
︙ |
Changes to src/sqliteInt.h.
︙ | |||
3384 3385 3386 3387 3388 3389 3390 | 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 | - + | #define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */ #define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */ #define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */ #define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */ #define WHERE_AGG_DISTINCT 0x0400 /* Query is "SELECT agg(DISTINCT ...)" */ #define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ #define WHERE_RIGHT_JOIN 0x1000 /* Processing a RIGHT JOIN */ |
︙ |
Changes to src/vdbeInt.h.
︙ | |||
536 537 538 539 540 541 542 543 544 545 546 547 548 549 | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | + | KeyInfo keyinfo; UnpackedRecord *pUnpacked; /* Unpacked version of aRecord[] */ UnpackedRecord *pNewUnpacked; /* Unpacked version of new.* record */ int iNewReg; /* Register for new.* values */ int iBlobWrite; /* Value returned by preupdate_blobwrite() */ i64 iKey1; /* First key value passed to hook */ i64 iKey2; /* Second key value passed to hook */ Mem oldipk; /* Memory cell holding "old" IPK value */ Mem *aNew; /* Array of new.* values */ Table *pTab; /* Schema object being updated */ Index *pPk; /* PK index if pTab is WITHOUT ROWID */ }; /* ** An instance of this object is used to pass an vector of values into |
︙ |
Changes to src/vdbeapi.c.
︙ | |||
2176 2177 2178 2179 2180 2181 2182 | 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 | + + + + - - - - + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + | iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); } if( iIdx>=p->pCsr->nField || iIdx<0 ){ rc = SQLITE_RANGE; goto preupdate_old_out; } if( iIdx==p->pTab->iPKey ){ pMem = *ppValue = &p->oldipk; sqlite3VdbeMemSetInt64(pMem, p->iKey1); }else{ |
︙ |
Changes to src/vdbeaux.c.
︙ | |||
5332 5333 5334 5335 5336 5337 5338 | 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 | - + + - + + | ** ** The returned value must be freed by the caller using sqlite3ValueFree(). */ sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ assert( iVar>0 ); if( v ){ Mem *pMem = &v->aVar[iVar-1]; |
︙ | |||
5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 | 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 | + | db->pPreUpdate = &preupdate; db->xPreUpdateCallback(db->pPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2); db->pPreUpdate = 0; sqlite3DbFree(db, preupdate.aRecord); vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pUnpacked); vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pNewUnpacked); sqlite3VdbeMemRelease(&preupdate.oldipk); if( preupdate.aNew ){ int i; for(i=0; i<pCsr->nField; i++){ sqlite3VdbeMemRelease(&preupdate.aNew[i]); } sqlite3DbNNFreeNN(db, preupdate.aNew); } } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ |
Changes to src/where.c.
︙ | |||
3955 3956 3957 3958 3959 3960 3961 | 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 | - + + + | }else{ assert( isCov==WHERE_EXPRIDX ); WHERETRACE(0x200, ("-> %s might be a covering expression index" " according to whereIsCoveringIndex()\n", pProbe->zName)); } } |
︙ | |||
5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 | 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 | + + + + | ** 5) The table must not have an inner-join ON or USING clause if there is ** a RIGHT JOIN anywhere in the query. Otherwise the ON/USING clause ** might move from the right side to the left side of the RIGHT JOIN. ** Note: Due to (2), this condition can only arise if the table is ** the right-most table of a subquery that was flattened into the ** main query and that subquery was the right-hand operand of an ** inner join that held an ON or USING clause. ** 6) The ORDER BY clause has 63 or fewer terms ** 7) The omit-noop-join optimization is enabled. ** ** Items (1), (6), and (7) are checked by the caller. ** ** For example, given: ** ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); ** |
︙ | |||
5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 | 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 | + | tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy); } hasRightJoin = (pWInfo->pTabList->a[0].fg.jointype & JT_LTORJ)!=0; for(i=pWInfo->nLevel-1; i>=1; i--){ WhereTerm *pTerm, *pEnd; SrcItem *pItem; WhereLoop *pLoop; Bitmask m1; pLoop = pWInfo->a[i].pWLoop; pItem = &pWInfo->pTabList->a[pLoop->iTab]; if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ) continue; if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0 && (pLoop->wsFlags & WHERE_ONEROW)==0 ){ continue; |
︙ | |||
5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 | 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 | + + | && pTerm->pExpr->w.iJoin==pItem->iCursor ){ break; /* restriction (5) */ } } if( pTerm<pEnd ) continue; WHERETRACE(0xffffffff, ("-> drop loop %c not used\n", pLoop->cId)); m1 = MASKBIT(i)-1; pWInfo->revMask = (m1 & pWInfo->revMask) | ((pWInfo->revMask>>1) & ~m1); notReady &= ~pLoop->maskSelf; for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){ if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ pTerm->wtFlags |= TERM_CODED; } } if( i!=pWInfo->nLevel-1 ){ |
︙ | |||
6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 | 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 | + | memset(&sWLB, 0, sizeof(sWLB)); /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ testcase( pOrderBy && pOrderBy->nExpr==BMS-1 ); if( pOrderBy && pOrderBy->nExpr>=BMS ){ pOrderBy = 0; wctrlFlags &= ~WHERE_WANT_DISTINCT; wctrlFlags |= WHERE_KEEP_ALL_JOINS; /* Disable omit-noop-join opt */ } /* The number of tables in the FROM clause is limited by the number of ** bits in a Bitmask */ testcase( pTabList->nSrc==BMS ); if( pTabList->nSrc>BMS ){ |
︙ | |||
6557 6558 6559 6560 6561 6562 6563 | 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 | - - - - + + + + | ** procedure to keep the sqlite3WhereBegin() procedure from becoming ** too large. If sqlite3WhereBegin() becomes too large, that prevents ** some C-compiler optimizers from in-lining the ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons. */ notReady = ~(Bitmask)0; |
︙ | |||
6880 6881 6882 6883 6884 6885 6886 | 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 | - - - - - - - - - - - - - - - - - - - - | VdbeOp *pOp ){ if( (db->flags & SQLITE_VdbeAddopTrace)==0 ) return; sqlite3VdbePrintOp(0, pc, pOp); } #endif |
︙ | |||
7199 7200 7201 7202 7203 7204 7205 | 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 | - - + - - - - + + - - - - + | pOp->p1 = pLevel->iIdxCur; OpcodeRewriteTrace(db, k, pOp); }else{ /* Unable to translate the table reference into an index ** reference. Verify that this is harmless - that the ** table being referenced really is open. */ |
︙ |
Changes to src/whereexpr.c.
︙ | |||
209 210 211 212 213 214 215 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 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 | - - + + + + + + - + + + + + + + + + + + - + - + | sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ assert( !ExprHasProperty(pRight, EP_IntValue) ); z = (u8*)pRight->u.zToken; } if( z ){ |
︙ |
Added test/date5.test.