Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Merge all the latest trunk enhancements into the recursive-cte-orderby-fix branch. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | recursive-cte-orderby-fix |
Files: | files | file ages | folders |
SHA3-256: |
5f159e542552bb2c589ddb167f38157f |
User & Date: | drh 2024-06-27 15:03:14 |
2024-06-27
| ||
15:03 | Merge all the latest trunk enhancements into the recursive-cte-orderby-fix branch. (Leaf check-in: 5f159e54 user: drh tags: recursive-cte-orderby-fix) | |
14:54 | Merge the latest trunk enhancements into the exists-to-join branch. (Leaf check-in: fc643f8a user: drh tags: exists-to-join) | |
2024-06-14
| ||
19:27 | Fix harmless comment typo. (check-in: ca063802 user: drh tags: recursive-cte-orderby-fix) | |
Changes to doc/compile-for-windows.md.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 6. Run the "`Makefile.msc`" makefile with an appropriate target. Examples: <ul> <li> `nmake /f makefile.msc` <li> `nmake /f makefile.msc sqlite3.c` <li> `nmake /f makefile.msc devtest` <li> `nmake /f makefile.msc releasetest` </ul> ## 32-bit Builds Doing a 32-bit build is just like doing a 64-bit build with the following minor changes: 1. Use the "x86 Native Tools Command Prompt" instead of | > > > > > > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 6. Run the "`Makefile.msc`" makefile with an appropriate target. Examples: <ul> <li> `nmake /f makefile.msc` <li> `nmake /f makefile.msc sqlite3.c` <li> `nmake /f makefile.msc devtest` <li> `nmake /f makefile.msc releasetest` <li> `nmake /f makefile.msc sqlite3.exe` </ul> 7. For a debugging build of the CLI, where the ".treetrace" and ".wheretrace" commands work, add the DEBUG=3 argument to nmake. Like this: <ul> <li> `nmake /f makefile.msc DEBUG=3 clean sqlite3.exe` </ul> ## 32-bit Builds Doing a 32-bit build is just like doing a 64-bit build with the following minor changes: 1. Use the "x86 Native Tools Command Prompt" instead of |
︙ | ︙ |
Changes to ext/fts5/fts5_expr.c.
︙ | ︙ | |||
1890 1891 1892 1893 1894 1895 1896 | int iPhrase, Fts5Expr **ppNew ){ int rc = SQLITE_OK; /* Return code */ Fts5ExprPhrase *pOrig = 0; /* The phrase extracted from pExpr */ Fts5Expr *pNew = 0; /* Expression to return via *ppNew */ TokenCtx sCtx = {0,0,0}; /* Context object for fts5ParseTokenize */ | | | 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 | int iPhrase, Fts5Expr **ppNew ){ int rc = SQLITE_OK; /* Return code */ Fts5ExprPhrase *pOrig = 0; /* The phrase extracted from pExpr */ Fts5Expr *pNew = 0; /* Expression to return via *ppNew */ TokenCtx sCtx = {0,0,0}; /* Context object for fts5ParseTokenize */ if( !pExpr || iPhrase<0 || iPhrase>=pExpr->nPhrase ){ rc = SQLITE_RANGE; }else{ pOrig = pExpr->apExprPhrase[iPhrase]; pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr)); } if( rc==SQLITE_OK ){ pNew->apExprPhrase = (Fts5ExprPhrase**)sqlite3Fts5MallocZero(&rc, |
︙ | ︙ |
Changes to ext/fts5/fts5_main.c.
︙ | ︙ | |||
959 960 961 962 963 964 965 966 967 968 969 970 971 972 | if( rc!=SQLITE_OK ){ pCursor->pVtab->zErrMsg = sqlite3_mprintf( "%s", sqlite3_errmsg(pConfig->db) ); } }else{ rc = SQLITE_OK; } break; } } } return rc; | > | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | if( rc!=SQLITE_OK ){ pCursor->pVtab->zErrMsg = sqlite3_mprintf( "%s", sqlite3_errmsg(pConfig->db) ); } }else{ rc = SQLITE_OK; CsrFlagSet(pCsr, FTS5CSR_REQUIRE_DOCSIZE); } break; } } } return rc; |
︙ | ︙ | |||
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 | /* ** Return the rowid that the cursor currently points to. */ static i64 fts5CursorRowid(Fts5Cursor *pCsr){ assert( pCsr->ePlan==FTS5_PLAN_MATCH || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH || pCsr->ePlan==FTS5_PLAN_SOURCE ); if( pCsr->pSorter ){ return pCsr->pSorter->iRowid; }else{ return sqlite3Fts5ExprRowid(pCsr->pExpr); } } /* ** This is the xRowid method. The SQLite core calls this routine to ** retrieve the rowid for the current row of the result set. fts5 ** exposes %_content.rowid as the rowid for the virtual table. The ** rowid should be written to *pRowid. */ static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int ePlan = pCsr->ePlan; assert( CsrFlagTest(pCsr, FTS5CSR_EOF)==0 ); | > > > > < | | < | < < < | < < < < < | 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | /* ** Return the rowid that the cursor currently points to. */ static i64 fts5CursorRowid(Fts5Cursor *pCsr){ assert( pCsr->ePlan==FTS5_PLAN_MATCH || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH || pCsr->ePlan==FTS5_PLAN_SOURCE || pCsr->ePlan==FTS5_PLAN_SCAN || pCsr->ePlan==FTS5_PLAN_ROWID ); if( pCsr->pSorter ){ return pCsr->pSorter->iRowid; }else if( pCsr->ePlan>=FTS5_PLAN_SCAN ){ return sqlite3_column_int64(pCsr->pStmt, 0); }else{ return sqlite3Fts5ExprRowid(pCsr->pExpr); } } /* ** This is the xRowid method. The SQLite core calls this routine to ** retrieve the rowid for the current row of the result set. fts5 ** exposes %_content.rowid as the rowid for the virtual table. The ** rowid should be written to *pRowid. */ static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int ePlan = pCsr->ePlan; assert( CsrFlagTest(pCsr, FTS5CSR_EOF)==0 ); if( ePlan==FTS5_PLAN_SPECIAL ){ *pRowid = 0; }else{ *pRowid = fts5CursorRowid(pCsr); } return SQLITE_OK; } /* ** If the cursor requires seeking (bSeekRequired flag is set), seek it. |
︙ | ︙ |
Changes to ext/fts5/test/fts5_common.tcl.
︙ | ︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 | } set res } proc fts5_test_rowcount {cmd} { $cmd xRowCount } proc test_queryphrase_cb {cnt cmd} { upvar $cnt L for {set i 0} {$i < [$cmd xInstCount]} {incr i} { foreach {ip ic io} [$cmd xInst $i] break set A($ic) 1 } | > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | } set res } proc fts5_test_rowcount {cmd} { $cmd xRowCount } proc fts5_test_rowid {cmd} { $cmd xRowid } proc test_queryphrase_cb {cnt cmd} { upvar $cnt L for {set i 0} {$i < [$cmd xInstCount]} {incr i} { foreach {ip ic io} [$cmd xInst $i] break set A($ic) 1 } |
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 | fts5_test_columntext fts5_test_columntotalsize fts5_test_poslist fts5_test_poslist2 fts5_test_collist fts5_test_tokenize fts5_test_rowcount fts5_test_all fts5_test_queryphrase fts5_test_phrasecount fts5_columntext fts5_queryphrase fts5_collist | > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | fts5_test_columntext fts5_test_columntotalsize fts5_test_poslist fts5_test_poslist2 fts5_test_collist fts5_test_tokenize fts5_test_rowcount fts5_test_rowid fts5_test_all fts5_test_queryphrase fts5_test_phrasecount fts5_columntext fts5_queryphrase fts5_collist |
︙ | ︙ |
Changes to ext/fts5/test/fts5ab.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ab | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ab # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ac.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ac | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ac # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ad.test.
︙ | ︙ | |||
14 15 16 17 18 19 20 | # More specifically, the focus is on testing prefix queries, both with and # without prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ad | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # More specifically, the focus is on testing prefix queries, both with and # without prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ad # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ae.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ae | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # focus of this script is testing the FTS5 module. # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ae # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5af.test.
︙ | ︙ | |||
14 15 16 17 18 19 20 | # More specifically, the tests in this file focus on the built-in # snippet() function. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5af | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # More specifically, the tests in this file focus on the built-in # snippet() function. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5af # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ag.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ag | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ag # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # This file attempts to verify that the extension APIs work with |
︙ | ︙ |
Changes to ext/fts5/test/fts5ah.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # focus of this script is testing the FTS5 module. # # TESTRUNNER: slow source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ah | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # focus of this script is testing the FTS5 module. # # TESTRUNNER: slow source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ah # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ai.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # Specifically, it tests transactions and savepoints # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ai | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # Specifically, it tests transactions and savepoints # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ai # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5aj.test.
︙ | ︙ | |||
15 16 17 18 19 20 21 | # constant, the FTS index does not grow indefinitely as rows are inserted # and deleted, # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5aj | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # constant, the FTS index does not grow indefinitely as rows are inserted # and deleted, # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5aj # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc doc {} { set dict [list a b c d e f g h i j k l m n o p q r s t u v w x y z] |
︙ | ︙ |
Changes to ext/fts5/test/fts5ak.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # Specifically, the auxiliary function "highlight". # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ak | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # Specifically, the auxiliary function "highlight". # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ak # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5al.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # Specifically, this function tests the %_config table. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5al | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # Specifically, this function tests the %_config table. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5al # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5alter.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # The tests in this file focus on renaming FTS5 tables using the # "ALTER TABLE ... RENAME TO ..." command # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5alter | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # The tests in this file focus on renaming FTS5 tables using the # "ALTER TABLE ... RENAME TO ..." command # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5alter # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # Test renaming regular, contentless and columnsize=0 FTS5 tables. |
︙ | ︙ |
Changes to ext/fts5/test/fts5auto.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file contains automatically generated tests for various types # of MATCH expressions. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5auto | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file contains automatically generated tests for various types # of MATCH expressions. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5auto # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set data { -4026076 |
︙ | ︙ |
Changes to ext/fts5/test/fts5aux.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on the auxiliary function APIs. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5aux | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on the auxiliary function APIs. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5aux # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc inst {cmd i} { $cmd xInst $i |
︙ | ︙ |
Added ext/fts5/test/fts5aux2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | # 2024 June 24 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # Tests focusing on the auxiliary function APIs. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5aux # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE x1 USING fts5(a, b); INSERT INTO x1 VALUES('a b', 'c d'); INSERT INTO x1 VALUES('d e', 'a b'); INSERT INTO x1 VALUES('a b', 'e f'); INSERT INTO x1 VALUES('d e', 'c d'); } fts5_aux_test_functions db do_execsql_test 1.1 { SELECT fts5_test_all(x1) FROM x1 WHERE rowid=2 } [list [list {*}{ columnsize {2 2} columntext {{d e} {a b}} columntotalsize {8 8} poslist {} tokenize {{d e} {a b}} rowcount 4 }]] do_execsql_test 1.2 { SELECT fts5_test_columntext(x1) FROM x1 } { {{a b} {c d}} {{d e} {a b}} {{a b} {e f}} {{d e} {c d}} } do_execsql_test 1.3 { SELECT fts5_test_rowid(x1) FROM x1 } { 1 2 3 4 } do_execsql_test 1.4 { SELECT fts5_test_phrasecount(x1) FROM x1 } { 0 0 0 0 } do_catchsql_test 1.5 { SELECT fts5_queryphrase(x1, 0) FROM x1 } {1 SQLITE_RANGE} do_execsql_test 1.6 { SELECT fts5_test_rowcount(x1) FROM x1 } {4 4 4 4} finish_test |
Changes to ext/fts5/test/fts5auxdata.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on the fts5 xSetAuxdata() and xGetAuxdata() APIs. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5auxdata | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on the fts5 xSetAuxdata() and xGetAuxdata() APIs. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5auxdata # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE f1 USING fts5(a, b); |
︙ | ︙ |
Changes to ext/fts5/test/fts5bigpl.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # 4 or 5 byte position-list size varints. Because of the amount of memory # required, these tests only run on 64-bit platforms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5bigpl | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # 4 or 5 byte position-list size varints. Because of the amount of memory # required, these tests only run on 64-bit platforms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5bigpl # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } if { $tcl_platform(wordSize)<8 } { finish_test |
︙ | ︙ |
Changes to ext/fts5/test/fts5columnsize.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on fts5 tables with the columnsize=0 option. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5columnsize | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on fts5 tables with the columnsize=0 option. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5columnsize # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # Check that the option can be parsed and that the %_docsize table is |
︙ | ︙ |
Changes to ext/fts5/test/fts5config.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file focuses on the code in fts5_config.c, which is largely concerned # with parsing the various configuration and CREATE TABLE options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5config | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file focuses on the code in fts5_config.c, which is largely concerned # with parsing the various configuration and CREATE TABLE options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5config # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # Try different types of quote characters. |
︙ | ︙ |
Changes to ext/fts5/test/fts5content.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5content | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5content # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # Contentless tables |
︙ | ︙ |
Changes to ext/fts5/test/fts5contentless.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } # Check that it is not possible to specify "contentless_delete=1" for # anything other than a contentless table. |
︙ | ︙ |
Changes to ext/fts5/test/fts5contentless2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc vocab {} { list aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn ooo ppp |
︙ | ︙ |
Changes to ext/fts5/test/fts5contentless3.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless3 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless3 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE ft USING fts5(x, content=, contentless_delete=1); |
︙ | ︙ |
Changes to ext/fts5/test/fts5contentless4.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless4 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless4 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc document {n} { set vocab [list A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] |
︙ | ︙ |
Changes to ext/fts5/test/fts5contentless5.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless5 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests for the content= and content_rowid= options. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5contentless5 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(a, b, c, content='', contentless_delete=1); |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file tests that the FTS5 'integrity-check' command detects # inconsistencies (corruption) in the on-disk backing tables. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file tests that the FTS5 'integrity-check' command detects # inconsistencies (corruption) in the on-disk backing tables. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(x); |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt2.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt2 | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 # Create a simple FTS5 table containing 100 documents. Each document |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt3.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt3 | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt3 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 database_may_be_corrupt |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt4.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt4 | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt4 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 do_execsql_test 1.0 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt5.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt5 | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt5 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 database_may_be_corrupt |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt6.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt6 | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # inconsistencies in the backing tables) correctly. In this case # "correctly" means without crashing. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt6 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 database_may_be_corrupt |
︙ | ︙ |
Changes to ext/fts5/test/fts5corrupt7.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt7 | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5corrupt7 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_may_be_corrupt 1 do_execsql_test 1.0 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5dlidx.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This test is focused on uses of doclist-index records. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5dlidx | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This test is focused on uses of doclist-index records. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5dlidx # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } if { $tcl_platform(wordSize)<8 } { finish_test |
︙ | ︙ |
Changes to ext/fts5/test/fts5doclist.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This test is focused on edge cases in the doclist format. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5doclist | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This test is focused on edge cases in the doclist format. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5doclist # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- |
︙ | ︙ |
Changes to ext/fts5/test/fts5ea.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # Test the fts5 expression parser directly using the fts5_expr() SQL # test function. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ea | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Test the fts5 expression parser directly using the fts5_expr() SQL # test function. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ea # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc do_syntax_error_test {tn expr err} { set ::se_expr $expr |
︙ | ︙ |
Changes to ext/fts5/test/fts5eb.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5eb | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5eb # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc do_syntax_error_test {tn expr err} { set ::se_expr $expr |
︙ | ︙ |
Changes to ext/fts5/test/fts5fault6.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # This file is focused on OOM errors. # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5fault6 | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # This file is focused on OOM errors. # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5fault6 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- |
︙ | ︙ |
Changes to ext/fts5/test/fts5faultG.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5faultG | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5faultG # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set ::testprefix fts5faultG |
︙ | ︙ |
Changes to ext/fts5/test/fts5faultH.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5faultG | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5faultG # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set ::testprefix fts5faultH |
︙ | ︙ |
Changes to ext/fts5/test/fts5full.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # segid to use. In practice this can only really happen when automerge and # crisismerge are both disabled. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5full | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # segid to use. In practice this can only really happen when automerge and # crisismerge are both disabled. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5full # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE x8 USING fts5(i); |
︙ | ︙ |
Changes to ext/fts5/test/fts5hash.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # The tests in this file are focused on the code in fts5_hash.c. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5hash | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # The tests in this file are focused on the code in fts5_hash.c. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5hash # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- # Return a list of tokens (a vocabulary) that all share the same hash |
︙ | ︙ |
Changes to ext/fts5/test/fts5integrity.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests focused on the integrity-check procedure. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5integrity | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests focused on the integrity-check procedure. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5integrity # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE xx USING fts5(x); |
︙ | ︙ |
Changes to ext/fts5/test/fts5lastrowid.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests of the last_insert_rowid functionality with fts5. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5lastrowid | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests of the last_insert_rowid functionality with fts5. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5lastrowid # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(str); |
︙ | ︙ |
Changes to ext/fts5/test/fts5matchinfo.test.
︙ | ︙ | |||
513 514 515 516 517 518 519 | SELECT quote(matchinfo(t1, 'n')) FROM t1 LIMIT 1; } $res fts5_aux_test_functions db do_execsql_test 15.3 { SELECT fts5_test_all(t1) FROM t1 LIMIT 1; } { | | | 513 514 515 516 517 518 519 520 521 522 523 | SELECT quote(matchinfo(t1, 'n')) FROM t1 LIMIT 1; } $res fts5_aux_test_functions db do_execsql_test 15.3 { SELECT fts5_test_all(t1) FROM t1 LIMIT 1; } { {columnsize {1 1} columntext {c d} columntotalsize {2 2} poslist {} tokenize {c d} rowcount 2} } finish_test |
Changes to ext/fts5/test/fts5merge.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Test that focus on incremental merges of segments. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5merge | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Test that focus on incremental merges of segments. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5merge # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } db func repeat [list string repeat] |
︙ | ︙ |
Changes to ext/fts5/test/fts5near.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on the NEAR operator. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5near | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on the NEAR operator. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5near # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc do_near_test {tn doc near res} { uplevel [list do_execsql_test $tn " |
︙ | ︙ |
Changes to ext/fts5/test/fts5optimize.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } # # 1.* - Warm body tests for index optimization using ('optimize') |
︙ | ︙ |
Changes to ext/fts5/test/fts5optimize2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set nLoop 2500 |
︙ | ︙ |
Changes to ext/fts5/test/fts5optimize3.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # TESTRUNNER: superslow # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5optimize2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set nLoop 2500 |
︙ | ︙ |
Changes to ext/fts5/test/fts5origintext.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5origintext2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_register_origintext db do_execsql_test 1.0 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5origintext3.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext3 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext3 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { reset_db |
︙ | ︙ |
Changes to ext/fts5/test/fts5origintext4.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext4 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext4 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } # The tests below verify that a doclist-index is used to limit the number # of pages loaded into the cache. It does this by querying sqlite3_db_status() |
︙ | ︙ |
Changes to ext/fts5/test/fts5origintext5.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests for tables that use both tokendata=1 and contentless_delete=1. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests for tables that use both tokendata=1 and contentless_delete=1. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5origintext # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } # Return a random integer between 0 and n-1. # |
︙ | ︙ |
Changes to ext/fts5/test/fts5phrase.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5phrase | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focused on phrase queries. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5phrase # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t3 USING fts5(a, b, c); |
︙ | ︙ |
Changes to ext/fts5/test/fts5plan.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file focuses on testing the planner (xBestIndex function). # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5plan | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file focuses on testing the planner (xBestIndex function). # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5plan # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE TABLE t1(x, y); |
︙ | ︙ |
Changes to ext/fts5/test/fts5porter.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # http://tartarus.org/martin/PorterStemmer/ # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5porter | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # http://tartarus.org/martin/PorterStemmer/ # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5porter # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set test_vocab { a a aaron aaron |
︙ | ︙ |
Changes to ext/fts5/test/fts5porter2.test.
︙ | ︙ | |||
14 15 16 17 18 19 20 | # These are extra tests added to those in fts5porter.test in order to # improve test coverage of the porter stemmer implementation. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5porter2 | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # These are extra tests added to those in fts5porter.test in order to # improve test coverage of the porter stemmer implementation. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5porter2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } set test_vocab { tion tion |
︙ | ︙ |
Changes to ext/fts5/test/fts5prefix.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests focused on prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5prefix | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests focused on prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5prefix # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE xx USING fts5(x, prefix=1); |
︙ | ︙ |
Changes to ext/fts5/test/fts5prefix2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file contains tests focused on prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5prefix2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file contains tests focused on prefix indexes. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5prefix2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach p {3 2 1} { reset_db |
︙ | ︙ |
Changes to ext/fts5/test/fts5query.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5query | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5query # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } for {set tn 1 ; set pgsz 64} {$tn<32} {incr tn; incr pgsz 16} { reset_db |
︙ | ︙ |
Changes to ext/fts5/test/fts5rank.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file focuses on testing queries that use the "rank" column. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rank | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file focuses on testing queries that use the "rank" column. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rank # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } #------------------------------------------------------------------------- |
︙ | ︙ |
Changes to ext/fts5/test/fts5rebuild.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rebuild | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rebuild # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.1 { CREATE VIRTUAL TABLE f1 USING fts5(a, b); |
︙ | ︙ |
Changes to ext/fts5/test/fts5restart.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This file focuses on testing the planner (xBestIndex function). # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5restart | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This file focuses on testing the planner (xBestIndex function). # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5restart # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE f1 USING fts5(ff); |
︙ | ︙ |
Changes to ext/fts5/test/fts5rowid.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests of the scalar fts5_rowid() and fts5_decode() functions. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rowid | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests of the scalar fts5_rowid() and fts5_decode() functions. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5rowid # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_catchsql_test 1.1 { SELECT fts5_rowid() |
︙ | ︙ |
Changes to ext/fts5/test/fts5savepoint.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5savepoint | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5savepoint # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE ft USING fts5(c); |
︙ | ︙ |
Changes to ext/fts5/test/fts5securefault.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5securefault | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # focus of this script is testing the FTS5 module. # source [file join [file dirname [info script]] fts5_common.tcl] source $testdir/malloc_common.tcl set testprefix fts5securefault # If SQLITE_ENABLE_FTS5 is not defined, omit this file. return_if_no_fts5 do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(ab); INSERT INTO t1(rowid, ab) VALUES (0, 'abc'), (1, 'abc'), (2, 'abc'), (3, 'abc'), (4, 'def'); } |
︙ | ︙ |
Changes to ext/fts5/test/fts5simple.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } if 1 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5simple2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple2 | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(a, detail=none); |
︙ | ︙ |
Changes to ext/fts5/test/fts5simple3.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple3 | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5simple3 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } fts5_aux_test_functions db |
︙ | ︙ |
Changes to ext/fts5/test/fts5synonym.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on custom tokenizers that support synonyms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5synonym | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on custom tokenizers that support synonyms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5synonym # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc tcl_create {args} { return "tcl_tokenize" } |
︙ | ︙ |
Changes to ext/fts5/test/fts5synonym2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on custom tokenizers that support synonyms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5synonym2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on custom tokenizers that support synonyms. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5synonym2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach tok {query document} { foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5tokenizer.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on the built-in fts5 tokenizers. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5tokenizer | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on the built-in fts5 tokenizers. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5tokenizer # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5tokenizer2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on the built-in fts5 tokenizers. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5tokenizer2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on the built-in fts5 tokenizers. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5tokenizer2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } sqlite3_fts5_create_tokenizer db tst get_tst_tokenizer proc get_tst_tokenizer {args} { |
︙ | ︙ |
Changes to ext/fts5/test/fts5ubsan.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # This test is focused on edge cases that cause ubsan errors. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ubsan | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # This test is focused on edge cases that cause ubsan errors. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5ubsan # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE x1 USING fts5(x); |
︙ | ︙ |
Changes to ext/fts5/test/fts5unicode.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # Tests focusing on the fts5 tokenizers # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # Tests focusing on the fts5 tokenizers # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc tokenize_test {tn tokenizer input output} { uplevel [list do_test $tn [subst -nocommands { |
︙ | ︙ |
Changes to ext/fts5/test/fts5unicode2.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | # # This is a modified copy of FTS4 test file "fts4_unicode.test". # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode2 | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # # This is a modified copy of FTS4 test file "fts4_unicode.test". # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc do_unicode_token_test {tn input res} { uplevel [list do_test $tn [list \ |
︙ | ︙ |
Changes to ext/fts5/test/fts5unicode3.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # # Tests focusing on the fts5 tokenizers # source [file join [file dirname [info script]] fts5_common.tcl] | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # # Tests focusing on the fts5 tokenizers # source [file join [file dirname [info script]] fts5_common.tcl] # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } proc fts3_unicode_path {file} { file join .. [file dirname [info script]] .. .. fts3 unicode $file |
︙ | ︙ |
Changes to ext/fts5/test/fts5unicode4.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode4 | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #*********************************************************************** # # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unicode4 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE sss USING fts5(a, prefix=3); |
︙ | ︙ |
Changes to ext/fts5/test/fts5unindexed.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # The tests in this file focus on "unindexed" columns. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unindexed | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # The tests in this file focus on "unindexed" columns. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5unindexed # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.1 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5version.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # The tests in this file focus on testing that unrecognized file-format # versions are detected and reported. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5version | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # The tests in this file focus on testing that unrecognized file-format # versions are detected and reported. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5version # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.1 { |
︙ | ︙ |
Changes to ext/fts5/test/fts5vocab.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # The tests in this file focus on testing the fts5vocab module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5vocab | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # The tests in this file focus on testing the fts5vocab module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5vocab # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { |
︙ | ︙ |
Changes to ext/fts5/test/fts5vocab2.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # # The tests in this file focus on testing the fts5vocab module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5vocab2 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # # The tests in this file focus on testing the fts5vocab module. # source [file join [file dirname [info script]] fts5_common.tcl] set testprefix fts5vocab2 # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } do_execsql_test 1.0 { CREATE VIRTUAL TABLE t1 USING fts5(a, b); |
︙ | ︙ |
Changes to ext/wasm/GNUmakefile.
︙ | ︙ | |||
135 136 137 138 139 140 141 142 | # noise. The $(abspath...) GNU make function can transform relative # paths to absolute. dir.wasm := $(patsubst %/,%,$(dir $(MAKEFILE))) dir.api := api dir.jacc := jaccwabyt dir.common := common dir.fiddle := fiddle dir.tool := $(dir.top)/tool | > | > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | # noise. The $(abspath...) GNU make function can transform relative # paths to absolute. dir.wasm := $(patsubst %/,%,$(dir $(MAKEFILE))) dir.api := api dir.jacc := jaccwabyt dir.common := common dir.fiddle := fiddle dir.fiddle-debug := fiddle-debug dir.tool := $(dir.top)/tool CLEAN_FILES += *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ $(dir.fiddle)/*~ \ $(dir.fiddle-debug)/* ######################################################################## # dir.dout = output dir for deliverables. # # MAINTENANCE REMINDER: the output .js and .wasm files of certain emcc # buildables must be in _this_ dir, rather than a subdir, or else # parts of the generated code get confused and cannot load |
︙ | ︙ | |||
382 383 384 385 386 387 388 | # effect, so emcc_opt+=-g3 doesn't work. So... emcc_opt_full := $(emcc_opt) -g3 # ^^^ ALWAYS use -g3. See below for why. # # ^^^ -flto improves runtime speed at -O0 considerably but doubles # build time. # | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | # effect, so emcc_opt+=-g3 doesn't work. So... emcc_opt_full := $(emcc_opt) -g3 # ^^^ ALWAYS use -g3. See below for why. # # ^^^ -flto improves runtime speed at -O0 considerably but doubles # build time. # # ^^^^ (-O3, -Oz, -Os) all minify symbol names and there appears to be # no way around that except to use -g3, but -g3 causes the binary file # size to absolutely explode (approx. 5x larger). This minification # utterly breaks the resulting module, making it unsable except as # self-contained/self-referential-only code, as ALL of the exported # symbols get minified names. # # However, we have an option for using -Oz or -Os: # |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-opfs-async-proxy.js.
︙ | ︙ | |||
169 170 171 172 173 174 175 | } } return [dh, filename]; }; /** If the given file-holding object has a sync handle attached to it, | | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | } } return [dh, filename]; }; /** If the given file-holding object has a sync handle attached to it, that handle is removed and asynchronously closed. Though it may sound sensible to continue work as soon as the close() returns (noting that it's asynchronous), doing so can cause operations performed soon afterwards, e.g. a call to getSyncHandle(), to fail because they may happen out of order from the close(). OPFS does not guaranty that the actual order of operations is retained in such cases. i.e. always "await" on the result of this function. */ const closeSyncHandle = async (fh)=>{ if(fh.syncHandle){ log("Closing sync handle for",fh.filenameAbs); |
︙ | ︙ | |||
261 262 263 264 265 266 267 268 | errorObject.message ].join(' '), { cause: errorObject }); this.name = 'GetSyncHandleError'; } }; GetSyncHandleError.convertRc = (e,rc)=>{ | > > > > > > < < | | | | | | < | > > > > > > | < > | > > | | | > > > > > > > > > > > > > > | 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 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | 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)=>{ if( e instanceof GetSyncHandleError ){ if( e.cause.name==='NoModificationAllowedError' /* Inconsistent exception.name from Chrome/ium with the same exception.message text: */ || (e.cause.name==='DOMException' && 0===e.cause.message.indexOf('Access Handles cannot')) ){ return state.sq3Codes.SQLITE_BUSY; }else if( 'NotFoundError'===e.cause.name ){ /** Maintenance reminder: SQLITE_NOTFOUND, though it looks like a good match, has different semantics than NotFoundError and is not suitable here. */ return state.sq3Codes.SQLITE_CANTOPEN; } }else if( 'NotFoundError'===e?.name ){ return state.sq3Codes.SQLITE_CANTOPEN; } return rc; }; /** Returns the sync access handle associated with the given file handle object (which must be a valid handle object, as created by xOpen()), lazily opening it if needed. In order to help alleviate cross-tab contention for a dabase, if an exception is thrown while acquiring the handle, this routine will wait briefly and try again, up to some fixed number of times. If acquisition still fails at that point it will give up and propagate the exception. Client-level code will see that as an I/O error. 2024-06-12: there is a rare race condition here which has been reported a single time: https://sqlite.org/forum/forumpost/9ee7f5340802d600 What appears to be happening is that file we're waiting for a lock on is deleted while we wait. What currently happens here is that a locking exception is thrown but the exception type is NotFoundError. In such cases, we very probably should attempt to re-open/re-create the file an obtain the lock on it (noting that there's another race condition there). That's easy to say but creating a viable test for that condition has proven challenging so far. */ const getSyncHandle = async (fh,opName)=>{ if(!fh.syncHandle){ const t = performance.now(); log("Acquiring sync handle for",fh.filenameAbs); const maxTries = 6, msBase = state.asyncIdleWaitTime * 2; |
︙ | ︙ | |||
582 583 584 585 586 587 588 | readOnly: create ? false : (state.sq3Codes.SQLITE_OPEN_READONLY & flags), deleteOnClose: !!(state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags) }); fh.releaseImplicitLocks = (opfsFlags & state.opfsFlags.OPFS_UNLOCK_ASAP) || state.opfsFlags.defaultUnlockAsap; | < < < < < < < < < < < < < | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | readOnly: create ? false : (state.sq3Codes.SQLITE_OPEN_READONLY & flags), deleteOnClose: !!(state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags) }); fh.releaseImplicitLocks = (opfsFlags & state.opfsFlags.OPFS_UNLOCK_ASAP) || state.opfsFlags.defaultUnlockAsap; __openFiles[fid] = fh; storeAndNotify(opName, 0); }catch(e){ wTimeEnd(); error(opName,e); state.s11n.storeException(1,e); storeAndNotify(opName, state.sq3Codes.SQLITE_IOERR); |
︙ | ︙ | |||
670 671 672 673 674 675 676 | mTimeEnd(); }, xUnlock: async function(fid/*sqlite3_file pointer*/, lockType/*SQLITE_LOCK_...*/){ mTimeStart('xUnlock'); let rc = 0; const fh = __openFiles[fid]; | > | < > > | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | mTimeEnd(); }, xUnlock: async function(fid/*sqlite3_file pointer*/, lockType/*SQLITE_LOCK_...*/){ mTimeStart('xUnlock'); let rc = 0; const fh = __openFiles[fid]; if( fh.syncHandle && state.sq3Codes.SQLITE_LOCK_NONE===lockType /* Note that we do not differentiate between lock types in this VFS. We're either locked or unlocked. */ ){ wTimeStart('xUnlock'); try { await closeSyncHandle(fh) } catch(e){ state.s11n.storeException(1,e); rc = state.sq3Codes.SQLITE_IOERR_UNLOCK; } wTimeEnd(); |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-vfs-opfs.c-pp.js.
︙ | ︙ | |||
386 387 388 389 390 391 392 393 394 395 396 397 398 399 | counterpart... */ state.sq3Codes = Object.create(null); [ 'SQLITE_ACCESS_EXISTS', 'SQLITE_ACCESS_READWRITE', 'SQLITE_BUSY', 'SQLITE_ERROR', 'SQLITE_IOERR', 'SQLITE_IOERR_ACCESS', 'SQLITE_IOERR_CLOSE', 'SQLITE_IOERR_DELETE', 'SQLITE_IOERR_FSYNC', 'SQLITE_IOERR_LOCK', | > | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | 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', |
︙ | ︙ | |||
714 715 716 717 718 719 720 721 | 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. */ | > > > > > < | < | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | 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 */ wasm.poke(pOut, 0, 'i32'); return 0; }, xClose: function(pFile){ mTimeStart('xClose'); let rc = 0; const f = __openFiles[pFile]; if(f){ delete __openFiles[pFile]; rc = opRun('xClose', pFile); if(f.sq3File) f.sq3File.dispose(); } mTimeEnd(); return rc; }, xDeviceCharacteristics: function(pFile){ return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; }, xFileControl: function(pFile, opId, pArg){ /*mTimeStart('xFileControl'); mTimeEnd();*/ return capi.SQLITE_NOTFOUND; }, |
︙ | ︙ |
Changes to ext/wasm/common/whwasmutil.js.
︙ | ︙ | |||
152 153 154 155 156 157 158 | memory and returning its pointer. In Emscripten this is conventionally made available via `Module['_malloc']`. This API requires that the alloc routine throw on allocation error, as opposed to returning null or 0. - 'dealloc()` must behave like C's `free()`, accepting either a pointer returned from its allocation counterpart or the values | | < | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | memory and returning its pointer. In Emscripten this is conventionally made available via `Module['_malloc']`. This API requires that the alloc routine throw on allocation error, as opposed to returning null or 0. - 'dealloc()` must behave like C's `free()`, accepting either a pointer returned from its allocation counterpart or the values null/0 (for which it must be a no-op). In Emscripten this is conventionally made available via `Module['_free']`. APIs which require allocation routines are explicitly documented as such and/or have "alloc" in their names. This code is developed and maintained in conjunction with the Jaccwabyt project: |
︙ | ︙ | |||
726 727 728 729 730 731 732 | } if(list) list.push(rc); }while(list && arguments[0].length); return list || rc; }; /** | | | | | | | | | > | | | | 725 726 727 728 729 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 | } if(list) list.push(rc); }while(list && arguments[0].length); return list || rc; }; /** The counterpart of peek(), this sets a numeric value at the given WASM heap address, using the 3rd argument to define how many bytes are written. Throws if given an invalid type. See peek() for details about the `type` argument. If the 3rd argument ends with `*` then it is treated as a pointer type and this function behaves as if the 3rd argument were `i32`. If the first argument is an array, it is treated like a list of pointers and the given value is written to each one. Returns `this`. (Prior to 2022-12-09 it returned this function.) ACHTUNG: calling this often, e.g. in a loop to populate a large chunk of memory, can have a noticably painful impact on performance. Rather than doing so, use heapForSize() to fetch the heap object and assign directly to it or use the heap's set() method. */ target.poke = function(ptr, value, type='i8'){ if (type.endsWith('*')) type = ptrIR; const c = (cache.memory && cache.heapSize === cache.memory.buffer.byteLength) ? cache : heapWrappers(); for(const p of (Array.isArray(ptr) ? ptr : [ptr])){ switch (type) { |
︙ | ︙ |
Changes to ext/wasm/fiddle.make.
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | -Wno-limited-postlink-optimizations \ $(emcc.exportedRuntimeMethods) \ -sEXPORTED_FUNCTIONS=@$(abspath $(EXPORTED_FUNCTIONS.fiddle)) \ -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory \ $(SQLITE_OPT) $(SHELL_OPT) \ -DSQLITE_SHELL_FIDDLE # -D_POSIX_C_SOURCE is needed for strdup() with emcc fiddle.EXPORTED_FUNCTIONS.in := \ EXPORTED_FUNCTIONS.fiddle.in \ $(EXPORTED_FUNCTIONS.api) $(EXPORTED_FUNCTIONS.fiddle): $(fiddle.EXPORTED_FUNCTIONS.in) $(MAKEFILE.fiddle) sort -u $(fiddle.EXPORTED_FUNCTIONS.in) > $@ | > > > > > > > < < > > > | > | < | | > > | | | | | | | > > > > > > > > > | > | > | < > > > > | < | 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 67 68 69 70 71 72 73 74 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | -Wno-limited-postlink-optimizations \ $(emcc.exportedRuntimeMethods) \ -sEXPORTED_FUNCTIONS=@$(abspath $(EXPORTED_FUNCTIONS.fiddle)) \ -sEXPORTED_RUNTIME_METHODS=FS,wasmMemory \ $(SQLITE_OPT) $(SHELL_OPT) \ -DSQLITE_SHELL_FIDDLE # -D_POSIX_C_SOURCE is needed for strdup() with emcc # Flags specifically for debug builds of fiddle. Performance suffers # greatly in debug builds. fiddle.emcc-flags.debug := $(fiddle.emcc-flags) \ -DSQLITE_DEBUG \ -DSQLITE_ENABLE_SELECTTRACE \ -DSQLITE_ENABLE_WHERETRACE fiddle.EXPORTED_FUNCTIONS.in := \ EXPORTED_FUNCTIONS.fiddle.in \ $(EXPORTED_FUNCTIONS.api) $(EXPORTED_FUNCTIONS.fiddle): $(fiddle.EXPORTED_FUNCTIONS.in) $(MAKEFILE.fiddle) sort -u $(fiddle.EXPORTED_FUNCTIONS.in) > $@ fiddle.cses := $(dir.top)/shell.c $(sqlite3-wasm.c) $(eval $(call call-make-pre-post,fiddle-module,vanilla)) ######################################################################## # emit rules for one of the two fiddle builds. $1 must be # either $(dir.fiddle) or $(dir.fiddle-debug). $2 must be empty # in the former case and .debug in the latter. define make-fiddle-rules fiddle-module.js$(2) := $(1)/fiddle-module.js fiddle-module.wasm$(2) := $$(subst .js,.wasm,$$(fiddle-module.js$(2))) $(1): @test -d "$$@" || mkdir -p "$$@" $$(fiddle-module.js$(2)): $(1) $$(MAKEFILE) $$(MAKEFILE.fiddle) \ $$(EXPORTED_FUNCTIONS.fiddle) \ $$(fiddle.cses) $$(pre-post-fiddle-module-vanilla.deps) $$(fiddle.SOAP.js$(2)) $$(emcc.bin) -o $$@ $$(fiddle.emcc-flags$(2)) \ $$(pre-post-fiddle-module-vanilla.flags) \ $$(fiddle.cses) $$(maybe-wasm-strip) $$(fiddle-module.wasm$(2)) @cp -p $$(SOAP.js) $$(dir $$@) @if [[ x.debug = x$(2) ]]; then \ cp -p $$(dir.fiddle)/index.html \ $$(dir.fiddle)/fiddle.js \ $$(dir.fiddle)/fiddle-worker.js \ $$(dir $$@)/.; \ fi @for i in $(1)/*.*js $(1)/*.html $(1)/*.wasm; do \ test -f $$$${i} || continue; \ gzip < $$$${i} > $$$${i}.gz; \ done fiddle$(2): $$(fiddle-module.js$(2)) $(1)/fiddle.js.gz endef $(eval $(call make-fiddle-rules,$(dir.fiddle))) $(eval $(call make-fiddle-rules,$(dir.fiddle-debug),.debug)) fiddle: $(fiddle-module.js) $(fiddle-module.js.debug) fiddle.debug: $(fiddle-module.js.debug) clean: clean-fiddle clean-fiddle: rm -f $(fiddle-module.js) $(fiddle-module.js).gz \ $(fiddle-module.wasm) $(fiddle-module.wasm).gz \ $(dir.fiddle)/$(SOAP.js) \ $(dir.fiddle)/fiddle-module.worker.js \ EXPORTED_FUNCTIONS.fiddle rm -fr $(dir.fiddle-debug) .PHONY: fiddle fiddle.debug all: fiddle ######################################################################## # fiddle_remote is the remote destination for the fiddle app. It # must be a [user@]HOST:/path for rsync. # Note that the target "should probably" contain a symlink of # index.html -> fiddle.html. |
︙ | ︙ |
Deleted ext/wasm/fiddle/emscripten.css.
|
| < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to ext/wasm/fiddle/index.html.
︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | .app-view { flex: 20 1 auto; } #view-split { display: flex; flex-direction: column-reverse; } </style> </head> <body> <header id='titlebar'> <span>SQLite3 Fiddle</span> <span class='powered-by'>Powered by <a href='https://sqlite.org'>SQLite3</a></span> | > > > > > > > > > > > > > > > > > > > > > > > > > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | .app-view { flex: 20 1 auto; } #view-split { display: flex; flex-direction: column-reverse; } /* emcscript-related styling, used during the module load/intialization processes... */ .emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } div.emscripten { text-align: center; } div.emscripten_border { border: 1px solid black; } #module-spinner { overflow: visible; } #module-spinner > * { margin-top: 1em; } .spinner { height: 50px; width: 50px; margin: 0px auto; animation: rotation 0.8s linear infinite; border-left: 10px solid rgb(0,150,240); border-right: 10px solid rgb(0,150,240); border-bottom: 10px solid rgb(0,150,240); border-top: 10px solid rgb(100,0,200); border-radius: 100%; background-color: rgb(200,100,250); } @keyframes rotation { from {transform: rotate(0deg);} to {transform: rotate(360deg);} } </style> </head> <body> <header id='titlebar'> <span>SQLite3 Fiddle</span> <span class='powered-by'>Powered by <a href='https://sqlite.org'>SQLite3</a></span> |
︙ | ︙ |
Changes to src/os_unix.c.
︙ | ︙ | |||
2275 2276 2277 2278 2279 2280 2281 | ** The file suffix added to the data base filename in order to create the ** lock directory. */ #define DOTLOCK_SUFFIX ".lock" /* ** This routine checks if there is a RESERVED lock held on the specified | | | | < < < | < < < | > > | > | < | | 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 | ** The file suffix added to the data base filename in order to create the ** lock directory. */ #define DOTLOCK_SUFFIX ".lock" /* ** This routine checks if there is a RESERVED lock held on the specified ** file by this or any other process. If the caller holds a SHARED ** or greater lock when it is called, then it is assumed that no other ** client may hold RESERVED. Or, if the caller holds no lock, then it ** is assumed another client holds RESERVED if the lock-file exists. */ static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) { unixFile *pFile = (unixFile*)id; SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); if( pFile->eFileLock>=SHARED_LOCK ){ *pResOut = 0; }else{ *pResOut = osAccess((const char*)pFile->lockingContext, 0)==0; } OSTRACE(("TEST WR-LOCK %d %d %d (dotlock)\n", pFile->h, 0, *pResOut)); return SQLITE_OK; } /* ** Lock the file with the lock specified by parameter eFileLock - one ** of the following: ** ** (1) SHARED_LOCK |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
7380 7381 7382 7383 7384 7385 7386 | ** ** SELECT name FROM sailors AS S, reserves AS R ** WHERE S.sid = R.sid AND R.day = '2022-10-25'; */ static void existsToJoin(Parse *pParse, Select *p, Expr *pWhere){ if( pWhere && !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) | | > | 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 | ** ** SELECT name FROM sailors AS S, reserves AS R ** WHERE S.sid = R.sid AND R.day = '2022-10-25'; */ static void existsToJoin(Parse *pParse, Select *p, Expr *pWhere){ if( pWhere && !ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) && p->pSrc->nSrc>0 && p->pSrc->nSrc<BMS && pParse->db->mallocFailed==0 ){ if( pWhere->op==TK_AND ){ Expr *pRight = pWhere->pRight; existsToJoin(pParse, p, pWhere->pLeft); existsToJoin(pParse, p, pRight); } |
︙ | ︙ |
Changes to src/shell.c.in.
︙ | ︙ | |||
2416 2417 2418 2419 2420 2421 2422 | } break; } case MODE_ScanExp: case MODE_Explain: { static const int aExplainWidth[] = {4, 13, 4, 4, 4, 13, 2, 13}; static const int aExplainMap[] = {0, 1, 2, 3, 4, 5, 6, 7 }; | | | 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 | } break; } case MODE_ScanExp: case MODE_Explain: { static const int aExplainWidth[] = {4, 13, 4, 4, 4, 13, 2, 13}; static const int aExplainMap[] = {0, 1, 2, 3, 4, 5, 6, 7 }; static const int aScanExpWidth[] = {4, 15, 6, 13, 4, 4, 4, 13, 2, 13}; static const int aScanExpMap[] = {0, 9, 8, 1, 2, 3, 4, 5, 6, 7 }; const int *aWidth = aExplainWidth; const int *aMap = aExplainMap; int nWidth = ArraySize(aExplainWidth); int iIndent = 1; |
︙ | ︙ | |||
3426 3427 3428 3429 3430 3431 3432 | #ifndef SQLITE_ENABLE_STMT_SCANSTATUS UNUSED_PARAMETER(db); UNUSED_PARAMETER(pArg); #else if( pArg->scanstatsOn==3 ){ const char *zSql = " SELECT addr, opcode, p1, p2, p3, p4, p5, comment, nexec," | > > > > > | > | 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 | #ifndef SQLITE_ENABLE_STMT_SCANSTATUS UNUSED_PARAMETER(db); UNUSED_PARAMETER(pArg); #else if( pArg->scanstatsOn==3 ){ const char *zSql = " SELECT addr, opcode, p1, p2, p3, p4, p5, comment, nexec," " format('% 6s (%.2f%%)'," " CASE WHEN ncycle<100_000 THEN ncycle || ' '" " WHEN ncycle<100_000_000 THEN (ncycle/1_000) || 'K'" " WHEN ncycle<100_000_000_000 THEN (ncycle/1_000_000) || 'M'" " ELSE (ncycle/1000_000_000) || 'G' END," " ncycle*100.0/(sum(ncycle) OVER ())" " ) AS cycles" " FROM bytecode(?)"; int rc = SQLITE_OK; sqlite3_stmt *pStmt = 0; rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); if( rc==SQLITE_OK ){ sqlite3_stmt *pSave = pArg->pStmt; |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
768 769 770 771 772 773 774 | ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. ** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, | | | | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. ** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, ** PENDING, or EXCLUSIVE lock on the file. It returns, via its output ** pointer parameter, true if such a lock exists and false otherwise. ** ** The xFileControl() method is a generic interface that allows custom ** VFS implementations to directly control an open file using the ** [sqlite3_file_control()] interface. The second "op" argument is an ** integer opcode. The third argument is a generic pointer intended to ** point to a structure that may contain arguments or space in which to ** write return values. Potential uses for xFileControl() might be |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
4121 4122 4123 4124 4125 4126 4127 | int iRetCur; /* Transient table holding RETURNING results */ int nRetCol; /* Number of in pReturnEL after expansion */ int iRetReg; /* Register array for holding a row of RETURNING */ char zName[40]; /* Name of trigger: "sqlite_returning_%p" */ }; /* | | | | 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 | int iRetCur; /* Transient table holding RETURNING results */ int nRetCol; /* Number of in pReturnEL after expansion */ int iRetReg; /* Register array for holding a row of RETURNING */ char zName[40]; /* Name of trigger: "sqlite_returning_%p" */ }; /* ** An object used to accumulate the text of a string where we ** do not necessarily know how big the string will be in the end. */ struct sqlite3_str { sqlite3 *db; /* Optional database for lookaside. Can be NULL */ char *zText; /* The string collected so far */ u32 nAlloc; /* Amount of space allocated in zText */ u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */ u32 nChar; /* Length of the string so far */ u8 accError; /* SQLITE_NOMEM or SQLITE_TOOBIG */ u8 printfFlags; /* SQLITE_PRINTF flags below */ }; #define SQLITE_PRINTF_INTERNAL 0x01 /* Internal-use-only converters allowed */ #define SQLITE_PRINTF_SQLFUNC 0x02 /* SQL function arguments to VXPrintf */ #define SQLITE_PRINTF_MALLOCED 0x04 /* True if zText is allocated space */ #define isMalloced(X) (((X)->printfFlags & SQLITE_PRINTF_MALLOCED)!=0) /* ** The following object is the header for an "RCStr" or "reference-counted ** string". An RCStr is passed around and used like any other char* ** that has been dynamically allocated. The important interface |
︙ | ︙ |
Added test/existsexpr2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 90 91 92 93 94 95 96 | # 2024 June 14 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl set testprefix existsexpr2 do_execsql_test 1.0 { CREATE TABLE x1(a, b, PRIMARY KEY(a)) WITHOUT ROWID; INSERT INTO x1 VALUES(1, 2), (3, 4), (5, 6); CREATE INDEX x1b ON x1(b); CREATE TABLE x2(x, y); INSERT INTO x2 VALUES(1, 2), (3, 4), (5, 6); } do_execsql_test 1.1 { SELECT * FROM x1 WHERE EXISTS (SELECT 1 FROM x2 WHERE a!=123) } {1 2 3 4 5 6} do_execsql_test 1.2 { CREATE TABLE x3(u, v); CREATE INDEX x3u ON x3(u); INSERT INTO x3 VALUES (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3); } do_execsql_test 1.3 { SELECT * FROM x1 WHERE EXISTS ( SELECT 1 FROM x3 WHERE u IN (1, 2, 3, 4) AND v=b ); } { 1 2 } #------------------------------------------------------------------------- # reset_db do_execsql_test 2.0 { CREATE TABLE t1(a, b, c); CREATE INDEX t1ab ON t1(a,b); INSERT INTO t1 VALUES ('abc', 1, 1), ('abc', 2, 2), ('abc', 2, 3), ('def', 1, 1), ('def', 2, 2), ('def', 2, 3); CREATE TABLE t2(x, y); INSERT INTO t2 VALUES(1, 1), (2, 2), (3, 3); ANALYZE; DELETE FROM sqlite_stat1; INSERT INTO sqlite_stat1 VALUES('t1','t1ab','10000 5000 2'); ANALYZE sqlite_master; } do_execsql_test 2.1 { SELECT a,b,c FROM t1 WHERE b=2 ORDER BY a } { abc 2 2 abc 2 3 def 2 2 def 2 3 } do_execsql_test 2.2 { SELECT x, y FROM t2 WHERE EXISTS ( SELECT 1 FROM t1 WHERE b=x ) } { 1 1 2 2 } finish_test |
Changes to test/lock5.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2008 June 28 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # | < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # 2008 June 28 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is database locks. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix lock5 # This file is only run if using the unix backend compiled with the # SQLITE_ENABLE_LOCKING_STYLE macro. db close if {[catch {sqlite3 db test.db -vfs unix-none} msg]} { finish_test return |
︙ | ︙ | |||
97 98 99 100 101 102 103 | db close file exists test.db.lock } {0} ##################################################################### forcedelete test.db | | < < < | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | db close file exists test.db.lock } {0} ##################################################################### forcedelete test.db if {0==[catch {sqlite3 db test.db -vfs unix-flock} msg]} { do_test lock5-flock.1 { sqlite3 db test.db -vfs unix-flock execsql { CREATE TABLE t1(a, b); BEGIN; INSERT INTO t1 VALUES(1, 2); |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | db close catchsql { SELECT * FROM t1 } db2 } {0 {1 2}} do_test lock5-flock.8 { db2 close } {} ##################################################################### do_test lock5-none.1 { sqlite3 db test.db -vfs unix-none sqlite3 db2 test.db -vfs unix-none execsql { PRAGMA mmap_size = 0 } db2 execsql { BEGIN; INSERT INTO t1 VALUES(3, 4); } } {} do_test lock5-none.2 { execsql { SELECT * FROM t1 } } {1 2 3 4} | > > > > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | db close catchsql { SELECT * FROM t1 } db2 } {0 {1 2}} do_test lock5-flock.8 { db2 close } {} } ##################################################################### reset_db do_test lock5-none.1 { sqlite3 db test.db -vfs unix-none sqlite3 db2 test.db -vfs unix-none execsql { PRAGMA mmap_size = 0 } db2 execsql { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); BEGIN; INSERT INTO t1 VALUES(3, 4); } } {} do_test lock5-none.2 { execsql { SELECT * FROM t1 } } {1 2 3 4} |
︙ | ︙ | |||
174 175 176 177 178 179 180 | } {1 2} do_test lock5-none.5 { execsql COMMIT execsql {SELECT * FROM t1} db2 } {1 2} ifcapable memorymanage { | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 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 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | } {1 2} do_test lock5-none.5 { execsql COMMIT execsql {SELECT * FROM t1} db2 } {1 2} ifcapable memorymanage { if {[permutation]!="memsubsys1" && [permutation]!="memsubsys2"} { do_test lock5-none.6 { sqlite3_release_memory 1000000 execsql {SELECT * FROM t1} db2 } {1 2 3 4} } } do_test lock5-none.X { db close db2 close } {} ifcapable lock_proxy_pragmas { set env(SQLITE_FORCE_PROXY_LOCKING) $::using_proxy } ##################################################################### reset_db if {[permutation]!="inmemory_journal"} { # 1. Create a large database using the unix-dotfile VFS # 2. Write a large transaction to the db, so that the cache spills, but do # not commit it. # 3. Make a copy of the database files on disk. # 4. Try to read from the copy using unix-dotfile VFS. This fails because # the dotfile still exists, so SQLite things the database is locked. # 5. Remove the dotfile. # 6. Try to read the db again. This time, the old transaction is rolled # back and the read permitted. # do_test 2.dotfile.1 { sqlite3 db test.db -vfs unix-dotfile execsql { PRAGMA cache_size = 10; CREATE TABLE t1(x, y, z); CREATE INDEX t1x ON t1(x); WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000 ) INSERT INTO t1 SELECT hex(randomblob(20)), hex(randomblob(500)), i FROM s; } } {} do_execsql_test 2.dotfile.2 { BEGIN; UPDATE t1 SET z=z+1, x=hex(randomblob(20)); } do_test 2.dotfile.3 { list \ [file exists test.db] \ [file exists test.db-journal] \ [file exists test.db.lock] } {1 1 1} do_test 2.dotfile.4 { forcecopy test.db test.db2 forcecopy test.db-journal test.db2-journal file mkdir test.db2.lock sqlite3 db2 test.db2 -vfs unix-dotfile catchsql { SELECT count(*) FROM t1; } db2 } {1 {database is locked}} do_test 2.dotfile.5 { file delete test.db2.lock execsql { PRAGMA integrity_check } db2 } {ok} db2 close do_test 2.dotfile.6 { forcecopy test.db test.db2 forcecopy test.db-journal test.db2-journal sqlite3 db2 file:test.db2?nolock=1 -vfs unix-dotfile -uri 1 catchsql { SELECT count(*) FROM t1; } db2 } {0 1000} } finish_test |
Changes to tool/lemon.c.
︙ | ︙ | |||
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | */ static void stats_line(const char *zLabel, int iValue){ int nLabel = lemonStrlen(zLabel); printf(" %s%.*s %5d\n", zLabel, 35-nLabel, "................................", iValue); } /* The main program. Parse the command line and do it... */ int main(int argc, char **argv){ static int version = 0; static int rpflag = 0; static int basisflag = 0; static int compress = 0; | > > > > > > > > > | 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 | */ static void stats_line(const char *zLabel, int iValue){ int nLabel = lemonStrlen(zLabel); printf(" %s%.*s %5d\n", zLabel, 35-nLabel, "................................", iValue); } /* ** Comparison function used by qsort() to sort the azDefine[] array. */ static int defineCmp(const void *pA, const void *pB){ const char *zA = *(const char**)pA; const char *zB = *(const char**)pB; return strcmp(zA,zB); } /* The main program. Parse the command line and do it... */ int main(int argc, char **argv){ static int version = 0; static int rpflag = 0; static int basisflag = 0; static int compress = 0; |
︙ | ︙ | |||
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 | } if( OptNArgs()!=1 ){ fprintf(stderr,"Exactly one filename argument is required.\n"); exit(1); } memset(&lem, 0, sizeof(lem)); lem.errorcnt = 0; /* Initialize the machine */ Strsafe_init(); Symbol_init(); State_init(); lem.argv = argv; lem.argc = argc; | > | 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 | } if( OptNArgs()!=1 ){ fprintf(stderr,"Exactly one filename argument is required.\n"); exit(1); } memset(&lem, 0, sizeof(lem)); lem.errorcnt = 0; qsort(azDefine, nDefine, sizeof(azDefine[0]), defineCmp); /* Initialize the machine */ Strsafe_init(); Symbol_init(); State_init(); lem.argv = argv; lem.argc = argc; |
︙ | ︙ |
Changes to tool/spaceanal.tcl.
︙ | ︙ | |||
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 | if {$file_pgcnt2*$pageSize>1073742335} {incr file_pgcnt2} set ntable [db eval {SELECT count(*)+1 FROM sqlite_schema WHERE type='table'}] set nindex [db eval {SELECT count(*) FROM sqlite_schema WHERE type='index'}] set sql {SELECT count(*) FROM sqlite_schema WHERE name LIKE 'sqlite_autoindex%'} set nautoindex [db eval $sql] set nmanindex [expr {$nindex-$nautoindex}] # set total_payload [mem eval "SELECT sum(payload) FROM space_used"] set user_payload [mem one {SELECT int(sum(payload)) FROM space_used WHERE NOT is_index AND name NOT LIKE 'sqlite_schema'}] set user_percent [percent $user_payload $file_bytes] # Output the summary statistics calculated above. # puts "/** Disk-Space Utilization Report For $root_filename" puts "" statline {Page size in bytes} $pageSize statline {Pages in the whole file (measured)} $file_pgcnt statline {Pages in the whole file (calculated)} $file_pgcnt2 statline {Pages that store data} $inuse_pgcnt $inuse_percent statline {Pages on the freelist (per header)} $free_pgcnt2 $free_percent2 statline {Pages on the freelist (calculated)} $free_pgcnt $free_percent statline {Pages of auto-vacuum overhead} $av_pgcnt $av_percent statline {Number of tables in the database} $ntable statline {Number of indices} $nindex statline {Number of defined indices} $nmanindex statline {Number of implied indices} $nautoindex if {$isCompressed} { statline {Size of uncompressed content in bytes} $file_bytes set efficiency [percent $true_file_size $file_bytes] statline {Size of compressed file on disk} $true_file_size $efficiency | > > | 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 | if {$file_pgcnt2*$pageSize>1073742335} {incr file_pgcnt2} set ntable [db eval {SELECT count(*)+1 FROM sqlite_schema WHERE type='table'}] set nindex [db eval {SELECT count(*) FROM sqlite_schema WHERE type='index'}] set sql {SELECT count(*) FROM sqlite_schema WHERE name LIKE 'sqlite_autoindex%'} set nautoindex [db eval $sql] set nmanindex [expr {$nindex-$nautoindex}] set nwithoutrowid [db eval {SELECT count(*) FROM pragma_table_list WHERE wr}] # set total_payload [mem eval "SELECT sum(payload) FROM space_used"] set user_payload [mem one {SELECT int(sum(payload)) FROM space_used WHERE NOT is_index AND name NOT LIKE 'sqlite_schema'}] set user_percent [percent $user_payload $file_bytes] # Output the summary statistics calculated above. # puts "/** Disk-Space Utilization Report For $root_filename" puts "" statline {Page size in bytes} $pageSize statline {Pages in the whole file (measured)} $file_pgcnt statline {Pages in the whole file (calculated)} $file_pgcnt2 statline {Pages that store data} $inuse_pgcnt $inuse_percent statline {Pages on the freelist (per header)} $free_pgcnt2 $free_percent2 statline {Pages on the freelist (calculated)} $free_pgcnt $free_percent statline {Pages of auto-vacuum overhead} $av_pgcnt $av_percent statline {Number of tables in the database} $ntable statline {Number of WITHOUT ROWID tables} $nwithoutrowid statline {Number of indices} $nindex statline {Number of defined indices} $nmanindex statline {Number of implied indices} $nautoindex if {$isCompressed} { statline {Size of uncompressed content in bytes} $file_bytes set efficiency [percent $true_file_size $file_bytes] statline {Size of compressed file on disk} $true_file_size $efficiency |
︙ | ︙ | |||
668 669 670 671 672 673 674 675 676 677 678 679 680 681 | # Output subreports # if {$nindex>0} { subreport {All tables and indices} 1 0 } subreport {All tables} {NOT is_index} 0 if {$nindex>0} { subreport {All indices} {is_index} 0 } foreach tbl [mem eval {SELECT DISTINCT tblname name FROM space_used ORDER BY name}] { set qn [quote $tbl] set name [string toupper $tbl] | > > > > > > > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | # Output subreports # if {$nindex>0} { subreport {All tables and indices} 1 0 } subreport {All tables} {NOT is_index} 0 if {$nwithoutrowid>0} { subreport {All WITHOUT ROWID tables} {is_without_rowid} 0 set nrowidtab [db eval {SELECT count(*) FROM pragma_table_list WHERE type='table' AND NOT wr}] if {$nrowidtab>0} { subreport {ALL rowid tables} {NOT is_without_rowid AND NOT is_index} 0 } } if {$nindex>0} { subreport {All indices} {is_index} 0 } foreach tbl [mem eval {SELECT DISTINCT tblname name FROM space_used ORDER BY name}] { set qn [quote $tbl] set name [string toupper $tbl] |
︙ | ︙ |