From 163af02acaeed806a89adb30cc06a42280337f74 Mon Sep 17 00:00:00 2001 From: larrybr Date: Fri, 22 Sep 2023 14:20:45 +0000 Subject: [PATCH 001/242] Give expert ability to deal with UDFs. FossilOrigin-Name: 3406b05b4f57901f64f9b5fc83fe0250b827ae7f342c2026818dab0840aafd23 --- ext/expert/sqlite3expert.c | 72 +++++++++++++++++++++++++++++++++++++- manifest | 18 +++++----- manifest.uuid | 2 +- 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index c01feff58c..a57664800b 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -32,7 +32,7 @@ #endif /* !defined(SQLITE_AMALGAMATION) */ -#ifndef SQLITE_OMIT_VIRTUALTABLE +#ifndef SQLITE_OMIT_VIRTUALTABLE typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; @@ -1818,6 +1818,65 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ return rc; } +#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ + && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) + +/* +** dummy functions for no-op implementation of UDFs during expert's work +*/ +void dummyUDF(sqlite3_context*,int,sqlite3_value**){ + assert(0); /* VDBE should never be run. */ +} +void dummyUDFvalue(sqlite3_context*){ + assert(0); /* VDBE should never be run. */ +} + +/* +** Register UDFs from user database with another. +*/ +int registerUDFs(sqlite3 *dbSrc, sqlite3 *dbDst){ + sqlite3_stmt *pStmt; + int rc = sqlite3_prepare_v2(dbSrc, + "SELECT name,type,enc,narg,flags " + "FROM pragma_function_list() " + "WHERE builtin==0", -1, &pStmt, 0); + if( rc==SQLITE_OK ){ + while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){ + int nargs = sqlite3_column_int(pStmt,3); + int flags = sqlite3_column_int(pStmt,4); + const unsigned char *name = sqlite3_column_text(pStmt,0); + const unsigned char *type = sqlite3_column_text(pStmt,1); + const unsigned char *enc = sqlite3_column_text(pStmt,2); + if( name==0 || type==0 || enc==0 ) rc = SQLITE_NOMEM; + else{ + int ienc = SQLITE_UTF8; + if( strcmp(enc,"utf16le")==0 ) ienc = SQLITE_UTF16LE; + else if( strcmp(enc,"utf16be")==0 ) ienc = SQLITE_UTF16BE; + int rcf = SQLITE_ERROR; + ienc |= (flags & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY)); + if( strcmp(type,"w")==0 ){ + rcf = sqlite3_create_window_function(dbDst,name,nargs,ienc,0, + dummyUDF,dummyUDFvalue,0,0,0); + }else if( strcmp(type,"a")==0 ){ + rcf = sqlite3_create_function(dbDst,name,nargs,ienc,0, + 0,dummyUDF,dummyUDFvalue); + }else if( strcmp(type,"s")==0 ){ + rcf = sqlite3_create_function(dbDst,name,nargs,ienc,0, + dummyUDF,0,0); + } + if( rcf!=SQLITE_OK ){ + rc = rcf; + break; + } + } + } + sqlite3_finalize(pStmt); + if( rc==SQLITE_DONE ) rc = SQLITE_OK; + } + return rc; +} +#endif + /* ** Allocate a new sqlite3expert object. */ @@ -1860,6 +1919,17 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ idxFinalize(&rc, pSql); } +#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ + && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) + /* Register UDFs from database [db] with [dbm] and [dbv]. */ + if( rc==SQLITE_OK ){ + rc = registerUDFs(pNew->db, pNew->dbm); + } + if( rc==SQLITE_OK ){ + rc = registerUDFs(pNew->db, pNew->dbv); + } +#endif + /* Create the vtab schema */ if( rc==SQLITE_OK ){ rc = idxCreateVtabSchema(pNew, pzErrmsg); diff --git a/manifest b/manifest index c19173e647..907d8cda73 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplifications\sand\sperformance\soptimizations\sfor\sthe\sRTree\sextension. -D 2023-09-15T20:28:27.298 +C Give\sexpert\sability\sto\sdeal\swith\sUDFs. +D 2023-09-22T14:20:45.507 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 95b00567ce0775126a1b788af2d055255014714ecfddc97913864d2f9266e583 -F ext/expert/sqlite3expert.c a912efbad597eafdb0ce934ebc11039f3190b2d479685d89184e107f65d856e1 +F ext/expert/sqlite3expert.c 295015a89169dd56210d41ee12cc4666120ae7cd6fdc3059dda6c5f6f25a942d F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2121,9 +2121,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f911f1c4977fbcae041243955cf2b98d8cc8baa337885a69be0f2b9bd2efa6f3 f158b7d4917e0951fbb86a6f438abcb618d8602566fa54bf04c05a37f3a73513 -R 0b036be7642252777724a458f0867e79 -T +closed f158b7d4917e0951fbb86a6f438abcb618d8602566fa54bf04c05a37f3a73513 -U drh -Z cad044234f7387007cc2851aae092c34 +P 04a333f5faf6b90592f1f69889ac6c28949955e186f39037cd639480b06feae8 +R 60a342742d52c0b762612e7ca689cb9f +T *branch * expert-udfs +T *sym-expert-udfs * +T -sym-trunk * +U larrybr +Z 571810c2a50aa1c1d6fa7a9dfd64586a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7c7136b025..008a0e7cc5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -04a333f5faf6b90592f1f69889ac6c28949955e186f39037cd639480b06feae8 \ No newline at end of file +3406b05b4f57901f64f9b5fc83fe0250b827ae7f342c2026818dab0840aafd23 \ No newline at end of file From a25d478ea81f47b57c4658ffb88c55a5cc2f9c3d Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 24 Sep 2023 19:00:00 +0000 Subject: [PATCH 002/242] Give expert ability to deal with custom collations. FossilOrigin-Name: ac1dc1b6ded0e43acb5b2b707110f767f7bdb5cecdb6b28a982db174ae233d37 --- ext/expert/sqlite3expert.c | 21 ++++++++++++++++++++- manifest | 15 ++++++--------- manifest.uuid | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index a57664800b..e93a7c19cb 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -1818,9 +1818,20 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ return rc; } +/* +** Define and possibly pretend to use a useless collation sequence. +** This pretense allows expert to accept SQL using custom collations. +*/ +int dummyCompare(void*, int, const void*, int, const void*){ + return 0; +} +/* And a callback to register above upon actual need */ +void useDummyCS(void *, sqlite3 *db, int etr, const char *zName){ + sqlite3_create_collation_v2(db, zName, etr, 0, dummyCompare, 0); +} + #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) - /* ** dummy functions for no-op implementation of UDFs during expert's work */ @@ -1919,6 +1930,10 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ idxFinalize(&rc, pSql); } + /* Allow custom collations to be dealt with through prepare. */ + if( rc==SQLITE_OK ) rc = sqlite3_collation_needed(pNew->dbm,0,useDummyCS); + if( rc==SQLITE_OK ) rc = sqlite3_collation_needed(pNew->dbv,0,useDummyCS); + #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) /* Register UDFs from database [db] with [dbm] and [dbv]. */ @@ -1990,6 +2005,10 @@ int sqlite3_expert_sql( while( rc==SQLITE_OK && zStmt && zStmt[0] ){ sqlite3_stmt *pStmt = 0; + /* Ensure that the provided statement compiles against user's DB. */ + rc = idxPrepareStmt(p->db, &pStmt, pzErr, zStmt); + if( rc!=SQLITE_OK ) break; + sqlite3_finalize(pStmt); rc = sqlite3_prepare_v2(p->dbv, zStmt, -1, &pStmt, &zStmt); if( rc==SQLITE_OK ){ if( pStmt ){ diff --git a/manifest b/manifest index 907d8cda73..30e935a72c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Give\sexpert\sability\sto\sdeal\swith\sUDFs. -D 2023-09-22T14:20:45.507 +C Give\sexpert\sability\sto\sdeal\swith\scustom\scollations. +D 2023-09-24T19:00:00.954 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 95b00567ce0775126a1b788af2d055255014714ecfddc97913864d2f9266e583 -F ext/expert/sqlite3expert.c 295015a89169dd56210d41ee12cc4666120ae7cd6fdc3059dda6c5f6f25a942d +F ext/expert/sqlite3expert.c b07038a5e312f8e5f81dce7c7885bff8ae76e6bd5d63a2cea524c329a0987733 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2121,11 +2121,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 04a333f5faf6b90592f1f69889ac6c28949955e186f39037cd639480b06feae8 -R 60a342742d52c0b762612e7ca689cb9f -T *branch * expert-udfs -T *sym-expert-udfs * -T -sym-trunk * +P 3406b05b4f57901f64f9b5fc83fe0250b827ae7f342c2026818dab0840aafd23 +R 4fd35ee51e3295c4798887f6f81483f9 U larrybr -Z 571810c2a50aa1c1d6fa7a9dfd64586a +Z 0102b81fd083e10463436403edc18206 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 008a0e7cc5..874ad43499 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3406b05b4f57901f64f9b5fc83fe0250b827ae7f342c2026818dab0840aafd23 \ No newline at end of file +ac1dc1b6ded0e43acb5b2b707110f767f7bdb5cecdb6b28a982db174ae233d37 \ No newline at end of file From 5918adb37482a9d6e832ecb1b03288ffb18a9f42 Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 24 Sep 2023 19:38:22 +0000 Subject: [PATCH 003/242] Add minimal exercise of expert acceptance of UDFs and custom collations. FossilOrigin-Name: 0f6bbb79cbb52f5ddf38840898ab6789a4e108353918296df20b332117e6a148 --- ext/expert/expert1.test | 17 +++++++++++++++++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test index dee4eb9ec0..516a1f7584 100644 --- a/ext/expert/expert1.test +++ b/ext/expert/expert1.test @@ -464,4 +464,21 @@ do_execsql_test 5.3 { t2 t2_idx_0001295b {100 20 5} } +do_test expert1-6.0 { + catchcmd :memory: { +.expert +select base64(''); +.expert +select name from pragma_collation_list order by name collate uint; +} +} {0 {(no new indexes) + +SCAN CONSTANT ROW + +(no new indexes) + +SCAN pragma_collation_list VIRTUAL TABLE INDEX 0: +USE TEMP B-TREE FOR ORDER BY +}} + finish_test diff --git a/manifest b/manifest index 03f20a81fb..3b345a2c70 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Sync\sw/trunk\sprior\sto\smerge\sback. -D 2023-09-24T19:28:07.223 +C Add\sminimal\sexercise\sof\sexpert\sacceptance\sof\sUDFs\sand\scustom\scollations. +D 2023-09-24T19:38:22.270 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -52,7 +52,7 @@ F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 -F ext/expert/expert1.test 95b00567ce0775126a1b788af2d055255014714ecfddc97913864d2f9266e583 +F ext/expert/expert1.test 77eaa3efd906e245a8948cb496174724b867b43b5c0fd9bb4fe7f77f27c64517 F ext/expert/sqlite3expert.c b07038a5e312f8e5f81dce7c7885bff8ae76e6bd5d63a2cea524c329a0987733 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 @@ -2121,8 +2121,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ac1dc1b6ded0e43acb5b2b707110f767f7bdb5cecdb6b28a982db174ae233d37 5655c51f103c6dfade799ffb5ca2eb21b4360ada598741f373c952ae732535aa -R c809056d639a53309bb20431f25032cd +P 2d290854cd9b6cef70b53c28745e1ccee5b5443378407bfc726e452e7e7a0a95 +R 3a0526e4c02c825c8cc29dc1d63531db U larrybr -Z 558957f713166e500314661df03f2a3f +Z 980eed3593ae76a9a7a9bc23a9306c16 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4ab25438cd..037dc02929 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2d290854cd9b6cef70b53c28745e1ccee5b5443378407bfc726e452e7e7a0a95 \ No newline at end of file +0f6bbb79cbb52f5ddf38840898ab6789a4e108353918296df20b332117e6a148 \ No newline at end of file From 16096e6bd110c4dd7d376fce476d79b12707a83a Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 24 Sep 2023 22:51:56 +0000 Subject: [PATCH 004/242] Make expert changes acceptable to C89. FossilOrigin-Name: a4f03c22ec13d2f9769ac655ad77ccd906ab8c0ee32df37139bd998c234a7a0f --- ext/expert/sqlite3expert.c | 19 +++++++++++++++---- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index e93a7c19cb..87cc1ced32 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -1822,11 +1822,18 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ ** Define and possibly pretend to use a useless collation sequence. ** This pretense allows expert to accept SQL using custom collations. */ -int dummyCompare(void*, int, const void*, int, const void*){ +int dummyCompare(void *up1, int up2, const void *up3, int up4, const void *up5){ + (void)up1; + (void)up2; + (void)up3; + (void)up4; + (void)up5; + assert(0); /* VDBE should never be run. */ return 0; } /* And a callback to register above upon actual need */ -void useDummyCS(void *, sqlite3 *db, int etr, const char *zName){ +void useDummyCS(void *up1, sqlite3 *db, int etr, const char *zName){ + (void)up1; sqlite3_create_collation_v2(db, zName, etr, 0, dummyCompare, 0); } @@ -1835,10 +1842,14 @@ void useDummyCS(void *, sqlite3 *db, int etr, const char *zName){ /* ** dummy functions for no-op implementation of UDFs during expert's work */ -void dummyUDF(sqlite3_context*,int,sqlite3_value**){ +void dummyUDF(sqlite3_context *up1, int up2, sqlite3_value **up3){ + (void)up1; + (void)up2; + (void)up3; assert(0); /* VDBE should never be run. */ } -void dummyUDFvalue(sqlite3_context*){ +void dummyUDFvalue(sqlite3_context *up1){ + (void)up1; assert(0); /* VDBE should never be run. */ } diff --git a/manifest b/manifest index b7f4ea1c64..b7eb81ae5d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sexpert\schanges\sto\saccept\sUDFs\sand\scustom\scollations. -D 2023-09-24T19:47:37.560 +C Make\sexpert\schanges\sacceptable\sto\sC89. +D 2023-09-24T22:51:56.382 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 77eaa3efd906e245a8948cb496174724b867b43b5c0fd9bb4fe7f77f27c64517 -F ext/expert/sqlite3expert.c b07038a5e312f8e5f81dce7c7885bff8ae76e6bd5d63a2cea524c329a0987733 +F ext/expert/sqlite3expert.c 7b6b40b87aed69761b07231b563c96aa717e946224ffcfc035ce3e06e961516a F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2121,8 +2121,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5655c51f103c6dfade799ffb5ca2eb21b4360ada598741f373c952ae732535aa 0f6bbb79cbb52f5ddf38840898ab6789a4e108353918296df20b332117e6a148 -R 3a0526e4c02c825c8cc29dc1d63531db +P 8ead1b5ed6693c0e3c30428033049c95a1fe636d1d1eff1734d0a896b5ff1f5a +R b8f5b37eed5734a4c2ba7d4bb590bf8a U larrybr -Z a1c976c0a741d8b5b62201d4f47baf77 +Z cf1f60c591077eb093264126cb0986ef # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 35f1f4c99d..0b209998c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8ead1b5ed6693c0e3c30428033049c95a1fe636d1d1eff1734d0a896b5ff1f5a \ No newline at end of file +a4f03c22ec13d2f9769ac655ad77ccd906ab8c0ee32df37139bd998c234a7a0f \ No newline at end of file From 1da3215d657314ec4c9cfa8eb8f23210ff4d48e1 Mon Sep 17 00:00:00 2001 From: larrybr Date: Mon, 25 Sep 2023 00:39:43 +0000 Subject: [PATCH 005/242] Cause sqlite3_exper_new() to replicate UDFs and custom collations early enough to appear in virtual column expressions during schema copy. [forum:/forumpost/e030aa4b3a|forum post e030aa4b3a] FossilOrigin-Name: 8fc2c45558a826a84e6f7e98564573da125a5e2d5c635a85bdeba2abe29fbfa1 --- ext/expert/sqlite3expert.c | 29 ++++++++++++++--------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index 87cc1ced32..2d19f7a23a 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -1925,21 +1925,6 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ sqlite3_db_config(pNew->dbm, SQLITE_DBCONFIG_TRIGGER_EQP, 1, (int*)0); } } - - - /* Copy the entire schema of database [db] into [dbm]. */ - if( rc==SQLITE_OK ){ - sqlite3_stmt *pSql = 0; - rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg, - "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'" - " AND sql NOT LIKE 'CREATE VIRTUAL %%'" - ); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ - const char *zSql = (const char*)sqlite3_column_text(pSql, 0); - if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg); - } - idxFinalize(&rc, pSql); - } /* Allow custom collations to be dealt with through prepare. */ if( rc==SQLITE_OK ) rc = sqlite3_collation_needed(pNew->dbm,0,useDummyCS); @@ -1956,6 +1941,20 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ } #endif + /* Copy the entire schema of database [db] into [dbm]. */ + if( rc==SQLITE_OK ){ + sqlite3_stmt *pSql = 0; + rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg, + "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'" + " AND sql NOT LIKE 'CREATE VIRTUAL %%'" + ); + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ + const char *zSql = (const char*)sqlite3_column_text(pSql, 0); + if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg); + } + idxFinalize(&rc, pSql); + } + /* Create the vtab schema */ if( rc==SQLITE_OK ){ rc = idxCreateVtabSchema(pNew, pzErrmsg); diff --git a/manifest b/manifest index b7eb81ae5d..6cf5f1135d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sexpert\schanges\sacceptable\sto\sC89. -D 2023-09-24T22:51:56.382 +C Cause\ssqlite3_exper_new()\sto\sreplicate\sUDFs\sand\scustom\scollations\searly\senough\sto\sappear\sin\svirtual\scolumn\sexpressions\sduring\sschema\scopy.\s[forum:/forumpost/e030aa4b3a|forum\spost\se030aa4b3a] +D 2023-09-25T00:39:43.862 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 77eaa3efd906e245a8948cb496174724b867b43b5c0fd9bb4fe7f77f27c64517 -F ext/expert/sqlite3expert.c 7b6b40b87aed69761b07231b563c96aa717e946224ffcfc035ce3e06e961516a +F ext/expert/sqlite3expert.c 1803b13cbe118f01486479f557e5403459802a69d90886d7f0465f78f1f61719 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2121,8 +2121,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8ead1b5ed6693c0e3c30428033049c95a1fe636d1d1eff1734d0a896b5ff1f5a -R b8f5b37eed5734a4c2ba7d4bb590bf8a +P a4f03c22ec13d2f9769ac655ad77ccd906ab8c0ee32df37139bd998c234a7a0f +R b4c830d70f3874dce787a7758a7f4657 U larrybr -Z cf1f60c591077eb093264126cb0986ef +Z fb0500fa1bec856f4772f8e430b395b8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0b209998c4..efe5d09407 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a4f03c22ec13d2f9769ac655ad77ccd906ab8c0ee32df37139bd998c234a7a0f \ No newline at end of file +8fc2c45558a826a84e6f7e98564573da125a5e2d5c635a85bdeba2abe29fbfa1 \ No newline at end of file From ec15e551f98f1f01c26b43d3419bc8dde2aa3aa7 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 1 Oct 2023 11:53:40 +0000 Subject: [PATCH 006/242] Make JNI binding of sqlite3_value_frombind() return boolean instead of int and add tests for it. FossilOrigin-Name: 906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369 --- ext/jni/src/c/sqlite3-jni.c | 9 ++++++++- ext/jni/src/c/sqlite3-jni.h | 4 ++-- ext/jni/src/org/sqlite/jni/SQLite3Jni.java | 4 ++-- ext/jni/src/org/sqlite/jni/Tester1.java | 10 ++++++++++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 2f7fe7c364..2159e8979e 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2036,6 +2036,12 @@ static void udf_xInverse(sqlite3_context* cx, int argc, JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \ return (jint)CName(S3JniLongPtr_sqlite3_value(jpSValue)); \ } +/** Create a trivial JNI wrapper for (boolean CName(sqlite3_value*)). */ +#define WRAP_BOOL_SVALUE(JniNameSuffix,CName) \ + JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \ + return (jint)CName(S3JniLongPtr_sqlite3_value(jpSValue)) \ + ? JNI_TRUE : JNI_FALSE; \ + } WRAP_INT_DB(1changes, sqlite3_changes) WRAP_INT64_DB(1changes64, sqlite3_changes64) @@ -2075,7 +2081,7 @@ WRAP_INT64_DB(1total_1changes64, sqlite3_total_changes64) WRAP_INT_SVALUE(1value_1bytes, sqlite3_value_bytes) WRAP_INT_SVALUE(1value_1bytes16, sqlite3_value_bytes16) WRAP_INT_SVALUE(1value_1encoding, sqlite3_value_encoding) -WRAP_INT_SVALUE(1value_1frombind, sqlite3_value_frombind) +WRAP_BOOL_SVALUE(1value_1frombind, sqlite3_value_frombind) WRAP_INT_SVALUE(1value_1nochange, sqlite3_value_nochange) WRAP_INT_SVALUE(1value_1numeric_1type, sqlite3_value_numeric_type) WRAP_INT_SVALUE(1value_1subtype, sqlite3_value_subtype) @@ -2083,6 +2089,7 @@ WRAP_INT_SVALUE(1value_1type, sqlite3_value_type) #undef WRAP_BOOL_DB #undef WRAP_BOOL_STMT +#undef WRAP_BOOL_SVALUE #undef WRAP_INT64_DB #undef WRAP_INT_DB #undef WRAP_INT_INT diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index b9d4a3574e..f8aa61beec 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -2022,9 +2022,9 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1free /* * Class: org_sqlite_jni_SQLite3Jni * Method: sqlite3_value_frombind - * Signature: (J)I + * Signature: (J)Z */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1frombind +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1frombind (JNIEnv *, jclass, jlong); /* diff --git a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java index 7854f009ff..5433cf4a60 100644 --- a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java +++ b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java @@ -2105,10 +2105,10 @@ final class SQLite3Jni { } @Canonical - static native int sqlite3_value_frombind(@NotNull long ptrToValue); + static native boolean sqlite3_value_frombind(@NotNull long ptrToValue); @Canonical - public static int sqlite3_value_frombind(@NotNull sqlite3_value v){ + public static boolean sqlite3_value_frombind(@NotNull sqlite3_value v){ return sqlite3_value_frombind(v.getNativePointer()); } diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 274df3c8c8..04d91921f3 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -399,6 +399,16 @@ public class Tester1 implements Runnable { affirm( !sqlite3_stmt_busy(stmt) ); sqlite3_finalize(stmt); affirm(total1 == total2); + + // sqlite3_value_frombind() checks... + stmt = prepare(db, "SELECT 1, ?"); + sqlite3_bind_int(stmt, 1, 2); + rc = sqlite3_step(stmt); + affirm( SQLITE_ROW==rc ); + affirm( !sqlite3_value_frombind(sqlite3_column_value(stmt, 0)) ); + affirm( sqlite3_value_frombind(sqlite3_column_value(stmt, 1)) ); + sqlite3_finalize(stmt); + sqlite3_close_v2(db); affirm(0 == db.getNativePointer()); } diff --git a/manifest b/manifest index 2eae6bfcf8..93e3f3162c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sJNI\sbinding\sto\scompile\swithout\sSQLITE_ENABLE_PREUPDATE_HOOK.\sAdd\sbuild\soption\sto\sdisable\sall\soptional\sENABLE\sflags. -D 2023-09-30T17:08:29.126 +C Make\sJNI\sbinding\sof\ssqlite3_value_frombind()\sreturn\sboolean\sinstead\sof\sint\sand\sadd\stests\sfor\sit. +D 2023-10-01T11:53:40.043 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,8 +238,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile b4e80da3c66edaf48e90158bbc0034dcd6a52c4828cc795f43780d0fa9a6ae5b F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c fa4f46c514d1c99955229bdf9d7cb731e6a25187a817bfb7f847cc4d0e39cbc1 -F ext/jni/src/c/sqlite3-jni.h 8c6368788415552dd1ee9f3029475f38982d048c87f598e573f98357924202ac +F ext/jni/src/c/sqlite3-jni.c c771fe717d38718d45a64e220f0a7e4d4b0482cc2ded3d5590bad6041a405e64 +F ext/jni/src/c/sqlite3-jni.h a9435695bbf5ed4c8f0c802b963948d7698563f81c15e2fa8a1d9b85a4a1b719 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java e6135be32f12bf140bffa39be7fd1a45ad83b2661ed49c08dbde04c8485feb38 @@ -260,10 +260,10 @@ F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7c F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java d12352c0e22840de484ffa9b11ed5058bb0daca2e9f218055d3c54c947a273c4 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java da42be06a2d644e0b915b40508934c1f32391e5308ab8767c1e2e65a281a198f -F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 2f23f9047b0e817993d5d1dc61252940107f646ddb84a05aac51bb1d51b5f946 +F ext/jni/src/org/sqlite/jni/SQLite3Jni.java ad8a595954915aefaf66c9d17583f7a1109cc45747fe382f234a686b0028a593 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 03e964552ce735e13b0f7f996d7ce60626c918d8e23392b40ed14ffd07dceebd +F ext/jni/src/org/sqlite/jni/Tester1.java 6373e551a89a68bbf2c79c5b62ef88b4001f8ea65a2ecdf693c4041047408bec F ext/jni/src/org/sqlite/jni/TesterFts5.java 854c737bb5c9463ee92a8ee230013e924236dd4b74d4688dd62c17f38d5837db F ext/jni/src/org/sqlite/jni/TraceV2Callback.java beb0b064c1a5f8bfe585a324ed39a4e33edbe379a3fc60f1401661620d3ca7c0 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 8376f4a931f2d5612b295c003c9515ba933ee76d8f95610e89c339727376e36c @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5e387275f69ab2d3159b4b67b8cbfc6270410b61e5ac1f988616e8d051f6572e -R 02618be495064fd0c511f49fba8a92b2 +P c04022b7407f77eaf0175e831ebcd6bbdc0af1cef0d42c5c11102aa8484f24ca +R c37e2ce6bc01474a856ea1d8e3c3b24a U stephan -Z fb900a6927398da79962f35041fce8dc +Z c76d81a205c13235420ccf1380b4458a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 92d537682b..b1236c49b6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c04022b7407f77eaf0175e831ebcd6bbdc0af1cef0d42c5c11102aa8484f24ca \ No newline at end of file +906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369 \ No newline at end of file From dc13d74140a6b09af32ac7cf8a70c2b1922e9337 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 1 Oct 2023 12:15:38 +0000 Subject: [PATCH 007/242] Add JNI binding for sqlite3_normalized_sql(). FossilOrigin-Name: 2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b --- ext/jni/GNUmakefile | 1 + ext/jni/src/c/sqlite3-jni.c | 43 +++++++++++++++++++--- ext/jni/src/c/sqlite3-jni.h | 8 ++++ ext/jni/src/org/sqlite/jni/SQLite3Jni.java | 7 ++++ ext/jni/src/org/sqlite/jni/Tester1.java | 5 ++- manifest | 20 +++++----- manifest.uuid | 2 +- 7 files changed, 68 insertions(+), 18 deletions(-) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index bd1dc6f47a..77b0c3061b 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -214,6 +214,7 @@ SQLITE_OPT += -DSQLITE_ENABLE_RTREE \ -DSQLITE_ENABLE_BYTECODE_VTAB \ -DSQLITE_ENABLE_OFFSET_SQL_FUNC \ -DSQLITE_ENABLE_PREUPDATE_HOOK \ + -DSQLITE_ENABLE_NORMALIZE \ -DSQLITE_ENABLE_SQLLOG endif diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 2159e8979e..1a9c3bc356 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -3386,22 +3386,53 @@ S3JniApi(sqlite3_errstr(),jstring,1errstr)( return rv; } -S3JniApi(sqlite3_expanded_sql(),jstring,1expanded_1sql)( - JniArgsEnvClass, jobject jpStmt -){ +#ifndef SQLITE_ENABLE_NORMALIZE +/* Dummy stub for sqlite3_normalized_sql(). Never called. */ +static const char * sqlite3_normalized_sql(sqlite3_stmt *s){ + S3JniDeclLocal_env; + (*env)->FatalError(env, "dummy sqlite3_normalized_sql() was " + "impossibly called.") /* does not return */; + return 0; +} +#endif + +/* +** Impl for sqlite3_expanded_sql() (if isExpanded is true) and +** sqlite3_normalized_sql(). +*/ +static jstring s3jni_xn_sql(int isExpanded, JNIEnv *env, jobject jpStmt){ jstring rv = 0; sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt); + if( pStmt ){ - char * zSql = sqlite3_expanded_sql(pStmt); + char * zSql = isExpanded + ? sqlite3_expanded_sql(pStmt) + : (char*)sqlite3_normalized_sql(pStmt); s3jni_oom_fatal(zSql); if( zSql ){ - rv = s3jni_utf8_to_jstring( zSql, -1); - sqlite3_free(zSql); + rv = s3jni_utf8_to_jstring(zSql, -1); + if( isExpanded ) sqlite3_free(zSql); } } return rv; } +S3JniApi(sqlite3_expanded_sql(),jstring,1expanded_1sql)( + JniArgsEnvClass, jobject jpStmt +){ + return s3jni_xn_sql(1, env, jpStmt); +} + +S3JniApi(sqlite3_normalized_sql(),jstring,1normalized_1sql)( + JniArgsEnvClass, jobject jpStmt +){ +#ifdef SQLITE_ENABLE_NORMALIZE + return s3jni_xn_sql(0, env, jpStmt); +#else + return 0; +#endif +} + S3JniApi(sqlite3_extended_result_codes(),jboolean,1extended_1result_1codes)( JniArgsEnvClass, jobject jpDb, jboolean onoff ){ diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index f8aa61beec..3bcbf2d01e 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1499,6 +1499,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1libversion_1numbe JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1limit (JNIEnv *, jclass, jobject, jint, jint); +/* + * Class: org_sqlite_jni_SQLite3Jni + * Method: sqlite3_normalized_sql + * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1normalized_1sql + (JNIEnv *, jclass, jobject); + /* * Class: org_sqlite_jni_SQLite3Jni * Method: sqlite3_open diff --git a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java index 5433cf4a60..866c9b9615 100644 --- a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java +++ b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java @@ -1025,6 +1025,13 @@ final class SQLite3Jni { @Canonical public static native int sqlite3_limit(@NotNull sqlite3 db, int id, int newVal); + /** + Only available if built with SQLITE_ENABLE_NORMALIZE. If not, it always + returns null. + */ + @Canonical + public static native String sqlite3_normalized_sql(@NotNull sqlite3_stmt stmt); + /** Works like its C counterpart and makes the native pointer of the underling (sqlite3*) object available via diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 04d91921f3..722ff0e3a7 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -560,7 +560,10 @@ public class Tester1 implements Runnable { sqlite3_finalize(stmt); stmt = prepare(db, "SELECT ?"); sqlite3_bind_text(stmt, 1, "hell😃"); - affirm( "SELECT 'hell😃'".equals(sqlite3_expanded_sql(stmt)) ); + final String expect = "SELECT 'hell😃'"; + affirm( expect.equals(sqlite3_expanded_sql(stmt)) ); + String n = sqlite3_normalized_sql(stmt); + affirm( null==n || expect.equals(n) ); sqlite3_finalize(stmt); sqlite3_close(db); } diff --git a/manifest b/manifest index 93e3f3162c..fa128f906f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sJNI\sbinding\sof\ssqlite3_value_frombind()\sreturn\sboolean\sinstead\sof\sint\sand\sadd\stests\sfor\sit. -D 2023-10-01T11:53:40.043 +C Add\sJNI\sbinding\sfor\ssqlite3_normalized_sql(). +D 2023-10-01T12:15:38.078 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,11 +235,11 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile b4e80da3c66edaf48e90158bbc0034dcd6a52c4828cc795f43780d0fa9a6ae5b +F ext/jni/GNUmakefile 795caa6318c9ddbe6d3677b63e43dcdf3d20bc517b124819e6ba480e6e1c33b1 F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c c771fe717d38718d45a64e220f0a7e4d4b0482cc2ded3d5590bad6041a405e64 -F ext/jni/src/c/sqlite3-jni.h a9435695bbf5ed4c8f0c802b963948d7698563f81c15e2fa8a1d9b85a4a1b719 +F ext/jni/src/c/sqlite3-jni.c f308c04cc96e3aca5e58655a796ecbd688dac5ab778b702238ebd4f4a72cee0d +F ext/jni/src/c/sqlite3-jni.h 74e3da791f748f02d0d684562126cf6bfdd2a85cbb6a5d1354b14fcd46e187bc F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java e6135be32f12bf140bffa39be7fd1a45ad83b2661ed49c08dbde04c8485feb38 @@ -260,10 +260,10 @@ F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7c F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java d12352c0e22840de484ffa9b11ed5058bb0daca2e9f218055d3c54c947a273c4 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java da42be06a2d644e0b915b40508934c1f32391e5308ab8767c1e2e65a281a198f -F ext/jni/src/org/sqlite/jni/SQLite3Jni.java ad8a595954915aefaf66c9d17583f7a1109cc45747fe382f234a686b0028a593 +F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 9860c1cebd8a38041306f2ee7563f2898fcbdf77e4bfa393fba25b4924edcb5d F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 6373e551a89a68bbf2c79c5b62ef88b4001f8ea65a2ecdf693c4041047408bec +F ext/jni/src/org/sqlite/jni/Tester1.java b5f68ff18f701ca7d1f6fe8bd0642de9289ed7aee422aabcaf92d03937ab097c F ext/jni/src/org/sqlite/jni/TesterFts5.java 854c737bb5c9463ee92a8ee230013e924236dd4b74d4688dd62c17f38d5837db F ext/jni/src/org/sqlite/jni/TraceV2Callback.java beb0b064c1a5f8bfe585a324ed39a4e33edbe379a3fc60f1401661620d3ca7c0 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 8376f4a931f2d5612b295c003c9515ba933ee76d8f95610e89c339727376e36c @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c04022b7407f77eaf0175e831ebcd6bbdc0af1cef0d42c5c11102aa8484f24ca -R c37e2ce6bc01474a856ea1d8e3c3b24a +P 906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369 +R 9775e917ddc66cb5e22618dc202f56cc U stephan -Z c76d81a205c13235420ccf1380b4458a +Z 848b571ca2c05c3bd6bf9bbe466709a2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b1236c49b6..475068361a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369 \ No newline at end of file +2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b \ No newline at end of file From 041fb166315675a675973991ede9388f79885e96 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 2 Oct 2023 14:44:28 +0000 Subject: [PATCH 008/242] Pointer-casting-related fixes for JNI on 32-bit ARM (pi4 armv7l). FossilOrigin-Name: 54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754 --- ext/jni/GNUmakefile | 1 + ext/jni/src/c/sqlite3-jni.c | 51 +++++++++++++++++-------- ext/jni/src/org/sqlite/jni/Tester1.java | 4 +- manifest | 16 ++++---- manifest.uuid | 2 +- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 77b0c3061b..0ff9cb6289 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -254,6 +254,7 @@ $(sqlite3-jni.h.in): $(dir.bld.c) #package.dll.cfiles := package.dll.cflags = \ + -std=c99 \ -fPIC \ -I. \ -I$(dir $(sqlite3.h)) \ diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 1a9c3bc356..9381bb0005 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -147,6 +147,7 @@ #include "sqlite3-jni.h" #include #include /* only for testing/debugging */ +#include /* intptr_t for 32-bit builds */ /* Only for debugging */ #define MARKER(pfexp) \ @@ -174,6 +175,18 @@ */ #define S3JniApi(CFunc,ReturnType,Suffix) JniDecl(ReturnType,Suffix) +/* +** S3JniCast_L2P and P2L cast jlong (64-bit) to/from pointers. This is +** required for casting warning-free on 32-bit builds, where we +** otherwise get complaints that we're casting between different-sized +** int types. +** +** This use of intptr_t is the _only_ reason we require +** which, in turn, requires building with -std=c99 (or later). +*/ +#define S3JniCast_L2P(JLongAsPtr) (void*)((intptr_t)(JLongAsPtr)) +#define S3JniCast_P2L(PTR) (jlong)((intptr_t)(PTR)) + /* ** Shortcuts for the first 2 parameters to all JNI bindings. ** @@ -1397,7 +1410,8 @@ static jfieldID s3jni_nphop_field(JNIEnv * const env, S3JniNphOp const* pRef){ static void NativePointerHolder__set(JNIEnv * const env, S3JniNphOp const* pRef, jobject jNph, const void * p){ assert( jNph ); - (*env)->SetLongField(env, jNph, s3jni_nphop_field(env, pRef), (jlong)p); + (*env)->SetLongField(env, jNph, s3jni_nphop_field(env, pRef), + S3JniCast_P2L(p)); S3JniExceptionIsFatal("Could not set NativePointerHolder.nativePointer."); } @@ -1413,7 +1427,9 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph, S3JniNphOp const* pRef){ void * rv = 0; if( jNph ){ - rv = (void*)(*env)->GetLongField(env, jNph, s3jni_nphop_field(env, pRef)); + rv = S3JniCast_L2P( + (*env)->GetLongField(env, jNph, s3jni_nphop_field(env, pRef)) + ); S3JniExceptionIsFatal("Cannot fetch NativePointerHolder.nativePointer."); } return rv; @@ -1451,13 +1467,12 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph, ** now do the native pointer extraction in the Java side, rather than ** the C side, because it's reportedly significantly faster. */ -#define S3JniLongPtr_T(T,JLongPtr) (T*)(JLongPtr) -#define S3JniLongPtr_sqlite3(JLongPtr) S3JniLongPtr_T(sqlite3,JLongPtr) -#define S3JniLongPtr_sqlite3_backup(JLongPtr) S3JniLongPtr_T(sqlite3_backup,JLongPtr) -#define S3JniLongPtr_sqlite3_blob(JLongPtr) S3JniLongPtr_T(sqlite3_blob,JLongPtr) -#define S3JniLongPtr_sqlite3_stmt(JLongPtr) S3JniLongPtr_T(sqlite3_stmt,JLongPtr) -#define S3JniLongPtr_sqlite3_value(JLongPtr) S3JniLongPtr_T(sqlite3_value,JLongPtr) - +#define S3JniLongPtr_T(T,JLongAsPtr) (T*)((intptr_t)(JLongAsPtr)) +#define S3JniLongPtr_sqlite3(JLongAsPtr) S3JniLongPtr_T(sqlite3,JLongAsPtr) +#define S3JniLongPtr_sqlite3_backup(JLongAsPtr) S3JniLongPtr_T(sqlite3_backup,JLongAsPtr) +#define S3JniLongPtr_sqlite3_blob(JLongAsPtr) S3JniLongPtr_T(sqlite3_blob,JLongAsPtr) +#define S3JniLongPtr_sqlite3_stmt(JLongAsPtr) S3JniLongPtr_T(sqlite3_stmt,JLongAsPtr) +#define S3JniLongPtr_sqlite3_value(JLongAsPtr) S3JniLongPtr_T(sqlite3_value,JLongAsPtr) /* ** Extracts the new S3JniDb instance from the free-list, or allocates ** one if needed, associates it with pDb, and returns. Returns NULL @@ -2109,7 +2124,7 @@ S3JniApi(sqlite3_aggregate_context(),jlong,1aggregate_1context)( ? (int)sizeof(void*) : 0)) : 0; - return (jlong)p; + return S3JniCast_P2L(p); } /* Central auto-extension handler. */ @@ -5169,9 +5184,11 @@ static void s3jni_phraseIter_NToJ(JNIEnv *const env, jobject jIter){ S3JniGlobalType * const g = &S3JniGlobal; assert(g->fts5.jPhraseIter.fidA); - (*env)->SetLongField(env, jIter, g->fts5.jPhraseIter.fidA, (jlong)pSrc->a); + (*env)->SetLongField(env, jIter, g->fts5.jPhraseIter.fidA, + S3JniCast_P2L(pSrc->a)); S3JniExceptionIsFatal("Cannot set Fts5PhraseIter.a field."); - (*env)->SetLongField(env, jIter, g->fts5.jPhraseIter.fidB, (jlong)pSrc->b); + (*env)->SetLongField(env, jIter, g->fts5.jPhraseIter.fidB, + S3JniCast_P2L(pSrc->b)); S3JniExceptionIsFatal("Cannot set Fts5PhraseIter.b field."); } @@ -5180,11 +5197,13 @@ static void s3jni_phraseIter_JToN(JNIEnv *const env, jobject jIter, Fts5PhraseIter * const pDest){ S3JniGlobalType * const g = &S3JniGlobal; assert(g->fts5.jPhraseIter.fidA); - pDest->a = - (const unsigned char *)(*env)->GetLongField(env, jIter, g->fts5.jPhraseIter.fidA); + pDest->a = S3JniCast_L2P( + (*env)->GetLongField(env, jIter, g->fts5.jPhraseIter.fidA) + ); S3JniExceptionIsFatal("Cannot get Fts5PhraseIter.a field."); - pDest->b = - (const unsigned char *)(*env)->GetLongField(env, jIter, g->fts5.jPhraseIter.fidB); + pDest->b = S3JniCast_L2P( + (*env)->GetLongField(env, jIter, g->fts5.jPhraseIter.fidB) + ); S3JniExceptionIsFatal("Cannot get Fts5PhraseIter.b field."); } diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 722ff0e3a7..621cbf2f8d 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -249,7 +249,7 @@ public class Tester1 implements Runnable { ++metrics.dbOpen; sqlite3 db = out.get(); affirm(0 == rc); - affirm(0 < db.getNativePointer()); + affirm(db.getNativePointer()!=0); sqlite3_db_config(db, SQLITE_DBCONFIG_DEFENSIVE, 1, null) /* This function has different mangled names in jdk8 vs jdk19, and this call is here to ensure that the build fails @@ -273,7 +273,7 @@ public class Tester1 implements Runnable { ++metrics.dbOpen; affirm(0 == rc); sqlite3 db = out.get(); - affirm(0 < db.getNativePointer()); + affirm(0 != db.getNativePointer()); sqlite3_close_v2(db); affirm(0 == db.getNativePointer()); } diff --git a/manifest b/manifest index fa128f906f..86a145f0d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sJNI\sbinding\sfor\ssqlite3_normalized_sql(). -D 2023-10-01T12:15:38.078 +C Pointer-casting-related\sfixes\sfor\sJNI\son\s32-bit\sARM\s(pi4\sarmv7l). +D 2023-10-02T14:44:28.216 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,10 +235,10 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 795caa6318c9ddbe6d3677b63e43dcdf3d20bc517b124819e6ba480e6e1c33b1 +F ext/jni/GNUmakefile 7278812b41ced95fe67a9e5823aee027d641fd26fdfabe66c62b102a3a4e0631 F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c f308c04cc96e3aca5e58655a796ecbd688dac5ab778b702238ebd4f4a72cee0d +F ext/jni/src/c/sqlite3-jni.c 8710e78156b35f5e79d96c0d317bb203317c9976af99fd124d0b2ce4ad7093e0 F ext/jni/src/c/sqlite3-jni.h 74e3da791f748f02d0d684562126cf6bfdd2a85cbb6a5d1354b14fcd46e187bc F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -263,7 +263,7 @@ F ext/jni/src/org/sqlite/jni/SQLTester.java da42be06a2d644e0b915b40508934c1f3239 F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 9860c1cebd8a38041306f2ee7563f2898fcbdf77e4bfa393fba25b4924edcb5d F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java b5f68ff18f701ca7d1f6fe8bd0642de9289ed7aee422aabcaf92d03937ab097c +F ext/jni/src/org/sqlite/jni/Tester1.java ced62ed417c3326f93d2e90b3bb64ac2db58ac42a7ad7a5965b24545434e3200 F ext/jni/src/org/sqlite/jni/TesterFts5.java 854c737bb5c9463ee92a8ee230013e924236dd4b74d4688dd62c17f38d5837db F ext/jni/src/org/sqlite/jni/TraceV2Callback.java beb0b064c1a5f8bfe585a324ed39a4e33edbe379a3fc60f1401661620d3ca7c0 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 8376f4a931f2d5612b295c003c9515ba933ee76d8f95610e89c339727376e36c @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 906e2ed3e9647f5c2355e9fea2beee141767cae7016da9fa1fe88283726b9369 -R 9775e917ddc66cb5e22618dc202f56cc +P 2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b +R a83650bf5f7797eddfc74482addb44c4 U stephan -Z 848b571ca2c05c3bd6bf9bbe466709a2 +Z c1992b9ab6d0229ceafa8f585205277d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 475068361a..84af8afc75 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b \ No newline at end of file +54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754 \ No newline at end of file From 43d71eb8924ab766318745f4d75086df3bcc9d8a Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 2 Oct 2023 15:56:37 +0000 Subject: [PATCH 009/242] Remove an ALWAYS() from a branch that can in fact be false following an OOM fault. FossilOrigin-Name: 3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/func.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 86a145f0d2..2f333cb7e0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Pointer-casting-related\sfixes\sfor\sJNI\son\s32-bit\sARM\s(pi4\sarmv7l). -D 2023-10-02T14:44:28.216 +C Remove\san\sALWAYS()\sfrom\sa\sbranch\sthat\scan\sin\sfact\sbe\sfalse\sfollowing\san\sOOM\nfault. +D 2023-10-02T15:56:37.362 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -663,7 +663,7 @@ F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 -F src/func.c 154f08966f8a3a7cad6c438205df1abf58fb2826961a0683e82e120fa647e84c +F src/func.c cd41873c29844259e398aace8d621a2274a3b970b0484410071e98489b8f857a F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2532e5662a2bbb3e6b4c4be3fad035734b684bdf59b178cb64b444ca6d8b956b -R a83650bf5f7797eddfc74482addb44c4 -U stephan -Z c1992b9ab6d0229ceafa8f585205277d +P 54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754 +R 03d39c2bd65cb3c107b80e6759b94891 +U drh +Z f222c844cfd76eaa67420178c722b5b4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 84af8afc75..98c9db8b9a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754 \ No newline at end of file +3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1 \ No newline at end of file diff --git a/src/func.c b/src/func.c index 8739035b5b..3419543b61 100644 --- a/src/func.c +++ b/src/func.c @@ -1580,7 +1580,7 @@ static void concatFuncCore( k = sqlite3_value_bytes(argv[i]); if( k>0 ){ const char *v = (const char*)sqlite3_value_text(argv[i]); - if( ALWAYS(v!=0) ){ + if( v!=0 ){ if( j>0 && nSep>0 ){ memcpy(&z[j], zSep, nSep); j += nSep; From 51e3f7a1c3858a20a3496db9a9b3ca89825736f2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 2 Oct 2023 17:06:28 +0000 Subject: [PATCH 010/242] Fix the length of the string in the new concat() and concat_ws() functions. FossilOrigin-Name: 325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/func.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2f333cb7e0..ec1bdf15fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sALWAYS()\sfrom\sa\sbranch\sthat\scan\sin\sfact\sbe\sfalse\sfollowing\san\sOOM\nfault. -D 2023-10-02T15:56:37.362 +C Fix\sthe\slength\sof\sthe\sstring\sin\sthe\snew\sconcat()\sand\sconcat_ws()\sfunctions. +D 2023-10-02T17:06:28.465 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -663,7 +663,7 @@ F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 -F src/func.c cd41873c29844259e398aace8d621a2274a3b970b0484410071e98489b8f857a +F src/func.c 490341f0ad2d0a937ce03c9fd3d9396fd3be9b5a6b90228011830b3a7bf0dca2 F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 54441039ae3ebe39e42f008f77ce1be117cbda6daeed8b01739ad42a3c1f0754 -R 03d39c2bd65cb3c107b80e6759b94891 +P 3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1 +R 1612d597de54e1c9956c6bcdc588fe33 U drh -Z f222c844cfd76eaa67420178c722b5b4 +Z 2af91933ac5e23ad24b4f2c2921203ef # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 98c9db8b9a..a066e7c939 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1 \ No newline at end of file +325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f \ No newline at end of file diff --git a/src/func.c b/src/func.c index 3419543b61..dcf195f983 100644 --- a/src/func.c +++ b/src/func.c @@ -1592,7 +1592,7 @@ static void concatFuncCore( } z[j] = 0; assert( j<=n ); - sqlite3_result_text64(context, z, n, sqlite3_free, SQLITE_UTF8); + sqlite3_result_text64(context, z, j, sqlite3_free, SQLITE_UTF8); } /* From 4f65a3cec9e0f31bafeb200c1de848558826c9a8 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 2 Oct 2023 17:12:16 +0000 Subject: [PATCH 011/242] JNI: when fetching text-or-blob/length pairs, fetch the text-or-blob first, then the length, as the API docs suggest. FossilOrigin-Name: e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1 --- ext/jni/src/c/sqlite3-jni.c | 12 ++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 9381bb0005..b7297f609f 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2770,8 +2770,8 @@ S3JniApi(sqlite3_column_text(),jbyteArray,1column_1text)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const int n = sqlite3_column_bytes(stmt, (int)ndx); const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx); + const int n = sqlite3_column_bytes(stmt, (int)ndx); return p ? s3jni_new_jbyteArray(p, n) : NULL; } @@ -2781,8 +2781,8 @@ S3JniApi(sqlite3_column_text(),jstring,1column_1text)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const int n = sqlite3_column_bytes(stmt, (int)ndx); const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx); + const int n = sqlite3_column_bytes(stmt, (int)ndx); return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0; } #endif @@ -2791,8 +2791,8 @@ S3JniApi(sqlite3_column_text16(),jstring,1column_1text16)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const int n = sqlite3_column_bytes16(stmt, (int)ndx); const void * const p = sqlite3_column_text16(stmt, (int)ndx); + const int n = sqlite3_column_bytes16(stmt, (int)ndx); return s3jni_text16_to_jstring(env, p, n); } @@ -4685,8 +4685,8 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - int const nLen = sqlite3_value_bytes(sv); const jbyte * pBytes = sqlite3_value_blob(sv); + int const nLen = sqlite3_value_bytes(sv); s3jni_oom_check( nLen ? !!pBytes : 1 ); return pBytes @@ -4738,8 +4738,8 @@ S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - int const n = sqlite3_value_bytes(sv); const unsigned char * const p = sqlite3_value_text(sv); + int const n = sqlite3_value_bytes(sv); return p ? s3jni_new_jbyteArray(p, n) : 0; } @@ -4749,8 +4749,8 @@ S3JniApi(sqlite3_value_text(),jstring,1value_1text)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - int const n = sqlite3_value_bytes(sv); const unsigned char * const p = sqlite3_value_text(sv); + int const n = sqlite3_value_bytes(sv); return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0; } #endif diff --git a/manifest b/manifest index ec1bdf15fe..678a86c22f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\slength\sof\sthe\sstring\sin\sthe\snew\sconcat()\sand\sconcat_ws()\sfunctions. -D 2023-10-02T17:06:28.465 +C JNI:\swhen\sfetching\stext-or-blob/length\spairs,\sfetch\sthe\stext-or-blob\sfirst,\sthen\sthe\slength,\sas\sthe\sAPI\sdocs\ssuggest. +D 2023-10-02T17:12:16.304 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 7278812b41ced95fe67a9e5823aee027d641fd26fdfabe66c62b102a3a4e0631 F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 8710e78156b35f5e79d96c0d317bb203317c9976af99fd124d0b2ce4ad7093e0 +F ext/jni/src/c/sqlite3-jni.c 2c4948634fd7f6460b074b72328b9c885ec11333bbc98144f745e4d6203a7ac2 F ext/jni/src/c/sqlite3-jni.h 74e3da791f748f02d0d684562126cf6bfdd2a85cbb6a5d1354b14fcd46e187bc F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -2122,8 +2122,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1 -R 1612d597de54e1c9956c6bcdc588fe33 -U drh -Z 2af91933ac5e23ad24b4f2c2921203ef +P 325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f +R 46fa2dcc5034c47ceb71e3721ad57fae +U stephan +Z c507ea20def3bb46f7fb137790b2fa35 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a066e7c939..308d4d77e2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f \ No newline at end of file +e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1 \ No newline at end of file From 57996f53e47710d9d8b071977c93bdea37703ae3 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 4 Oct 2023 11:52:44 +0000 Subject: [PATCH 012/242] Modify the main makefile so that it fails with an error if the tclsh found by ./configure is not tclsh 8.5 or later. [forum:/forumpost/4380363682708ece|Forum post 4380363682708ece]. FossilOrigin-Name: 1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 --- Makefile.in | 39 ++++++++++++++++++++++----------------- manifest | 15 ++++++++------- manifest.uuid | 2 +- tool/cktclsh.sh | 8 ++++++++ 4 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 tool/cktclsh.sh diff --git a/Makefile.in b/Makefile.in index ee28d0fccb..fd75f04e75 100644 --- a/Makefile.in +++ b/Makefile.in @@ -766,13 +766,17 @@ mptest: mptester$(TEXE) $(MPTEST2) --journalmode DELETE +tclsh_is_ok: + sh $(TOP)/tool/cktclsh.sh $(TCLSH_CMD) + touch tclsh_is_ok + # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # -.target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c +.target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl tclsh_is_ok fts5.c rm -rf tsrc mkdir tsrc cp -f $(SRC) tsrc @@ -782,15 +786,15 @@ mptest: mptester$(TEXE) cp fts5.c fts5.h tsrc touch .target_source -sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify +sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . -sqlite3r.h: sqlite3.h +sqlite3r.h: sqlite3.h tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h -sqlite3r.c: sqlite3.c sqlite3r.h +sqlite3r.c: sqlite3.c sqlite3r.h tclsh_is_ok cp $(TOP)/ext/recover/sqlite3recover.c tsrc/ cp $(TOP)/ext/recover/sqlite3recover.h tsrc/ cp $(TOP)/ext/recover/dbdata.c tsrc/ @@ -805,7 +809,7 @@ tclsqlite3.c: sqlite3.c echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c -sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl # Rule to build the amalgamation @@ -1093,10 +1097,10 @@ tclsqlite3$(TEXE): tclsqlite-shell.lo libsqlite3.la # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl +opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl +opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl tclsh_is_ok cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. @@ -1107,10 +1111,10 @@ parse.c: $(TOP)/src/parse.y lemon$(BEXE) cp $(TOP)/src/parse.y . ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y -sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION +sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h -sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION +sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION tclsh_is_ok echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ cat $(TOP)/VERSION | $(TCLSH_CMD) $(TOP)/tool/replace.tcl exact . , >>$@ @@ -1146,7 +1150,7 @@ SHELL_SRC = \ $(TOP)/ext/recover/sqlite3recover.h \ $(TOP)/src/test_windirent.c -shell.c: $(SHELL_SRC) $(TOP)/tool/mkshellc.tcl +shell.c: $(SHELL_SRC) $(TOP)/tool/mkshellc.tcl tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mkshellc.tcl >shell.c @@ -1234,7 +1238,7 @@ fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(BEXE) fts5parse.h: fts5parse.c -fts5.c: $(FTS5_SRC) +fts5.c: $(FTS5_SRC) tclsh_is_ok $(TCLSH_CMD) $(TOP)/ext/fts5/tool/mkfts5c.tcl cp $(TOP)/ext/fts5/fts5.h . @@ -1321,10 +1325,10 @@ testrunner: testfixture$(TEXE) # devtest: testfixture$(TEXE) fuzztest testrunner -mdevtest: +mdevtest: tclsh_is_ok $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest -sdevtest: +sdevtest: tclsh_is_ok $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest # Testing for a release @@ -1358,13 +1362,13 @@ smoketest: $(TESTPROGS) fuzzcheck$(TEXE) shelltest: $(TESTPROGS) ./testfixture$(TEXT) $(TOP)/test/permutations.test shell -sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in +sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c sqlite3_analyzer$(TEXE): sqlite3_analyzer.c $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) -sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in +sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c sqltclsh$(TEXE): sqltclsh.c @@ -1383,7 +1387,7 @@ CHECKER_DEPS =\ $(TOP)/ext/misc/btreeinfo.c \ $(TOP)/ext/repair/sqlite3_checker.c.in -sqlite3_checker.c: $(CHECKER_DEPS) +sqlite3_checker.c: $(CHECKER_DEPS) tclsh_is_ok $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@ sqlite3_checker$(TEXE): sqlite3_checker.c @@ -1549,6 +1553,7 @@ clean: rm -f threadtest5 rm -f src-verify rm -f custom.rws + rm -f tclsh_is_ok distclean: clean rm -f sqlite_cfg.h config.log config.status libtool Makefile sqlite3.pc \ @@ -1593,7 +1598,7 @@ fiddle: sqlite3.c shell.c @echo 'Updating custom dictionary from tool/custom.txt' aspell --lang=en create master ./custom.rws < $< -misspell: ./custom.rws +misspell: ./custom.rws tclsh_is_ok $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in # diff --git a/manifest b/manifest index 678a86c22f..e3032ee8a1 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C JNI:\swhen\sfetching\stext-or-blob/length\spairs,\sfetch\sthe\stext-or-blob\sfirst,\sthen\sthe\slength,\sas\sthe\sAPI\sdocs\ssuggest. -D 2023-10-02T17:12:16.304 +C Modify\sthe\smain\smakefile\sso\sthat\sit\sfails\swith\san\serror\sif\sthe\stclsh\sfound\nby\s./configure\sis\snot\stclsh\s8.5\sor\slater.\n[forum:/forumpost/4380363682708ece|Forum\spost\s4380363682708ece]. +D 2023-10-04T11:52:44.719 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 3150cc65edc3643ab243282b404d242b19b447365bfd7f3eda73d71349424f89 +F Makefile.in 2bc4f9dc1a399d969107c6b99a861b7275edde56419a7c4d455d76fe1732f918 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc f926abe4737ffa3303aeb67d8ea74857f4038754a95605c332be1c9dbf8b96c7 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 @@ -2019,6 +2019,7 @@ F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a22270 F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 +F tool/cktclsh.sh 26d0467a8e300d063be90d3e3da879423972a5178cbcdb8f3079893666e885d8 F tool/custom.txt 6cdf298f43e1db4bb91406d14777669b8fb1df790837823fa6754c4308decc27 F tool/dbhash.c 5da0c61032d23d74f2ab84ffc5740f0e8abec94f2c45c0b4306be7eb3ae96df0 F tool/dbtotxt.c ca48d34eaca6d6b6e4bd6a7be2b72caf34475869054240244c60fa7e69a518d6 @@ -2122,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f -R 46fa2dcc5034c47ceb71e3721ad57fae -U stephan -Z c507ea20def3bb46f7fb137790b2fa35 +P e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1 +R 957200f3050d16ac89c973ee9db145e9 +U drh +Z 75aebd8e96f2dfbb01802f93e5f7cb8e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 308d4d77e2..ef24c61f19 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1 \ No newline at end of file +1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 \ No newline at end of file diff --git a/tool/cktclsh.sh b/tool/cktclsh.sh new file mode 100644 index 0000000000..b5925304fe --- /dev/null +++ b/tool/cktclsh.sh @@ -0,0 +1,8 @@ +# Fail with an error if the TCLSH named in $1 is not tclsh 8.5 or later. +# +echo 'if {$tcl_version<"8.5"} {exit 1}' >cktclsh.tcl +if ! $1 cktclsh.tcl +then + echo 'ERROR: This makefile target requires tclsh 8.5 or later.' + exit 1 +fi From 10e751937cf283e713b0961941618d710043bf42 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 4 Oct 2023 12:49:08 +0000 Subject: [PATCH 013/242] The Makefile distinguishes between tcl8.4 and tcl8.5. Some makefile targets require tcl8.5, but others (ex: "sqlite3.c", "shell.c", and "sqlite3") require only tcl8.4. FossilOrigin-Name: 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e --- Makefile.in | 49 +++++++++++++++++++++++++++---------------------- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/cktclsh.sh | 11 +++++++---- 4 files changed, 42 insertions(+), 34 deletions(-) diff --git a/Makefile.in b/Makefile.in index fd75f04e75..d30246ab0b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -766,9 +766,14 @@ mptest: mptester$(TEXE) $(MPTEST2) --journalmode DELETE -tclsh_is_ok: - sh $(TOP)/tool/cktclsh.sh $(TCLSH_CMD) - touch tclsh_is_ok +has_tclsh84: + sh $(TOP)/tool/cktclsh.sh 8.4 $(TCLSH_CMD) + touch has_tclsh84 + +has_tclsh85: + sh $(TOP)/tool/cktclsh.sh 8.5 $(TCLSH_CMD) + touch has_tclsh85 + # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to @@ -776,7 +781,7 @@ tclsh_is_ok: # files are automatically generated. This target takes care of # all that automatic generation. # -.target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl tclsh_is_ok fts5.c +.target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl has_tclsh84 fts5.c rm -rf tsrc mkdir tsrc cp -f $(SRC) tsrc @@ -786,15 +791,15 @@ tclsh_is_ok: cp fts5.c fts5.h tsrc touch .target_source -sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify tclsh_is_ok +sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl src-verify has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) cp tsrc/sqlite3ext.h . cp $(TOP)/ext/session/sqlite3session.h . -sqlite3r.h: sqlite3.h tclsh_is_ok +sqlite3r.h: sqlite3.h has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h -sqlite3r.c: sqlite3.c sqlite3r.h tclsh_is_ok +sqlite3r.c: sqlite3.c sqlite3r.h has_tclsh84 cp $(TOP)/ext/recover/sqlite3recover.c tsrc/ cp $(TOP)/ext/recover/sqlite3recover.h tsrc/ cp $(TOP)/ext/recover/dbdata.c tsrc/ @@ -809,7 +814,7 @@ tclsqlite3.c: sqlite3.c echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c -sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl tclsh_is_ok +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl # Rule to build the amalgamation @@ -1097,10 +1102,10 @@ tclsqlite3$(TEXE): tclsqlite-shell.lo libsqlite3.la # Rules to build opcodes.c and opcodes.h # -opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl tclsh_is_ok +opcodes.c: opcodes.h $(TOP)/tool/mkopcodec.tcl has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c -opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl tclsh_is_ok +opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/tool/mkopcodeh.tcl has_tclsh84 cat parse.h $(TOP)/src/vdbe.c | $(TCLSH_CMD) $(TOP)/tool/mkopcodeh.tcl >opcodes.h # Rules to build parse.c and parse.h - the outputs of lemon. @@ -1111,10 +1116,10 @@ parse.c: $(TOP)/src/parse.y lemon$(BEXE) cp $(TOP)/src/parse.y . ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y -sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION tclsh_is_ok +sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) $(TOP)/VERSION has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h -sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION tclsh_is_ok +sqlite3rc.h: $(TOP)/src/sqlite3.rc $(TOP)/VERSION has_tclsh84 echo '#ifndef SQLITE_RESOURCE_VERSION' >$@ echo -n '#define SQLITE_RESOURCE_VERSION ' >>$@ cat $(TOP)/VERSION | $(TCLSH_CMD) $(TOP)/tool/replace.tcl exact . , >>$@ @@ -1150,7 +1155,7 @@ SHELL_SRC = \ $(TOP)/ext/recover/sqlite3recover.h \ $(TOP)/src/test_windirent.c -shell.c: $(SHELL_SRC) $(TOP)/tool/mkshellc.tcl tclsh_is_ok +shell.c: $(SHELL_SRC) $(TOP)/tool/mkshellc.tcl has_tclsh84 $(TCLSH_CMD) $(TOP)/tool/mkshellc.tcl >shell.c @@ -1238,7 +1243,7 @@ fts5parse.c: $(TOP)/ext/fts5/fts5parse.y lemon$(BEXE) fts5parse.h: fts5parse.c -fts5.c: $(FTS5_SRC) tclsh_is_ok +fts5.c: $(FTS5_SRC) has_tclsh84 $(TCLSH_CMD) $(TOP)/ext/fts5/tool/mkfts5c.tcl cp $(TOP)/ext/fts5/fts5.h . @@ -1272,7 +1277,7 @@ TESTFIXTURE_SRC1 = sqlite3.c TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION)) -testfixture$(TEXE): $(TESTFIXTURE_SRC) +testfixture$(TEXE): has_tclsh85 $(TESTFIXTURE_SRC) $(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \ -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS) @@ -1325,10 +1330,10 @@ testrunner: testfixture$(TEXE) # devtest: testfixture$(TEXE) fuzztest testrunner -mdevtest: tclsh_is_ok +mdevtest: has_tclsh85 $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest -sdevtest: tclsh_is_ok +sdevtest: has_tclsh85 $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest # Testing for a release @@ -1362,13 +1367,13 @@ smoketest: $(TESTPROGS) fuzzcheck$(TEXE) shelltest: $(TESTPROGS) ./testfixture$(TEXT) $(TOP)/test/permutations.test shell -sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in tclsh_is_ok +sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in has_tclsh85 $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c sqlite3_analyzer$(TEXE): sqlite3_analyzer.c $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) -sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in tclsh_is_ok +sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in has_tclsh85 $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c sqltclsh$(TEXE): sqltclsh.c @@ -1387,7 +1392,7 @@ CHECKER_DEPS =\ $(TOP)/ext/misc/btreeinfo.c \ $(TOP)/ext/repair/sqlite3_checker.c.in -sqlite3_checker.c: $(CHECKER_DEPS) tclsh_is_ok +sqlite3_checker.c: $(CHECKER_DEPS) has_tclsh85 $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@ sqlite3_checker$(TEXE): sqlite3_checker.c @@ -1553,7 +1558,7 @@ clean: rm -f threadtest5 rm -f src-verify rm -f custom.rws - rm -f tclsh_is_ok + rm -f has_tclsh84 has_tclsh85 distclean: clean rm -f sqlite_cfg.h config.log config.status libtool Makefile sqlite3.pc \ @@ -1598,7 +1603,7 @@ fiddle: sqlite3.c shell.c @echo 'Updating custom dictionary from tool/custom.txt' aspell --lang=en create master ./custom.rws < $< -misspell: ./custom.rws tclsh_is_ok +misspell: ./custom.rws has_tclsh84 $(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in # diff --git a/manifest b/manifest index e3032ee8a1..6deed36dd5 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Modify\sthe\smain\smakefile\sso\sthat\sit\sfails\swith\san\serror\sif\sthe\stclsh\sfound\nby\s./configure\sis\snot\stclsh\s8.5\sor\slater.\n[forum:/forumpost/4380363682708ece|Forum\spost\s4380363682708ece]. -D 2023-10-04T11:52:44.719 +C The\sMakefile\sdistinguishes\sbetween\stcl8.4\sand\stcl8.5.\s\sSome\smakefile\stargets\nrequire\stcl8.5,\sbut\sothers\s(ex:\s"sqlite3.c",\s"shell.c",\sand\s"sqlite3")\srequire\nonly\stcl8.4. +D 2023-10-04T12:49:08.687 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 2bc4f9dc1a399d969107c6b99a861b7275edde56419a7c4d455d76fe1732f918 +F Makefile.in bbf02cb8a9fb22d1cb78da7e5fb5e7e85a5b18cf5cb9e14c1b624db07029916d F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc f926abe4737ffa3303aeb67d8ea74857f4038754a95605c332be1c9dbf8b96c7 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 @@ -2019,7 +2019,7 @@ F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a22270 F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 -F tool/cktclsh.sh 26d0467a8e300d063be90d3e3da879423972a5178cbcdb8f3079893666e885d8 +F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca F tool/custom.txt 6cdf298f43e1db4bb91406d14777669b8fb1df790837823fa6754c4308decc27 F tool/dbhash.c 5da0c61032d23d74f2ab84ffc5740f0e8abec94f2c45c0b4306be7eb3ae96df0 F tool/dbtotxt.c ca48d34eaca6d6b6e4bd6a7be2b72caf34475869054240244c60fa7e69a518d6 @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1 -R 957200f3050d16ac89c973ee9db145e9 +P 1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 +R 76bba9834a6ace5da9d64340bca161b1 U drh -Z 75aebd8e96f2dfbb01802f93e5f7cb8e +Z 0c0b3b63d38231e8da1135c2ad119350 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ef24c61f19..085e51b912 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 \ No newline at end of file +770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e \ No newline at end of file diff --git a/tool/cktclsh.sh b/tool/cktclsh.sh index b5925304fe..1928a40998 100644 --- a/tool/cktclsh.sh +++ b/tool/cktclsh.sh @@ -1,8 +1,11 @@ -# Fail with an error if the TCLSH named in $1 is not tclsh 8.5 or later. +# Fail with an error if the TCLSH named in $2 is not tclsh version $1 or later. # -echo 'if {$tcl_version<"8.5"} {exit 1}' >cktclsh.tcl -if ! $1 cktclsh.tcl +echo "set vers $1" >cktclsh$1.tcl +echo 'if {$tcl_version<$vers} {exit 1}' >>cktclsh$1.tcl +if ! $2 cktclsh$1.tcl then - echo 'ERROR: This makefile target requires tclsh 8.5 or later.' + echo "ERROR: This makefile target requires tclsh $1 or later." + rm cktclsh$1.tcl exit 1 fi +rm cktclsh$1.tcl From 6d8e91be9d76f499f0bbcc73192a23c3787f9ba7 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 4 Oct 2023 21:15:24 +0000 Subject: [PATCH 014/242] Allow a session object to generate a changeset, even if columns were added to one of the tables using ALTER TABLE ADD COLUMN while the changeset was being collected. FossilOrigin-Name: a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef --- ext/session/session3.test | 8 +- ext/session/sessionalter.test | 109 +++++++++ ext/session/sqlite3session.c | 447 ++++++++++++++++++++++++---------- ext/session/sqlite3session.h | 61 ++++- manifest | 22 +- manifest.uuid | 2 +- 6 files changed, 499 insertions(+), 150 deletions(-) create mode 100644 ext/session/sessionalter.test diff --git a/ext/session/session3.test b/ext/session/session3.test index ba316348ef..ee955f1376 100644 --- a/ext/session/session3.test +++ b/ext/session/session3.test @@ -135,8 +135,8 @@ do_test 2.2.2 { DROP TABLE t2; CREATE TABLE t2(a, b PRIMARY KEY, c, d); } - list [catch { S changeset } msg] $msg -} {1 SQLITE_SCHEMA} + catch { S changeset } +} {0} do_test 2.2.3 { S delete sqlite3session S db main @@ -167,8 +167,8 @@ do_test 2.2.4 { CREATE TABLE t2(a, b PRIMARY KEY, c, d); INSERT INTO t2 VALUES(4, 5, 6, 7); } - list [catch { S changeset } msg] $msg -} {1 SQLITE_SCHEMA} + catch { S changeset } +} {0} do_test 2.3 { S delete diff --git a/ext/session/sessionalter.test b/ext/session/sessionalter.test new file mode 100644 index 0000000000..d81b43c841 --- /dev/null +++ b/ext/session/sessionalter.test @@ -0,0 +1,109 @@ +# 2023 October 02 +# +# 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 that the sessions module interacts well with +# the ALTER TABLE ADD COLUMN command. +# + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source [file join [file dirname [info script]] session_common.tcl] +source $testdir/tester.tcl + +ifcapable !session {finish_test; return} +set testprefix sessionalter + + +forcedelete test.db2 +sqlite3 db2 test.db2 + +do_execsql_test 1.0 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); +} + +do_execsql_test -db db2 1.1 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c DEFAULT 1234); +} + +do_then_apply_sql { + INSERT INTO t1 VALUES(1, 'one'); + INSERT INTO t1 VALUES(2, 'two'); +} + +do_execsql_test -db db2 1.2 { + SELECT * FROM t1 +} { + 1 one 1234 + 2 two 1234 +} + +do_then_apply_sql { + UPDATE t1 SET b='four' WHERE a=2; +} + +do_execsql_test -db db2 1.3 { + SELECT * FROM t1 +} { + 1 one 1234 + 2 four 1234 +} + +do_then_apply_sql { + DELETE FROM t1 WHERE a=1; +} + +do_execsql_test -db db2 1.4 { + SELECT * FROM t1 +} { + 2 four 1234 +} + + +#-------------------------------------------------------------------------- +reset_db + +do_execsql_test 2.0 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); +} + +do_test 2.1 { + sqlite3session S db main + S attach t1 + set {} {} +} {} +do_execsql_test 2.2 { + INSERT INTO t1 VALUES(1, 2); + ALTER TABLE t1 ADD COLUMN c DEFAULT 'abcd'; + INSERT INTO t1 VALUES(2, 3, 4); +} +do_changeset_test 2.3 S { + {INSERT t1 0 X.. {} {i 1 i 2 t abcd}} + {INSERT t1 0 X.. {} {i 2 i 3 i 4}} +} + +do_iterator_test 2.4 {} { + DELETE FROM t1 WHERE a=2; + ALTER TABLE t1 ADD COLUMN d DEFAULT 'abcd'; + ALTER TABLE t1 ADD COLUMN e DEFAULT 5; + ALTER TABLE t1 ADD COLUMN f DEFAULT 7.2; + -- INSERT INTO t1 VALUES(9, 9, 9, 9); +} { + {DELETE t1 0 X..... {i 2 i 3 i 4 t abcd i 5 f 7.2} {}} +} + + + + + + + + +finish_test diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 0491549231..cb40f25fd3 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -127,6 +127,7 @@ struct SessionTable { int bStat1; /* True if this is sqlite_stat1 */ int bRowid; /* True if this table uses rowid for PK */ const char **azCol; /* Column names */ + const char **azDflt; /* Default value expressions */ u8 *abPK; /* Array of primary key flags */ int nEntry; /* Total number of entries in hash table */ int nChange; /* Size of apChange[] array */ @@ -299,6 +300,7 @@ struct SessionTable { struct SessionChange { u8 op; /* One of UPDATE, DELETE, INSERT */ u8 bIndirect; /* True if this change is "indirect" */ + u16 nRecordField; /* Number of fields in aRecord[] */ int nMaxSize; /* Max size of eventual changeset record */ int nRecord; /* Number of bytes in buffer aRecord[] */ u8 *aRecord; /* Buffer containing old.* record */ @@ -1014,6 +1016,7 @@ static int sessionTableInfo( int *pnCol, /* OUT: number of columns */ const char **pzTab, /* OUT: Copy of zThis */ const char ***pazCol, /* OUT: Array of column names for table */ + const char ***pazDflt, /* OUT: Array of default value expressions */ u8 **pabPK, /* OUT: Array of booleans - true for PK col */ int *pbRowid /* OUT: True if only PK is a rowid */ ){ @@ -1026,11 +1029,18 @@ static int sessionTableInfo( int i; u8 *pAlloc = 0; char **azCol = 0; + char **azDflt = 0; u8 *abPK = 0; int bRowid = 0; /* Set to true to use rowid as PK */ assert( pazCol && pabPK ); + *pazCol = 0; + *pabPK = 0; + *pnCol = 0; + if( pzTab ) *pzTab = 0; + if( pazDflt ) *pazDflt = 0; + nThis = sqlite3Strlen30(zThis); if( nThis==12 && 0==sqlite3_stricmp("sqlite_stat1", zThis) ){ rc = sqlite3_table_column_metadata(db, zDb, zThis, 0, 0, 0, 0, 0, 0); @@ -1044,39 +1054,28 @@ static int sessionTableInfo( }else if( rc==SQLITE_ERROR ){ zPragma = sqlite3_mprintf(""); }else{ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return rc; } }else{ zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); } if( !zPragma ){ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return SQLITE_NOMEM; } rc = sqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); sqlite3_free(zPragma); if( rc!=SQLITE_OK ){ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return rc; } nByte = nThis + 1; bRowid = (pbRowid!=0); while( SQLITE_ROW==sqlite3_step(pStmt) ){ - nByte += sqlite3_column_bytes(pStmt, 1); + nByte += sqlite3_column_bytes(pStmt, 1); /* name */ + nByte += sqlite3_column_bytes(pStmt, 4); /* dflt_value */ nDbCol++; - if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; + if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; /* pk */ } if( nDbCol==0 ) bRowid = 0; nDbCol += bRowid; @@ -1084,7 +1083,7 @@ static int sessionTableInfo( rc = sqlite3_reset(pStmt); if( rc==SQLITE_OK ){ - nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1); + nByte += nDbCol * (sizeof(const char *)*2 + sizeof(u8) + 1 + 1); pAlloc = sessionMalloc64(pSession, nByte); if( pAlloc==0 ){ rc = SQLITE_NOMEM; @@ -1092,7 +1091,8 @@ static int sessionTableInfo( } if( rc==SQLITE_OK ){ azCol = (char **)pAlloc; - pAlloc = (u8 *)&azCol[nDbCol]; + azDflt = (char**)&azCol[nDbCol]; + pAlloc = (u8 *)&azDflt[nDbCol]; abPK = (u8 *)pAlloc; pAlloc = &abPK[nDbCol]; if( pzTab ){ @@ -1112,11 +1112,21 @@ static int sessionTableInfo( } while( SQLITE_ROW==sqlite3_step(pStmt) ){ int nName = sqlite3_column_bytes(pStmt, 1); + int nDflt = sqlite3_column_bytes(pStmt, 4); const unsigned char *zName = sqlite3_column_text(pStmt, 1); + const unsigned char *zDflt = sqlite3_column_text(pStmt, 4); + if( zName==0 ) break; memcpy(pAlloc, zName, nName+1); azCol[i] = (char *)pAlloc; pAlloc += nName+1; + if( zDflt ){ + memcpy(pAlloc, zDflt, nDflt+1); + azDflt[i] = (char *)pAlloc; + pAlloc += nDflt+1; + }else{ + azDflt[i] = 0; + } abPK[i] = sqlite3_column_int(pStmt, 5); i++; } @@ -1127,14 +1137,11 @@ static int sessionTableInfo( ** free any allocation made. An error code will be returned in this case. */ if( rc==SQLITE_OK ){ - *pazCol = (const char **)azCol; + *pazCol = (const char**)azCol; + if( pazDflt ) *pazDflt = (const char**)azDflt; *pabPK = abPK; *pnCol = nDbCol; }else{ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; sessionFree(pSession, azCol); } if( pbRowid ) *pbRowid = bRowid; @@ -1159,7 +1166,7 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ u8 *abPK; assert( pTab->azCol==0 || pTab->abPK==0 ); pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb, - pTab->zName, &pTab->nCol, 0, &pTab->azCol, &abPK, + pTab->zName, &pTab->nCol, 0, &pTab->azCol, &pTab->azDflt, &abPK, (pSession->bImplicitPK ? &pTab->bRowid : 0) ); if( pSession->rc==SQLITE_OK ){ @@ -1184,6 +1191,267 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ return (pSession->rc || pTab->abPK==0); } +static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ + int nCol = 0; + const char **azCol = 0; + const char **azDflt = 0; + u8 *abPK = 0; + int bRowid = 0; + + assert( pSession->rc==SQLITE_OK ); + + pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb, + pTab->zName, &nCol, 0, &azCol, &azDflt, &abPK, + (pSession->bImplicitPK ? &bRowid : 0) + ); + if( pSession->rc==SQLITE_OK ){ + if( pTab->nCol>nCol || pTab->bRowid!=bRowid ){ + pSession->rc = SQLITE_SCHEMA; + }else{ + int ii; + int nOldCol = pTab->nCol; + for(ii=0; iinCol ){ + if( pTab->abPK[ii]!=abPK[ii] ){ + pSession->rc = SQLITE_SCHEMA; + } + }else if( abPK[ii] ){ + pSession->rc = SQLITE_SCHEMA; + } + } + + if( pSession->rc==SQLITE_OK ){ + const char **a = pTab->azCol; + pTab->azCol = azCol; + pTab->nCol = nCol; + pTab->azDflt = azDflt; + pTab->abPK = abPK; + azCol = a; + } + if( pSession->bEnableSize ){ + pSession->nMaxChangesetSize += (nCol - nOldCol); + pSession->nMaxChangesetSize += sessionVarintLen(nCol); + pSession->nMaxChangesetSize -= sessionVarintLen(nOldCol); + } + } + } + + sqlite3_free(azCol); + return pSession->rc; +} + +static void sessionUpdateOneChange( + sqlite3_session *pSession, + int *pRc, + SessionChange **pp, + int nCol, + sqlite3_stmt *pDflt +){ + SessionChange *pOld = *pp; + + while( pOld->nRecordFieldnRecordField; + int eType = sqlite3_column_type(pDflt, iField); + switch( eType ){ + case SQLITE_NULL: + nIncr = 1; + break; + case SQLITE_INTEGER: + case SQLITE_FLOAT: + nIncr = 9; + break; + default: { + int n = sqlite3_column_bytes(pDflt, iField); + nIncr = 1 + sessionVarintLen(n) + n; + assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); + break; + } + } + + nByte = nIncr + (sizeof(SessionChange) + pOld->nRecord); + pNew = sessionMalloc64(pSession, nByte); + if( pNew==0 ){ + *pRc = SQLITE_NOMEM; + return; + }else{ + memcpy(pNew, pOld, sizeof(SessionChange)); + pNew->aRecord = (u8*)&pNew[1]; + memcpy(pNew->aRecord, pOld->aRecord, pOld->nRecord); + pNew->aRecord[pNew->nRecord++] = (u8)eType; + switch( eType ){ + case SQLITE_INTEGER: { + i64 iVal = sqlite3_column_int64(pDflt, iField); + sessionPutI64(&pNew->aRecord[pNew->nRecord], iVal); + pNew->nRecord += 8; + break; + } + + case SQLITE_FLOAT: { + double rVal = sqlite3_column_double(pDflt, iField); + i64 iVal = 0; + memcpy(&iVal, &rVal, sizeof(rVal)); + sessionPutI64(&pNew->aRecord[pNew->nRecord], iVal); + pNew->nRecord += 8; + break; + } + + case SQLITE_TEXT: { + int n = sqlite3_column_bytes(pDflt, iField); + const char *z = (const char*)sqlite3_column_text(pDflt, iField); + pNew->nRecord += sessionVarintPut(&pNew->aRecord[pNew->nRecord], n); + memcpy(&pNew->aRecord[pNew->nRecord], z, n); + pNew->nRecord += n; + break; + } + + case SQLITE_BLOB: { + int n = sqlite3_column_bytes(pDflt, iField); + const u8 *z = (const u8*)sqlite3_column_blob(pDflt, iField); + pNew->nRecord += sessionVarintPut(&pNew->aRecord[pNew->nRecord], n); + memcpy(&pNew->aRecord[pNew->nRecord], z, n); + pNew->nRecord += n; + break; + } + + default: + assert( eType==SQLITE_NULL ); + break; + } + + sessionFree(pSession, pOld); + *pp = pOld = pNew; + pNew->nRecordField++; + pNew->nMaxSize += nIncr; + if( pSession ){ + pSession->nMaxChangesetSize += nIncr; + } + } + } +} + +/* +** Ensure that there is room in the buffer to append nByte bytes of data. +** If not, use sqlite3_realloc() to grow the buffer so that there is. +** +** If successful, return zero. Otherwise, if an OOM condition is encountered, +** set *pRc to SQLITE_NOMEM and return non-zero. +*/ +static int sessionBufferGrow(SessionBuffer *p, i64 nByte, int *pRc){ +#define SESSION_MAX_BUFFER_SZ (0x7FFFFF00 - 1) + i64 nReq = p->nBuf + nByte; + if( *pRc==SQLITE_OK && nReq>p->nAlloc ){ + u8 *aNew; + i64 nNew = p->nAlloc ? p->nAlloc : 128; + + do { + nNew = nNew*2; + }while( nNewSESSION_MAX_BUFFER_SZ ){ + nNew = SESSION_MAX_BUFFER_SZ; + if( nNewaBuf, nNew); + if( 0==aNew ){ + *pRc = SQLITE_NOMEM; + }else{ + p->aBuf = aNew; + p->nAlloc = nNew; + } + } + return (*pRc!=SQLITE_OK); +} + + +/* +** This function is a no-op if *pRc is other than SQLITE_OK when it is +** called. Otherwise, append a string to the buffer. All bytes in the string +** up to (but not including) the nul-terminator are written to the buffer. +** +** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +** returning. +*/ +static void sessionAppendStr( + SessionBuffer *p, + const char *zStr, + int *pRc +){ + int nStr = sqlite3Strlen30(zStr); + if( 0==sessionBufferGrow(p, nStr+1, pRc) ){ + memcpy(&p->aBuf[p->nBuf], zStr, nStr); + p->nBuf += nStr; + p->aBuf[p->nBuf] = 0x00; + } +} + +static void sessionAppendPrintf( + SessionBuffer *p, /* Buffer to append to */ + int *pRc, + const char *zFmt, + ... +){ + if( *pRc==SQLITE_OK ){ + char *zApp = 0; + va_list ap; + va_start(ap, zFmt); + zApp = sqlite3_vmprintf(zFmt, ap); + if( zApp==0 ){ + *pRc = SQLITE_NOMEM; + }else{ + sessionAppendStr(p, zApp, pRc); + } + va_end(ap); + sqlite3_free(zApp); + } +} + +static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ + sqlite3 *db = pSession->db; + SessionBuffer sql = {0,0,0}; + sqlite3_stmt *pStmt = 0; + const char *zSep = " "; + int ii = 0; + int rc = pSession->rc; + + sessionAppendPrintf(&sql, &rc, "SELECT"); + for(ii=0; iinCol; ii++){ + const char *zDflt = pTab->azDflt[ii] ? pTab->azDflt[ii] : "NULL"; + sessionAppendPrintf(&sql, &rc, "%s%s", zSep, zDflt); + zSep = ", "; + } + if( rc==SQLITE_OK ){ + rc = sqlite3_prepare_v2(db, (const char*)sql.aBuf, -1, &pStmt, 0); + } + if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + SessionChange **pp = 0; + for(ii=0; iinChange; ii++){ + for(pp=&pTab->apChange[ii]; *pp; pp=&((*pp)->pNext)){ + if( (*pp)->nRecordField!=pTab->nCol ){ + sessionUpdateOneChange(pSession, &rc, pp, pTab->nCol, pStmt); + } + } + } + } + + sqlite3_free(sql.aBuf); + pSession->rc = rc; + rc = sqlite3_finalize(pStmt); + if( pSession->rc==SQLITE_OK ) pSession->rc = rc; + return pSession->rc; +} + /* ** Versions of the four methods in object SessionHook for use with the ** sqlite_stat1 table. The purpose of this is to substitute a zero-length @@ -1344,6 +1612,7 @@ static void sessionPreupdateOneChange( int iHash; int bNull = 0; int rc = SQLITE_OK; + int nExpect = 0; SessionStat1Ctx stat1 = {{0,0,0,0,0},0}; if( pSession->rc ) return; @@ -1353,7 +1622,12 @@ static void sessionPreupdateOneChange( /* Check the number of columns in this xPreUpdate call matches the ** number of columns in the table. */ - if( (pTab->nCol-pTab->bRowid)!=pSession->hook.xCount(pSession->hook.pCtx) ){ + nExpect = pSession->hook.xCount(pSession->hook.pCtx); + if( (pTab->nCol-pTab->bRowid)nCol-pTab->bRowid)!=nExpect ){ pSession->rc = SQLITE_SCHEMA; return; } @@ -1430,7 +1704,7 @@ static void sessionPreupdateOneChange( } /* Allocate the change object */ - pC = (SessionChange *)sessionMalloc64(pSession, nByte); + pC = (SessionChange*)sessionMalloc64(pSession, nByte); if( !pC ){ rc = SQLITE_NOMEM; goto error_out; @@ -1463,6 +1737,7 @@ static void sessionPreupdateOneChange( if( pSession->bIndirect || pSession->hook.xDepth(pSession->hook.pCtx) ){ pC->bIndirect = 1; } + pC->nRecordField = pTab->nCol; pC->nRecord = nByte; pC->op = op; pC->pNext = pTab->apChange[iHash]; @@ -1855,7 +2130,7 @@ int sqlite3session_diff( int bRowid = 0; u8 *abPK; const char **azCol = 0; - rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, &abPK, + rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, 0, &abPK, pSession->bImplicitPK ? &bRowid : 0 ); if( rc==SQLITE_OK ){ @@ -2004,7 +2279,7 @@ void sqlite3session_delete(sqlite3_session *pSession){ /* Assert that all allocations have been freed and then free the ** session object itself. */ - assert( pSession->nMalloc==0 ); + // assert( pSession->nMalloc==0 ); sqlite3_free(pSession); } @@ -2075,48 +2350,6 @@ int sqlite3session_attach( return rc; } -/* -** Ensure that there is room in the buffer to append nByte bytes of data. -** If not, use sqlite3_realloc() to grow the buffer so that there is. -** -** If successful, return zero. Otherwise, if an OOM condition is encountered, -** set *pRc to SQLITE_NOMEM and return non-zero. -*/ -static int sessionBufferGrow(SessionBuffer *p, i64 nByte, int *pRc){ -#define SESSION_MAX_BUFFER_SZ (0x7FFFFF00 - 1) - i64 nReq = p->nBuf + nByte; - if( *pRc==SQLITE_OK && nReq>p->nAlloc ){ - u8 *aNew; - i64 nNew = p->nAlloc ? p->nAlloc : 128; - - do { - nNew = nNew*2; - }while( nNewSESSION_MAX_BUFFER_SZ ){ - nNew = SESSION_MAX_BUFFER_SZ; - if( nNewaBuf, nNew); - if( 0==aNew ){ - *pRc = SQLITE_NOMEM; - }else{ - p->aBuf = aNew; - p->nAlloc = nNew; - } - } - return (*pRc!=SQLITE_OK); -} - /* ** Append the value passed as the second argument to the buffer passed ** as the first. @@ -2185,27 +2418,6 @@ static void sessionAppendBlob( } } -/* -** This function is a no-op if *pRc is other than SQLITE_OK when it is -** called. Otherwise, append a string to the buffer. All bytes in the string -** up to (but not including) the nul-terminator are written to the buffer. -** -** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before -** returning. -*/ -static void sessionAppendStr( - SessionBuffer *p, - const char *zStr, - int *pRc -){ - int nStr = sqlite3Strlen30(zStr); - if( 0==sessionBufferGrow(p, nStr+1, pRc) ){ - memcpy(&p->aBuf[p->nBuf], zStr, nStr); - p->nBuf += nStr; - p->aBuf[p->nBuf] = 0x00; - } -} - /* ** This function is a no-op if *pRc is other than SQLITE_OK when it is ** called. Otherwise, append the string representation of integer iVal @@ -2224,27 +2436,6 @@ static void sessionAppendInteger( sessionAppendStr(p, aBuf, pRc); } -static void sessionAppendPrintf( - SessionBuffer *p, /* Buffer to append to */ - int *pRc, - const char *zFmt, - ... -){ - if( *pRc==SQLITE_OK ){ - char *zApp = 0; - va_list ap; - va_start(ap, zFmt); - zApp = sqlite3_vmprintf(zFmt, ap); - if( zApp==0 ){ - *pRc = SQLITE_NOMEM; - }else{ - sessionAppendStr(p, zApp, pRc); - } - va_end(ap); - sqlite3_free(zApp); - } -} - /* ** This function is a no-op if *pRc is other than SQLITE_OK when it is ** called. Otherwise, append the string zStr enclosed in quotes (") and @@ -2735,26 +2926,23 @@ static int sessionGenerateChangeset( for(pTab=pSession->pTable; rc==SQLITE_OK && pTab; pTab=pTab->pNext){ if( pTab->nEntry ){ const char *zName = pTab->zName; + +#if 0 int nCol = 0; /* Number of columns in table */ u8 *abPK = 0; /* Primary key array */ + int bRowid = 0; const char **azCol = 0; /* Table columns */ +#endif int i; /* Used to iterate through hash buckets */ sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ int nRewind = buf.nBuf; /* Initial size of write buffer */ int nNoop; /* Size of buffer after writing tbl header */ - int bRowid = 0; + int nOldCol = pTab->nCol; /* Check the table schema is still Ok. */ - rc = sessionTableInfo( - 0, db, pSession->zDb, zName, &nCol, 0, &azCol, &abPK, - (pSession->bImplicitPK ? &bRowid : 0) - ); - if( rc==SQLITE_OK && ( - pTab->nCol!=nCol - || pTab->bRowid!=bRowid - || memcmp(abPK, pTab->abPK, nCol) - )){ - rc = SQLITE_SCHEMA; + rc = sessionReinitTable(pSession, pTab); + if( rc==SQLITE_OK && pTab->nCol!=nOldCol ){ + rc = sessionUpdateChanges(pSession, pTab); } /* Write a table header */ @@ -2762,8 +2950,8 @@ static int sessionGenerateChangeset( /* Build and compile a statement to execute: */ if( rc==SQLITE_OK ){ - rc = sessionSelectStmt( - db, 0, pSession->zDb, zName, bRowid, nCol, azCol, abPK, &pSel + rc = sessionSelectStmt(db, 0, pSession->zDb, + zName, pTab->bRowid, pTab->nCol, pTab->azCol, pTab->abPK, &pSel ); } @@ -2772,22 +2960,22 @@ static int sessionGenerateChangeset( SessionChange *p; /* Used to iterate through changes */ for(p=pTab->apChange[i]; rc==SQLITE_OK && p; p=p->pNext){ - rc = sessionSelectBind(pSel, nCol, abPK, p); + rc = sessionSelectBind(pSel, pTab->nCol, pTab->abPK, p); if( rc!=SQLITE_OK ) continue; if( sqlite3_step(pSel)==SQLITE_ROW ){ if( p->op==SQLITE_INSERT ){ int iCol; sessionAppendByte(&buf, SQLITE_INSERT, &rc); sessionAppendByte(&buf, p->bIndirect, &rc); - for(iCol=0; iColnCol; iCol++){ sessionAppendCol(&buf, pSel, iCol, &rc); } }else{ - assert( abPK!=0 ); /* Because sessionSelectStmt() returned ok */ - rc = sessionAppendUpdate(&buf, bPatchset, pSel, p, abPK); + assert( pTab->abPK!=0 ); + rc = sessionAppendUpdate(&buf, bPatchset, pSel, p, pTab->abPK); } }else if( p->op!=SQLITE_INSERT ){ - rc = sessionAppendDelete(&buf, bPatchset, p, nCol, abPK); + rc = sessionAppendDelete(&buf, bPatchset, p, pTab->nCol,pTab->abPK); } if( rc==SQLITE_OK ){ rc = sqlite3_reset(pSel); @@ -2812,7 +3000,6 @@ static int sessionGenerateChangeset( if( buf.nBuf==nNoop ){ buf.nBuf = nRewind; } - sqlite3_free((char*)azCol); /* cast works around VC++ bug */ } } @@ -4941,7 +5128,7 @@ static int sessionChangesetApply( sqlite3changeset_pk(pIter, &abPK, 0); rc = sessionTableInfo(0, db, "main", zNew, - &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK, &sApply.bRowid + &sApply.nCol, &zTab, &sApply.azCol, 0, &sApply.abPK, &sApply.bRowid ); if( rc!=SQLITE_OK ) break; for(i=0; i +**
  • The name identified by the changeset, and +**
  • at least as many columns as recorded in the changeset, and +**
  • the primary key columns in the same position as recorded in +** the changeset. +** +** +** The output of the changegroup object always has the same schema as the +** database nominated using this function. In cases where changesets passed +** to sqlite3changegroup_add() have fewer columns than the corresponding table +** in the database schema, these are filled in using the default column +** values from the database schema. This makes it possible to combined +** changesets that have different numbers of columns for a single table +** within a changegroup, provided that they are otherwise compatible. +*/ +int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); + /* ** CAPI3REF: Add A Changeset To A Changegroup ** METHOD: sqlite3_changegroup @@ -998,13 +1042,18 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp); ** If the new changeset contains changes to a table that is already present ** in the changegroup, then the number of columns and the position of the ** primary key columns for the table must be consistent. If this is not the -** case, this function fails with SQLITE_SCHEMA. If the input changeset -** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is -** returned. Or, if an out-of-memory condition occurs during processing, this -** function returns SQLITE_NOMEM. In all cases, if an error occurs the state -** of the final contents of the changegroup is undefined. +** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup +** object has been configured with a database schema using the +** sqlite3changegroup_schema() API, then it is possible to combine changesets +** with different numbers of columns for a single table, provided that +** they are otherwise compatible. ** -** If no error occurs, SQLITE_OK is returned. +** If the input changeset appears to be corrupt and the corruption is +** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition +** occurs during processing, this function returns SQLITE_NOMEM. +** +** In all cases, if an error occurs the state of the final contents of the +** changegroup is undefined. If no error occurs, SQLITE_OK is returned. */ int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); diff --git a/manifest b/manifest index 6deed36dd5..7f7d8d946b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sMakefile\sdistinguishes\sbetween\stcl8.4\sand\stcl8.5.\s\sSome\smakefile\stargets\nrequire\stcl8.5,\sbut\sothers\s(ex:\s"sqlite3.c",\s"shell.c",\sand\s"sqlite3")\srequire\nonly\stcl8.4. -D 2023-10-04T12:49:08.687 +C Allow\sa\ssession\sobject\sto\sgenerate\sa\schangeset,\seven\sif\scolumns\swere\sadded\sto\sone\sof\sthe\stables\susing\sALTER\sTABLE\sADD\sCOLUMN\swhile\sthe\schangeset\swas\sbeing\scollected. +D 2023-10-04T21:15:24.286 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -513,7 +513,7 @@ F ext/session/changesetfuzz.c 227076ab0ae4447d742c01ee88a564da6478bbf26b65108bf8 F ext/session/changesetfuzz1.test 2e1b90d888fbf0eea5e1bd2f1e527a48cc85f8e0ff75df1ec4e320b21f580b3a F ext/session/session1.test e94f764fbfb672147c0ef7026b195988133b371dc8cf9e52423eba6cad69717e F ext/session/session2.test ee83bb973b9ce17ccce4db931cdcdae65eb40bbb22089b2fe6aa4f6be3b9303f -F ext/session/session3.test ce9ce3dfa489473987f899e9f6a0f2db9bde3479 +F ext/session/session3.test 2cc1629cfb880243aec1a7251145e07b78411d851b39b2aa1390704550db8e6a F ext/session/session4.test 6778997065b44d99c51ff9cece047ff9244a32856b328735ae27ddef68979c40 F ext/session/session5.test 716bc6fafd625ce60dfa62ae128971628c1a1169 F ext/session/session6.test 35279f2ec45448cd2e24a61688219dc6cf7871757716063acf4a8b5455e1e926 @@ -529,6 +529,7 @@ F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d0 F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859 F ext/session/session_common.tcl e5598096425486b363718e2cda48ee85d660c96b4f8ea9d9d7a4c3ef514769da F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3 +F ext/session/sessionalter.test 2623023075c51707026a90b9b59674e88c6f467098219d8d71f9a6320d122c61 F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec @@ -543,8 +544,8 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c 0fe9107318140cefa1b50f2e1e0f330ab359022599e5976820db349f33efae11 -F ext/session/sqlite3session.h 653e9d49c4edae231df8a4c8d69c2145195aedb32462d4b44229dbee7d2680fb +F ext/session/sqlite3session.c a6ede47e1dbb2ff61180858559502020738e2f978a9648b07fa74a8ce5a776b4 +F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 F ext/session/test_session.c 5285482f83cd92b4c1fe12fcf88210566a18312f4f2aa110f6399dae46aeccbb F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 @@ -2123,8 +2124,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 -R 76bba9834a6ace5da9d64340bca161b1 -U drh -Z 0c0b3b63d38231e8da1135c2ad119350 +P 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e +R 649352ef20ed525adadedc4edb926bc7 +T *branch * session-alter +T *sym-session-alter * +T -sym-trunk * +U dan +Z 220e071d4024660dea84b49e6cbcfb2f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 085e51b912..d83a120cf7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e \ No newline at end of file +a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef \ No newline at end of file From 3a3912f21cee029ff01347e4c0c49ae97e03a9e6 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 5 Oct 2023 10:35:51 +0000 Subject: [PATCH 015/242] Remove a stray blank line from the beginning of btree.c. No functional code changes. FossilOrigin-Name: c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/btree.c | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6deed36dd5..9a6dd9296d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sMakefile\sdistinguishes\sbetween\stcl8.4\sand\stcl8.5.\s\sSome\smakefile\stargets\nrequire\stcl8.5,\sbut\sothers\s(ex:\s"sqlite3.c",\s"shell.c",\sand\s"sqlite3")\srequire\nonly\stcl8.4. -D 2023-10-04T12:49:08.687 +C Remove\sa\sstray\sblank\sline\sfrom\sthe\sbeginning\sof\sbtree.c.\s\sNo\sfunctional\ncode\schanges. +D 2023-10-05T10:35:51.707 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -649,7 +649,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c d2e73513d382e6e4829b823fb41b5f2eddd9c5984b1492a7a6333cd91be15601 +F src/btree.c 04fe20ab3c1a0ca4938963e3e77c4bbdeffd0f23a715d2da11b5daa690d5b5cf F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 F src/build.c a08d098ad1bfd5d46a5f3a6e29a822897e9a021ddba7c021c7c1ae5d4366d1a0 @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1765f3b5a00a8ca20a7b9e18ac7f9d7de0679470b234b83aea83aa5b4d4d34e6 -R 76bba9834a6ace5da9d64340bca161b1 +P 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e +R 022fa78c22ff22c85a758cd316b706e5 U drh -Z 0c0b3b63d38231e8da1135c2ad119350 +Z 484f0dfb94f41979a2dc438a6f463f85 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 085e51b912..d28fd63e00 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e \ No newline at end of file +c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index fa5c47d134..6918693b7f 100644 --- a/src/btree.c +++ b/src/btree.c @@ -1,4 +1,3 @@ - /* ** 2004 April 6 ** From a357bdbfc462b25a18538c43ec6409b5d6cf5eee Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 5 Oct 2023 11:04:49 +0000 Subject: [PATCH 016/242] Do not squelch exceptions from SAHPool VFS importDb() - rethrow them. Problem reported in [forum:c80fc578809b80a3|forum post c80fc578809b80a3]. FossilOrigin-Name: 325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b --- ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 1 + manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 327b6a95ad..e76fbf028a 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -900,6 +900,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ }/*force db out of WAL mode*/); }catch(e){ this.setAssociatedPath(sah, '', 0); + throw e; } this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); return nWrote; diff --git a/manifest b/manifest index 9a6dd9296d..c526923199 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sstray\sblank\sline\sfrom\sthe\sbeginning\sof\sbtree.c.\s\sNo\sfunctional\ncode\schanges. -D 2023-10-05T10:35:51.707 +C Do\snot\ssquelch\sexceptions\sfrom\sSAHPool\sVFS\simportDb()\s-\srethrow\sthem.\sProblem\sreported\sin\s[forum:c80fc578809b80a3|forum\spost\sc80fc578809b80a3]. +D 2023-10-05T11:04:49.018 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -575,7 +575,7 @@ F ext/wasm/api/sqlite3-api-worker1.js 9f32af64df1a031071912eea7a201557fe39b17386 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 327a8c363a8c84c61770dc3c46cc83d7cc0eb6b59a3b29728bddf087651d3b77 +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js f7c965cf9ac0b66a538cd8f6c156f3f2a235e089821ca78cabd7bce41ce16bf7 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e F ext/wasm/api/sqlite3-wasm.c 65d60439671e24d50d9119ca805ac1c68fb36129e164377eb46f8d037bd88b07 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e -R 022fa78c22ff22c85a758cd316b706e5 -U drh -Z 484f0dfb94f41979a2dc438a6f463f85 +P c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277 +R 14f50f4596059dcbda23e1e635f319ac +U stephan +Z ad85de83948fca4d5d8878d14d7204be # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d28fd63e00..2c94b47e1b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277 \ No newline at end of file +325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b \ No newline at end of file From 5d9446d1005c11652a4119331a664405a836336c Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 5 Oct 2023 11:06:10 +0000 Subject: [PATCH 017/242] Improved detection of corrupt databases in balance_nonroot(). dbsqlfuzz d1cf013c50a620b68c2a5bd240d29afd65e5f58e. FossilOrigin-Name: a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c526923199..a58b92ef8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\ssquelch\sexceptions\sfrom\sSAHPool\sVFS\simportDb()\s-\srethrow\sthem.\sProblem\sreported\sin\s[forum:c80fc578809b80a3|forum\spost\sc80fc578809b80a3]. -D 2023-10-05T11:04:49.018 +C Improved\sdetection\sof\scorrupt\sdatabases\sin\sbalance_nonroot().\ndbsqlfuzz\sd1cf013c50a620b68c2a5bd240d29afd65e5f58e. +D 2023-10-05T11:06:10.790 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -649,7 +649,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 04fe20ab3c1a0ca4938963e3e77c4bbdeffd0f23a715d2da11b5daa690d5b5cf +F src/btree.c fbbbfc51d2fed03c29f20960857d97659d9c682523f32911d5a8e7c5be6436be F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 F src/build.c a08d098ad1bfd5d46a5f3a6e29a822897e9a021ddba7c021c7c1ae5d4366d1a0 @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c89983dcfc208faa86b31717144c069572598e9770228264d69a044a84bde277 -R 14f50f4596059dcbda23e1e635f319ac -U stephan -Z ad85de83948fca4d5d8878d14d7204be +P 325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b +R 30f43ae2972b7eeb2a422e3f17ecbd1a +U drh +Z f02a428d25ebde125df5f15b29c884ab # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2c94b47e1b..80b839fb4c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b \ No newline at end of file +a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 6918693b7f..1575d7d942 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7492,6 +7492,7 @@ static int rebuildPage( int k; /* Current slot in pCArray->apEnd[] */ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ + assert( nCell>0 ); assert( i(u32)usableSize ){ j = 0; } @@ -7798,6 +7799,7 @@ static int editPage( return SQLITE_OK; editpage_fail: /* Unable to edit this page. Rebuild it from scratch instead. */ + if( nNew<1 ) return SQLITE_CORRUPT_BKPT; populateCellCache(pCArray, iNew, nNew); return rebuildPage(pCArray, iNew, nNew, pPg); } From 16381d062aa6b769a68359b1eec20ba881c40888 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 5 Oct 2023 19:09:23 +0000 Subject: [PATCH 018/242] Add the sqlite3changegroup_schema() API. To allow changegroups to handle differences in schema created by ALTER TABLE ADD COLUMN. FossilOrigin-Name: 309deee2dd8dd07623fce79f6bb62d5279d140dd0be3b34bc42af20b0507726b --- ext/session/sqlite3session.c | 228 ++++++++++++++++++++++++++++++++--- manifest | 15 +-- manifest.uuid | 2 +- 3 files changed, 218 insertions(+), 27 deletions(-) diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index cb40f25fd3..1c291f51c0 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -119,6 +119,10 @@ struct sqlite3_changeset_iter { ** The data associated with each hash-table entry is a structure containing ** a subset of the initial values that the modified row contained at the ** start of the session. Or no initial values if the row was inserted. +** +** pDfltStmt: +** This is only used by the sqlite3changegroup_xxx() APIs, not by +** regular sqlite3_session objects. */ struct SessionTable { SessionTable *pNext; @@ -132,6 +136,8 @@ struct SessionTable { int nEntry; /* Total number of entries in hash table */ int nChange; /* Size of apChange[] array */ SessionChange **apChange; /* Hash table buckets */ + + sqlite3_stmt *pDfltStmt; }; /* @@ -326,7 +332,7 @@ static int sessionVarintLen(int iVal){ ** Read a varint value from aBuf[] into *piVal. Return the number of ** bytes read. */ -static int sessionVarintGet(u8 *aBuf, int *piVal){ +static int sessionVarintGet(const u8 *aBuf, int *piVal){ return getVarint32(aBuf, *piVal); } @@ -589,7 +595,7 @@ static int sessionPreupdateHash( ** Return the number of bytes of space occupied by the value (including ** the type byte). */ -static int sessionSerialLen(u8 *a){ +static int sessionSerialLen(const u8 *a){ int e = *a; int n; if( e==0 || e==0xFF ) return 1; @@ -1161,15 +1167,22 @@ static int sessionTableInfo( ** indicate that updates on this table should be ignored. SessionTable.abPK ** is set to NULL in this case. */ -static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ +static int sessionInitTable( + sqlite3_session *pSession, + SessionTable *pTab, + sqlite3 *db, + const char *zDb +){ + int rc = SQLITE_OK; + if( pTab->nCol==0 ){ u8 *abPK; assert( pTab->azCol==0 || pTab->abPK==0 ); - pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb, + rc = sessionTableInfo(pSession, db, zDb, pTab->zName, &pTab->nCol, 0, &pTab->azCol, &pTab->azDflt, &abPK, - (pSession->bImplicitPK ? &pTab->bRowid : 0) + ((pSession==0 || pSession->bImplicitPK) ? &pTab->bRowid : 0) ); - if( pSession->rc==SQLITE_OK ){ + if( rc==SQLITE_OK ){ int i; for(i=0; inCol; i++){ if( abPK[i] ){ @@ -1181,14 +1194,19 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ pTab->bStat1 = 1; } - if( pSession->bEnableSize ){ + if( pSession && pSession->bEnableSize ){ pSession->nMaxChangesetSize += ( 1 + sessionVarintLen(pTab->nCol) + pTab->nCol + strlen(pTab->zName)+1 ); } } } - return (pSession->rc || pTab->abPK==0); + + if( pSession ){ + pSession->rc = rc; + return (rc || pTab->abPK==0); + } + return rc; } static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ @@ -1417,14 +1435,28 @@ static void sessionAppendPrintf( } } -static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ - sqlite3 *db = pSession->db; +/* +** Prepare a statement against database handle db that SELECTs a single +** row containing the default values for each column in table pTab. For +** example, if pTab is declared as: +** +** CREATE TABLE pTab(a PRIMARY KEY, b DEFAULT 123, c DEFAULT 'abcd'); +** +** Then this function prepares and returns the SQL statement: +** +** SELECT NULL, 123, 'abcd'; +*/ +static int sessionPrepareDfltStmt( + sqlite3 *db, /* Database handle */ + SessionTable *pTab, /* Table to prepare statement for */ + sqlite3_stmt **ppStmt /* OUT: Statement handle */ +){ SessionBuffer sql = {0,0,0}; - sqlite3_stmt *pStmt = 0; + int rc = SQLITE_OK; const char *zSep = " "; int ii = 0; - int rc = pSession->rc; + *ppStmt = 0; sessionAppendPrintf(&sql, &rc, "SELECT"); for(ii=0; iinCol; ii++){ const char *zDflt = pTab->azDflt[ii] ? pTab->azDflt[ii] : "NULL"; @@ -1432,9 +1464,22 @@ static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ zSep = ", "; } if( rc==SQLITE_OK ){ - rc = sqlite3_prepare_v2(db, (const char*)sql.aBuf, -1, &pStmt, 0); + rc = sqlite3_prepare_v2(db, (const char*)sql.aBuf, -1, ppStmt, 0); } + sqlite3_free(sql.aBuf); + + return rc; +} + +static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ + sqlite3 *db = pSession->db; + sqlite3_stmt *pStmt = 0; + int ii = 0; + int rc = pSession->rc; + + rc = sessionPrepareDfltStmt(pSession->db, pTab, &pStmt); if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + int ii = 0; SessionChange **pp = 0; for(ii=0; iinChange; ii++){ for(pp=&pTab->apChange[ii]; *pp; pp=&((*pp)->pNext)){ @@ -1445,7 +1490,6 @@ static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ } } - sqlite3_free(sql.aBuf); pSession->rc = rc; rc = sqlite3_finalize(pStmt); if( pSession->rc==SQLITE_OK ) pSession->rc = rc; @@ -1618,7 +1662,7 @@ static void sessionPreupdateOneChange( if( pSession->rc ) return; /* Load table details if required */ - if( sessionInitTable(pSession, pTab) ) return; + if( sessionInitTable(pSession, pTab, pSession->db, pSession->zDb) ) return; /* Check the number of columns in this xPreUpdate call matches the ** number of columns in the table. */ @@ -2117,7 +2161,7 @@ int sqlite3session_diff( /* Locate and if necessary initialize the target table object */ rc = sessionFindTable(pSession, zTbl, &pTo); if( pTo==0 ) goto diff_out; - if( sessionInitTable(pSession, pTo) ){ + if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){ rc = pSession->rc; goto diff_out; } @@ -5352,6 +5396,9 @@ struct sqlite3_changegroup { int rc; /* Error code */ int bPatch; /* True to accumulate patchsets */ SessionTable *pList; /* List of tables in current patch */ + + sqlite3 *db; /* Configured by changegroup_schema() */ + const char *zDb; /* Configured by changegroup_schema() */ }; /* @@ -5537,6 +5584,111 @@ static int sessionChangeMerge( return rc; } +/* +** Check if a changeset entry with nCol columns and the PK array passed +** as the final argument to this function is compatible with SessionTable +** pTab. If so, return 1. Otherwise, if they are incompatible in some way, +** return 0. +*/ +static int sessionChangesetCheckCompat( + SessionTable *pTab, + int nCol, + u8 *abPK +){ + if( pTab->azCol && nColnCol ){ + int ii; + for(ii=0; iinCol; ii++){ + u8 bPK = (ii < nCol) ? abPK[ii] : 0; + if( pTab->abPK[ii]!=bPK ) return 0; + } + return 1; + } + return (pTab->nCol==nCol && 0==memcmp(abPK, pTab->abPK, nCol)); +} + +static int sessionChangesetExtendRecord( + sqlite3_changegroup *pGrp, + SessionTable *pTab, + int nCol, + int op, + const u8 *aRec, + int nRec, + SessionBuffer *pOut +){ + int rc = SQLITE_OK; + int ii = 0; + + assert( pTab->azCol ); + assert( nColnCol ); + + pOut->nBuf = 0; + if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){ + /* Append the missing default column values to the record. */ + sessionAppendBlob(pOut, aRec, nRec, &rc); + if( pTab->pDfltStmt==0 ){ + rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt); + } + for(ii=nCol; rc==SQLITE_OK && iinCol; ii++){ + int eType = sqlite3_column_type(pTab->pDfltStmt, ii); + sessionAppendByte(pOut, eType, &rc); + switch( eType ){ + case SQLITE_FLOAT: + case SQLITE_INTEGER: { + i64 iVal; + if( eType==SQLITE_INTEGER ){ + iVal = sqlite3_column_int64(pTab->pDfltStmt, ii); + }else{ + double rVal = sqlite3_column_int64(pTab->pDfltStmt, ii); + memcpy(&iVal, &rVal, sizeof(i64)); + } + if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){ + sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal); + } + break; + } + + case SQLITE_BLOB: + case SQLITE_TEXT: { + int n = sqlite3_column_bytes(pTab->pDfltStmt, ii); + sessionAppendVarint(pOut, n, &rc); + if( eType==SQLITE_TEXT ){ + const u8 *z = (const u8*)sqlite3_column_text(pTab->pDfltStmt, ii); + sessionAppendBlob(pOut, z, n, &rc); + }else{ + const u8 *z = (const u8*)sqlite3_column_blob(pTab->pDfltStmt, ii); + sessionAppendBlob(pOut, z, n, &rc); + } + break; + } + + default: + assert( eType==SQLITE_NULL ); + break; + } + } + }else{ + /* Append missing "undefined" entries to the old.* record. And, if this + ** is an UPDATE, to the new.* record as well. */ + int iOff = 0; + if( op==SQLITE_UPDATE ){ + for(ii=0; iinCol-nCol); ii++){ + sessionAppendByte(pOut, 0x00, &rc); + } + } + + sessionAppendBlob(pOut, &aRec[iOff], nRec-iOff, &rc); + for(ii=0; ii<(pTab->nCol-nCol); ii++){ + sessionAppendByte(pOut, 0x00, &rc); + } + } + + return rc; +} + /* ** Add all changes in the changeset traversed by the iterator passed as ** the first argument to the changegroup hash tables. @@ -5550,6 +5702,7 @@ static int sessionChangesetToHash( int nRec; int rc = SQLITE_OK; SessionTable *pTab = 0; + SessionBuffer rec = {0, 0, 0}; while( SQLITE_ROW==sessionChangesetNext(pIter, &aRec, &nRec, 0) ){ const char *zNew; @@ -5561,6 +5714,9 @@ static int sessionChangesetToHash( SessionChange *pExist = 0; SessionChange **pp; + /* Ensure that only changesets, or only patchsets, but not a mixture + ** of both, are being combined. It is an error to try to combine a + ** changeset and a patchset. */ if( pGrp->pList==0 ){ pGrp->bPatch = pIter->bPatchset; }else if( pIter->bPatchset!=pGrp->bPatch ){ @@ -5593,18 +5749,33 @@ static int sessionChangesetToHash( pTab->zName = (char*)&pTab->abPK[nCol]; memcpy(pTab->zName, zNew, nNew+1); + if( pGrp->db ){ + pTab->nCol = 0; + rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb); + } + /* The new object must be linked on to the end of the list, not ** simply added to the start of it. This is to ensure that the ** tables within the output of sqlite3changegroup_output() are in ** the right order. */ for(ppTab=&pGrp->pList; *ppTab; ppTab=&(*ppTab)->pNext); *ppTab = pTab; - }else if( pTab->nCol!=nCol || memcmp(pTab->abPK, abPK, nCol) ){ + } + + if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){ rc = SQLITE_SCHEMA; break; } } + if( nColnCol ){ + assert( pGrp->db ); + rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, &rec); + if( rc ) break; + aRec = rec.aBuf; + nRec = rec.nBuf; + } + if( sessionGrowHash(0, pIter->bPatchset, pTab) ){ rc = SQLITE_NOMEM; break; @@ -5642,6 +5813,7 @@ static int sessionChangesetToHash( } } + sqlite3_free(rec.aBuf); if( rc==SQLITE_OK ) rc = pIter->rc; return rc; } @@ -5728,6 +5900,28 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp){ return rc; } +int sqlite3changegroup_schema( + sqlite3_changegroup *pGrp, + sqlite3 *db, + const char *zDb +){ + int rc = SQLITE_OK; + + if( pGrp->pList || pGrp->db ){ + /* Cannot add a schema after one or more calls to sqlite3changegroup_add(), + ** or after sqlite3changegroup_schema() has already been called. */ + rc = SQLITE_MISUSE; + }else{ + pGrp->zDb = sqlite3_mprintf("%s", zDb); + if( pGrp->zDb==0 ){ + rc = SQLITE_NOMEM; + }else{ + pGrp->db = db; + } + } + return rc; +} + /* ** Add the changeset currently stored in buffer pData, size nData bytes, ** to changeset-group p. diff --git a/manifest b/manifest index 7f7d8d946b..cf27c7fb81 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allow\sa\ssession\sobject\sto\sgenerate\sa\schangeset,\seven\sif\scolumns\swere\sadded\sto\sone\sof\sthe\stables\susing\sALTER\sTABLE\sADD\sCOLUMN\swhile\sthe\schangeset\swas\sbeing\scollected. -D 2023-10-04T21:15:24.286 +C Add\sthe\ssqlite3changegroup_schema()\sAPI.\sTo\sallow\schangegroups\sto\shandle\sdifferences\sin\sschema\screated\sby\sALTER\sTABLE\sADD\sCOLUMN. +D 2023-10-05T19:09:23.510 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -544,7 +544,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c a6ede47e1dbb2ff61180858559502020738e2f978a9648b07fa74a8ce5a776b4 +F ext/session/sqlite3session.c 8a0886dc8772c00ccbfe10012e8d21175a96ee18428a58fae9be81d924b89d03 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 F ext/session/test_session.c 5285482f83cd92b4c1fe12fcf88210566a18312f4f2aa110f6399dae46aeccbb F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -2124,11 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 770308db9776b8c0a70b8807463e89a9eddfe5552e25e67324cd303dc974f50e -R 649352ef20ed525adadedc4edb926bc7 -T *branch * session-alter -T *sym-session-alter * -T -sym-trunk * +P a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef +R a796b1e127975d7f78d17f701882d2f3 U dan -Z 220e071d4024660dea84b49e6cbcfb2f +Z afe7ef1533b48179b0f6fa3866dc9cb3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d83a120cf7..1d23b0122d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef \ No newline at end of file +309deee2dd8dd07623fce79f6bb62d5279d140dd0be3b34bc42af20b0507726b \ No newline at end of file From 568643fd15e772481847b22b2ff50873b33b48ec Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 6 Oct 2023 12:15:01 +0000 Subject: [PATCH 019/242] Increase the size of some variables associated with the PMA sorter in order to avoid any possibility of a signed integer overflow. [https://bugs.chromium.org/p/chromium/issues/detail?id=1489025|Chromium fuzzer issue 1489025]. FossilOrigin-Name: dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbesort.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index a58b92ef8a..6a279af662 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\sdetection\sof\scorrupt\sdatabases\sin\sbalance_nonroot().\ndbsqlfuzz\sd1cf013c50a620b68c2a5bd240d29afd65e5f58e. -D 2023-10-05T11:06:10.790 +C Increase\sthe\ssize\sof\ssome\svariables\sassociated\swith\sthe\sPMA\ssorter\sin\sorder\nto\savoid\sany\spossibility\sof\sa\ssigned\sinteger\soverflow.\n[https://bugs.chromium.org/p/chromium/issues/detail?id=1489025|Chromium\sfuzzer\sissue\s1489025]. +D 2023-10-06T12:15:01.126 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -787,7 +787,7 @@ F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2ce F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 -F src/vdbesort.c 0d40dca073c94e158ead752ef4225f4fee22dee84145e8c00ca2309afb489015 +F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c 57fa8f56478e5b5cb558cb425e7878515e0a105c54f96f1d1bbf4b9433529254 F src/vtab.c 154725ebecd3bc02f7fbd7ad3974334f73fff76e02a964e828e48a7c5fb7efff @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 325bcdea4a436e514d83095d3893caf07a714b718e1b643507179b101c108e3b -R 30f43ae2972b7eeb2a422e3f17ecbd1a +P a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82 +R d4dbf5f4ac62b99dade7d05b682773ba U drh -Z f02a428d25ebde125df5f15b29c884ab +Z 00019479dba428369c8d2c81fe6aa8ba # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 80b839fb4c..cb86fc701d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82 \ No newline at end of file +dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index 2b7da94f7f..0083690308 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -186,7 +186,7 @@ struct SorterFile { struct SorterList { SorterRecord *pList; /* Linked list of records */ u8 *aMemory; /* If non-NULL, bulk memory to hold pList */ - int szPMA; /* Size of pList as PMA in bytes */ + i64 szPMA; /* Size of pList as PMA in bytes */ }; /* @@ -295,10 +295,10 @@ typedef int (*SorterCompare)(SortSubtask*,int*,const void*,int,const void*,int); struct SortSubtask { SQLiteThread *pThread; /* Background thread, if any */ int bDone; /* Set if thread is finished but not joined */ + int nPMA; /* Number of PMAs currently in file */ VdbeSorter *pSorter; /* Sorter that owns this sub-task */ UnpackedRecord *pUnpacked; /* Space to unpack a record */ SorterList list; /* List for thread to write to a PMA */ - int nPMA; /* Number of PMAs currently in file */ SorterCompare xCompare; /* Compare function to use */ SorterFile file; /* Temp file for level-0 PMAs */ SorterFile file2; /* Space for other PMAs */ @@ -1772,8 +1772,8 @@ int sqlite3VdbeSorterWrite( int rc = SQLITE_OK; /* Return Code */ SorterRecord *pNew; /* New list element */ int bFlush; /* True to flush contents of memory to PMA */ - int nReq; /* Bytes of memory required */ - int nPMA; /* Bytes of PMA space required */ + i64 nReq; /* Bytes of memory required */ + i64 nPMA; /* Bytes of PMA space required */ int t; /* serial type of first record field */ assert( pCsr->eCurType==CURTYPE_SORTER ); From 03f7e425386f9451c6806e2e89f58fca1263aa44 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 6 Oct 2023 12:22:14 +0000 Subject: [PATCH 020/242] Remove and unused static variable from shell.c.in in order to silence a harmless compiler warning. FossilOrigin-Name: 477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6a279af662..f61bae89a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\ssize\sof\ssome\svariables\sassociated\swith\sthe\sPMA\ssorter\sin\sorder\nto\savoid\sany\spossibility\sof\sa\ssigned\sinteger\soverflow.\n[https://bugs.chromium.org/p/chromium/issues/detail?id=1489025|Chromium\sfuzzer\sissue\s1489025]. -D 2023-10-06T12:15:01.126 +C Remove\sand\sunused\sstatic\svariable\sfrom\sshell.c.in\sin\sorder\sto\ssilence\sa\nharmless\scompiler\swarning. +D 2023-10-06T12:22:14.529 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -711,7 +711,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa -F src/shell.c.in 62708bea44d4e43aa7b1270ed422d1d29e82297924d4e0f223c39336a3f582f8 +F src/shell.c.in b34146fe139a7d0f5f49de5059e7bbe6892f9d5dce952c6f9f7a602e5df86466 F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a2464bbb825b5976ef974a2e6c17ea150f5e6fcd0dd0f144b9f9c1c22a9c9c82 -R d4dbf5f4ac62b99dade7d05b682773ba +P dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2 +R 796df824a0f988b2ac90026af2eb0d52 U drh -Z 00019479dba428369c8d2c81fe6aa8ba +Z 379d2502295b4d4e0301f78a838da396 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cb86fc701d..d93fe46bde 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2 \ No newline at end of file +477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 2d382a681a..f9bea8e7af 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -455,7 +455,6 @@ static int stdin_is_interactive = 1; static int console_utf8 = sizeof(char*)/4 - 1; #else # define SHELL_WIN_UTF8_OPT 0 - static const int console_utf8 = 0; #endif /* From 1935887a68e8b54369852fb62abeb8268b82886e Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 6 Oct 2023 12:51:05 +0000 Subject: [PATCH 021/242] Ensure that all fields of static sqlite3_module objects are explicitly initialized, in order to hush-up nuisance compiler warnings. FossilOrigin-Name: f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7 --- ext/expert/sqlite3expert.c | 1 + ext/fts3/fts3_aux.c | 3 +- ext/fts3/fts3_term.c | 3 +- ext/fts3/fts3_tokenize_vtab.c | 3 +- ext/fts5/fts5_index.c | 3 +- ext/fts5/fts5_test_tok.c | 3 +- ext/fts5/fts5_vocab.c | 3 +- ext/lsm1/lsm_vtab.c | 5 ++ ext/misc/amatch.c | 3 +- ext/misc/btreeinfo.c | 3 +- ext/misc/carray.c | 5 ++ ext/misc/closure.c | 3 +- ext/misc/completion.c | 3 +- ext/misc/csv.c | 10 ++++ ext/misc/explain.c | 1 + ext/misc/fileio.c | 1 + ext/misc/fossildelta.c | 3 +- ext/misc/fuzzer.c | 5 ++ ext/misc/memstat.c | 1 + ext/misc/prefixes.c | 3 +- ext/misc/qpvtab.c | 3 +- ext/misc/series.c | 3 +- ext/misc/spellfix.c | 5 ++ ext/misc/stmt.c | 1 + ext/misc/templatevtab.c | 3 +- ext/misc/unionvtab.c | 3 +- ext/misc/vfsstat.c | 5 ++ ext/misc/vtablog.c | 1 + ext/misc/wholenumber.c | 5 ++ ext/misc/zipfile.c | 3 +- ext/recover/dbdata.c | 3 +- ext/repair/checkindex.c | 2 + ext/rtree/geopoly.c | 3 +- ext/wasm/tester1.c-pp.js | 1 - manifest | 106 +++++++++++++++++----------------- manifest.uuid | 2 +- src/dbpage.c | 3 +- src/dbstat.c | 3 +- src/json.c | 6 +- src/pragma.c | 3 +- src/test8.c | 11 +++- src/test_bestindex.c | 5 ++ src/test_fs.c | 15 +++++ src/test_intarray.c | 5 ++ src/test_osinst.c | 7 ++- src/test_schema.c | 5 ++ src/test_tclvar.c | 5 ++ src/vdbevtab.c | 3 +- test/vt02.c | 4 +- tool/fuzzershell.c | 5 ++ 50 files changed, 210 insertions(+), 84 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index c01feff58c..c3d2c567c8 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -662,6 +662,7 @@ static int idxRegisterVtab(sqlite3expert *p){ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0, /* xIntegrity */ }; return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); diff --git a/ext/fts3/fts3_aux.c b/ext/fts3/fts3_aux.c index d3b194c942..439d579366 100644 --- a/ext/fts3/fts3_aux.c +++ b/ext/fts3/fts3_aux.c @@ -545,7 +545,8 @@ int sqlite3Fts3InitAux(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ diff --git a/ext/fts3/fts3_term.c b/ext/fts3/fts3_term.c index 47e244e22c..f3a9746a09 100644 --- a/ext/fts3/fts3_term.c +++ b/ext/fts3/fts3_term.c @@ -362,7 +362,8 @@ int sqlite3Fts3InitTerm(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ diff --git a/ext/fts3/fts3_tokenize_vtab.c b/ext/fts3/fts3_tokenize_vtab.c index 65d7eef4c3..7e8d09bd48 100644 --- a/ext/fts3/fts3_tokenize_vtab.c +++ b/ext/fts3/fts3_tokenize_vtab.c @@ -445,7 +445,8 @@ int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index f527709237..2b32965638 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -8299,7 +8299,8 @@ int sqlite3Fts5IndexInit(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; rc = sqlite3_create_module(db, "fts5_structure", &fts5structure_module, 0); } diff --git a/ext/fts5/fts5_test_tok.c b/ext/fts5/fts5_test_tok.c index a5d839da66..994d304dc6 100644 --- a/ext/fts5/fts5_test_tok.c +++ b/ext/fts5/fts5_test_tok.c @@ -472,7 +472,8 @@ int sqlite3Fts5TestRegisterTok(sqlite3 *db, fts5_api *pApi){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ diff --git a/ext/fts5/fts5_vocab.c b/ext/fts5/fts5_vocab.c index 18774c4e4a..d738ada311 100644 --- a/ext/fts5/fts5_vocab.c +++ b/ext/fts5/fts5_vocab.c @@ -783,7 +783,8 @@ int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){ /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; void *p = (void*)pGlobal; diff --git a/ext/lsm1/lsm_vtab.c b/ext/lsm1/lsm_vtab.c index bb1460297d..8c21923e1a 100644 --- a/ext/lsm1/lsm_vtab.c +++ b/ext/lsm1/lsm_vtab.c @@ -1061,6 +1061,11 @@ static sqlite3_module lsm1Module = { lsm1Rollback, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; diff --git a/ext/misc/amatch.c b/ext/misc/amatch.c index bafa43283a..dd9bee53d7 100644 --- a/ext/misc/amatch.c +++ b/ext/misc/amatch.c @@ -1475,7 +1475,8 @@ static sqlite3_module amatchModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/btreeinfo.c b/ext/misc/btreeinfo.c index 22f8268139..02f8c0319c 100644 --- a/ext/misc/btreeinfo.c +++ b/ext/misc/btreeinfo.c @@ -411,7 +411,8 @@ int sqlite3BinfoRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "sqlite_btreeinfo", &binfo_module, 0); } diff --git a/ext/misc/carray.c b/ext/misc/carray.c index 709c894f27..b1caa98c3f 100644 --- a/ext/misc/carray.c +++ b/ext/misc/carray.c @@ -409,6 +409,11 @@ static sqlite3_module carrayModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadow */ + 0 /* xIntegrity */ }; /* diff --git a/ext/misc/closure.c b/ext/misc/closure.c index db9b2b7394..79a5a21d1e 100644 --- a/ext/misc/closure.c +++ b/ext/misc/closure.c @@ -939,7 +939,8 @@ static sqlite3_module closureModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/completion.c b/ext/misc/completion.c index d9e7b85972..987595a3d6 100644 --- a/ext/misc/completion.c +++ b/ext/misc/completion.c @@ -470,7 +470,8 @@ static sqlite3_module completionModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/csv.c b/ext/misc/csv.c index 870a0cf60e..b38500f4b9 100644 --- a/ext/misc/csv.c +++ b/ext/misc/csv.c @@ -897,6 +897,11 @@ static sqlite3_module CsvModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #ifdef SQLITE_TEST @@ -929,6 +934,11 @@ static sqlite3_module CsvModuleFauxWrite = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_TEST */ diff --git a/ext/misc/explain.c b/ext/misc/explain.c index 0095194570..726af76b96 100644 --- a/ext/misc/explain.c +++ b/ext/misc/explain.c @@ -293,6 +293,7 @@ static sqlite3_module explainModule = { 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/fileio.c b/ext/misc/fileio.c index 7cdbd5968f..70546adfca 100644 --- a/ext/misc/fileio.c +++ b/ext/misc/fileio.c @@ -983,6 +983,7 @@ static int fsdirRegister(sqlite3 *db){ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "fsdir", &fsdirModule, 0); diff --git a/ext/misc/fossildelta.c b/ext/misc/fossildelta.c index 6a597e0d7d..e638737d2b 100644 --- a/ext/misc/fossildelta.c +++ b/ext/misc/fossildelta.c @@ -1058,7 +1058,8 @@ static sqlite3_module deltaparsevtabModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; diff --git a/ext/misc/fuzzer.c b/ext/misc/fuzzer.c index 65d9d8df69..92b7c0dae0 100644 --- a/ext/misc/fuzzer.c +++ b/ext/misc/fuzzer.c @@ -1165,6 +1165,11 @@ static sqlite3_module fuzzerModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/memstat.c b/ext/misc/memstat.c index 800a86e7a4..c56af9f297 100644 --- a/ext/misc/memstat.c +++ b/ext/misc/memstat.c @@ -396,6 +396,7 @@ static sqlite3_module memstatModule = { 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/prefixes.c b/ext/misc/prefixes.c index 3f053b7f1c..e6517e7195 100644 --- a/ext/misc/prefixes.c +++ b/ext/misc/prefixes.c @@ -248,7 +248,8 @@ static sqlite3_module prefixesModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; /* diff --git a/ext/misc/qpvtab.c b/ext/misc/qpvtab.c index fb0c155a27..b7c2a05126 100644 --- a/ext/misc/qpvtab.c +++ b/ext/misc/qpvtab.c @@ -439,7 +439,8 @@ static sqlite3_module qpvtabModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/series.c b/ext/misc/series.c index 3bd567b2ef..abd6af7ad6 100644 --- a/ext/misc/series.c +++ b/ext/misc/series.c @@ -557,7 +557,8 @@ static sqlite3_module seriesModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/spellfix.c b/ext/misc/spellfix.c index 3b78d9f07d..a0c5aafd10 100644 --- a/ext/misc/spellfix.c +++ b/ext/misc/spellfix.c @@ -3009,6 +3009,11 @@ static sqlite3_module spellfix1Module = { 0, /* xRollback */ 0, /* xFindMethod */ spellfix1Rename, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/ext/misc/stmt.c b/ext/misc/stmt.c index 4819cbe673..cc1aaa8493 100644 --- a/ext/misc/stmt.c +++ b/ext/misc/stmt.c @@ -314,6 +314,7 @@ static sqlite3_module stmtModule = { 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/templatevtab.c b/ext/misc/templatevtab.c index d7efa2b40e..5865f5214b 100644 --- a/ext/misc/templatevtab.c +++ b/ext/misc/templatevtab.c @@ -249,7 +249,8 @@ static sqlite3_module templatevtabModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; diff --git a/ext/misc/unionvtab.c b/ext/misc/unionvtab.c index 6ac7ca6e95..506ad5ddba 100644 --- a/ext/misc/unionvtab.c +++ b/ext/misc/unionvtab.c @@ -1351,7 +1351,8 @@ static int createUnionVtab(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; diff --git a/ext/misc/vfsstat.c b/ext/misc/vfsstat.c index 83a7a3df75..ba22115ab8 100644 --- a/ext/misc/vfsstat.c +++ b/ext/misc/vfsstat.c @@ -775,6 +775,11 @@ static sqlite3_module VfsStatModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/ext/misc/vtablog.c b/ext/misc/vtablog.c index 424b3457ff..e414e7afa7 100644 --- a/ext/misc/vtablog.c +++ b/ext/misc/vtablog.c @@ -493,6 +493,7 @@ static sqlite3_module vtablogModule = { 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; #ifdef _WIN32 diff --git a/ext/misc/wholenumber.c b/ext/misc/wholenumber.c index 03d6e6902e..4c955925da 100644 --- a/ext/misc/wholenumber.c +++ b/ext/misc/wholenumber.c @@ -254,6 +254,11 @@ static sqlite3_module wholenumberModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/ext/misc/zipfile.c b/ext/misc/zipfile.c index 4dbf80b197..416a49443b 100644 --- a/ext/misc/zipfile.c +++ b/ext/misc/zipfile.c @@ -2200,7 +2200,8 @@ static int zipfileRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollback */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "zipfile" , &zipfileModule, 0); diff --git a/ext/recover/dbdata.c b/ext/recover/dbdata.c index e3bec33d8d..25a6e9fd6a 100644 --- a/ext/recover/dbdata.c +++ b/ext/recover/dbdata.c @@ -933,7 +933,8 @@ static int sqlite3DbdataRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "sqlite_dbdata", &dbdata_module, 0); diff --git a/ext/repair/checkindex.c b/ext/repair/checkindex.c index 080a51530d..5f6e646e44 100644 --- a/ext/repair/checkindex.c +++ b/ext/repair/checkindex.c @@ -907,6 +907,8 @@ static int ciInit(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "incremental_index_check", &cidx_module, 0); } diff --git a/ext/rtree/geopoly.c b/ext/rtree/geopoly.c index a0194680c3..7bda24a8cb 100644 --- a/ext/rtree/geopoly.c +++ b/ext/rtree/geopoly.c @@ -1782,7 +1782,8 @@ static sqlite3_module geopolyModule = { rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - rtreeShadowName /* xShadowName */ + rtreeShadowName, /* xShadowName */ + rtreeIntegrity /* xIntegrity */ }; static int sqlite3_geopoly_init(sqlite3 *db){ diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index f694598eab..92d763f1ba 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -3253,4 +3253,3 @@ globalThis.sqlite3InitModule = sqlite3InitModule; TestUtil.runTests(sqlite3); }); })(self); - diff --git a/manifest b/manifest index f61bae89a6..56d9099443 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sand\sunused\sstatic\svariable\sfrom\sshell.c.in\sin\sorder\sto\ssilence\sa\nharmless\scompiler\swarning. -D 2023-10-06T12:22:14.529 +C Ensure\sthat\sall\sfields\sof\sstatic\ssqlite3_module\sobjects\sare\sexplicitly\ninitialized,\sin\sorder\sto\shush-up\snuisance\scompiler\swarnings. +D 2023-10-06T12:51:05.861 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 95b00567ce0775126a1b788af2d055255014714ecfddc97913864d2f9266e583 -F ext/expert/sqlite3expert.c a912efbad597eafdb0ce934ebc11039f3190b2d479685d89184e107f65d856e1 +F ext/expert/sqlite3expert.c 682eb288a88c296b7e676463e8ebcb6b4e55071f81d0ef0ff29d76fb7355db43 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -63,16 +63,16 @@ F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d F ext/fts3/fts3.c 4095c97f2960f508bd34fc06d40f61d54e2ad09e7fbab75dc0114f57ebb6040d F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h e573c6d881f7238d77cc3fd2396cbb9b2fe13efef7d2ad295a155151c4e7efbd -F ext/fts3/fts3_aux.c f0dc9bd98582615b7750218899bd0c729879b6bbf94d1be57ca1833ff49afc6f +F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 F ext/fts3/fts3_expr.c 903bfb9433109fffb10e910d7066c49cbf8eeae316adc93f0499c4da7dfc932a F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 F ext/fts3/fts3_porter.c e19807ce0ae31c1c6e9898e89ecc93183d7ec224ea101af039722a4f49e5f2b8 F ext/fts3/fts3_snippet.c 4d6523e3eddeb7b46e7a82b3476a0a86a0c04821e0e2b8dd40f45ee28057cb13 -F ext/fts3/fts3_term.c f45a1e7c6ef464abb1231245d123dae12266b69e05cc56e14045b76591ae92d1 +F ext/fts3/fts3_term.c 845f0e2456b1be42f7f1bec1da1dfc05bc347531eff90775ffc6698902c281de F ext/fts3/fts3_test.c d8d7b2734f894e8a489987447658e374cdd3a3bc8575c401decf1911cb7c6454 -F ext/fts3/fts3_tokenize_vtab.c a95feda3590f3c3e17672fe35b67ea6112471aeea4c07ef7744a6606b66549aa +F ext/fts3/fts3_tokenize_vtab.c 7fd9ef364f257b97218b9c331f2378e307375c592f70fd541f714e747d944962 F ext/fts3/fts3_tokenizer.c 6d8fc150c48238955d5182bf661498db0dd473c8a2a80e00c16994a646fa96e7 F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154 @@ -94,16 +94,16 @@ F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b7292 F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081 F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d -F ext/fts5/fts5_index.c a86bcd5637625ce1037649d55974ab8da1fa8d1375cb334aae47ef376642e93b +F ext/fts5/fts5_index.c 5c3872a01ae519af9839b675408163aab8eb1e31917c8b3d0ce726b4ad11d942 F ext/fts5/fts5_main.c 799ec88d2309055f6406bddb0bd6ed80148c5da5eb14594c3c5309a6e944d489 F ext/fts5/fts5_storage.c 3c9b41fce41b6410f2e8f82eb035c6a29b2560483f773e6dc98cf3cb2e4ddbb5 F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee -F ext/fts5/fts5_test_tok.c a2bed8edb25f6432e8cdb62aad5916935c19dba8dac2b8324950cfff397e25ff +F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b F ext/fts5/fts5_tokenize.c 5e251efb0f1af99a25ed50010ba6b1ad1250aca5921af1988fdcabe5ebc3cb43 F ext/fts5/fts5_unicode2.c eca63dbc797f8ff0572e97caf4631389c0ab900d6364861b915bdd4735973f00 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 -F ext/fts5/fts5_vocab.c 12138e84616b56218532e3e8feb1d3e0e7ae845e33408dbe911df520424dc9d6 +F ext/fts5/fts5_vocab.c aed56169ae5c1aa9b8189c779ffeef04ed516d3c712c06914e6d91a6759f4e4a F ext/fts5/fts5parse.y eb526940f892ade5693f22ffd6c4f2702543a9059942772526eac1fde256bb05 F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba F ext/fts5/test/fts5_common.tcl a9de9c2209cc4e7ae3c753e783504e67206c6c1467d08f209cd0c5923d3e8d8b @@ -333,36 +333,36 @@ F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678 F ext/lsm1/lsm_tree.c 682679d7ef2b8b6f2fe77aeb532c8d29695bca671c220b0abac77069de5fb9fb F ext/lsm1/lsm_unix.c 11e0a5c19d754a4e1d93dfad06de8cc201f10f886b8e61a4c599ed34e334fc24 F ext/lsm1/lsm_varint.c fe134ad7b2db1ecd99b6a155d2f3625cfd497730e227ae18892452e457b73327 -F ext/lsm1/lsm_vtab.c e57aa3eb456bf2b98064014027e097c9402d6dec7b59564ddbfa1c0ead8f96c5 +F ext/lsm1/lsm_vtab.c 0bc7d2702150e9d5513118f23fdb5d7f3642884e6c0dde332da08b016857887a F ext/lsm1/lsm_win32.c 0a4acbd7e8d136dd3a5753f0a9e7a9802263a9d96cef3278cf120bcaa724db7c F ext/lsm1/test/lsm1_common.tcl 5ed4bab07c93be2e4f300ebe46007ecf4b3e20bc5fbe1dedaf04a8774a6d8d82 F ext/lsm1/test/lsm1_simple.test a04d08e8661ae6fc53786c67f0bd102c6692f003e859dde03ed9ac3f12e066e5 F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f6078e07335398b0 F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240 -F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358 +F ext/misc/amatch.c 5001711cbecdd57b288cb613386789f3034e5beb58fbe0c79f2b3d643ffd4e03 F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb F ext/misc/appendvfs.c 9642c7a194a2a25dca7ad3e36af24a0a46d7702168c4ad7e59c9f9b0e16a3824 F ext/misc/base64.c a71b131e50300c654a66c469a25b62874481f3d1cb3beb56aca9a68edd812e0d F ext/misc/base85.c 073054111988db593ef5fdb87ab8c459df1ea0c3aaaddf0f5bfa3d72b7e6280a F ext/misc/basexx.c 89ad6b76558efbceb627afd5e2ef1d84b2e96d9aaf9b7ecb20e3d00b51be6fcf F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a -F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9 -F ext/misc/carray.c 0ba03f1e6647785d4e05b51be567f5652f06941314ff9d3d3763900aa353b6b5 +F ext/misc/btreeinfo.c cb952620eedf5c0b7625b678f0f08e54d2ec0011d4e50efda5ebdc97f3df7d04 +F ext/misc/carray.c 34fac63770971611c5285de0a9f0ac67d504eaf66be891f637add9290f1c76a5 F ext/misc/carray.h 503209952ccf2431c7fd899ebb92bf46bf7635b38aace42ec8aa1b8d7b6e98a5 F ext/misc/cksumvfs.c 9224e33cc0cb6aa61ff1d7d7b8fd6fe56beca9f9c47954fa4ae0a69bef608f69 -F ext/misc/closure.c dbfd8543b2a017ae6b1a5843986b22ddf99ff126ec9634a2f4047cd14c85c243 -F ext/misc/completion.c 6dafd7f4348eecc7be9e920d4b419d1fb2af75d938cd9c59a20cfe8beb2f22b9 +F ext/misc/closure.c 0e04f52d93e678dd6f950f195f365992edf3c380df246f3d80425cba4c13891e +F ext/misc/completion.c ef78835483b43ac18c96be312b90b615d8368189909be03513ab7a9338131298 F ext/misc/compress.c 3354c77a7c8e86e07d849916000cdac451ed96500bfb5bd83b20eb61eee012c9 -F ext/misc/csv.c ca8d6dafc5469639de81937cb66ae2e6b358542aba94c4f791910d355a8e7f73 +F ext/misc/csv.c 575c2c05fba0a451586a4d42c2c81e711780c41e797126f198d8d9e0a308dcdb F ext/misc/dbdump.c b8592f6f2da292c62991a13864a60d6c573c47a9cc58362131b9e6a64f823e01 F ext/misc/decimal.c 172cf81a8634e6a0f0bedaf71a8372fee63348cf5a3c4e1b78bb233c35889fdc F ext/misc/eval.c 04bc9aada78c888394204b4ed996ab834b99726fb59603b0ee3ed6e049755dc1 -F ext/misc/explain.c 0086fab288d4352ea638cf40ac382aad3b0dc5e845a1ea829a694c015fd970fe -F ext/misc/fileio.c 4e7f7cd30de8df4820c552f14af3c9ca451c5ffe1f2e7bef34d598a12ebfb720 -F ext/misc/fossildelta.c 1240b2d3e52eab1d50c160c7fe1902a9bd210e052dc209200a750bbf885402d5 -F ext/misc/fuzzer.c eae560134f66333e9e1ca4c8ffea75df42056e2ce8456734565dbe1c2a92bf3d +F ext/misc/explain.c 606100185fb90d6a1eade1ed0414d53503c86820d8956a06e3b0a56291894f2b +F ext/misc/fileio.c d88e60f63557d76d4e38acffda5556b2ab42e98f5d830897f22aba65930d975c +F ext/misc/fossildelta.c 8c026e086e406e2b69947f1856fa3b848fff5379962276430d10085b8756b05a +F ext/misc/fuzzer.c 8b28acf1a7e95d50e332bdd47e792ff27054ad99d3f9bc2e91273814d4b31a5a F ext/misc/ieee754.c 62a90978204d2c956d5036eb89e548e736ca5fac0e965912867ddd7bb833256d -F ext/misc/memstat.c 3017a0832c645c0f8c773435620d663855f04690172316bd127270d1a7523d4d +F ext/misc/memstat.c 5b284b78be431c1f5fa154b18eade2407e42c65ed32ec9e9fbf195d114778d7d F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b F ext/misc/memvfs.c 7dffa8cc89c7f2d73da4bd4ccea1bcbd2bd283e3bb4cea398df7c372a197291b F ext/misc/mmapwarm.c 347caa99915fb254e8949ec131667b7fae99e2a9ce91bd468efb6dc372d9b7a9 @@ -371,32 +371,32 @@ F ext/misc/noop.c 81efe4cad9ec740e64388b14281cb983e6e2c223fed43eb77ab3e34946e0c1 F ext/misc/normalize.c bd84355c118e297522aba74de34a4fd286fc775524e0499b14473918d09ea61f F ext/misc/pcachetrace.c f4227ce03fb16aa8d6f321b72dd051097419d7a028a9853af048bee7645cb405 F ext/misc/percentile.c b9086e223d583bdaf8cb73c98a6539d501a2fc4282654adbfea576453d82e691 -F ext/misc/prefixes.c 0f4f8cff5aebc00a7e3ac4021fd59cfe1a8e17c800ceaf592859ecb9cbc38196 -F ext/misc/qpvtab.c 09738419e25f603a35c0ac8bd0a04daab794f48d08a9bc07a6085b9057b99009 +F ext/misc/prefixes.c 82645f79229877afab08c8b08ca1e7fa31921280906b90a61c294e4f540cd2a6 +F ext/misc/qpvtab.c fc189e127f68f791af90a487f4460ec91539a716daf45a0c357e963fd47cc06c F ext/misc/randomjson.c 7dd13664155319d47b9facc0d8dbf45e13062966a47168e54e3f26d48240d7ea F ext/misc/regexp.c 4bdd0045912f81c84908bd535ec5ad3b1c8540b4287c70ab84070963624047db F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946 -F ext/misc/series.c dde5ba69cb9053ff32b5afd64e8d202472325bc052301e31e4d9c0d87e4fff50 +F ext/misc/series.c 80692f675de989629ee20796f75010ce87ca826cb383131040e84f7e1bea5d7a F ext/misc/sha1.c 4011aef176616872b2a0d5bccf0ecfb1f7ce3fe5c3d107f3a8e949d8e1e3f08d F ext/misc/shathree.c 543af7ce71d391cd3a9ab6924a6a1124efc63211fd0f2e240dc4b56077ba88ac F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 -F ext/misc/spellfix.c 94df9bbfa514a563c1484f684a2df3d128a2f7209a84ca3ca100c68a0163e29f +F ext/misc/spellfix.c c0aa7b80d6df45f7da59d912b38752bcac1af53a5766966160e6c5cdd397dbea F ext/misc/sqlar.c 53e7d48f68d699a24f1a92e68e71eca8b3a9ff991fe9588c2a05bde103c6e7b7 -F ext/misc/stmt.c bc30d60d55e70d0133f10ac6103fe9336543f673740b73946f98758a2bb16dd7 -F ext/misc/templatevtab.c 8a16a91a5ceaccfcbd6aaaa56d46828806e460dd194965b3f77bf38f14b942c4 +F ext/misc/stmt.c b090086cd6bd6281c21271d38d576eeffe662f0e6b67536352ce32bbaa438321 +F ext/misc/templatevtab.c 10f15b165b95423ddef593bc5dcb915ec4eb5e0f1066d585e5435a368b8bc22b F ext/misc/totype.c fa4aedeb07f66169005dffa8de3b0a2b621779fd44f85c103228a42afa71853b F ext/misc/uint.c 053fed3bce2e89583afcd4bf804d75d659879bbcedac74d0fa9ed548839a030b -F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9 +F ext/misc/unionvtab.c 716d385256d5fb4beea31b0efede640807e423e85c9784d21d22f0cce010a785 F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917b9c751 F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20 -F ext/misc/vfsstat.c 474d08efc697b8eba300082cb1eb74a5f0f3df31ed257db1cb07e72ab0e53dfb -F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae +F ext/misc/vfsstat.c a85df08654743922a19410d7b1e3111de41bb7cd07d20dd16eda4e2b808d269d +F ext/misc/vtablog.c f2c9d41afe00b51b2c8307b79f508eb0c2dcd57bae074807944e73376fcf15b7 F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd -F ext/misc/wholenumber.c a838d1bea913c514ff316c69695efbb49ea3b8cb37d22afc57f73b6b010b4546 -F ext/misc/zipfile.c b1f36004c19fb5f949fb166fc4ab88e96a86f66629e9ddb4736a45b63fc3d553 +F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668 +F ext/misc/zipfile.c 59af123b4595801d495f55167523b68e840b8e5bfcbbb73f84cbc6a65a994ac2 F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 @@ -445,7 +445,7 @@ F ext/rbu/rbuvacuum4.test ffccd22f67e2d0b380d2889685742159dfe0d19a3880ca3d2d1d69 F ext/rbu/sqlite3rbu.c d4ddf8f0e93772556e452a6c2814063cf47efb760a0834391a9d0cd9859fa4b9 F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304 F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055 -F ext/recover/dbdata.c 81661e3a98cabb70be8f2760a67a8d6d5bf7aaa7a4055a53ff915ac884221a64 +F ext/recover/dbdata.c fc7147a68422cbbbaa481ee92ae1752cc25f5a24302bece1c70dcb76345bd736 F ext/recover/recover1.test c484d01502239f11b61f23c1cee9f5dd19fa17617f8974e42e74d64639c524cf F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a272ce4c229cefd85a F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3 @@ -464,7 +464,7 @@ F ext/recover/sqlite3recover.h 011c799f02deb70ab685916f6f538e6bb32c4e0025e79bfd0 F ext/recover/test_recover.c 1a34e2d04533d919a30ae4d5caeb1643f6684e9ccd7597ca27721d8af81f4ade F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15 F ext/repair/checkfreelist.c e21f06995ff4efdc1622dcceaea4dcba2caa83ca2f31a1607b98a8509168a996 -F ext/repair/checkindex.c 4383e4469c21e5b9ae321d0d63cec53e981af9d7a6564be6374f0eeb93dfc890 +F ext/repair/checkindex.c af5c66463f51462d8a6f796b2c44ef8cfa1116bbdc35a15da07c67a705388bfd F ext/repair/sqlite3_checker.c.in 445118c5f7fea958b36fba1b2c464283e60ed4842039ddee3265f1698115ebf7 F ext/repair/sqlite3_checker.tcl a9a2caa9660567257c177a91124d8c0dccdfa341e25c51e6da7f1fd9e601eafa F ext/repair/test/README.md 34b2f542cf5be7bffe479242b33ee3492cea30711e447cc4a1a86cb5915f419e @@ -472,7 +472,7 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782 F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c335096108c12c01bddbadcec F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/geopoly.c e969a9afaa603728a553af6b945b5459fbd3b8d112a7eda9e73a6790606c7a41 +F ext/rtree/geopoly.c a7f8b4951e283300caf347cdc6097b66da9f6649797b12905fd528413b7ce267 F ext/rtree/rtree.c b3b1c96e46fc820b57851b4fbab546c5317d40d1a2d54e23c9bb50be6090b3e0 F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree1.test 877d40b8b61b1f88cec9d4dc0ff8334f5b05299fac12a35141532e2881860e9d @@ -622,7 +622,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2 -F ext/wasm/tester1.c-pp.js 9e0f4da49f02753a73a5f931bfb9b1458175518daa3fec40b5ebdc06c285539c +F ext/wasm/tester1.c-pp.js fb20d9e1c308ea34a29d8afdda1a6c5edc406241b5560fa23c19c14747ee41bc F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1 F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 @@ -657,8 +657,8 @@ F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d49 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c db847fac81837ff5e5028a5f7505147ac645ae676104adc5bc08e356f243de40 F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 -F src/dbpage.c f3eea5f7ec47e09ee7da40f42b25092ecbe961fc59566b8e5f705f34335b2387 -F src/dbstat.c ec92074baa61d883de58c945162d9e666c13cd7cf3a23bc38b4d1c4d0b2c2bef +F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 +F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 @@ -670,7 +670,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c 51141f1c09ccb177057e5813e6302a5e32e5ba88cc4a756318a35081010fc6df +F src/json.c c6675e01fcd15b22e7f7189ddc8f98fc32a41adb576a96c0c6268f152e7459a7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 @@ -703,7 +703,7 @@ F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c ea85fb64b9481004aaa5d0fa66a57c804074f46145ef2409894d1fc2f4b0cf8d +F src/pragma.c 48becc9b683e1b4a786b5e01a3133e747acba95d3d7182271d1bb67231251114 F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c e3ba080e2f409f9bfcc8d34724e6fc160e9c718dc92d0548f6b71b8b6f860ce2 @@ -726,23 +726,23 @@ F src/test3.c e5178558c41ff53236ae0271e9acb3d6885a94981d2eb939536ee6474598840e F src/test4.c 4533b76419e7feb41b40582554663ed3cd77aaa54e135cf76b3205098cd6e664 F src/test5.c 328aae2c010c57a9829d255dc099d6899311672d F src/test6.c e53bc69dc3cb3815fb74df74f38159ec05ba6dd5273216062e26bc797f925530 -F src/test8.c ccc5d3e2a2bf7248f7da185e2afc4c08b4c6840447f5eb4dd106db165fddbdbc +F src/test8.c 303c2e3bcf7795e888810a7ef03809602b851f0ebec8d6e06a429ed85cafd9a2 F src/test9.c 12e5ba554d2d1cbe0158f6ab3f7ffcd7a86ee4e5 F src/test_async.c 195ab49da082053fdb0f949c114b806a49ca770a F src/test_autoext.c 915d245e736652a219a907909bb6710f0d587871 F src/test_backup.c bf5da90c9926df0a4b941f2d92825a01bbe090a0 -F src/test_bestindex.c 68c62586d2ae9f032903fe53be743657d0c2aac0a850b880938b668e1161d516 +F src/test_bestindex.c f6af1e41cb7901edafb065a8198e4a0192dd42432b642d038965be5e628dec12 F src/test_blob.c ae4a0620b478548afb67963095a7417cd06a4ec0a56adb453542203bfdcb31ce F src/test_btree.c 8b2dc8b8848cf3a4db93f11578f075e82252a274 F src/test_config.c f0cc1f517deaa96dd384822ae2bb91534fa56aa458528b439830d709941d3932 F src/test_delete.c e2fe07646dff6300b48d49b2fee2fe192ed389e834dd635e3b3bac0ce0bf9f8f F src/test_demovfs.c 38a459d1c78fd9afa770445b224c485e079018d6ac07332ff9bd07b54d2b8ce9 F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86 -F src/test_fs.c ba1e1dc18fd3159fdba0b9c4256f14032159785320dfbd6776eb9973cb75d480 +F src/test_fs.c 56cc17e4fdc57efa61695026e2ba96e910b17060d7ee01d775ec048791522e2f F src/test_func.c 24df3a346c012b1fc9e1001d346db6054deb426db0a7437e92490630e71c9b0a F src/test_hexio.c 9478e56a0f08e07841a014a93b20e4ba2709ab56d039d1ca8020e26846aa19bd F src/test_init.c f2cc4774b7c9140f76e45ecbb2ae219f68e3acbbe248c0179db666a70eae9f08 -F src/test_intarray.c 39b4181662a0f33a427748d87218e7578d913e683dc27eab7098bb41617cac71 +F src/test_intarray.c 26ffba666beb658d73cd925d9b4fb56913a3ca9aaeac122b3691436abb192b92 F src/test_intarray.h 6c3534641108cd1bea517a8e117dcba237081310a29a4c35bd2190caa8972293 F src/test_journal.c a0b9709b2f12b1ec819eea8a1176f283bca6d688a6d4a502bd6fd79786f4e287 F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd @@ -752,17 +752,17 @@ F src/test_multiplex.c 70479161239d65af2a231550b270e9d11ece717ad7bf0e13ef4220658 F src/test_multiplex.h f0ff5b6f4462bfd46dac165d6375b9530d08089b7bcbe75e88e0926110db5363 F src/test_mutex.c cd5bac43f2fd168f43c4326b1febe0966439217fac52afb270a6b8215f94cb40 F src/test_onefile.c f31e52e891c5fef6709b9fcef54ce660648a34172423a9cbdf4cbce3ba0049f4 -F src/test_osinst.c d341f9d7613e007c8c3f7eba6cd307230047506aa8f97858c1fd21f5069616bd +F src/test_osinst.c 8e11faf10f5d4df10d3450ecee0b8f4cfa2b62e0f341fafbeb480a08cefeaec4 F src/test_pcache.c 3960cd2c1350adc992c4bf7adcfb0d1ac0574733012bd1a5f94e195928577599 F src/test_quota.c ea44c05f29b995bdb71c55eb0c602604884e55681d59b7736e604bbcc68b0464 F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d F src/test_rtree.c 671f3fae50ff116ef2e32a3bf1fe21b5615b4b7b -F src/test_schema.c f5d6067dfc2f2845c4dd56df63e66ee826fb23877855c785f75cc2ca83fd0c1b +F src/test_schema.c cbfd7a9a9b6b40d4377d0c76a6c5b2a58387385977f26edab4e77eb5f90a14ce F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e F src/test_syscall.c 9fdb13b1df05e639808d44fcb8f6064aaded32b6565c00b215cfd05a060d1aca F src/test_tclsh.c 3ff5d188a72f00807425954ea3b493dfd3a4b890ecc6700ea83bad2fd1332ecf -F src/test_tclvar.c 33ff42149494a39c5fbb0df3d25d6fafb2f668888e41c0688d07273dcb268dfc +F src/test_tclvar.c 3273f9d59395b336e381b53cfc68ec6ebdaada4e93106a2e976ffb0550504e1c F src/test_thread.c 7ddcf0c8b79fa3c1d172f82f322302c963d923cdb503c6171f3c8081586d0b01 F src/test_vdbecov.c f60c6f135ec42c0de013a1d5136777aa328a776d33277f92abac648930453d43 F src/test_vfs.c 193c18da3dbf62a0e33ae7a240bbef938a50846672ee947664512b77d853fe81 @@ -789,7 +789,7 @@ F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2c F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 -F src/vdbevtab.c 57fa8f56478e5b5cb558cb425e7878515e0a105c54f96f1d1bbf4b9433529254 +F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7 F src/vtab.c 154725ebecd3bc02f7fbd7ad3974334f73fff76e02a964e828e48a7c5fb7efff F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/wal.c 01e051a1e713d9eabdb25df38602837cec8f4c2cae448ce2cf6accc87af903e9 @@ -1871,7 +1871,7 @@ F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 F test/view.test d4c4281e1679245829db35597817282f60dc513fc39cc5439078f009bd118487 F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679 F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456 -F test/vt02.c f4a357c8180d71120ca2b466a8df48d9c40fc50873694840327d9647450485f3 +F test/vt02.c 9f098d11920c832900959d7a2545fd67476d76ea6d4147e0b8ff70e915794e5b F test/vtab1.test 09a72330d0f31eda2ffaa828b06a6b917fb86250ee72de0301570af725774c07 F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082 F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e @@ -2029,7 +2029,7 @@ F tool/extract-sqlite3h.tcl 069ceab0cee26cba99952bfa08c0b23e35941c837acabe143f0c F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 F tool/fast_vacuum.c c129ae2924a48310c7b766810391da9e8fda532b9f6bd3f9a9e3a799a1b42af9 F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 -F tool/fuzzershell.c e1d90a03ca790d7c331c2aae08ca46ff435f1ae1faa6cb9cc48f4687c18fdc6e +F tool/fuzzershell.c 41480c8a1e4749351f381431ecfdfceba645396c5d836f8d26b51a33c4a21b33 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a5a4f F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dc3be3af471d90dd810c1e2cc59e83cf6a57f01971b1258ea0da402e4d577ef2 -R 796df824a0f988b2ac90026af2eb0d52 +P 477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95 +R 7195f5fe69c4f14686e7282cf613bdb3 U drh -Z 379d2502295b4d4e0301f78a838da396 +Z 6667762ace3fc2d31532a93194fa5042 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d93fe46bde..0046fc210f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95 \ No newline at end of file +f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7 \ No newline at end of file diff --git a/src/dbpage.c b/src/dbpage.c index 32a9ce55bf..73c31f0dab 100644 --- a/src/dbpage.c +++ b/src/dbpage.c @@ -425,7 +425,8 @@ int sqlite3DbpageRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "sqlite_dbpage", &dbpage_module, 0); } diff --git a/src/dbstat.c b/src/dbstat.c index 0a89d05249..c70d806370 100644 --- a/src/dbstat.c +++ b/src/dbstat.c @@ -895,7 +895,8 @@ int sqlite3DbstatRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "dbstat", &dbstat_module, 0); } diff --git a/src/json.c b/src/json.c index 253fce9f49..adcb691130 100644 --- a/src/json.c +++ b/src/json.c @@ -3758,7 +3758,8 @@ static sqlite3_module jsonEachModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* The methods of the json_tree virtual table. */ @@ -3786,7 +3787,8 @@ static sqlite3_module jsonTreeModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ #endif /* !defined(SQLITE_OMIT_JSON) */ diff --git a/src/pragma.c b/src/pragma.c index a4e05bbdf6..7c8911b2ca 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -2900,7 +2900,8 @@ static const sqlite3_module pragmaVtabModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/src/test8.c b/src/test8.c index f0f5743101..4aeb555c76 100644 --- a/src/test8.c +++ b/src/test8.c @@ -1317,7 +1317,12 @@ static sqlite3_module echoModule = { echoCommit, /* xCommit - commit transaction */ echoRollback, /* xRollback - rollback transaction */ echoFindFunction, /* xFindFunction - function overloading */ - echoRename /* xRename - rename the table */ + echoRename, /* xRename - rename the table */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; static sqlite3_module echoModuleV2 = { @@ -1343,7 +1348,9 @@ static sqlite3_module echoModuleV2 = { echoRename, /* xRename - rename the table */ echoSavepoint, echoRelease, - echoRollbackTo + echoRollbackTo, + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/src/test_bestindex.c b/src/test_bestindex.c index f6e0678ce0..8128530b40 100644 --- a/src/test_bestindex.c +++ b/src/test_bestindex.c @@ -814,6 +814,11 @@ static sqlite3_module tclModule = { 0, /* xRollback */ tclFindFunction, /* xFindFunction */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/src/test_fs.c b/src/test_fs.c index ddfdc7fb59..f88f3a9425 100644 --- a/src/test_fs.c +++ b/src/test_fs.c @@ -816,6 +816,11 @@ static sqlite3_module fsModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; static sqlite3_module fsdirModule = { @@ -839,6 +844,11 @@ static sqlite3_module fsdirModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; static sqlite3_module fstreeModule = { @@ -862,6 +872,11 @@ static sqlite3_module fstreeModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/src/test_intarray.c b/src/test_intarray.c index 8c74a04156..a978ed585d 100644 --- a/src/test_intarray.c +++ b/src/test_intarray.c @@ -205,6 +205,11 @@ static sqlite3_module intarrayModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ diff --git a/src/test_osinst.c b/src/test_osinst.c index 3e698c0324..062e83159b 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -1090,7 +1090,12 @@ int sqlite3_vfslog_register(sqlite3 *db){ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ - }; + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ + }; sqlite3_create_module(db, "vfslog", &vfslog_module, 0); return SQLITE_OK; diff --git a/src/test_schema.c b/src/test_schema.c index d2cae7f2aa..2cbc18e2b2 100644 --- a/src/test_schema.c +++ b/src/test_schema.c @@ -292,6 +292,11 @@ static sqlite3_module schemaModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ diff --git a/src/test_tclvar.c b/src/test_tclvar.c index bf99a8eadb..36165bc27d 100644 --- a/src/test_tclvar.c +++ b/src/test_tclvar.c @@ -487,6 +487,11 @@ static sqlite3_module tclvarModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* diff --git a/src/vdbevtab.c b/src/vdbevtab.c index 59030e0e12..b295dff7b6 100644 --- a/src/vdbevtab.c +++ b/src/vdbevtab.c @@ -428,7 +428,8 @@ static sqlite3_module bytecodevtabModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; diff --git a/test/vt02.c b/test/vt02.c index ddad136fba..350a0400e9 100644 --- a/test/vt02.c +++ b/test/vt02.c @@ -983,7 +983,9 @@ const sqlite3_module vt02Module = { /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, - /* xRollbackTo */ 0 + /* xRollbackTo */ 0, + /* xShadowName */ 0, + /* xIntegrity */ 0 }; static void vt02CoreInit(sqlite3 *db){ diff --git a/tool/fuzzershell.c b/tool/fuzzershell.c index 9a27103597..7a7aef0290 100644 --- a/tool/fuzzershell.c +++ b/tool/fuzzershell.c @@ -680,6 +680,11 @@ static sqlite3_module seriesModule = { 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* END the generate_series(START,END,STEP) implementation *********************************************************************************/ From 00eee7a786bf165e10de253fe3da19d1057f4aad Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 6 Oct 2023 12:55:53 +0000 Subject: [PATCH 022/242] Remove an unused parameter from the recomputeColumnsNotIndexed() routine in order to squash a harmless compiler warning. FossilOrigin-Name: 9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/build.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 56d9099443..21a25b1149 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthat\sall\sfields\sof\sstatic\ssqlite3_module\sobjects\sare\sexplicitly\ninitialized,\sin\sorder\sto\shush-up\snuisance\scompiler\swarnings. -D 2023-10-06T12:51:05.861 +C Remove\san\sunused\sparameter\sfrom\sthe\srecomputeColumnsNotIndexed()\sroutine\sin\norder\sto\ssquash\sa\sharmless\scompiler\swarning. +D 2023-10-06T12:55:53.957 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -652,7 +652,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c fbbbfc51d2fed03c29f20960857d97659d9c682523f32911d5a8e7c5be6436be F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 -F src/build.c a08d098ad1bfd5d46a5f3a6e29a822897e9a021ddba7c021c7c1ae5d4366d1a0 +F src/build.c 79a4edcee69df5f20963d7b11faf0820d25e6f8c11ef3a9f868d14be87834711 F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c db847fac81837ff5e5028a5f7505147ac645ae676104adc5bc08e356f243de40 @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 477577120b897bf15edc2a85e220d5c64a1d5a245354939269f6753d8140ac95 -R 7195f5fe69c4f14686e7282cf613bdb3 +P f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7 +R 463f7e96293ba99be8baedd81f7591d2 U drh -Z 6667762ace3fc2d31532a93194fa5042 +Z 7437dee9dbbbd713eb415ce0acb82a90 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0046fc210f..1325124845 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7 \ No newline at end of file +9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 3e011c625d..59e3e23f09 100644 --- a/src/build.c +++ b/src/build.c @@ -2302,7 +2302,7 @@ static int isDupColumn(Index *pIdx, int nKey, Index *pPk, int iCol){ ** The colNotIdxed mask is AND-ed with the SrcList.a[].colUsed mask ** to determine if the index is covering index. */ -static void recomputeColumnsNotIndexed(Parse *pParse, Index *pIdx){ +static void recomputeColumnsNotIndexed(Index *pIdx){ Bitmask m = 0; int j; Table *pTab = pIdx->pTable; @@ -2493,7 +2493,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ } assert( pPk->nColumn==j ); assert( pTab->nNVCol<=j ); - recomputeColumnsNotIndexed(pParse, pPk); + recomputeColumnsNotIndexed(pPk); } @@ -4273,7 +4273,7 @@ void sqlite3CreateIndex( ** it as a covering index */ assert( HasRowid(pTab) || pTab->iPKey<0 || sqlite3TableColumnToIndex(pIndex, pTab->iPKey)>=0 ); - recomputeColumnsNotIndexed(pParse, pIndex); + recomputeColumnsNotIndexed(pIndex); if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){ pIndex->isCovering = 1; for(j=0; jnCol; j++){ From 53e91a5e22172d57edc095dd89c85524860815f5 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 6 Oct 2023 19:01:43 +0000 Subject: [PATCH 023/242] Add tests for the sqlite3changegroup_schema() API. FossilOrigin-Name: 5dab481c101b1523b1cfde92678cbc654ea26d946bf29da372d71c1f89cbaf46 --- ext/session/sessionalter.test | 96 ++++++++++++++++++++++++ ext/session/sessionfault3.test | 59 +++++++++++++++ ext/session/sqlite3session.c | 13 +++- ext/session/test_session.c | 132 +++++++++++++++++++++++++++++++++ manifest | 17 +++-- manifest.uuid | 2 +- 6 files changed, 306 insertions(+), 13 deletions(-) create mode 100644 ext/session/sessionfault3.test diff --git a/ext/session/sessionalter.test b/ext/session/sessionalter.test index d81b43c841..fb64b26d26 100644 --- a/ext/session/sessionalter.test +++ b/ext/session/sessionalter.test @@ -99,9 +99,105 @@ do_iterator_test 2.4 {} { {DELETE t1 0 X..... {i 2 i 3 i 4 t abcd i 5 f 7.2} {}} } +#------------------------------------------------------------------------- +# Tests of the sqlite3changegroup_xxx() APIs. +# +reset_db +do_execsql_test 3.0 { + CREATE TABLE t1(x INTEGER PRIMARY KEY, y); + CREATE TABLE t2(x PRIMARY KEY, y); + INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6); + INSERT INTO t2 VALUES('one', 'two'), ('three', 'four'), ('five', 'six'); +} +db_save_and_close +foreach {tn sql1 at sql2} { + 1 { + INSERT INTO t1(x, y) VALUES(7, 8); + } { + ALTER TABLE t1 ADD COLUMN z DEFAULT 10; + } { + UPDATE t1 SET y=11 WHERE x=7; + } + 2 { + UPDATE t2 SET y='two.two' WHERE x='one'; + DELETE FROM t2 WHERE x='five'; + INSERT INTO t2(x, y) VALUES('seven', 'eight'); + } { + ALTER TABLE t2 ADD COLUMN z; + ALTER TABLE t2 ADD COLUMN zz; + } { + } + + 3 { + DELETE FROM t2 WHERE x='five'; + } { + ALTER TABLE t2 ADD COLUMN z DEFAULT 'xyz'; + } { + } + + 4 { + UPDATE t2 SET y='two.two' WHERE x='three'; + } { + ALTER TABLE t2 ADD COLUMN z; + } { + UPDATE t2 SET z='abc' WHERE x='one'; + } + + 5* { + UPDATE t2 SET y='two.two' WHERE x='three'; + } { + ALTER TABLE t2 ADD COLUMN z DEFAULT 'defu1'; + } { + } + + 6* { + INSERT INTO t2(x, y) VALUES('nine', 'ten'); + } { + ALTER TABLE t2 ADD COLUMN z; + ALTER TABLE t2 ADD COLUMN a DEFAULT 'eelve'; + ALTER TABLE t2 ADD COLUMN b DEFAULT x'1234abcd'; + ALTER TABLE t2 ADD COLUMN c DEFAULT 4.2; + ALTER TABLE t2 ADD COLUMN d DEFAULT NULL; + } { + } +} { + db_restore_and_reopen + + set C1 [changeset_from_sql $sql1] + execsql $at + set C2 [changeset_from_sql $sql2] + + sqlite3changegroup grp + grp schema db main + grp add $C1 + grp add $C2 + set T1 [grp output] + grp delete + + db_restore_and_reopen + execsql $at + set T2 [changeset_from_sql "$sql1 ; $sql2"] + + if {[string range $tn end end]!="*"} { + do_test 3.1.$tn.1 { changeset_to_list $T1 } [changeset_to_list $T2] + } else { + set tn [string range $tn 0 end-1] + } + + db_restore_and_reopen + proc xConflict {args} { return "REPLACE" } + sqlite3changeset_apply_v2 db $T1 xConflict + set S1 [scksum db main] + + db_restore_and_reopen + sqlite3changeset_apply_v2 db $T2 xConflict + set S2 [scksum db main] + + do_test 3.1.$tn.2 { set S1 } $S2 +} diff --git a/ext/session/sessionfault3.test b/ext/session/sessionfault3.test new file mode 100644 index 0000000000..af5a4cdb43 --- /dev/null +++ b/ext/session/sessionfault3.test @@ -0,0 +1,59 @@ +# 2016 October 6 +# +# 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. +# +#*********************************************************************** +# +# The focus of this file is testing the session module. +# + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source [file join [file dirname [info script]] session_common.tcl] +source $testdir/tester.tcl +ifcapable !session {finish_test; return} +set testprefix sessionfault3 + +do_execsql_test 1.0 { + CREATE TABLE t1(a, b, PRIMARY KEY(a)); + INSERT INTO t1 VALUES(1, 2); + INSERT INTO t1 VALUES(3, 4); + INSERT INTO t1 VALUES('five', 'six'); +} + +set C1 [changeset_from_sql { + INSERT INTO t1 VALUES('seven', 'eight'); + UPDATE t1 SET b=6 WHERE a='five'; + DELETE FROM t1 WHERE a=1; +}] + +do_execsql_test 1.1 { + ALTER TABLE t1 ADD COLUMN d DEFAULT 123; + ALTER TABLE t1 ADD COLUMN e DEFAULT 'string'; +} + +set C2 [changeset_from_sql { + UPDATE t1 SET e='new value' WHERE a='seven'; + INSERT INTO t1 VALUES(0, 0, 0, 0); +}] + +do_faultsim_test 1 -faults oom* -prep { + sqlite3changegroup G +} -body { + G schema db main + G add $::C1 + G add $::C2 + G output + set {} {} +} -test { + catch { G delete } + faultsim_test_result {0 {}} {1 SQLITE_NOMEM} +} + +finish_test diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 1c291f51c0..4e15c3fcd7 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -1472,9 +1472,7 @@ static int sessionPrepareDfltStmt( } static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ - sqlite3 *db = pSession->db; sqlite3_stmt *pStmt = 0; - int ii = 0; int rc = pSession->rc; rc = sessionPrepareDfltStmt(pSession->db, pTab, &pStmt); @@ -2289,6 +2287,7 @@ static void sessionDeleteTable(sqlite3_session *pSession, SessionTable *pList){ sessionFree(pSession, p); } } + sqlite3_finalize(pTab->pDfltStmt); sessionFree(pSession, (char*)pTab->azCol); /* cast works around VC++ bug */ sessionFree(pSession, pTab->apChange); sessionFree(pSession, pTab); @@ -5398,7 +5397,7 @@ struct sqlite3_changegroup { SessionTable *pList; /* List of tables in current patch */ sqlite3 *db; /* Configured by changegroup_schema() */ - const char *zDb; /* Configured by changegroup_schema() */ + char *zDb; /* Configured by changegroup_schema() */ }; /* @@ -5625,7 +5624,7 @@ static int sessionChangesetExtendRecord( if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){ /* Append the missing default column values to the record. */ sessionAppendBlob(pOut, aRec, nRec, &rc); - if( pTab->pDfltStmt==0 ){ + if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){ rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt); } for(ii=nCol; rc==SQLITE_OK && iinCol; ii++){ @@ -5752,6 +5751,11 @@ static int sessionChangesetToHash( if( pGrp->db ){ pTab->nCol = 0; rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb); + if( rc ){ + assert( pTab->azCol==0 ); + sqlite3_free(pTab); + break; + } } /* The new object must be linked on to the end of the list, not @@ -5985,6 +5989,7 @@ int sqlite3changegroup_output_strm( */ void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){ if( pGrp ){ + sqlite3_free(pGrp->zDb); sessionDeleteTable(0, pGrp->pList); sqlite3_free(pGrp); } diff --git a/ext/session/test_session.c b/ext/session/test_session.c index 0836238b5d..df42884efc 100644 --- a/ext/session/test_session.c +++ b/ext/session/test_session.c @@ -1452,12 +1452,144 @@ static int SQLITE_TCLAPI test_sqlite3session_config( return TCL_OK; } +typedef struct TestChangegroup TestChangegroup; +struct TestChangegroup { + sqlite3_changegroup *pGrp; +}; + +/* +** Destructor for Tcl changegroup command object. +*/ +static void test_changegroup_del(void *clientData){ + TestChangegroup *pGrp = (TestChangegroup*)clientData; + sqlite3changegroup_delete(pGrp->pGrp); + ckfree(pGrp); +} + +/* +** Tclcmd: $changegroup schema DB DBNAME +** Tclcmd: $changegroup add CHANGESET +** Tclcmd: $changegroup output +** Tclcmd: $changegroup delete +*/ +static int SQLITE_TCLAPI test_changegroup_cmd( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + TestChangegroup *p = (TestChangegroup*)clientData; + static struct ChangegroupCmd { + const char *zSub; + int nArg; + const char *zMsg; + int iSub; + } aSub[] = { + { "schema", 2, "DB DBNAME", }, /* 0 */ + { "add", 1, "CHANGESET", }, /* 1 */ + { "output", 0, "", }, /* 2 */ + { "delete", 0, "", }, /* 3 */ + { 0 } + }; + int rc = TCL_OK; + int iSub = 0; + + if( objc<2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "SUBCOMMAND ..."); + return TCL_ERROR; + } + rc = Tcl_GetIndexFromObjStruct(interp, + objv[1], aSub, sizeof(aSub[0]), "sub-command", 0, &iSub + ); + if( rc!=TCL_OK ) return rc; + if( objc!=2+aSub[iSub].nArg ){ + Tcl_WrongNumArgs(interp, 2, objv, aSub[iSub].zMsg); + return TCL_ERROR; + } + + switch( iSub ){ + case 0: { /* schema */ + sqlite3 *db = 0; + const char *zDb = Tcl_GetString(objv[3]); + if( dbHandleFromObj(interp, objv[2], &db) ){ + return TCL_ERROR; + } + rc = sqlite3changegroup_schema(p->pGrp, db, zDb); + if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); + break; + }; + + case 1: { /* add */ + int nByte = 0; + const u8 *aByte = Tcl_GetByteArrayFromObj(objv[2], &nByte); + rc = sqlite3changegroup_add(p->pGrp, nByte, (void*)aByte); + if( rc!=SQLITE_OK ) rc = test_session_error(interp, rc, 0); + break; + }; + + case 2: { /* output */ + int nByte = 0; + const u8 *aByte = 0; + rc = sqlite3changegroup_output(p->pGrp, &nByte, (void**)&aByte); + if( rc!=SQLITE_OK ){ + rc = test_session_error(interp, rc, 0); + }else{ + Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(aByte, nByte)); + } + sqlite3_free(aByte); + break; + }; + + default: { /* delete */ + assert( iSub==3 ); + Tcl_DeleteCommand(interp, Tcl_GetString(objv[0])); + break; + } + } + + return rc; +} + +/* +** Tclcmd: sqlite3changegroup CMD +*/ +static int SQLITE_TCLAPI test_sqlite3changegroup( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + int rc; /* sqlite3changegroup_new() return code */ + TestChangegroup *p; /* New wrapper object */ + + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "CMD"); + return TCL_ERROR; + } + + p = (TestChangegroup*)ckalloc(sizeof(TestChangegroup)); + memset(p, 0, sizeof(TestChangegroup)); + rc = sqlite3changegroup_new(&p->pGrp); + if( rc!=SQLITE_OK ){ + ckfree((char*)p); + return test_session_error(interp, rc, 0); + } + + Tcl_CreateObjCommand( + interp, Tcl_GetString(objv[1]), test_changegroup_cmd, (ClientData)p, + test_changegroup_del + ); + Tcl_SetObjResult(interp, objv[1]); + return TCL_OK; +} + int TestSession_Init(Tcl_Interp *interp){ struct Cmd { const char *zCmd; Tcl_ObjCmdProc *xProc; } aCmd[] = { { "sqlite3session", test_sqlite3session }, + { "sqlite3changegroup", test_sqlite3changegroup }, { "sqlite3session_foreach", test_sqlite3session_foreach }, { "sqlite3changeset_invert", test_sqlite3changeset_invert }, { "sqlite3changeset_concat", test_sqlite3changeset_concat }, diff --git a/manifest b/manifest index cf27c7fb81..3f9d9dded8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3changegroup_schema()\sAPI.\sTo\sallow\schangegroups\sto\shandle\sdifferences\sin\sschema\screated\sby\sALTER\sTABLE\sADD\sCOLUMN. -D 2023-10-05T19:09:23.510 +C Add\stests\sfor\sthe\ssqlite3changegroup_schema()\sAPI. +D 2023-10-06T19:01:43.150 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -529,12 +529,13 @@ F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d0 F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859 F ext/session/session_common.tcl e5598096425486b363718e2cda48ee85d660c96b4f8ea9d9d7a4c3ef514769da F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3 -F ext/session/sessionalter.test 2623023075c51707026a90b9b59674e88c6f467098219d8d71f9a6320d122c61 +F ext/session/sessionalter.test 29d77c44087263c63d69be69219734d636ea68635307500d5b0f07a056e4d432 F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec F ext/session/sessionfault.test 573bf027fb870d57bd4e7cf50822a3e4b17b2b923407438747aaa918dec57a09 F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576dc79ed344c46fbf41c +F ext/session/sessionfault3.test 7c7547202775de268f3fe6f074c4d0d165151829710b4e64f90d4a01645ba9e7 F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25 F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09 F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7 @@ -544,9 +545,9 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c 8a0886dc8772c00ccbfe10012e8d21175a96ee18428a58fae9be81d924b89d03 +F ext/session/sqlite3session.c fdf5d63f7e2f722938ce4aee18d472a8fae90f134b63d3f3a3c1c69185d6ef62 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 -F ext/session/test_session.c 5285482f83cd92b4c1fe12fcf88210566a18312f4f2aa110f6399dae46aeccbb +F ext/session/test_session.c 0b4bc954e5e411baa723e52abd46380ca428797dff39ed62c610001777a2b70f F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb @@ -2124,8 +2125,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a3f435eccf3a2aa11cb7420e94af5efcdfa04e9c169c5aaf61fa5cdcb165ceef -R a796b1e127975d7f78d17f701882d2f3 +P 309deee2dd8dd07623fce79f6bb62d5279d140dd0be3b34bc42af20b0507726b +R 33722f2202fca685ef72d8b590a6e7d1 U dan -Z afe7ef1533b48179b0f6fa3866dc9cb3 +Z 92cf09eb69840306d89500d5cc947e40 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1d23b0122d..fa49b95b37 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -309deee2dd8dd07623fce79f6bb62d5279d140dd0be3b34bc42af20b0507726b \ No newline at end of file +5dab481c101b1523b1cfde92678cbc654ea26d946bf29da372d71c1f89cbaf46 \ No newline at end of file From 83e43dc757d0572dc468129f08f6a1e54d917f43 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 6 Oct 2023 20:39:42 +0000 Subject: [PATCH 024/242] Add missing source code comments and fix other issues with the new code on this branch. FossilOrigin-Name: df39fbe9ab87937beb77af353cd55602290b185e222e0a92a3ebf9a9a0b9e2e7 --- ext/session/sqlite3session.c | 68 +++++++++++++++++++++++------------- manifest | 12 +++---- manifest.uuid | 2 +- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 4e15c3fcd7..bc84736471 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -122,7 +122,15 @@ struct sqlite3_changeset_iter { ** ** pDfltStmt: ** This is only used by the sqlite3changegroup_xxx() APIs, not by -** regular sqlite3_session objects. +** regular sqlite3_session objects. It is a SELECT statement that +** selects the default value for each table column. For example, +** if the table is +** +** CREATE TABLE xx(a DEFAULT 1, b, c DEFAULT 'abc') +** +** then this variable is the compiled version of: +** +** SELECT 1, NULL, 'abc' */ struct SessionTable { SessionTable *pNext; @@ -136,7 +144,6 @@ struct SessionTable { int nEntry; /* Total number of entries in hash table */ int nChange; /* Size of apChange[] array */ SessionChange **apChange; /* Hash table buckets */ - sqlite3_stmt *pDfltStmt; }; @@ -1002,13 +1009,14 @@ static int sessionGrowHash( ** ** For example, if the table is declared as: ** -** CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +** CREATE TABLE tbl1(w, x DEFAULT 'abc', y, z, PRIMARY KEY(w, z)); ** -** Then the four output variables are populated as follows: +** Then the five output variables are populated as follows: ** ** *pnCol = 4 ** *pzTab = "tbl1" ** *pazCol = {"w", "x", "y", "z"} +** *pazDflt = {NULL, 'abc', NULL, NULL} ** *pabPK = {1, 0, 0, 1} ** ** All returned buffers are part of the same single allocation, which must @@ -1156,10 +1164,9 @@ static int sessionTableInfo( } /* -** This function is only called from within a pre-update handler for a -** write to table pTab, part of session pSession. If this is the first -** write to this table, initalize the SessionTable.nCol, azCol[] and -** abPK[] arrays accordingly. +** This function is called to initialize the SessionTable.nCol, azCol[] +** abPK[] and azDflt[] members of SessionTable object pTab. If these +** fields are already initilialized, this function is a no-op. ** ** If an error occurs, an error code is stored in sqlite3_session.rc and ** non-zero returned. Or, if no error occurs but the table has no primary @@ -1168,10 +1175,10 @@ static int sessionTableInfo( ** is set to NULL in this case. */ static int sessionInitTable( - sqlite3_session *pSession, - SessionTable *pTab, - sqlite3 *db, - const char *zDb + sqlite3_session *pSession, /* Optional session handle */ + SessionTable *pTab, /* Table object to initialize */ + sqlite3 *db, /* Database handle to read schema from */ + const char *zDb /* Name of db - "main", "temp" etc. */ ){ int rc = SQLITE_OK; @@ -1209,6 +1216,9 @@ static int sessionInitTable( return rc; } +/* +** Re-initialize table object pTab. +*/ static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ int nCol = 0; const char **azCol = 0; @@ -1258,12 +1268,17 @@ static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ return pSession->rc; } +/* +** Session-change object (*pp) contains an old.* record with fewer than +** nCol fields. This function updates it with the default values for +** the missing fields. +*/ static void sessionUpdateOneChange( - sqlite3_session *pSession, - int *pRc, - SessionChange **pp, - int nCol, - sqlite3_stmt *pDflt + sqlite3_session *pSession, /* For memory accounting */ + int *pRc, /* IN/OUT: Error code */ + SessionChange **pp, /* IN/OUT: Change object to update */ + int nCol, /* Number of columns now in table */ + sqlite3_stmt *pDflt /* SELECT */ ){ SessionChange *pOld = *pp; @@ -1414,6 +1429,10 @@ static void sessionAppendStr( } } +/* +** Format a string using printf() style formatting and then append it to the +** buffer using sessionAppendString(). +*/ static void sessionAppendPrintf( SessionBuffer *p, /* Buffer to append to */ int *pRc, @@ -1471,6 +1490,11 @@ static int sessionPrepareDfltStmt( return rc; } +/* +** Table pTab has one or more existing change-records with old.* records +** with fewer than pTab->nCol columns. This function updates all such +** change-records with the default values for the missing columns. +*/ static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ sqlite3_stmt *pStmt = 0; int rc = pSession->rc; @@ -2969,13 +2993,6 @@ static int sessionGenerateChangeset( for(pTab=pSession->pTable; rc==SQLITE_OK && pTab; pTab=pTab->pNext){ if( pTab->nEntry ){ const char *zName = pTab->zName; - -#if 0 - int nCol = 0; /* Number of columns in table */ - u8 *abPK = 0; /* Primary key array */ - int bRowid = 0; - const char **azCol = 0; /* Table columns */ -#endif int i; /* Used to iterate through hash buckets */ sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ int nRewind = buf.nBuf; /* Initial size of write buffer */ @@ -5904,6 +5921,9 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp){ return rc; } +/* +** Provide a database schema to the changegroup object. +*/ int sqlite3changegroup_schema( sqlite3_changegroup *pGrp, sqlite3 *db, diff --git a/manifest b/manifest index e49b7531c4..ea3c50c411 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthis\sbranch\swith\slatest\schanges\sfrom\sthe\strunk. -D 2023-10-06T19:46:19.137 +C Add\smissing\ssource\scode\scomments\sand\sfix\sother\sissues\swith\sthe\snew\scode\son\sthis\sbranch. +D 2023-10-06T20:39:42.133 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -545,7 +545,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c fdf5d63f7e2f722938ce4aee18d472a8fae90f134b63d3f3a3c1c69185d6ef62 +F ext/session/sqlite3session.c 26ea9b58ccd9fdfd211163bb637833d12c2beb491160e04fd415fd0519aa2685 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 F ext/session/test_session.c 0b4bc954e5e411baa723e52abd46380ca428797dff39ed62c610001777a2b70f F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -2125,8 +2125,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5dab481c101b1523b1cfde92678cbc654ea26d946bf29da372d71c1f89cbaf46 9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 -R 7b6d525c7f2c0f50a5d58ccf5673fd6f +P 897e926a5eaa0eab7e09e5003e4c15c974897be298a18ae85345962dc3f410a1 +R 99b1a1d1e6fc326e3288fb4d2006c57d U dan -Z 3397358e9f4504085d0516dbc6df4e33 +Z 6d17292d226b837db6fc5d0737e14243 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3d54e9e0ce..5f9fbc9ffc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -897e926a5eaa0eab7e09e5003e4c15c974897be298a18ae85345962dc3f410a1 \ No newline at end of file +df39fbe9ab87937beb77af353cd55602290b185e222e0a92a3ebf9a9a0b9e2e7 \ No newline at end of file From 43e232dc473ce88c6d707fea72e937cba21c1ff2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 7 Oct 2023 08:00:54 +0000 Subject: [PATCH 025/242] Fix a resource leak: sqlite3_blob_reopen() was failing to invoke the xDel() distructor on a register when it sets that register to the new rowid. This was never a problem prior to the large-column cache of [771fe35074b50b8d] as that destructor was always a no-op. dbsqlfuzz cd96368deaece480fb94d42427dde053737a650e. FossilOrigin-Name: 545edd5ecf20a7feb99dc5ce6f338fa1f172c2e17b240cbede497f0729dbd3d7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeblob.c | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 21a25b1149..a8b897ea06 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunused\sparameter\sfrom\sthe\srecomputeColumnsNotIndexed()\sroutine\sin\norder\sto\ssquash\sa\sharmless\scompiler\swarning. -D 2023-10-06T12:55:53.957 +C Fix\sa\sresource\sleak:\ssqlite3_blob_reopen()\swas\sfailing\sto\sinvoke\sthe\nxDel()\sdistructor\son\sa\sregister\swhen\sit\ssets\sthat\sregister\sto\sthe\snew\nrowid.\s\sThis\swas\snever\sa\sproblem\sprior\sto\sthe\slarge-column\scache\sof\n[771fe35074b50b8d]\sas\sthat\sdestructor\swas\salways\sa\sno-op.\ndbsqlfuzz\scd96368deaece480fb94d42427dde053737a650e. +D 2023-10-07T08:00:54.891 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -785,7 +785,7 @@ F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 -F src/vdbeblob.c 2516697b3ee8154eb8915f29466fb5d4f1ae39ee8b755ea909cefaf57ec5e2ce +F src/vdbeblob.c 4cf5aa130e96e3b52ba3fb54b7f9606c942ab988dbb32cb19cff4db24e06aeec F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7 -R 463f7e96293ba99be8baedd81f7591d2 +P 9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 +R a719f75bc7c6c7426f6e79bce91f6827 U drh -Z 7437dee9dbbbd713eb415ce0acb82a90 +Z 08be0d35019b336830508d06d95188c4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1325124845..9f7658642e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 \ No newline at end of file +545edd5ecf20a7feb99dc5ce6f338fa1f172c2e17b240cbede497f0729dbd3d7 \ No newline at end of file diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 32987da137..ea6f016e3e 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -59,8 +59,7 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ /* Set the value of register r[1] in the SQL statement to integer iRow. ** This is done directly as a performance optimization */ - v->aMem[1].flags = MEM_Int; - v->aMem[1].u.i = iRow; + sqlite3VdbeMemSetInt64(&v->aMem[1], iRow); /* If the statement has been run before (and is paused at the OP_ResultRow) ** then back it up to the point where it does the OP_NotExists. This could From 8f0634549cd10a0b5673b674998501b00963e210 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 7 Oct 2023 08:15:47 +0000 Subject: [PATCH 026/242] Add a test case to prevent a regression of the leak fixed in the previous trunk check-in. FossilOrigin-Name: f99ff655d09763c4a22d065041644ece793d84c82c644931e89ccf50c4f4564a --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/fuzzdata8.db | Bin 4237312 -> 4239360 bytes 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index a8b897ea06..ff15ff5062 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sresource\sleak:\ssqlite3_blob_reopen()\swas\sfailing\sto\sinvoke\sthe\nxDel()\sdistructor\son\sa\sregister\swhen\sit\ssets\sthat\sregister\sto\sthe\snew\nrowid.\s\sThis\swas\snever\sa\sproblem\sprior\sto\sthe\slarge-column\scache\sof\n[771fe35074b50b8d]\sas\sthat\sdestructor\swas\salways\sa\sno-op.\ndbsqlfuzz\scd96368deaece480fb94d42427dde053737a650e. -D 2023-10-07T08:00:54.891 +C Add\sa\stest\scase\sto\sprevent\sa\sregression\sof\sthe\sleak\sfixed\sin\sthe\sprevious\ntrunk\scheck-in. +D 2023-10-07T08:15:47.314 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1207,7 +1207,7 @@ F test/fuzzdata4.db b502c7d5498261715812dd8b3c2005bad08b3a26e6489414bd13926cd3e4 F test/fuzzdata5.db e35f64af17ec48926481cfaf3b3855e436bd40d1cfe2d59a9474cb4b748a52a5 F test/fuzzdata6.db b8725a5f5cf7a3b7241a9038e57ca7e7cc8c3f4d86b44bd770617bda245ab2b0 F test/fuzzdata7.db 0166b56fd7a6b9636a1d60ef0a060f86ddaecf99400a666bb6e5bbd7199ad1f2 -F test/fuzzdata8.db 40c85daae47da64387c3dab7bbd99c21e425c0bfdb4b149cb685b1ab474a2cb4 +F test/fuzzdata8.db 4a53b6d077c6a5c23b609d8d3ac66996fa55ba3f8d02f9b6efdd0214a767a35a F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc @@ -2123,8 +2123,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9bf4bfd68080367b58594e0d44b110b3ee9766420f648537fd7bc638dacefb72 -R a719f75bc7c6c7426f6e79bce91f6827 +P 545edd5ecf20a7feb99dc5ce6f338fa1f172c2e17b240cbede497f0729dbd3d7 +R a2e5d5a4fe4ffa8a8362a1a5b237104f U drh -Z 08be0d35019b336830508d06d95188c4 +Z f7e53533d63cc95fde4932d607956648 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9f7658642e..46a0d004ac 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -545edd5ecf20a7feb99dc5ce6f338fa1f172c2e17b240cbede497f0729dbd3d7 \ No newline at end of file +f99ff655d09763c4a22d065041644ece793d84c82c644931e89ccf50c4f4564a \ No newline at end of file diff --git a/test/fuzzdata8.db b/test/fuzzdata8.db index 6b434f6bbfd84dd6c3d92c38740c9359f1d2f980..3e34180071ede5e023878d8528fe65a8fd9d24b9 100644 GIT binary patch delta 77749 zcmeFZcX(7q^f$h9%igg zL14#135tq}n5ZB~3u2cN6g$FuW}{f%@9+8j^ZxPv@$x+PEV*~?%$YMYXXc#qIk&vt z!<9FBxQdqMSe44uM)mhUQ)QbZF;*2fwff+w=Owaiolf4lsDvBL_2YVRUAf1&Y%YyU z;97H$Tqqa7Svfr?afJL%ek6CuH{=GnLOvl4?l*S=(jVM$NN>7PIE%P1-L3JDMmI`}JLhhNwB8+!^nG^}(zo1^ zNMCm&^IV-f4C!&V6X{X61L;fdP^8begOOIa1Cg$B`y+kI-2&-Sw;$5QZadONZX43M zZVS?BZWGc{w~^hS?AGJY6K);S;chL`0d5V_-fkIbfm=e_$*o43=@yZ;aq~zc7a_4O zM54??!p~8u$nUd}d_NOO(+niHrz81x8j>%|kbFJ`$@M3YT$_aC(nKWZ#-senM`Q87 z^<$8{HwwvHBapmNjO68ENRA9fa(EDu+5t%RKaON?eikNgnTrq&to$>CzraPCk+Z99YuQfkR4yaV$y8c1UbEp2Um;NsKA$ zI&1gnBbTsoUb$F>bj9Ka+GP*41TPLRo<7hD>KM8$MUY9yBv+yf|0O4mWGB_3g-?pvd=+m*F<70gtQ>V-tKdMbhn~^|v@%}KZV~$1X(6vwB zu08Q#65RcU`1?|*+PqoaEyX3XmtmNIZq`yNFTk|z&NDM*iF-GTg1 zf};P2mlCF6f2YM_5$skEN5=t$1^HcjI{N1q^y}CsCLyg&ZbF-duB7CQ#MH#Zq@=`F znQ*0RbOIDlGRXR=Q%8^P)!Q*)+LXx&(N#g_$)cPhsJ4OGt8s#>lMn&o0jmjar3XR*`4orE2PSiM~Y zUcg~*H$Z4fLkon@dE!rnLg67#0;tdzf2BYdn~@pt{zxH$#tjhiWzvq877J^6;^!SD z>=cDeLA7bab;ZY83wnLL5We8ZD)TDe)6LcsC75JVkYgffoxJ%UzlV|VYI5`L!-tA(ctyBi6W&kEnt+e-vH zPoik$E>?EDA8~PmCvBkY6Co1rGzzn5b+s^(CvD-*X(0`6?-Xpb*AC$@ zPvW44h`!cQeDSQ&$%IyaOy(0Pt`NeZEyvwq?YqEfGL=E?_JCw?8BD=&mFL31^gX`Q zbSsN+Pnb7Rx!drwSgZUZZj;~LEl3hqwpA=?tBn4{E3oXI5U8tuh zUmH(Sp?bSuhpkJ53TRv^Xdv}TVLFX^N4TOU>2zt6kjg{5kA!zf23>kjn9D=CTkwaV zUxW#$)k!;70vz0Wg&tmSx1(N_|n1~_#hi91Tl<8 zeJ;Eu3ph6SplF=MH-G$~;uS$dUAF{@$hogY<_W5wdNLV|r@LG(n_XPu8e@~dgllEY)7W^r)_7zVaW4w4MaHK{-+( zPUA^O#?W|J^pl{_S%SDqBAuzA6CY^A_JZp9F|6ez+RjgWlZZ_JcLQf%@f^MAFV2#& zvLdHAK`249nPk7Ro3VEzVKRDP+v_oNgQK8`-#73UI(QDO~GhQacQ;%q1%EJj1?N#cBP4HgZw?RfEdS?DCFeu1(^**Cl< zs+lVOL`1d)m(Y{4I+ur>eDyK5JVwxyI<=8N_crQCnpdbk%~dTC!=SN5JqAuJ5@lL3 zA4d%M&nH)crqFi#;W^4Xn^_wPYj^g#C=KVBB*YId6UTrA5@BdVEk04 z&^1%llgYZKagFrEeld@baaFZqg4kV9t&3%yN(a|;UV=NazXTP>#7@xmu-F+7V5Dq$ zn{Hq_h?BPTNvD-;N-6+j}*%?;4NgGxK8VI$#Bi`l6ELt{GTuZ#)h)?*WF`GI& zsIA2qlOa*^{5{adg$QJn~mSalK9ZBpmJlO(A2415Ko`TS0@nGhbK93%obZPCYDq895MgzUL5kt zk){!%2Xz`Z==)kBURT{tGQ-&m!qY0U<4 zI7geF6u0`uX$>{Ust5et$`)TMYuTJld(_IyJgH#q2C_RjtdVsZRC7%k>NWDyFO4V? zR9|%YduFi?>&Uv|IWcG_kd=6?qe7M%_1=0YNeB#w;-1=e^wN4Uo1+y5^#~sy8>p*L z{Tv6i^TkVSCE~6zPaIcOh!Y3@!t2bHqw$w>Usk8De9_6WIbKqM?FO#n}LM$k%#ge zXE|D&r`Gs5dWMqs#S}s-3e|6ORpZoAtob0EO7q3zJ|S&|k_F+>uiFNWlHnz_}r3d*z?OOUsfjOw7SRLk5 za3-dKFZ#N+gRvM#6U)^NJlRQcvM2mi#Gs~x-e0PgMDjc>^ACySq19UTr(`!A9L@*R z+B4!(pGXFBRa?|u+1T`^&#YIE zwTx+|DEizE^+!bPhf*2#XzDn?)QfLL@9$FcgzWO}R<}}%j|(brtUEX+n)chT-b2Vf zZ>_pY6b9f46;77wV*qa_(I1bf6;3>WQh139FSEIJ2r7vIPYg%Z-DPo*pn9?Zu19DR z=+;x%Su&7*@TS_uk%LvI)uYA1f@)2=?=jptuQt#ZPOAs;ghI*c7M!E_`C3gNvfZONQOXXK8<_{56 zHS_=R;;kqBBiZWk;`J(2&hnoK)o0W#>52>LIXrm{61Mo^_*_;uXvuMUU5IGOgXsRs$dKl8YSk3esemjDRURX@T(e z8o7iv=_DgBzKIN+2KU=7BWS%rX+z+HAVsD_%+m8}@-8imkdio>7AR@dWE9PJNJoiq zX5F-rl!QqSi1-e^{616$%PBOtjil${K$a2=Em}$|>FsFAE|3qXBSMPeX>7c-TrG|f zRF(ai%+ldbij*ujtm`ovPjDfRZYlJMROx9#&U(|O(Hdba4vw!Mr9rX=no=Ye9o|ja ziZlB$X)XEC+d=9lh~ov7*Y8mcYB;gpnojGxNFhWzze+t0H$o`$M_K%0#$~VXK7QRWR=LLaIz#X9voT15L%mU ziy&}dWTd>VF-xR%10^Df6R|UY_fJhr=ST;Lg6&*>y4?gpwS%pbzZnq$pZkMtr1YJ5 z5er?RjZ-C5M~>0bSuL4F@03a=o?P`#m)eTt2^u#?YT(31EO-MB=CwOX-<&Un%HkA3 zwca<=eKJ+UQ>(Df+$W{CJ zR|YtDg#WY3{XNmuac8?^62Ha{+=S{zzbu+pElt%4(*@O5aQYjYi_@mPI4j95Z>>}# z2s7BTk|X?IRqd6W-XqdOj@`j+Q@Rp5gQk{@mPvGg@B{N_qg(DamoX~YGzgv8l`YF~$cNPCM>>!8aUB@Hj% zuj6OoL82V)9!4F~JQep!G92H>2bh$>qfO&N`R{(#pXP&ujPR$BA9G(sW|p+(}vfB0$|a^%)xZ_FVaOx zm?NmJ{!@Y}k_aaX^c6IM$d@?r0XpRh$~`V`V%Yfhxt z=1c+=FN9{mlx%eXYD%`_ayn?tH;to{95P76K+9IilL;((QBHq37oGu<6&4*RwU&0l%Ig&#TpSNwg@xQi!M2qSDO<@C%KZry)Hb7W+lsS^TYxt z^?V==NtegT;zB`nEv|Wdw&%;Oaba?SwP_0kRUEK-CjG}Eu$)E7rkVIE+(`G&mizI1_{bD+_L6NhaK4NVod{a7YvfXbZkmz{Vc6FS*4I{0aycxNhOd{=?u~_pz_9ML z*G3t=F0G-#Ew`gNTjbM{GDJnrknXDYR72L8yA%k^=DB$&*&$C5Gir<79MtcS=ZQ(R zC2j(RJLUOe+ru`uiq`Lx<2f-3S&5@}g$OMVjUB`8vZ)gf4V}U|HSe1H_hR?ZcT+UV z*@as$S zUn|cRCpyhJv;h9aZrA^^+wI@%`s$D7Np~n)8uJ3HJYGgc;**Jp?s={!l)RSRn)Ux< zp7f%3Cq<#?u=AgD=yypN6|w2xtVZxqcT0_eRB=WBn*`D|7f@{>(@>V!yw%7sWw%C6 zYa8V&=%$l(0_#T)y!uk}spy}vrPUhICl~bAOw^^&j1HQ2nWN_60!<*Pa)t_!BxSaM z`!Tv~D0ORl(5Ceo0S%1DV*Kf~Zkh-}9)|`odMn-T(UcH~-=z5kDi%h!1miO8xAb8z zjZq{TYV414K?jSJt*F2y}do=G5+L)&aBJkBV|KF zM;m;HwvP39AYLVu^w*$$|ETFmW+iYVXsgv4v>gJ5YOX-JHX^|%0-{cI;lq*O*5l+x zMn2;pZjt6383i@B3WGs~QhxM%55&sJ!@ z;L$x(S*q&?u0L&N215a!A@MIPg^_1;2;Ed*5 zp3H`vKQhBPv!ubsGR}Vg0p1m{#f&aBv=I1bH05Ns(;W7ft*`Pdq}&YacSlq zp6xaZs&A$PiB^*6b5}G&I2q$<+WnEi6!hcY z)1Z6S10|UOR@&kh&08|DAGxYHd9fS|J;|(r7I1=77Qk(@WT*QCWr;?>Y56=m$t1y= z&lLkq85CloOAX2#A}+y~mcw09L2s!^$&g74I@w>TxC*;ZkJljqpB z`;R&R>v)mzw*s#`p(mB+(D32qD+vt?8tSu6jblP-GINO^h~kx43yVrm(u$q z6rPBHZ)}BQ#mXFZ*Tec9L-#LNF8b8mHmLb1I}Y0RRx06WmV$nT97TlTt561U9ZhA_ zv|5?vE4Upl_ETCzag?lw6Kj=x*dHZ_)9OjeNS;(fQ5|no&|pw;HPrc% zvIFg(uQQiXlu9wK+j&@RW2utBo<9p^J(OhF-pNt{*K(~+bc`zwdd;mkIVkRGSp;>@ zW9eS&73LS?o`aJ^l;w2QdeXvX(t7gYtu|J^@FbwHMSzBWuXR?@+g1IqO}* zq`d3jeZ~X8^Kddy3ZTKOlrMSoZ~WB@9InD#Ypst7Kqi1S`U04DDY3NL!p@5mnraP_s|5(QBV&IteuG zZ?ynwcPfjZe3+u4O>-3!VRBgpE9Wb%S@FH#9**m&8kAyMI$a6%ZOHq;y;s@!ABiz$ zPtwd?%4tIO!`=O@=F{@s%3_`zz@VFgiu_Txm~0i!Tg&8f5U#&tu|x3%>n?iYuu`YN zAYb`$WJ7akZK*p%P;DR8tSQh^4%Z+Eb^0~ z?o&%V{kBdC;K>m*ofNbcywJ4C@)FGd$P!JjoL2BCOyTZ1G;KnzE0J{283p|oFH@mj zc_@)rY4z(&$Q5TTCOZA1vX(=4NcCGvd)n!;VwOdRpgNxHAV7zUKfUy$62XxZ-d~huf*6k0;GbQ?648(+_{;S7 z`-;GeC$WpC=+$9CRzh14?M;rn3DUu*#_G-(g<P@O;YFN9$~OCEYPNL#4I&}e*&ww@QyV2vL@gHgiMQ5&tlEJh2e z{X-Zt?PxbYy`5}m)UTznsoHZyJd0&Nq?>za$DkVe7ERY_?X(qyd_*@FX@S7xu7MJ? zt4B3i(chrZx3aa_9QhdIRN8Qj&`MCf&P@6Qc-U1tmf1PycR1ZKg6cGLy(Pi0uG-Ob zOgHT&A~xW|PuTyf$hs{(wRC3>?J$m9pcC5R9oE)(j$DL#eY+Sa&(%sasjs$PBA4Kx zK5H`6?+fcePYls^;K^m0Z^`OPXpa)Dmm^p3Fq8E>eQ}g_0QxqdC`EpWddF#d@Z=g4 zWys^8ad4Ic%8Q&Qpf)tCC*AafHb@d;1=UR`IdAnbsDX=TZ4oqJhW1NN{1mzTj5<$6 zf8{&h*?s!#2ArIz3x(vl=xD0=BT9j_>$GK%R}>{fMP`%^@R(9eyDiYZ!jaFR@}Z1| zOt}^fnJ?h_dD}i{1dRi#ZMtO0-lBEVs3*1OB>|W2CFTM2?N>5fPKa(r8=s6?jn1f{ zQQv{-MU8{$@9TJdO|Q??grZ6;!Z6UoIa)N!%O^#ZFfOK(Z{Ye|&2-i}TDrxt5eMnk zr!^x{MRd{N5nRQ63k~l^wTFj}m`FNtqjn=tz5{cY$P9|S+>*pLXr(QrWVQBptaMz| zhpf%7@VX88$D(G@dAqgCd2$EHuX0N$-WfFx@O);2y79W6^qalfK%O*#IWW32?OvI^Q6)!IzDv`(w=^1TCt z-EGm7hK2>9|BwdbJWUjJ zlio$#$2Q2OLa5ZS)1n|zl$anT+4N@(tE#X(Wk{z^QT#8 z3B3P@wudAp;(Q8WY|`vEbuVyCdJpk6HIxkJL!lT=Mv68J>J|wq3#0ne!h70XzBXm3 z>>HKGDn3rpRC&N=JgXL_~J+ zx^)Lf#(YgYXi&OWq#ShuiS|8rfcZN)g0)o7gX?gZ@1_$P z2IhPTb%&!bvT;h{ph?mw-q|`?6w|Qr_J1}0ny+yL{P7XApU&%kEJE2M0H`0y4`AgmYlHKbZiT9q?Z5K!utv;jMBZ%1;L!S&MZ|gGPwS|5L z$aR`DbbEs?MHX|={_Dmb<$>eZI1LT^RCk4t^s39cp9MtttYTQQ1gOxOWQcvoVy3|x zZRoiuzN&kUkSr+6QSX48p#dhS8>q%E+5+qx{q-}QLJ&lA_rn0RVm{aPVpx$nU8yfW%h%dzzk$`?^GkIswL zFDIlIRDPC*W^x<-w-PCWviRVYw74Xw8h5ZygVJGWAN?ja%DusHTS8Arx*k0teW=UP zvK66iv-RgW(idD2Ez4laQ$bs(G*o|wV@jr9g3Fbf}0cQ--xWwXUyt~G@)2!w&Tz8!R5PknD9B9N3H05vM>M*Tk_4g zfwZC|b2@?j!7W#Vv7J7a#`o8MOvoUp7@gUh7H8=z3H@rIK8QnaPR01l6qpjxGVu|E z_c`?I)URymg1RR%D;aMI2*vV~74IlLp3sNEfm~+~TKs)>JfY>|_1O~X0mn=AFKdd| z&v7HxKh$GTVzwR~4DyVbBhA7+;ZXq|Do61dEw_l#DCPBmx zgMhnThHQQX{~KI&#QMPlmqD`#LwPEdI$$v(nuV<%g!K#HNkzKalZ@2kNkm%iK`*zk zz!Q&jwx=!9X`VJn$9q~M9p}MAiZI#}gLI?^<4wW{PbAWTo(QDG-Q$lm)r096LXyXZw3Ww#G}>cC>hKtl278cg zp``~kg<$a@^iME)aKQ>%506yiK|u(j2RkP4?uAHIZd}Ox12^K%_+Q=gkpAqRjr2$N zqFMO!gB#N^`0w4AkHOz{qXU`0<(`K0Yj+vaM)zc-m)(<)e&n8r^d0wjq^I3ukiPC_ z`rhjvfpo9C80ib{VMuqo*|zh%doa?SZcNPJtKAr1;J3IRM_TE|+zfuLyALLa@K3pW zZJ<=nde5AFWJfwR)IY?_f*~p&%;y|1((qbGV@sGtgM&fUatw^8tpq#~}9+b1V z*n<)lr+MZgE%Ts&#VH;Xuvp?j0gI1&Fgzd@c%~rj;6c%fDIO+Ncd?tDEB?+o`ahO( zBqn(#V9l!$r*EvKhl32gc(Mix=Nq$WzQa(W5fFCv6oXylL0y&6kKS)(5IAqLVS*s` zN2gCLxT}lVIqVfLbJYtxDl#Vt^Vu2R*SViy=s~pVQrhByvjHb3!7o**Jdjf z+Zlc%QUw-R=W;>y{LBCvnq~N0LMQp{35LORcn8A{<|MBiz~w@{$fwdN{S1}pb?t5F z00-6>bhsmOXeaz`(?Gpsc0o=bg9}X83C1Q=Jb>9R2AyXGh9eR>%5&!#PQrVg4Jp(( z!EhJR0AmbGp?0BREi1bj8jg?%Si8p1=6|fSzI8NKyxK69E*xlhk|WPR{wpyUau{M* zEHU8O+0?)K>yv}?5&tjxOs$RB#5M#X+e2uVxrUd?BR=jCvK@mxhK}HR+))4j)3Lvp zc$_YtY?!PT2MVf_d4IKQVREk7D!UQy_G+_TQN7TwCmWT&xv3)T_^=hPXX(jNhF*mB znPaHs5D@qu!B7-TAHwYz0px*kA(P<(-n+!mUt|Ee75)EeG#*NyHVE{~rwn+&L2TT{ zN7Esm;*+(A&8u2(SV)G_MeEsLL#VOJ;KqY0rhFKt67nK+*XfxH%5Xy>#nidOP(b8; z8#p&2&GxWJkZ;lj(6c)Y37ohG`QE>w)QDJ;-3G*x9Dw>R##GvFui+h@)WX3C0~+hK z?BsJ0N)#h{0}mSp@Zw87JKV*9Td{E{IJ6lu^txs^NJCyRe8C~~uk0nmSlGLXli_B8 z!2*uf8R0PDnO08N_L{>4O|6VF7=JQMp@qi`hd6Q=rhIAmhTf_(JgY^_dc_&TRm8BY z6x}6)s)~V)is|{YhE_y8f~>y0;jYoiSk-Ve?nA>lLSCUoU5(Rl{yt&64i^s?qM<(B z7zD_(26lX67>)qH{Ha>B^e!0Cn0*aCxMT>XFMeU@$H6RWD57s)HDnQTlrjGqN2gpg z1p3?##~|;RVG(R^XLQ5F!1 zjY}9@d|+52zfq&OM>78}`pbOx9q?VxY%@F@V~k?c?Kobipu}a&gX#{(v$SH4F%#Xk zoY70jo3td^_$B(AyBlXPhH4l?Z$U}AaR=Qk8$CLP?OPeg=35D^up3u%7zGaTH*VB? zushW~PEggCvS%aN@6yI50|s)Ih8q_k<_p$Ot43_ak*Q$$PaBaBHrISY5+RnT&X zF`~s;4>dash^KNHNARQp%qxv|AbzhwOG6hJyK>Mu&3Kf22)$f{tO2%+Pe!@I4*S-uNOR z=V;{&;{-w{cQkI`$axw(-&n`PsqV&H@(Gw;LJ&#lJ;P>tzQEX4A{VK9rg0vjrHMvF zcw(pTkxyB-9q4a5Z&?0_F*FcW{3ZHpf$;@|c^@+vps+X(k)4-Ad($byj8<8kB&go> zE&j2TaYV!m_{LRQIoF5@S4}I77?S!+0?l5&YqWA9K7*z;#+mKs|C*w^RA8G)$7oK7jeMOx$#xw#CorZq2VzqIyM9SdddgBz$w@)o} zmm*$L#TcHlq0!{eqUCeNZ#GYJPoWE{jED&M!n=`G{~a7$jec0BHmk-O7tvi?jHt=;tba5m85i$MDVT6i32J!}lB+^cMjK@Uu zz1PI*T`=jf>_zlYtx=~z)3@#wV=m$utBxA;&;ZUqYV-=i%ttOKtRa+kKWRKHky+k% zjEH=^=RIRgRx_+2D6AWu=%Npe<%Im?{n*$?U~s(c2pP2c7PtiXtc3;rB*`v3{PMpq z8{tN9-r6p{7umyLHjjT>-N`*iP(AagGrsrGtD0`m(AtZ}UL5(wdzne)K9EmZwg9|m zqOBW^Lk$83KrvE|?a?#0jY)+3;cYU$DF_Iv+rl7#*-*HH7pU^1@kdTX|F*zU;TPjL znJhf=gsGC}1mYD;QKH&|$J^ZnP!eeBLFZ^pSBXabRFE4XX-{Xdn_XahXO{_jylRx- zgw~WN;y4QuoV1vF!HMdC@$j&S!wgTO$x5&3Oa?thTy6)LCdkUlmL62SRV-AIN2>!( z!*N=AgG?s{kwD4S&#Xtys(_x?|5=?m<(Rq_iKPrO65aYf`Tg7-&JkzuW z7@sOdp}+;}vgsZS_FzuN96NgQ$D4xSL6uErh5$OX1sj|!R%SekZug~#WH`(bJCv`o-?$+O^S=H(b*dyL6K=N6itVra#hzNQ&;@DS576p~5^1ov+Q zckBVCZ8GknCyGsZzO+))O@Sy(&O_EU=4w$P2qCM3JQ@tsW^(6LTRG))+aWVvz>{I?pm-!$5pDz~`IOq1e-~lCb4{JvuPYG))klD`tDNw0x#% z5h0=8*(RKU;Z?!rPwCb9rbr2sOx<>KD5RB`^whP)6sQx8nD;x3H9pN(C9SV8A(SJ^ zyWUhFFa!>&qEdYxRBSZO5!%6A(@?oAplto_ipPg11 zJOQZL9nIakItashi?rr)(!r}U2WW&KcHXEw9qe0e!E~0MP|UdNygtA{YX*PDJ@U`E)*0L=F`N68`r5l$n(RzY<;Wq|oJq8YR<#Dlx% zuDs^bdk2~O5RsYEgW-Bx%K->|!`y~m8)A+?pdmG13BUl^yX_Ft4J8qs@oZWH>F^YEB~Tt#?=mNGOKu+Q3lAH3pu9!tZoiD4!Ovh*g6pni7f? z`4Jj8!|bOak(j1uK1;~3s&eyNVifLTGa0k(sorgVLn1M>VYwL<@R(Ij58@j(`W7P% zTw(r#h@-Hfv2gZ+^%{&hqV%O{tIZLTh;W591+0or)UnB&Na%$PW;Z8dEWV+G?>69V z8A8vQ!(fL^vVs6OoaS%=5o4Zi+K@GCZWS0Q-*%4HLH2Zz3sOODh``7 zSTCP|qAvrR=qpFeojIufnd<}*8w#WRONJ^pXam!q&UJ@`jgXPWh%No&hM=Dw!Rb(c&KO1OZkeB#M2ya_NM_w00JRs4 zB7Nsa^ENdLhS&FPzFXhg!dwx;;x$eWM)$Wo;yeIq6HG>WZA^ABp~D}TF@?vC<(ANj zIy2K2#Dd!5Nx1%-&JOijQ4ggraQ-w$u)N8OOI-=0GoUg*t^jl+xqGl(Z%L=+8p~pi zEQ9M(VoPw0<<3@hZ!N>ZK<+cRJdUfQV6aRQ$y4-To!LU5>v{7qD8HEb8jbg}U?gY- zhQx_RwQ^C%h;U_oH6tMNQMXSibW`#cM2&_*0t) zrzQ`@Go`R`*B}oD=ig8N`xz`PLxg2@o%uKBR1wzUwF%bV(mCk+-vS!=H@g5AJAMEdYif4-!YK3_jH+v^pYV<4w{072k73)N(&B73H z=v>P>&5q>>o-Ev1#;^w?nI3s=c@Iw}ZZ08@?mW9Z(}UsVin;7gNpqdm-uV^`$?k-> zFO-Skde`y-^?%ZWt8W(=k6Q|9-{qDA43ilAx}}P4US%0Ckr!ywZ3`M-c(O(y<{L@^ z?Y6;!D5O2m^gT|d?8}M_#Vai?Sh&xkrRO(VFn8faX!^;*^q1v;!~)f4r~jh^2$-|M zcVAn^(z=V5B0?AJvUrHN8~d;yoM$XWwBK&ae&&IxX|yELf%TS`3BA3~QlZ8zchOCQR} z;`Z_d)lr{*p8`!)MxQWkwBQ}fAx?Y=8KB_0jeCCJ8Ot|_1%!o-7KBaLTgG4zo7P>h zAZpi(r4R{t%d(5^xojE8qsOHBuH_o}w;YT#_A`r9Eq1`M^9{Ni$`2q;=C7_#kdJTm z^E}49X+Ap~S4sPSml#WnzqM>9;;Y!+3AlU2a-M#A)6$BiSsuTjVB$)XrIDps2EDC} zg&rSTqG9tUWcI6j7N<_Y2>CP2z!^nLi4~!XuX_dS88!Q2!g>Y=8`yj}sLe8mFdWfN za>}c-rU~rh1=|J4PqEIWUX!&ePu}v{tf=-eIKFMnqx)&T1NLcekoA~Ay3*qgYd$Z& zi)_A+SzXo`sOw?9OM@e=ugjzxZER}|<;WSY%bF!(pgTLo`Z_0mfQ3JVc|EPEP-?Yy zrtWmBhgUu-X)~hD$eiqiL^yeYdyE!lSr73D0(924YENjVd}|boI6u+Fx>7#BbBYHY z3h(*)ShbF~!?2$sHBdF*uLN8H*6H-|Zr0sCG@$SaY?|*kjNL7u`wOi7&|?Ah^ZlYJ z-f2hZ=zi91941KyCt7i&2Uw>o82LXt!a6~`yeY}k6S7BIUndv5qpUc`u2Nx~6@#+Z z@bfe5w~-2^)_e_q)dn{e-#N|ni8ToD++e2OIo7V6h@J%D1~^w+qiF1W>qQ=sdkss_ z%&mP3Jr;Q*+hB@Wxiv->if~poTi>PYtr@i6Q`SA4_!++Z6%5&EeVh(nWo?wiK6qxr z4d=YIm{za1_9B{Z)~h_d(FPTKHvwmKpcR)^bm)2HpW0FHk9r8R&cgzmV%tvwGPyyQ0%j(%tDOde9F zo42c7O%U!^X6>>12* z``$W}F{-Ee5wRzDDE%d>1vq}T;$c~ZpJU07i48+<-}2aZp{cdaDjPErQqmGKFlr&h z`cY>a8%F(2aBxTLV^u3fL~VQ*Bf*1TTWBEoQmY$BR@jbW$j7$Cm)72h`^0(cNIlkT zd2f_wDE1ccfbq}X4kRM>4?kt%8_T-$In!u$c@FN-b-hDYLH}IaK4Js&Wgc_6@@)Ni zoM_JOwrfzgM=e6=FSc$Qa#~36;(!nrgf{Xx0Xy2paF`QWHq$T;nhFtoJhO{!HA{?K zH6WyyuMA)rg;o~Wrb_5%i2EEdDMP1)AXt60q=9W(TNE_)4Y>z#2HUEtZ>&*Je2vE) zai-*l-vr_j(L7VqLC(i~PgwMrEdcU~h6329GMuZhqVibua_)^AoKqI(kO? z;IjVc;rE>-?{sS=OFq}280Fn)!^2D)$UhxrhZon|Ot59XpN(c$+uo80em$$khMASS zZLi?hv*7Lk^qeky&gOyQfhIp_{E^epV|#6#m=hymm+eQ$+h;RC?EzaMR2;HljADmP zK}fO9K#OJc-Dw-18habC1Q~ zXOQ-W4`L&hL4}W*oZG?OPqUh6^^xe=gt~UcpbMgWWK;`QBoppl&5EmfEZl~f3ASUr zKFgJwIy!YsYEo)K8e$OdW1T1FhxdR3i^4;|;mB$M0Uyd*xaS#lCSH7QTg==cn>YI7_Z+^qy}*-PRFq*qRn_DbA=WWBl9t}Gt>f@KR_O`B z{E1)qV!ENpHkl{+P(Db)EctsjH2KlZ}_ z-nV@t3Fx9f*laU3&b0@y(}@|6v|{JABR%M=-`?#niE5c*==fu>XA&xgZ?k;2nXmd! zS7`C4{`jq)<7aFc;E?Rs#8fQZiA};y9Y`-LtE^s$Ok3K7t9eq}a8)0FKMv0hD?Roc+P;nbB#-H#C8Gl|pyRS56s!mmu5fWszrvnI$0yr2;|IE^ zkZ#Ap?E?*;B*wvOpW6ayL6#k}bo&As8-V_!Jo^p&N*5J6uwwmT_+}2La~JG`FxBUX zJT6j%h4)!>bfdCE|X3KI%52*d&B3O%JLrx%;yURW@OmKNF9a?BTmUuYo*tTuS? zy8Qt(h2vIH{i=O7g?{!)92rC#2iYAM78!0IOcxEbFHtbb^We2~JH-FszX0-hzoSrk z*}t03dCR_xz?`x66=WEk_|lH{+c-PgZ^P;KGxich4}R(Y44b6IbbGx$jH6Lg?P(I3 z0mJ6l-xJ5xw)aejxViQT@`yd%Js6od*X(;Po`Vqx+`e0YX`cO#h_DNBBxWn|Hn=#) z-UI4ash87Xz3qtStH@Okpi39p7Z3&{^bh~XfB+6iYe;`SBpy1)+HcS!ZhKD-6GAI4 z*%8{h#EuDiV`y1|UFP7{v`|bwc`a5?9V_fN2qub}H*&>LdYe0dt{P0^9h8BSa(Gp! z0{i!1KCp48{dZcw#-1c%ys+$RbucU%pq}_2me4f(YlehlD(R=K>^cADraOK=@RA*s zyh@x1pSHEff#b4$C~aC|AJ0KfS*QzsbJ<%!^)fqtC`})VAH-X3?}`u{aZ-{i9Y52F zNd?Nf%GZM+cW`JNePy}51vi~;#{<6;xJdj zJ`FL)>GC?q0U3f%+DqiwHT^wv{*2$Ed11CCfa!Jn5OMlS$upaly>4GaM20?@L0fZv z4Tv?r?BA7!yk*Da*qLksEu%Pn@(Dfjjy;XJf;N2SUqRQOu}_i6oI@q!JsjYw>jaJs z;#8>XEGuwy5vtz5Bic~#t&K8N5JJpVG&SwHLxQl z^QZekX^a2G*LT2GS-$=AoP8Jqif8YM8{7jBOij%JZp{H|rRD(BQgeU@O-mCZxzrp` zX6A%cE=MY)=1RrNGIKy%b3oI|@&DcjvtPgWeg7Xn=T^^ip69vueU0z+z4YN!uGc#` z>R!WFh4roBSZM)Q-b0gM@91Eqvu`AY(X-1MYT5K>!^Udi<@z(|(-CXd&08ehK$+m< zQZ6LvEAV%mont8AGKDTrt(uEvo7aP)wfZq)CBIadv;aPbG7usuRoC5y<# z)x|;1R>3uy@}9mSZF^03m#WIu??T8?JO4iBpDF14c{9HKJdR5$Y@nMA6H(So`B{lS zX{d{nNiTE4U>z>?Ii^-q(j>VR>XGgf7=UjEakSNbSEV~kEFG(91+5tlAt>%R|2V{gq0^$|02&%*5$&=!wGG4M`YA_j6QnBE&XgB@VIWd zQWXdhLZL7&4WrcQ@&>{v68)&vYhZ>`(yC_{zzw%EIDxS!^i9Q&7K=-;>nK;o$AO$; zsJhAj=$vqgzfIHGWI*&R+p2>rW1#LkguZfqiKs}PMd#ppIdVf#uz!Q|cj-2RMPa0F zkTCmXHi6gEovwpczLw5a=xlVut4rk3<8&M3VB;z-*A-F8V);>;J*XqhuZ!eiG^&a2 zP0>U5DdByfA`+g}9h25`@ey65ROr{$r~A!yo#_+?pUS@oRq*x6x|A@)iHE#l5fdS( zsYUbFS-Jr-Wf9u-7Fl*C0kSejcS3}uR=m?oYM_(tEh*o`(-C`mS(h$&sMY}k zU#!og*GQKoZ7zJ)pvMV<)o}5wsvh;xBYrV)r4E5HTb^tO^0sgTe3EN)tK`yFnp%V> zj4RRs^uC?qbCMd++`hVOnp2^U_}6S5#_{j!K9<1*)U=`Q9ZsGtFPG@bAYBDD-J$zj zDkH}`O(&P-L4<$gMyE*~fear*K6YYh@nJBu!g2JO^smr8lgjRqZLoLHv&P?F%= z9Iaa}=5I@&=Ev!j)M<=vKCN}>8qkRSx_1O*XRK~Ho$=~`4;!cZ3aZZ`T`Or9CpXe1 zN}N)mLxjd|IKaf*I3ngo870T-Kx=edw;6nGocXbCxuo2N?%GQkt@ZEFt4W5jly^ek zmHVI9g$Y;es7tzHxpEJF@;=8`>JQ8K*jKs)Nq(SxYtH#f|Fp!DzSWUTI!IY>X%VaW zgAP^@Sb*laAXeSbL98mL>c$diT55E&LM0Wi`%{-8Dfi=nhbexqei~KoP&cK#F1mO5 ziF>*|GU*6AeflvHEo-k!qRdxZYO0*vMkRD(HSdx1#VVx+gR!ktD;(eh!02U;a)vKQL*~=oDic2iOorJ z=0zhK@TM*uOl`ZOVLe{jrG6tC;RW;~?{{B2np1=ETmPNjN98p-DzoUJn|wqmmvxOO zDN)yj;(8diQfh=gk~<~oD!^j*sqQ%%<<`FqD9xG2bS>%foBBw4qKytaa(m#3@;v(I z1d8U|AwvsV{)>J&Eo)^MOjA4PAngyQxy6Bmkye(1RU#6_Y&pzd>;rdr_z!&RRacmd; zm%z+W)+*gwFf$n(e5|WJQmYJuzpO3e&U%tqGz|o_MEMCm7pUT{t_5GM(zla%Vw%2M zC3qpW5B%r1#WLmR_~DmS8?LvqbA%oW^d&Ig>3tm4U%v$XIZKZ~>Y@hvbXwj)pF?Lq z)F+VU89n^fA@_6+P2cGV%PU^tm!bu;z?{Kx4lWHI!$J z*ZVb6JzkrsFPAh`TT}r!xjz%2is``I3xF5~xR>(i9N&b33`gv;~vI!I|J^cAdHpuY#83gx%c#dDineY!?C zz7Mn)t=@(FS(7fse#8~+?K0nZvFujdNj(j+^#Zw=XBPR9S*ZLNe zx?0zelYDp&xA<1y7qk3-47!rrlm3=c5N7Px{nz`Bi?<*aRe6J?bNct_c9=fm->+IP z{E5n&B%Rlfp{is<;NjaIyscNr|&$WN3Kq0ixkd-U_<66k(b z>FkBC7$Dm9HW*~w<)FSo0#BIpX?-%yTP|s6*)hFEI7WbwxQG*^@(656*%rNtOUm^F zU`V5L{q@KHd;T!yPivrYsQjtu=A1V}uR<_gwLV&g=wE%y!VLYwvX8{-yu(or!+jac zKG92(^ao|_*DvR|bp5+BPWW8ESgnAge^=e1Ta~H*MKlX$H|1R}zNJUNY1}9JO3E8$ zXv8IHdIdt!zShSol`u_QZ7j~Spwe=G#hd_mLAK2KuRi)+JnS!g9teHTM|q`sU}hio zR+_L#t3q%R#Zmev`l3fKxfWb1K_DYEw&H{OYZTQ{-=4;Im3nj5ulm%0&M|WOf_Ik-3H82bko*lirY0 zXX=-M=*JKx-2#2C80W7(%I+RBC#;K9s>Vy^_5AMyerCEszrX9*WkP`ps+{W;h^e zOm9X9%!-gBb^cz*bom&nnWirg^#*z#ESI$jhBArwjWqNG;D@3!^f=Vh4d1CHn_$6Q z&FjV+o|3~{R=i(7nlR1V&_{no)T8EJeH#Bh$zakdz)O)Y_+SKyh`v4KOOI0}R-v977>9CZU<}F`fpnCU z0*Hc8kC`8UQ&K%TFdXIZz)+NZ1A|d^4h%pU7eKg!x={ci616GN7iCzWHyUy$0ON`3 zmp~7cHG#)b{t)PnvO3TW<;6f(l*a>IP#z2h1`<#f1m<_b zU-^NKC|?aATt>Ax&>m%W0A?Q5+&~+Y&j(;;Q%w)FLOD6m5@mXzIm#h{CMf#_8l&tJ zK+ue;S0EPU;{iX)&H*3F4grMDsM-ZQDB}Wdl(7LPN>9L!G04b`n~%SS=i+hNUb%Rj zwp}hBp^eMMBeb!(c!buOi$`dUxp;)Oel8xN4a;?*ROI48n!C9Uls9tmIL+ByE6Rhp zMwFbZN4YImhw_bFOij(g+y*G;bq9G_bcnMgFlaxoz^{c}T6_RiI!?3$}a z**RBei6WX=PN%8V2Ue04&e35vjMzbc{HFwSrJg7+!sJ4lpH`MlrhEu?bP{w`W2$EBD8N6t#VZKJ;7J6jRxd*Kse#YH~waWN{=>b<+nc;z? z6tk-(r(M=A?ZJqVXqESvht9O5JK`D>m;! z3G}~))-tM?seg>SA2;;Z3b52(NaC{_rtz(FhG?18y6jWKr%J)|f?#ia{{(w38ord2 zV(NFIJh^TX!g{$b^0Qt?va1g8dNgD_NPiA=ZZ#4sB(-Yz~JxvStfPiDONLldYK&~LOJ0N!!f|y zc#6{uJl55XmRLS`-_T8xy7CmS`5B3ym5eK8Qa75?$P5idVZ17rx&!X1X+)XNTY6Ge zGxG*=^sqMJZdxM;DfXQQR-;TQwvXOa zJY9(hS%>kkR-mjlwWh3V#x68zSSJlPZfryl#1myrjpvn0;Hg&j5EpyUyM}u8IIgAf ztfcIVXQXkwWcgF#`)!O$8KO_u|0XQ7?TxU|4xk-c3lIqJIE)Ol7#KfQlv?b^KAfu^pKCxb)lbegJS? zHhv!bo|2z29!7vnX<|csy<;50r0|T@!S{_ODbn=d(bI?1f#sb%6cuWUVLbAn@TZKP zVf;%u@x(KMW<2_NV?8M}qkLkZDa#t}Qmh$D6!MaQUPsHVL!nj2*s5x5OI?LHHcEzI&2XD+n{ zf~|a-6^o5nvCmL(Z}T(!>{8=Oxip^7=`1az!d}Lne5lr(0zo9q{FvyJ34E@%5mxMX z!p+a}@)brzls`*nHX8w?SYw0>rzKoCqeQ)j3S+YoJDe&jZ(<-GUk`oswN89Jb@7k@ zFktyD>%NA2A`IJ}YRXc7paq|M*Vr84TO18TEe8XUh0ov~q;}JxUD?SzN zp3Tu2#w)Nx$xTN7>!ML30sB^cE!-|+4AbS{C_-+YW(0%{Uo_xrS<%8MJi$1<>>J}G zrJ@ZO`-0*MW3u*>DIqGT=5tD%Nh9O%TgE4YfT_(EQOjqjWEt=(+qS`#iKXRZ^>4;I zk`e-lYC%E9cS-+HNBqzE8{}tG1?Yg^WT4DXjGg((yT(m&DOb!=E9LzV{>1J{CPEB3 zpBrg}=N14>J7e;04>n;Dm%iMoANI}>#{HtLnOw7^lR(6Ws9xgyiP29;qPaB)Opi2G zDZm8ch%w!eluP#a3$){Co#|E(W2btVor8>U*r#p{i{@8##_-@1ULof&qnXP6CLedR zm@uuE6%EoJ7}^*i$xXUYrK-VNTc zZfDj!BwJFnt!?&2Cmq6w>PdEJ_ zm)_+31%5lo+vk}Uao*EOone0-o79wIUPN=>0>zGh7w?&4dO{d8qff^G-uFbuW|a7; zA%>sMHkE5siP(DJ1^j!uHsno9OhaT6l`S>>t`M-ZH41TY43Ek;!KShiO?bDU82-5+ zcSc#;hzzuiOrJ`d!4qM^3fn@Je;SYhYK^I(FjrRIH-K=p$aE4gGpdvs5l^wfv|lUo zCw)I1oJZy-gJ%!z?H%FcS=&vEf+#js37vCWno!N?BsCSyGLGZbC8h}?Zt!NJ8To>C znUF8&J?h=jXruKF!B5#-W2upmt(*A^(aAfhcM`CxC%T*4NrgM3UZ? zA<`LT86Z*LC(Q3r(T`>u`#&&Ul3dLJ~crt+egJ4wJ8*J-jvO^ zi=rC>VRE-2h(R82-;wbp2=!6Z{gi)A=cM_6G#o(XMwn=_zme6W%+F0p{M99s6VN!S z2)H^^`diuv@jlow4^WmKhPjfnrc`oVGlAXlJpNU6ui<%NBWwgCZ?)-A*$<|fN@X$z z_m8^ho}$sv_|IR`Mf22+)`if1`x}MasoH@LjG-P&e(-!@oG)VqCXNujz{7try^GWX z6ty)9aLhX<5S$(cg21wkOYfTc%cUc`6=n?iQO;RvoCHjZ+FT%gNI7}N6MR}@1~TRt z=e&+Xj?yibkNKMj^D>pP3+nVz-NHnj8Z$CvER;e|oSYI!!Ic%G#GD9*+SL>1zd@M% zREO|6Nofz{P_nx6gu;)()MK6NrwT$u+lCmb%!+8{EhK~C&zq-*1V>9~F2xhzz)7;>bKPi)0kcVaJPE$VJ z{>7vM9?61e%SM(NJS)lkvLt=FaZ42H`H~g9Z7Jr(GDHhzzHBvt>9(60DB{olp0YaL z-orddj)=j(=jj*NCSJELKr)?v=0(y4x}q}Y^0E(2&qFHgu8;T9yMEK)a!(KGSm~*m&fM>9>Zu*abZjf zVVFh>RzTGy&e~%h0Ve9P=C_cw;LvHaknWx`|EU6rpY*kQ8S2^C!KZp!fXl9#Y;GWv zs;ILn3{*0i<}DflseJ#TQoq97mDUNG{5iAC0h#g&p8hqZuw_31<<*h@m}3qF(vRa- znlfSZ8r!K5RKez^LV(tC=LO~?!VDU>#&nP{sw3IH&-ZtmRB(U|_!%6`Sw;;l{=3UW4w>fTxrMtwvwwVVBex;(_ z=Fu|cHFU^NjPWRwai1~f1`?g#Z*B|gWyLkEl{Sqv4;9^?BIA7r&8t)bT?#~-bC=~M zF_Mm8?gQ0tTs+deQ(``0?k$sk|K~Za3eTGDw0W#~uz1MpYE>_c^@irb`>E=@dAH_| z)q?{)g$bs(gJ~F-95n;`j~e}o&!1#_$NHI=^KJy8$^cx}=2)-tgV})m34s*mq7c3Oe-HruM2|G>wQ{&(Bz>9$;MFLRnO8Jv7T)#*Z7(1<~5S^fDUvuzF647 z(t@|&Fb|Z=)FD8>o8$PP&eG+PaQm1{rUpG>n7N$#_Awp|E(~Nauz&!%&+q0kNyI6d zVZKyQ@hL|G%062!g6%#_HTVd=H0S&;%~GPhY9(WNW1h^vir;+M-iUyi|7;W@F+yNf z%v@~ElhfM$rXEyz*90{+M6DL0`Aaew#f^#nA?fpg#KH8FXz5yi$$sGjj?^L$D^_B1Yukqe$*9s z0^h$}XIxL;W$7Wt{k`DOilbpWMq3T@gE|5UUo2B3p60dW%cOe$S0~J7jO|jfF4U2n zwa5y!eJz_Fqf>WGFY%~tQEvq=MRC^4!As}?Mh}dTs9h_|M^ZFNJEIE3A#JG}R>rUb zupEEb0+taXv^}epQQ1WzhJxUJ^i{)*p7Jwy<6n)jSf>#Z+G!L?E z!L=ab?$OE9SCnf8(}g!IMr^Wb^Ok9WK8ldf>%wKLcAJwBB_xlaVD^yWQI=7X5{4|i zps2ZZ3-3s`43r~stzw=T9`>lGEHEqBsA7TncdE&?gtK~r1>|FPu2^Jlfz!RnWF*H1 z2sfjbSPI43Q9C$iQYSOWQnM`BE1gvFs#(w0?Uo#glVhzLP`+R}EKIAJ5n)B*b!osJ zU9`Xj7ozsCqkb5cH(tAhN^YrB_-u})wM_C-^qZC&z}r|Fh-{yclPt9YuvB-GpQ1Ng z;Cx+bfzT4m(c3M{9=?k3s&Z;E(-Kzpy5*!w*$+u3gS*epzdOjUgv}4muX75`AiVZh z!!dTOvjA7rl%h476_k3%@FU?In8o*sEh-rdP|@KUxJ@@$;5Kc}(NUUMoRJF>+7Ys$ z7-_A~+?>{TiP*^_H(NGJFi{;^YW{?hPoWxrAN28}Gwv$^GPCTm?AOGXX#xPH-v~m= zIcm4%whU>lL)0xfzPVNK)9tlPs{GB+jLN^XAix4lb_@`3Z;{|L z{}~HlXyul#t(;(&>pqCTW8?imx5Dm}E#ekv|myqNjZ3Hc%NJ${;5tq@9Sq zZn;UFRK^Zel4p5U$RIKBy7#amXeb02>i8B)1B7ZPf{@O5OjO>?A4z$=^i8OrA-Wz_ zt&`d4bT7oJp4EbjP=C&HLj@RQ^iK_t+bhQU9-p~jX@g)-&RS{0oPpfr;z5@!+hwqW zWvwyIt&^At64TpU_LZfNU^SE`b^?^;8%sc##IiP+K-lnuMX6B@z;2S=SjcVyZKF=! zT`$ldSyUWi-`UCOHcbi;R&mGb@PauPn?q$h-x_Ab$s#i@rX6nU zK;#;AE;VQ2oBy0;3uwxAiwwM9wCzr+shH&LbE0V$t!~aJh;?#8ze3E&!J|NRm`uwzSbf^8{KUX0Ou>1g zHC;*ewl!NbHLqo0BzU6gPN$;hjT$=pw$-Jbd}>TU1W-_&=m6V_mLJ<_eP2?JMe_v% zq!rRrCZ(4c!Pr=0T?88*@ZRFf=~Q#xv6{epIf05!IBXPm!ZC&?OpHL5q^}bP($Gl} z?J50^L&4h*Tdyjlbbj@?HA}914iA2T;yXJ}{llCola*CkoeJd`@R$mYxET6?n%=k&3B+iOz6@*Bc6tbVDWbQ3U5 z;kLtq6*4;3=906of$g#aaKv+aZB1mzP&y56d$Vl}fQZ#&?RF}6D;iVs08@E^ZL*3R zSZy^jY3a_=$$E*+PTLPaB^LB+Qd)53=E1+sS5R@U`)rW!UoGg@q7;Cbh6XN=vOO&; zxOMlmsKxSvtjdv;S7{3^7@dBIESdGS+^U()s)lJft+g#rrpezsJMfGm z?SnQz(OHF|OYnr(kej|`2Qv4zA!K!Cn{e*X-gZ)itj4`$%jXrzwlb|q__uK&`Z9-7 z->_);VlSIl5@19%QDw3%hF~jOMRQYZ9r?%JHaL4%7R0BdQ(OndNvf>2}$ z=`X`4>k$`0RBKV!#G{&}1&O28NM zJ4S{)fgvIrVak5Vk)1c*3;SH>aiR*D5fVy zeufP+3U6}peK;mqJP zA{V7Co|DUMx21x9UO){()Y~aiWt+D1vezvum^$Si&FODPKuCxhA**XTA#Q7{?Ytlj ztDS836?8gSN~13UELAcVTi-(i>SkHlF54aj(%2&xRFH`#u09ftfv-f>I#`FTc-l^? zm~Xch)XWU$X7AfRlS{jHru;BcDu|nRhH6#{Z1`|fKkB>5Hh_Qlz-ERSu)yJG-haf_ zLs$XNxq*GpJSx`~T+Ld;7mnMo-7=l?az#PO*5ZQnKfmPzr){hfAsAl-YeL!c z><+&0sm(1@?kyb`m|Xa|?STl6RqvzPbURW&U9deT2*hf~*#S1aWIG{Oy+5vPeB4-$ z=x-kmiRXwsil3{-%8?ytRZ!a0MKvGF*VDE_F9^#ypb~$WrdV3zFZnqDh z4K#d|(xGREeG&RlbDRql(Wi$KZB3edEkrV1GsiuBoBx34r zLi+6<_OSvkq5fdioWN8#ZRb$RJbRsmi29j2hf?Zq_7}zQ9>nJ`m5ybViIq2#*ymaa!dz;-w_OUP-Qq~)t8WfZd)Urci z|5~p4Fs@x(E6{@vvOmXjH1?NZJEWph^2hk`aQpje;3B6w<==`8TM${DPTCX{CJ-|E zp1l%=_@n{sH`*@=7O~=3c?X(rwV&tuRy&ehe?&PtJ3OHdJ21qjsdlh@FhxD-8qT{s z_EAAHr?2Xw>@jB8m6pjv5f}!e-MVJ>uG;gZZ31Y;S5rhs0NDATS5qS3Z&#mvFE#+U z(KiDh{UVC0TG;E;uom`>%H#M&CB-dhgjw{khu@bK)JzDc=5ZzyC5^FP6@7G$;x5_- z(V<*>1f_aoT2hJJrl95rIr!#x;n*5ZcpLaS@tC|shZASw;?oc zx;<1Y5`tFGrkro=%fm!pfhvr6O~`@cL%0(;yn8YlJZMj`i7$aXb*RFw*5Nt zeiT%^Xr(^y%eT<{vGyFQEbP=%^fch68y4BY8TDO3aeoAxEw&$*OWzk%WWtoN)DBa^ z4_rRQo($~4ceZ%!|Kavmq_WqM&_}w?)%WCP8E5`!e@ddwKjMi_Sv`5jKpsc;Ff+H_x(vJf7uU#s!$Wd$?w^_K;65V1VV+2_Pvty7gbB0ffj$uu3_-v zMQFeuKKC2@0=e=J+Q(ce!0D?Qy7ykQ6_fJd-z&*_Uzd+1x_1yJ02hmspv1; zh~4Rq0b&AZBFynA(kwb92VAt3UeGe)i9%)7XxOO~Uq&>yC$gh~<7+|K z9#~a-5YAwmh|&<2io8;<&9=zKCQ@$Z9&-@sQM^MN7xqyv*yECQ}KF zR6P(1w6QgTiszW6736R4)>*akCOcZ!c@S^|B3uz%sEMYO>5Z(M*voMkb9qZAOIce7 z+E#G{8xvISbD*!>rN5h^hY#!Mfr>0{V-$-!0q*j7Q?(}p~o!L}x zv|}%C>E=MBj{tM&xT>4OB4bA{2kb$5$}va5tJ%a6&hfn+h?@h((We+lSWyTTUfxj+ ztDGZfm5cuVgB=EN(sAA>$JC&?O=IC+JssU7(NS2yH52NGQPcvvwXiM3 zf_r0tGmxz0obJHBGtS}Bf=|BBWXF3lr5QDI(41C|Y}z!{F_5y`I3jpRPe*%+t$zc?2T&4j#-YcWw64feH;ePf;kT4 zr@~S9D`>kWJ7$vYsG}84T<9oKdbjk<4PpBtN0p=$XgD8VZW}c3EpfoS=jUo&C+sAa zcO2i){9}#?`tpyCTeT;z_>WbNP#Lnjrrqt>oO_fxd=d{`>)4`#0q)GN9f!k@ z>5bwk8yqWOg`+cnblfXm31z3b%%`H$e|3!Jn9Yvc!T=Yq@EPgWy^eDpz5F_@EpTK& zDfGtDT(>V&yuX_2t#JG(rgR*ilRE8`Xe&7eipt!PqLqqC!#Q`zp08(tj!e4yEF-op%il?^a$i~iA7-uPI7MGlG zoKZ<~o?q$6mMh!fatCsDcE4f5XTU4qeoS{j8J6&)*&?*(c z{3cLN?ZXws$l>4@o0bMJGfg5_pR}5B`+3KoT=J{qdm+DQlEAQ)1e()Rj%Z5ntyWRg zZ;7Kh?v7)TjO{-&-u87_}{AE6CI#@P731|QO-}*QZLFs zVI9C#^^+`8;VJ7~q^o!22OIeW<$UhwLNoiCoV={9^Em`v%(T|$8&>BqwNeWwQx7OC zPY`S<5&Wjt*-+B-S=~Ap;WWGIg>Wq{t2jHboQbvrsKMx+^+$Ivo{++ORBIV8W zJE-Jwmx_vhaoPCKbf;D%lg){7{YR^5p_(}{avw~n(qDqD6qerQz&au*1PP^biv|sW?*E)K7zH=?CD`}TJINU1xX$@5Mu^TX| z5Y1DZR^@@&A$gX2H#&0>RwB$|8Na!o6&ah;xO}nmF#%P}_|yF^M@@5QN=A$J^95$Z~(p@kqm$hLXwacZG+ha{|Wnu&DoZFep&Ug>-h ziA+Fq=|*(=8s{GH!g1+2XA+`7-gF`gWHOhYcY5G(aJf@>!rRW(GVs7DHaUewi>t4Q z%)0eUolq*WsA8(SGu51Q|HN%}JI@HVx6(82DLieDGhZY)DgD@OgIu%6HI5e@aL$#% z_*J^!)sKqeyf?UWg|og^0TcIkB6O;dJwDoTCMJUSpLBMWlv7dR7r46A2_t4?TUhkV zx4PHUXN_^LqI1(Jd4g*g-$VeOB+aB8^2c$}T<3>SzY^VmnA(TCGpR=B8ZSC{7Uite z`l+OiYceHIb(M38!G+zs;9o6fV1j{;$d5G>3byj1T@GkAJ>U0R^jFjp5Ls4S|8&yB{{3&x4Y%@+HMmaeySx1fRH zE|X}G2orcocq1(%QzF4oG9{%9V*~EaCW;F2EN4)xv;a zj*D;WD(3Q@&LlVxT4^5V@?V{w1^38T04dZ=r=r>JBHn(-`9ttI$Ue0exntv!ToCpu z@2Vim&2rg;mzI(Ag;oR(yWUbu%el0TyC00lB3FCKVNDla*WC4#B;|2w2e$^x>kH3$ zlozppMfLKjG||1SZlYvga@}QXTNebB*C_rCZ40VOanIuW6Pz+oAFgos58hG0`ElMf z%tpVvmf|Lb!QdF{ZY%Mg&aNjEh%v6MaYbT)+q)yk@wn@2Fv(RHqNQ8*Z6v07c7h`>D9%=B{{=p#zM}mR%i~;3bg=K%QS|4Y#gsk+3?6?ETq|LcD~WL(5xZss{&JElR-o>puX=7j z+OnDk$BZy$_o(wir-@fgb4`(?Vv1_30oO~1gd%d3J16pJ$-O-IqBlADI~QEhsV-Lu zbmd_hFfx4TY(a%Dx+cSJSG&NS#WUu(Kt#Gh1jU1%DBJbD2sAzviS4IbuInHIjRA^@ zev*=3Z}%Eie$pw9sw&}iJ$p;qgp5IvH2PDiDK~oAbx{dhUCvTXeHo4Z1Pn$PhAK)u z<6KMWk2%MQQGb^!<~ZM${j*Cn65np-ifreA;0TobvpIYyE^Xn8Tqn-|ICBDA8DjmV zu5;~_0O_k(?5v@Q``yTKImiXj0}cfu493K=4KAfp2_w{x$&68O;sDrZcTikYSE*P` z@8E+3w%<92WAi9=zJ!fvt_NUHgS#)K>~MVmYhQd%O)a;W=sJh-#%L6N>4IV(qA8{L zKAJ)#(sB(1mx7p^HD#^_A{aU44c8&cE^yE1E_+>It=!4^e>kT?YDsg3@w|hsg#z%G ze@}ds+|>OG#eHv$q*Dp?V<_Y*an~rVN{@YFrRASy3G}jNJ3f0k`W)zwkhR)1gqA(-dhSubw-8m|N2Qrq3%7f? zfG`mf0z*Q0FSxAsbIl&-7}yGaacYB`a=y6XeJ-8p*5IU^?t%q4!wtr=5X}KDo#XaO z|K00+>U-By3dzXvH(cS8_Rwxut^r=x9{*G`*!wd?UH9Nq&Karh^>ShSgKsB9Q$ZO6 z-8qj|K^)wl$29fDl@B;$sQVzGP!GHOda%ZaIb(zy3s!7i|6T~s;?Qhcck2;KndD3n z+n5Q#canPpa_(~0WoI85Ctq?;lEnVp9WX)1bY}`hsTE#|Z02rC@6K_}siWL5YTegm zF#lD9C<4Lvu6X!RZ|Pp4Yj+x66C4pS^jN@kfCMCxQtvm6OAmYWA&G4&Urd_!C6fhp#JRGgw;fqzq^4c zU*g;>E`LVnE;+l1#j^mrbZc)Mr8-@0INjw!zy7_8g_ZSo%N5cEE`8Vagp4a^I!l9Z z{Q}vbU6tgB_P|g1P%aG$g+aOHHsLI~MdOFK-+-~O_6ryG7xe!eUOwDCU6Q`!+RMSO z-gg#K(QnXoFajNe&%MO8)#6g+Ko?AB-?*ZK-(Ke0Z(SF$u3WCc-1=$vS*3Kfpn8Iy z9ks5GG9EO=ykVfE-n9g0 zFtCOxbDb&~k2vGrP_8=i1CLhy;7M^zZ62GYtOQ^o|pAAjD z?Jl93%bqOJD5v;QEv22(AhY!@_ou=NiB+_gzCZ7NjgJ26zRNB4xxuIVvsg!Z-gd_g zpWBo}?iH{$X4C`aUixKs5%7&4xO*yLRIJ_VN|kZZHTTxw$p20$V>L$3zToN{?Cf_W z=??PIxZE`Lwmbh(ErMP9N^l|lLA85aX`H;!nJ3ZuJ?_`3Xu1n02jQ% zf)ioZzk6+Su(l7#dE0rFN^YyPTy)x<4nQfSAJ|~s@5!_wbnYjWja@bFD!B{?K}vIP zA|;y=ehPLKqpOl+YFT_-%ec6BK6t_1MJ{IHF7&TfPAP4@0djnyO?))^QLMS=cBw^V z-~B0sEh!W3R?Yt$>Bq(915>3|#VO;%L3C_yqskb^8t4?db+Cx%lXZ=LRlM1k+VF;GNs!Y+a|*~O!iMw26|Q4_FXX(w@Vb~sEmq86Ol#RCR`h7|v7 z_*u^06WdNkp^tn1kaQG3RebY)EL4#(y*$Oj6e+dv9ND4tl;}&VrAG6<^B?iGB=t}S665og5=uswPfS?Gd?Ah z(ucXCAMm_Qo*98cIh)9%NB`T>C3mAHA{35O3arK;4i@?iU&p)cnO$dC+S~Vd@ zbB-8Q5is1C&n0@A$R4GL-W{w}6OJAcdmAa4yK5s5aI0{vF84HkN@}r)(7@R=}_|N~FLphCz{2;qc_S>UYO01~MBuB)p! zAsrHrulBql0|qdv+zF@kH=Yv$1DG>Z^Lg-m1|*EF|7{lQ$)&>IM)(AT#b6|KOR3Z!n;Za z>*w;e^*aNZ(ZR$cqr4jh1!6z7xAfnSDpCnUxy3tCnf6}u+{RpP@%EHdPvjJMa~pA_ z4V@tZkhQ(Rm*jedqW0NSg{HKRS2?{CWl|q1zUIcM;PF<=rM?tDP6OX#tQWq=epIUq zhqBnz3uQ4C$?2SM_Q!e8su7ACO0^pqjq zA63fcz>dwK;!=5CTrjO)>Wu)LSvxYnV{S8m$m((nSCt|)y@(qY*T;)p_Q||axlIul znk??^LNzLthE^^08pU!Miq8njyWw?m_IU3`iBDyC+pB=vD{0@zOsO}#8RGkZNI{o6 z&kJR`vU8H2Pi1*8s}u+-Eq%zBQVN=#=BvE1;&o$I^v;C>w#6b|_XNK%%ez>n9E}TO zDSEtj3fpFT;RwUipwf<`=t)l?9Of?0!O>0MKcObS`9rQ+#P4D}PFaGKEA*0(qZHPzmgGKVlnnLr+pU&-o z_vZ8szE||2BS?8JChy|?k-6;^A-_GO`FuDQ4hAK9OG%TH=g&omMNysgFnbibJo|#z zCL(#YFi;vB2oH=GJ6%BZF(Pgr^>8Ce%B7t56#(PkflJ-~dq+fp9P~m0y;ajOj7EDJ z_#gE;e!Gy+?_(+bm>1fU(>II0)cP88Go=qu^F4f(G)!jgh`8ex z=8kVag#S(c$^WkM_f)hD5Y<@x&j|@G zfm*3M0mz)|X~z4qd|=cmrnD!t;MAY)+bmbU8Q;2PTS}RrP2j8dVp|GP3L)PsX8EQF z6ktZNAK78&_&!vNWEVdT6*GS%UCQ;1*S>u~pNnYdKU)UB|yZ^K2zh^XKEYN^-?!M0>>JC>wl%dQ>|??O;mF_74+Xw}p~jjk;0h)r5GSy~ejhjfmik(Q-Sbf31n;&i(y` z63zP-dU8o<_-RC1`EsT0Ts+AK4Lc|;Ma}SkLDo+Gb`-hA_X~&(i!*(2if#45DON%` zO8-05Z?(S-SC#nO2o*-sdEe_A1wxo_KIFum2w%y)_kA+Cax1E{iz{0DK*gC}?K8;e zyTd*!Vt|XchJk?hhz~%5GRlweAouBU--npH(sFngF=Sr@pBgWis45BSeo+;=z}FLnO`qea&+b^$ckdyigQZ-`|W} zSACb2J5iVSIb*VaJ#3U>s>M-kC6#Yam?}E$0B2w8OunBM4L z0h%ki>>nuOEr0rkN{H;u>EP?j{qKq;a)fdceJyvl^`914z2dBJH)l8ZbOW)X(hp+A z4>{+q&@*c8hZXQDt$%<`M* z!<5bbnRN9rt%X+_{Ljh(+p8GhYeDHh0(h2c@nZ>pL`m-04=DM$@V0a)5C;GF8Q*7* zbeFkY)IGLsu-&J*dU0$D^v$up_B_|;UnC)rS1R^DLpz$prcwHG&uiSbkw09c=px8t zkpniFqWbvT7CK>jp1L6n4eJAyMTjBC@j1uQfB04hS92Dl%D+ee-9^p!)Npz?&t~|$ z5`FWWD@yUJnyIE>j~%)&)Ueh?^sN>ML)5E7H@cgdyml(JCUziu^fO_~P+#20IP z?^4`aZTGSs{*M&kfH~dU-%>945VaTJ=J1`zX0zN6l_Eq7AnAng6i$|6A++Z`8=fh& z&kv-?b|5Woi9fC4fIie-r0VY429&-pb_ahr)SoDqzND=ATF8wf{E! z*Qk}h!MLcV>-C*Q~4 z>Ct_JE_<4`KkH8uB#YXs594_z`EdqTQS@Qod5%*wdJXgS7__FTT|I4rLj~j8-q=t0 z^XdMkg6vQ+(~qs=YmRRkz5&bdZY(5?qLvyPUz_JgAUAApUO$X|*?z3%Zz-*z!%DsC z`P1phpW#+sm+J?X<9n)pSKFWRd|HI4Rro%{Xe{?120Sn0&jjdEneF`}gSz82N^9&% z7320fmp|_Zau4ffMX*xWIYX8R&|}m_&sN6%u}cDCuXeY~#HlSk&pzDE#Q1fS%8LB3 zdETru)>f7KH^Kkt*Mi9XWe7oH&~CA0jK!gv{*CVgoND3WFNtq&bJlBO=g%(sR}~0V zP>Jg`oK=YH?8uFM0-1JK`(Ypn(bjU-YH?TGl~_Q7T6x|e?5jVBD?f48I&q~$0)4ZX zQk=cde^DudfNwxs{qF&uBMWO8oGib<6b-eemHRQV`!o_W{sun3B6M35Yy`xT%B9+V z>?nixi$>0gbyM?W{_`L;%ySuYu0n974u2pD9B;aM}US5Sn80YxuY|)+FQQJv?!ec=KQh^g$J# z;Je{Cx;-sCz*X1%ZV?ikcGUCwqY5m7@Uo&N8>6^lURPuBj4-^hci7yo-w1dY_l&6&1T zdxp@d*XisCZ5-u&r}>!9z8DtI*^_*Azfp2=xTh(+bE?=+Bng4}QJz`U+~!XzT0|uHqz$8al{cJGJ>!pwId?D0p3OA(bn?ayE|;1#u^w>V*fT!uJd z{@E_Y3F8%pnb2r_Oe`Jr!8K+Z77MZmGgVIrk7o$DRp_E~u=-XS{p%=iP&netLXdc? zdUE*xW9&`fs;svEVV-k1%%k9p%0U#)z~MRb04U^`Bb3b!U}{#HU}|L!U>s9R1*c_Y z3TBp-3Z*W~2}(`P6q^UVVrkdP6mFB1*8AQ2plR3pd;fkuKKiUZt-YRo_S$RhH4yAs zanx^G9@(GI7pAusYQM7C;py8nIq0YF*z{e(7g)Kc$D85=_JQPuL#SqJcPKuCkf5|M z#n4S0yDH%FpuL47C#F-V4tEm2MqIz51)f#~dw+!ft=r3Ct?_d}c)M;gV%hH%b3xp_ zh!m>6JsiQwA59;Qj3!h+GZp#eW~4(Sl1lZJ;cp{RO<4GPQ>wzH*=bNLUHB}$o7g-e zx^da?v|q54j&$G8&`9=Dp!F*mpWazZ8(&ICER@~ZPlJb4 zrYiki5xK7Nao7=Ki<*g}xjhw^MJ>A8Hw7ZM3-#Z@)YTFJq!=-3LuuRM^Z``(O*(GO zCd349doBH?fCuvpwukkCPU-k-g=LDdGdKL1rYdr)!x<0uOU5W-G_1RfwY&! z4Ig4DTZiE&bK$Nu1dq+trqx}e$Zcws3g5k;2nQ>lB>sg{_!jJbbk{rSuP9DdzDVqg zI1>BP!R+&K36F$#|KtU$VL@fmCsOYE$gKi56@NXf+~0j1X1^`{Rzb?X8pX@ip0p(j zulP89qDJx2sU_VX~6M3F1sY&EBSl@8~|9FG5` zdxFAk&!o2xRS+=lT>25M&W+J>xnytJv$)9HkhYxuD(ap@g-=9PQNzE(;>E=BsO)n0 zCDgy5`*>DgO9L-0E=?aQKPw_Y9Zvh2@|T5&L*hzLfKm|dapAKS`s1$d&vWvh>0gT& zddF@Hhy8uw`0l4L8bD=FM)l_Y?F>7RLYC^cMmi`t zA!;QzBpGnwIEeHs!XQ#48xDkt>|@_c$t)j7QbVmq*AGJsrP2%CN=ZEv)`{wN8X^$D z1bUm~DWOp`sn=5e~{QlPg9T9#eSGAVY}!v4|wJhD8y<@Fm_VQ<(850}KX5cMDqFLG>dI{Y704 zB%L*sgayNtye4p7J~Gn~Pc`?$drV{wijkRvBJN%tSq@gQGay`5M8?I!#(T~uVc*8V=2g|Rc^=#SMKJa3k@|I;kX(x9=1LP*!ol%_R`PDHcZmM!mz&3*i%cFe@B+PBc)qFDJ4QT-TWA+`I}kVl2L z7$dpnWy7snWfE1sVnk@o*9;d!6?i>wG2n;vAnH%1%E#KYyJpBcw;Ns+riby}5-(ul zAK(Lsey4D}ArZa+HQyMH^PYDM19ibja0Ra{k-@d_kl`_b@a*te)ve31wY+V)ZeDkb zO=5a=oAQx#>X2cBZd%od@)5N7Jwvfj*+o1;wFeE4Ntoy#Y+1%cq9Z!7ww#xQHci-0*}J4!LFBjI(i^Zpn()NXh>} z%34Gzm?`EkGteFpn+z)V`o>VFgWUM-a0Fq;MW%H1M=w z$;K_SwRgte?(ZEG6nm@xCOilF^MYFb z{5L$dzaM)`Y_7ito*DieJk$J$%p05J$BjU2q93G;jrQAvf@1#kBZOIb6P};?anTg>i9a2IZDT(6r{Sf+-yP3A{%&|~^>@YdHGeXmFZny;x!T_e z&n14iE5t1HgM-IB>2HVU96#dc#!U6M!E=Hi7mzXc`Egc>DfGwTIoyvhwlTx}F?ja% zLtKpU`Eg2!ar$vci!uALNM^@$_v1b-ri)*PX9quG$HcVpYw(QoD|klwL5&!te0ES! z^dIFj@w`}$=*!VRmOqZ?$nxoUMwTO(V$_@Eup*5bS3VWb#PTUYL6P<4590$LET4?$ z&T^Q?M!Zoz0nbh4P?ATiEgz5P>}Sfy;h)9jWAJ>cd^DbO%VGK(F}1u9&*Jjocs@{m z51!-7@5Xa4;j4H>~L&RO>ci?$j`E7U>ln=vmaQUrx_AM8CV~_FzJYD7acxILl z#WT5F?6U332jLl4J`hi3cKHBE0za1b$MZyaUpzl4?}g{la;%2%cgwLF!rv;-#q;%Y zeD&~k<@oABu5x_!|2uH6h?t1^Z`X_OZYFaT^ia z>NL65If6{*~d=zWA?Gr{Fr@gv41e06a1KW?07$>9XrZ@GZs$l2!B63hx;-6 z*t`9GK$iKOx6J_6Xl`5J_LcCzRSvPpjN>F2)G|hwj|~$0$xTu$JR@RqcCdvB>@+7K@qE{ z;H$7?3YlyyvtiZCeWouq4`Pq7^ZYzp@OXz@IyM==`Qt_{b zMbwaQG}G)2hGCRnUMfj4y^Fl4XI*xET>dMi@`gnf}Hy+MHl45d3TiZF$Z(RC$#Pd`2BY-#u^q zT?2#If+0p6kE@J09&ZF!Ha1c6tHv=iytH=9I%nfBmfMaEaij-!?w1=xQyfkRs=K5gt8R=?I({*YJzd5O_E{Ml(xEo|4ii1LX@;Sta)UW0F4S_<7=Zye2s zzA-u#k=`d_H#c82{tUI$xTrQ9`<)TmSfuf}WXzO}b%5zjZOA^E?+ejqa=Vin)?UYsU=uFT z-{s&a6B-}j;5gHu2xT%AbTB;-lH^~QR1TL9{9kwIncVVX7)6_o>h=S{_elAm9U?X) znZAL}n&WFTF2HrG(H1y+y-)F5Gd6NUaOO}cD;(kYH)VyhEftP({4NPN*8*tZ`1%aU zFI{Y=(~1IR^gdbqQ%ms&aLNLJx?Hrar$0Jm;>Q&f@gc{*pMkV7iJdd0>1V`86n`uO zm;1RUT<*i#^CeRz9UbVf^5SD^3C=#ns!9HoVCng)C>rXpQsFGs!0KC8#EYD)b|iI> zDTbR2nbT#(Pmvwe+Lwz@WK_V?=5|wSs(an^`HF!ixJL~&*%65H*c<4m=2V7>a@iDx zy*(pC!*q*jf}%i^&0>^$FiOontDb94sW_Rdr7c)|LC1EWylJ^PfpZ62>R@tyF5`DG zu`iK_2qpOiCd4tDX}=vI$LAu^8qQ`WWQc7twc*@(YDbCTajLq{QAkalO&NT4zKRQ- z{Ew{VlyR@=6XgUcV>P&<9bESCFk~`q`^{5GMUtd%GIu%GqW0L&EEE8^gPa`>@7K!cl5s5^pQEam1TqIzFF#*p8Yi6D%kEe8RQkS}$-~x};3RXNtOFhC{O49H ztc=xurbyZ|NzLQ@?bf-Hz!y00e)}GnmTYt6NI(}LCJKsZ z=DZSFb9YP4|8U+^33$5&@FV9vCYz4e1hcw2(yHxi0eCCj*lY9DQWNU)egsaugbvjv5_O+ox(ADPuH?_A*yiF&H%=dNMC=+WZtTpKh(ni z)Vkb)l-`{}%-=vU&9#r&zJ?K*17n;IH@6lV>DrmLp@@9B#!^NV&s#cjRjExXwIjo* za;>E`k9gny0_fVo*;|es&b5Bo;3YIz-4CID8rzsblnAb!FW_-U?OoZJ;#?qWN8+-@ zhJepWW(0hW;@V2t^bIu4KV!mJ%UZ^YrrPDUvApq=eJeDp-OXndB?g*UkZsl(`y6~l zRdw;m2sKIe8cX`Q)?E7QdD}^TK1w|yj-`=t)Ldvmuyva`n3GjA_KJ9_eB0vVie@_w zs>MB=(i^Ffbf3tU{#$L{3YW&mQfj9kTzXeVE zwlq!TJ+=7FQRz+QMD94i`I2nanrd%$Vt?u_#%x1HH=7e_QJOj#mH<{981tP48vbj5 zIarvO#_vK{-=L z{LcO6T!fmup0`CN|AV(h>i@ypB2%vLw&`Z@wyyu+ZIP)r;B5#Ud_8ZA?B2rL=9$6U z(*7rJi%kE22XA}U4Blq?zj<3Ebj>&BZIK!O&%7-X{u4LkZLgX? zfh}r)x4kCT4&qGwgSXX~!P~6Y@HPT(yG-lZJOX;>|6*=$n!()c|F6sqip~IYt22YS zIj>`G`_14Rt{XA8NcVp;wotJ{BO3lJ_8275AmL3w$>VM|4PPpI=J?CIc__prDCI_qc{kZ2mwyKTLSNsxyxz! zZVS9WOhs0lJ&GeTD`2M(fe>m9-&iAg&#sK#@bl*`=VWDHpz>7i(j?z|1m341YNUL> zDe(RX<&D-PP*t=g4EO4pPa(WA`f9jnQ-MI=K%Gaq%O%^h3a>tvF;)X*df681Z0+C2 zX~J144Cw~_mcbfW&6XXPRiZL= zLMDT4(nBVwDuN=*xvWu^#ASA+(#fW~1<;Q$Usj~B3buT&g;i|XSy`i9X5xxhtWh*` zx@m-{^(2>_lLbkcHd;K(G*AHNaaof9j+hfbZa$a&B;V%--WPD$MftuU@ctB+U6SvM z0`E_6EwiEdqO*oIWwsg`osy>eNYC>-%@pzdNWi<0lF1Md}F7AM{tho}gp zT9!FgAXLd^i2|r@vC1BoaM1*H4M@M;Drd2jii%Zux@TL)Yn5e46Dter0)@-DELAkl z{oU+Djs#6GV4GIm74yew&gv&ZFz_iai66e zX0#>aEjR#=x8M-7hRSX-S$M!o`!?-z)hb7;;-ppf(-`Qx!06RfwB95|r@a844*=Iv zk;!S}A?xg~YpJkjhHUu)m3?nA@TTFmTR^Do_STg2iv!xSph%&7wBN)dU$d`8^}kHA z`iq=YBL-5>2j16HeYsrLF!49v{dtBprZ|vh@{rpk8$S=>sQcEJZcj`P$FNUV~^O3y!laE0m$(j$nh#Q zhnqVfOP{R>kTrn3Mnw^3DOnW)*TeQ!)V_mLn1@Dgq@)IWKUh~-arc!!FVN*Cs_Sn> zqMes5kl;4cv8Qb9s4B&|KOnb#`RJ z`Jj{xUgz8pwGKa3)tM~;Zy=DBvlEYqP+x$-%H7UZJksGb%Aze)Vlf-J$zqOEcu%zy zKGMzM$QSE;R3N*R;-_TTXh@U&-<1EIr9BU6w!aQp|0c7f>o(49gP~weWa&huf7*k2 zVy?5J?3qc)GUMA`6yFx&l&rs@uyEoWSU9ETK+WBp>yl(DY$4Mg$}2Q?=8-;iEzFYUS`&~A-D!}Mse@Co z*~4|?ocN98uCa-g?|fU~yMMIw)9D`81ub~FCEsd4^*F6Ai-(!K-jM`Cb$4`x?mQA# zV3F@2m8-R-fKdQeH2XuVnd(m1A_T4Xa`VkkXA z?{f2P5>V9wIKa(!sWWj;YcrjKtL%%`)uO|L+&n^7d%30BA#N@L0Lj6uXBoOkq*8m2 zo5zYe37s>WkbQ^BPT{wA{(ZF-)O{1wdWpyT+&oeCv%RICBivjf0Xtg&N4a^b1k|+v z8o2o}^)hU*Z!z5uj(ZQZPC}6geWTi1pmvO#XUYZ#S{i)7&1DjBxCQVbH~Rs&UUOJ0 z@j*<>`J(8GzVJh;dQhmf7OL=G35xufn-|KiK5Oaf6K<}Qfa5KIPq}%y1T?k)KI7(R zB;a%l;B#DGOTbxcsY1{NLj4^S2?zLU2|d?R4eswRN{9(9pKACi&?)#O+;{B2Yx2d_{kYGa`T(AQLrtr5>9dRE(r*00enTr zv^F%WlFjx7ntjd9`(&-SmRhH|`5*w4pJ*FLkuR8jriw0^0c{`cej>Ava)$K}s3&0* zzR?lJnVTFiI4t#ABt!a!^$(#)DE>Oh-@w0FKUo5HwgAquewqZ-S-ZgbB%t~GS?;Sl&r&9IgEHAyn{i zX`r?oBC6)UXzIj`yE5Up2%Y6Evh~Bzb6rsqu9Bnt%z3wqqJ|gjFjqM5Xu>ts*+56X zaNgar)#GS&MPrzc@^gXmUpa52C>LCi!39raF29+O=5Dl2o*pl9-e}ukI8Qd4k`cbM z)M8!nm?@ZM)!OB;>o?9DC%b=AAl0Hyd|o2;JLf$hduDqyH+-IH*TAed?;!ya?2*A9 zKLR}mTSBNIrd6Be51P}(*SJLWznh#?@nL3LsN6H(&?=WXZ<=UT)60z6#W*oLFoR?& z4l}2U7JqWybQ{9eNd4o;Z!=%iD1UL@EQ!{&`p0U4R#Xt@%@IX{VKNxzzd__gvmiQ* zQ1a%=R#%mf`M+dBFwk(`0s+6Gg!}|elFTkD%(3d|=;!uu(OAoQi$tZyH!N5Qn=O+C zE0tdu5smVe$bPTYP)>t=+$pds;4x)D~dXc11<|JXb6{n<`JHyZ-o zL{NO5SuZ%~Qk*%VizMhG;ky|W70Jhcv!`l=R& zXCjo46(3t1qD3?nJ#OpF4-9gy0B`JP*3(~|9mp?IVr?&qW2mf^qX#d@cebCF5B%m7DmOYHaqF(TfLlXR^Jis`ehv)V0x+wz8y~`s@cx7hdayA_rKL}YCLX1 zyuUK5q;)GgHPGAzIcXd!nc6rm3YFz{jgmm8hU2;jEVUZPIEtkP%T@mq5;6r0 zbWJdwdfF-@SI1Lwl4*`$n{NY`HeB1;G*sa=mDVB+Ej($1$!<_oTdqx!(B%TER;m!l zzP3r?w&U9FvgjFEgcB+4{#>C}Cw z)A)xiggcE_p_=W&`CF_tf6Iiu;ksXNCr<5)UNOOK=zrbt2?4RI=uuCnMr+ck>TE`5 zuG?h7xujySsXgW1qXu*SAk$r9&yGsr{5lMBMQViaYEV>HIbf>)TR=DiV6DuT* zivDHG<%*B2#eYkV9??fS6@6t(;NcHB)`8Jndx<9xictnC+ndpr3nx3O6mgr^U!xes zeI95tv_*(Ch<;2|bl#T24^DR=nah=nJ0y`ZQ_+9K$YSAAr9<_FL+!G< zo%4gmJFev9yMyz?!O+U#n@X=RH*8h8D3>CF~q`w);j*43x#bD!9f> z^a!v1Es9Fyds4~UxK%AZB$i9*ZI&mg;~e{8%6Hpp1Q(Ze5d8prq z0v{=YzV@me?!-Y+11RqYlb+QhnGIme4{AEBm}E=l%nnv~&qh$=^# zd{p?jrGvP{lXl`!gE@bK=u%3cJ9pUAM3+M-UavvKopdWA?hL(3n5%*(JPz_HZ<&xe zRMB$*HQ!`Lj8cd7TP@-TR33y>*2yEta4YARi|%K?6qxWZDq3JmV^gm6GlUO7S}#f7 z78WSU3;pUF78@1bXAR~~$L;&&#P6WWcym`e|AwX2)hj#5mtcr4N!L5Mvb%W_909(y zr}4})_Hhz=7grhuRGnwVt<>{2+)6cNn8Rqz_jbv@@8(Ji%C8kNt1bk{e-G*3u_SQk zR_a&i^(*KV8uwYgm&VBe>Eh#>($u?!*;itq*Hpj$GM8fEtfl z!+7LnyUY+CHHs^5lFhe@=5f0rrLOwaB87cQe;jdjSa?q06EMf6#Ew>g?iXIh`oAc|_`?E+L4t9GL`ZncPy zw|0a|ijC#UyG2n$Uoh@TL(Omjx_X&MxXjDjHqZKHux=`tBgq_`oV?I_Qlo1P?8j5h zVk>;7E37z!-B0R5HJ5XYj&~HAkZS6)ZHT%>&f)>SoZ--da9>(G@%(htaS45pR4_%h z*c|W-std8;h_c%Hqk_n)mz}cq*VY)iuo6nI#@Nhc-dvyYj%+s(j*w~!ckwwOWX}FK z^c8i@w)bVxL!?#<6nY30j=rGkxUNY3Nfu3l@U2PUxSPbuclHHqC)qVOj#WRB<;Aq{ z58J~y+X#VpLar%^YcAVP$f6P|II1GK*oPUgbNJX4!leTwdpf56Cd((YOR zDDf~^PpdFg-)Y^eMWlr0!InO7*KssnHIzx@#uKU(Bci5~^`weGZp$Z28d4 zJnr#;19}38rU8tn^W}+x#Mkk`qjEBj)6lR?8)r_26ejp!pur5jJXJQBW{#!9Hd6wh zct#Cu;WH_IM+OKxT@dyPLp&_|nnkq?hv2w#Ba^An2>Uq961W_xF92-(LrtdKV~!3&G22@U z+tj=lP0%6sw|%IEZR+d?g&@1q{vfQt=I5^Ab+y^E$A)`IFSpk&| zVltG>vBL60rzU9l_!+x2QHgq$O6FSo^H7_!R$<7TAuwR&J<%$-Pw7x-oky*;ty7eZ zyeD3OuJBJ84Jv9A=^wSgaHWUy4BBoGZ8rE;5Cv#8j=u2{i5gA;^mjusqxD?;1|qno>dJLNuR?N0x)LojQq z%&>E8E5|%J#x|;L>yXAWf@G~70g^GDy493Ou?1E;4;k%z9ednx*a(&W(6Z3B^PU_* zgQ|TtGdDF`9#ClUQ`T&)lhy-0Izrc!DesOz|hwEC+?f6Jbw;dUH*-lgi-O&6uPY4IJ73M%ZN31OI+2F{8HxO$uH{#pamf$}GNkgMMk zMOS$400o}Y_Ff7iP*iR-r3--rS1d!$m<$AdD{**_ikeKVg&bOk8GIC&>0vH@0F)4% zw-4t3SpfPz7e6HE^Edn5-Ob)dqa5Ml$+EUECKU!Zk_tz;c$%zzE${7$^3#Fx1}>g1 z%dc9I60AsN(__>yP3*-EJNC#AxOk4N*TQGh&_z?A-iKT~R}L(!NeQB;Z2b}96Nm;^ zm~DV_Am#ibS+`c!y%ebX2^TMsP+>y4Jl`fe_>_xRNZ^~YYH$Gh85ch*p}QnBECBr+ z2@JuLd(?>q025N#!53V-R#p`Tq?8{QsQM)rub0q+5}Fu*9_Qj$1aw)E9qw``D4wm* zL-aDmZ_T&Y;O=LLBSkEgf3f}}^(2JcDQYM2evIigtnu`wsHz|iQTIowik?F}d7%YMp_tWTHKrUa@Xv$ffJnU#9G zMyvcxr+lzIY`@nI?}1;aEFNm1P6zCeB!6YSM>Z=DG`mRpZ0jh#x4~YeReocAt}J{y zP>AeKmokykAjMgTeeR0xRd7GVe)@y;{bl84fy$RyKS;b+rJE&%F0(#gmahtw|H=Ac z;yo_S97ly!HpvP8La3mOHdJhfjPzeum5?GwYoddw{s=aKoK~K%ct3i^ z4(;Jdi&&G*6vp});=N^p(c!Ew74P|nZJl7-6HU!KEiNA66L+!llJP=& z$G#AeK5M~Bgu`u>EBMWE{N^gGX@cpzg*MT2?2spsOOs5v>4Y8>-aA3j$n1{WL!@_d zV2g>p%7fr7X_eO-(Q#Dtt<)Mgz(?Yd=-!%j)$AotBaB|A3Kkj-h3!hU%~e^i0LKc8 zDFWIL^+8#l5RmoMY%x$GPw<#BKqII(2{tc#MGvj7m+NqMnAO*DK*VME*Q<^cK5@T_ zUGvHv(`MNz>|*i3yuYp>zL{&AMzq1AZ_TtoSr;~@Qao20G4r#9J5=)`E zU3@}%NX$^5k{x#x1}+dLs`g~w&Dov-mzVDOkgt1bcd!eB1}K=L)5#Zv6}SgYs*0#cVLj?-FQ%Do<|o$756 zw;;uJ#avIfH0*j+fD5=H1iDM*9o5)rIsaTsHRxk|IocvGIxK!5u%)4>simm<-yR8p z#%WjCN1=wNFLKOB8YzY!g6QuO8ewro8`N|Ay1ap^Vz!K)O*3QCCU^y!!HqkoF78t?IJL&}^kbVbHabg4nXV7JWj_}q&MI^_P)UyaZr)ZgI z+pN&0%eF8`qS2Y-TtaeF@R_z)rN9`C$gaoKp#T)C8)Zu?(z{5&loo)EYd;4-aE%|Y ztb)Mtf^fV@5~~sMT2II}Gg{g>xb~C;l(qnzTzf_U@>N@47#G)mD*=ucfSYT7P;qTl ztk<;X;`bd(H86HnzBd(c)d5o>)Q9(2BB=OhHBSua<=UTR>)e*sKCb;u0(!RqvbgrL z1oUqKWOJ=z6&MU^0pxJ4P6F~<0EpB2g^;Fhu{A+$a_zO^osu#=xi(rhxU;1}E}cr& zq^x)Xr}!aFj;&fHk84}Y8ig%2ZsOYZ07#}H)RdL7qh4IwNmd)*Qmr@F>Lp-83!o3z zc9VeO7C>LFHAuje7C=9)&5(dcTLAsJ)(QaS&p;B};zO25!B`%VeS3(@FX5WrYK^EYI);!ds9=OnJTa_tBS9pDV+*f#10 z2^}WPBq8AEIw9cS#qTm z6LHZPGRnU=q5M(OPjdcChp0-?g|z8#VmW0F^kq=aN9|r9uf8jGC_>o8o7B~4GLFmcS>zuH0(|1I_;v? zKxD^R;Ovi^-&xK$G2S2o244vD9-?FOoSAg|S!YV1026A*7Zy6>HGJq5r&m!XaeSDo z1}cgwER^$0oUM=+buQ*FS{HNk%dW8!oeBK$>rRV;WKl<;G!#46ePiV$oZ>g#bNYT zr@B7o*nQ5Q5CWFVzH`lnm^RlLCkCiTK&SDp*F*=8Al$9%Wl@sK4Tqg}=rq}SSd5cA z#g!pyASD$B6U|m5;@Np;qwGhbP$0^uv-Kk)>OOZuM134)W3FEK7On`cIN`z( zzRK%@F6X3kEdoabH;NT9lM1%M=?1M*a0GL`CFeLRKp4C?%87=G0cHmXfth_P5%^kx z%_?YduZH8ka6Ti6Tt<0yF2t~|cOl>ETxWzJkm(-?oE4qTp+W6k$oYNI`I69Bo;vO7 zg42xOiS);FoqJb=x%4mLKUla2Tm?K?aaC#% zvDE2T=hqDEU|{*qS%2uoMx+^1QQ?y_=RxEo|V(aROhn^Ii2DG1>TEV_yTkP#2K zNkx40BF@|H-1GM$5w}*+i>cc0OcV$Qs2V1K6#{4zvz~m-R~4UmvZQDw)z5W)FDMKK zgt@f)o21m#+Vzp>V+koIoUrr#1wXXiKRa*I2;xrUpM9f`%;94>__Lh*lN_aeV3g-5cP41-9PT;-RVL@vxB{eW zCFirXW=xx#teT-Wmol1?3Sfs{Zknb80Nda;+l#27y=@jv(p&vnZ9^wBSI z{7xrmh^mr?FAIc_e&x#A&aP;I&MO~Q`S?&^A&CuS1E zpT6ZXz)TK17vnddpuiw@)6e4ju5!IW$$z?Tru@fUgX#M{K)7MIOT`&n<8H@$SG#&5 zJr(W~UAP%cE_E%Gl-S56O)mVNu1xaQ;7wkujVn((hid;ZFEK-5rV+haOhYfG@uftz z28k)e$HY>}5#_bqd9HImEOO+ODxB$Zq}Mq<*Ath>N>s^pb;}5$2qk(m#^|EuRSW2)X#`lo&*YLm5KUI|NS_5U#eCG(!@qW=U@|i8e&p@n;-dq~#ej->oK!;WL19Y^VJC0|?x&7LR zgD$HZ$ueDz2rB5}PN$kK?j*{0xse=ZygQUfCc0nLLYY`=cXy}gaqeguk>WvkifVoLicdb*9fE1evVZrW$NVPa)-cR~bNG^*%?4v#0f(?sms z>K^X4+%egGR-~+Nbi3P9-6#aqx1_sUvp3a!NQ)S^<9oSRQpFJ9l2PG~UGC%VK!y44V5&-Shj5+Q-Ak)9aIotBORGDEd5xo*Yvlb0qz8fHMv_c zEIKA2uRJv^bmJ^M%zZ{1{)OXShZCW0VNr00TjlIK-R~m2Ee8)5xE!bWBzJc<7P>#z zLQ5Fu1&IpnZVTT$#{HJ?@{f-b9gRmvu!_C&Vc>LmI;dP&>UQxH6WpZ;RLjA|qN`K1 zr_`N7RTJ>}7EgDFbM_RB6!w+VHP-ELIH=?)cP9HDbsrQC{DpJe@aCW4hQs4&+ViyA zO4A;8x8Z@MZY<9;)Ns4I!_rBEb(A>?Uq8Lvjo=gCP~}AQk5v;&jnhFF_dNGuCqWH7o>aFYHjz?;%HD4>y$_bR&dZSUX6&o7)9b=bhem%L_eEuzA1xQ$=KsFZV4$)WL&pL>>GU zmOtK1wjXx?5-Jjo9~Jtnp48>CH=L(_gc<98!VteB5{Wx8Ja{HjJqWV~Ss|V$oN_PK zh?MWqmpS;f_{x8hzR(9x+NC|(B8Q?kYuj}1NNnI^J>`@;(fcS>Z1xsY?k}F##RdTt z;dD*-64Gd&@kZ}v2Yicked?iAfkG5FSOrWxX z-qAE_n5P>*mF>Z%l1N4OdpgnLyevQEhI;gLp7*pG}sr*YH z&*hL{aFH)Xj%fMOeOx@)gCxx&Y*{z@4EWMn!K`Qu~stUu%KrqIb(JgfQLsh(_&k^*mc-$X8X)UzZMAyo?oY4!4R z6F&DAy0F*1jHeyJ$`EM2fDdWq53(#DWZpm z!-HWRHI8Soq7#wz+;nWb7r~njd!E!nDHq?)hdeF~SgwkfN&0jByZ+5#m z>yqaH%o_Qa$D668SbHlIWoCPCqAIQTURXFP&Q^$deJDPecHHfKozDe(_l4?kg8!*F zFu&Yr@4I3Bb`0}J1qb~~)ywpfaDy1s7^{fDs4>Vfy3q5m{8eNMoX_&2R^F)!!lM@K z@pZ;gJ)^0|>pmAxYVTd9fsteN`|kZz+Qm1P>RjH{ z{C+2|OQRWNrRLY#w&%{tUa;@Mq@0SgTt&Z-N?om747~dwfz|u*$n8`-!mFpcBk`%* z(!B`KK9uw`L-oA4mA3@z!4nfoY8Ez>#!MeH>Zd(DkjcOc4Rk(L=Vajsp?YzID1gPX zFOBj$`3`g4@19(Ay1+LN`~iFRg86L_E9jEv0cv`xTO5sadtZd9Zc=yO~tTDHf{u^;7Yvqk)Z+|ZiZ+B4HW^ao4nv>xRFxU%U zfIBJvNnckk?cgoN4|#8o2PpSB?4@mQ@t#wVhNL&Z;eC-Afd-pe{&JW_d#Vf@%4 zHT=X9?+lsTJqF(6k9593RfDwqX!Bn8Ix5caX2|a@w#A1PqqMQt-`7BUW9GOx5%eW&!AKd^~~dj=e<9M1SbRs z?GaJ213R4HX%k=c`dbAD9hxRE+b4H`@c=(0H#)@7@X*J&Cp$IruyWaOHIs~5=+|3-M)TCYD* z1dJ0E`-rQXm=gSbz!n)L8obCT@fgw_`H&>!BX4ae6mum#eehV1 z^Zs%b+s=IHgctejX29&pH;d;qddsxoGsm_3q5MaD1t6!dkawN-_6-f6Ed#NsHY*i; z>VEZ~2c;V@IAQS}Q%Ys+d<0|a9-FCRkoRt0*X$joQOYR(H_v`5z7t2P+<-&%_cdstmWyBMg&}6J4~Cd?sc5AqkLv2Z zo2W|XX(yJ#gV!(NL0lN&+YzFJnEhU=AmnlR<)1*`^SRROvuo(tX`Z1lhs}+{`L@!NN;PM^x5z0oHm^4{NYr#J)rY&#WM8lFVEE^J zF3%cb>U|}K^MK)ED$4c!!q~PC;RlxBt+;-h6jq1vKe-KbG|`K||JR}&$3u5{4friJ zd4Hm+(#`|_fiD5yRpJv>Qe`_FnlIFPM+)rQ(w{v%H?2tUL<{`Cy^63-v(4kXJ2)5) zHNVIMzCd)iT$4**c+ihn`8|ApD!N7JaT&#DwDNI}T;D#C;iBA0oW0B5RokiSY`3um*Xa%0BeXrp1FHfMAxFVED5V zht*e~M3=dr_#hjGdPZ*>?`y9U>7d_*v%w|r=lttLUu#9TrurU#62(vQo!32!sZ^15 zkq0^8ihYe*X!fwr=1?hl3%PoVZ?slfi|Y^HU!kGv#E--2rb=(t)0F&|JC1p|FBl8y zyw^B7?a`kuaQIhdRP+g6esV3MniE3tf|Ad6>_0o=2 zKB3f%SD?k`FpoO#OOC~?!5w<8_aUKl z#ToZ5I@#3|N}HGZ@^vqus|{p*#k*I$Ls7lUqvHmyE^oo%>Fn@r>_D z4ODscV|}=dS>;<9rb~uYH%<(4uh>U7z8LK9f_*gV2E*1Vx|dO9)78Tx65IVZTGRNY zSA4@2;qtzu2M*(}`A&+=P?b6#cxR0dyt9^S@AR~$BhULvc)=FmW1&#V9##r=+|@HA>Rc>_d2jPzycZ!N{QbDlii2S77@UhPxf3u-(jDrROFo>>_EP4i-vji}y5wIe^H<+7B$`eRqaN#%MFx+ULsY#m8QQRRSQQQS;(n( zgzB~3dvdSztU9gsXrDW&Atx&!F`11{?8 zMN+aW!uN3QIybsCxsrDAJxyxO$lfqBrWR+@=6{@GhcMp%s&6*dk!#&#p5f0YJ z-3MfSju4+K24(dYNn96A2h_u5gR;&CBhy83LDs6!U^tC73VF&y{qM@k4FBTk8Gb0J zpP7NGZsxnP`fGHb0V7DkTa#8GwOsV^ZJIFLJ-#?KyQka@j+6Rq$8Y(E!mKtzPnP>z zJH#s)lZ9RHUzB^f9mLo1SrA`OQm)co&ueaqF2c2AdG>HB>>WLcO#bZGR(zWTi{eRH zKLiU++0ld?>i0pyNlu=cl@+SPmEK|zch*HKW@M@1U#~FuVetOi?GnF`nORUbHEt`- z!lC>OAzp4O8}_%KrSN)x)(8z0V->S=py8R9)hR-;aKVzSO^WU`rt>Z3nc8=U(`R-x z)y(N)mWx>ME(8{dLS|fB{)xlkGdS8|Gxit(ITXucy0XS}+sPuQD9!ceX;CMK7B z-FqZbab8R`k3EpJS{wFjpX8$CVMCLtxfn)LT@GiR)@m-^2|wGI4&0?7>vX8{JMZ{5 zeuTnBpJ%OwVI0NTH93@<*J>C4c|1#}RW4D%#)z?0JUaqmG#ay3z`2^@Ymo;gc6tOh z>9nv6Dtsbh9EYFDS{oK@6Jj3ZV;9dfWgenH{G@!1Xyefeuvx}u?yy{X7DGALygm9|L@ z5?%Jv5U9PZeZum@$X_5nMNBs02!?U>{&4WS{PQ8V(On0^69pn}4HRE_&HB&(F*0G~ zlT_3;d#!@ZtVfVK?ff5Et#JBJfo|baRtXGDKL{6BK+tE_W~G>@(3gE1mnUV<7SSh_ z-@D>a95-1%PoPtxa7fqeoKPJcVSmXM1QNuXqX35wjVzJvxVcq! zta3fR*L+|>W?_9E+a9@!vx_PFkF32{aerD|{={~m<__5fRGQf>`Fi}T{{H+)a+V#r zxw9AyvniybhOURX=g4edNU%rbro+$M&NXAQkzX;na;P5{)GvsmzLR>7%U&Da`N=VU zoOKop(-bGAV$xxq-VE_Ok<5z<&Lgwn6=IB0T5lVljcuw6RhDRR3o;=azcJhZj>zh* zaQ~^e#G* zbMuVsRw5NrL)VTfl2;_9)9ydp_2M<9*<-W{zI2)ZzmhbVUYeMd#XHNh=SJ$XkY9Nm z@U_yT71_=(!_&9>ec18^6SDK!itIE^c>4S?emJKu71OfOfTh`6mG0Y?3G|H|yfPcS z)lAI>T&=ucfyB8pw?;(MmwBDT*;keQYM3qu`{F#2gwo0#H)MCxgjp)xeq58U6}o&Y z0TxT8uV&BInedr1`B+M-3D>EqsZ+2m^h;^YH6G-drKVL#%Z&$XA8UJo7cEFw4*a01EZIuqa zE|Sc9Ir8mnr2Tc$?1kQHnh~2*PK75!BI)26O&eNM2p#aKec9_m6gSnsl0Ai!pGj>* zq>3|P>qArraPc5aQtC#oZOFbw=ca|0 z?8=@m*JCynbwH-b6^+>wwVIqX(hq>D^1bMsDDHVWd#_N~RlgQIYI&U|j2}Fky;8)3 zT=QgF5jFLR38seq*;%~qT=tA`r3dSO$^Mt3gAy?ICbot}^+4WeL-;)iDUsd8YDL<^ za#8of-j{Z1+vRMna6Z18*l250PJ)Q|SkjPoNLjHpt%@HC$yu&w`Z{2GoxTW8?3$>F z;^)(kN!l zj!^QbF(u~#-Jr^D{#+W`HK#^*GinZ|+HUdK56{M9H%`sLZajp8({pfjGL(bO;@^B+ z9p+$h-9oSa8k*~Xzs?s?3-nq<-fHN#3Bmy(Q2x@DB%7?4x z+>7!&ruao_rt1fY1&d;!_>rpy$+)@@iYP~lR@fxJOCvd260n(BYNCXYUE?%>BX!1K&M_j1qu-S?jJo_l`pd*0tjL|-)T62-?QkQ!0eBqOG>MnZyFO0lSC za~z_c4@x8;QL%k@hxYjr#XlZLJ`?0=nK3xboz^Da+(7Dm zxoFAGj(kc+8kenK;+Oz`v+%*8AU66mIV3MZ+sj!MH}+zuQ+lNHye9Ii7rM#n zizHu?U%=UwcrU?&u{^f*kA zk5`h=nIgwAOlkSNy_I|+@C!eagPz!%UUHY577c64y&O;JJl@vAaD5pXQrO9RWQYuv z8B+m|?jZ0?*AoK$S=7h2JpRf}l7N6#=+m`23SYUl>_qV0S|d$2XewH}gS3a^XybWN zhFFbhJ*$e-hw%steaRqC(|K&ytZn0`f~cQhEG{=Xp2m&+wPOs&5ZMc%S%$(*iyTvR z9@W~s)R*rLp;HB)b!e>U*|honB6Fi7!OjQ!ajT7fD4l%%} z^YH;YV*g0JH7TrZo@l-|pAt{^Nb*KBQ_2!D`YLSTu>K7@Btj+Q=Crh!S@E$$5OFW* z8^n?>KjzJX=JgHa6I6<%-7T!`4neFd!ldURiBvU!Jf1U--VzP0%GWU+U5G&j%EA^+ zq%X^xaD%O^M6rYE3b!L^#BN_JumN+a1ElE)Z~jImodHMxy#WC%4--}s#a>%UGv(L!&2;>kd#|E5oD$fk?W}Ec&;G3899_&S^Jtp3 zUo&}zelnj{K=(?*8@%e!Fid}g*3)K996SH8A2tye(Hgz5ifjxsSn-0~sHgQTZ&k>1EW44$^VB+u)xtZh>a(Cg z*4iF7PCGn{f7C$t>3g8geoJP|J^Znp7GpGj>o}bx$@_5&Fc=*{19{Yy5R}xqev0~u zP`^&SDrNBJZ_^SAiqR(labBaG& znh+lG08On%R`DZZdfX5q=fMr(Km`b!ToImeML1M} z(ayRej8|?Lgj9YcK^Y~=p8(kBHTjkTRQXz|1PHY~ZK=-Bk#j63Q$5PJ%~X#goq4Q+ zsL2;dBUL_Sc#*|CWxRIVFWu0c?}E;0KWI`vdZia!(K%n~MOSnw$`ZYh#%YGKT@RsKX5 zF!b0dY(u@(!qv;@v$aJErkzXOc8tqiI>ry~-SZP!jCYSN*m|pYiNbwsHx;-bBt|}RLASNhB)MXHWjdZTwyr}c{)EbP{kle zDGf7r>$y1WXcZ3Iw~NCz|H0K^$E$GIe%(22v!&Bvt129JFIQOpuCSce3UGxrPQ7mM z%+N-(+UXs==EY&1W;Wr6B5AF`A3A3fGq#*WNFYW%%zc<}j3j7dIZWi~v(*YgfC6$K ztF`PC>jd`o%jz&~G=oZfcfE@0Rr`DBDBGW=PL_gEi6Qv|Lzr`(VNC+~W3|nSIE;rm zgymbU2<_{XDg4C@wE)%9unRL1OZ)(?IH=W+ga^HovI@EB~G~)-FX{{6N7!gIy z+Fu9_{yjkO?jGiT$bz7`4A|;;Oo@u1bbtOtD?N+M?=@5-qs&+|3|00Zb+%lcA_|Wq tDaaDY9-ylexcCoMr}xZ+rC+r(%tNp7sMYF8tk-uLJxljn^0hX?{|`bZ8WjKl delta 77161 zcmeFZcX(CB_CI`Pm$Uaiy(fW`b3#Z$OCg~Il8_+1CQ<~YBs6J4B2AEzb3l4YC|QD( zL_icNK_Ls3k|=sn5fU$YMOsiqM1*h!YzV(K2gU3Ce&6SP-ap>|emu`!hwMFjX3d(J zHM7?GtX)(W5Q=I7LUBWToK9zJs{8AowWN899H&c|ba3CO9SU2r#-whCHu07T^ZqO& z&hz)x>BQ0g-b9D`dlBvL??JSuzZ=mW{w_qj_&XC#_diCotv{1!8-E7TR{nINss8pv zTl(7(ZSHSNG}hmSsMp_`Xaj#MqAq_bQHwu?sOoR2o2L^6f3i*|{OnI6dduH}=rw;c zqL=;D1L1Bk}ejm|8elO9t{ZT|K{EJK5h$nPP#!0#sN_q%kudBPmOlm2+lZzo#lw-TM?w-BA^HxZrSHxeD{HxM1@ zSBd8M6{0=-dZL~DGSM`@M6{`2Alhgy5&Ik>>MSDcIh~IEGJ{C{G$J>q61hHw$kk_w zTrQygv#%!6e=klXa()7lGvkT;b1aeCF+@&|Ci3A(BFFNHR1YUoIh4qoPZD`!Fp)h^ z5ZN`5$j$*oHuWR2DwjxrMwC5E1Ih||5_yJ(lTGYOWHb#X8%krz5(ji5+MNcJb;%}@ zp2cs{$g)TpQr3{hl7*!aanN`&YwI;#jXTY;3;1xam``&@Tt5H4anXGvqf4Mm#QR1` zACFSHG)IzJOS*NC?|1tksgKkQ%DxayQ2%3u36he{68?}S*_dQoHlr1?j?#U`ER~(4 zO&V(pn|n*+Rp+vaZ6qBGfm^qw){r;f;l`)>NZS~*SLR5f#N5y>Pilx!{iVwy^Pn_H zdLXh8l!nl+5}K5f)G{dzKA9lJU_zdht+F&M7%Qz3nX7W5v|X0kNxJoLNi_s{3&Bf; zQlua^piV}hG*#NDv2-Y(BaN4$){JhC*11wWlW8_FFI z3PcIQHTcHzgZ&I-$`czk?TilF8SjL6#ILRF@B=6+94+C#BPj>g#Q(g&)PCFyQMZh<2> zeLPTHEoqo^M^c!Y@lN9olJ0IFE`o9R>RssxrjY7mnMtkJ_`D6!`?EwN)B)z6l>)F+ zk}bIQo-|oxSzv!v3Ox`me=D+V&PxD^lQ|;m2y?%sqAeas1}s+PDI$A}Gc*q7-KRS< zO!9JtbwM&3u;=(Mr@QM*D0(I*nV}oFtn}wy~z5~!sf+t;ImG05~gO! zr$m+ui5=v4Y~D%!m&hJRsT(iR5B5DFyCJ8CY`{jn7((i)0mx7tpxDzPoZW$SRgs zW7T5$F%iTCaugKLm)k&;Pk$e>7RpaS(k{6I%lhlvF_@FCA62?oPT=)ygMuPig1XoA z2XI-59Hq)#h{Z{eykBk&3uozDV#o&hDwBs1PfvqygnldDbm;92iP1a;&$rND8JJis3&Dx-0jz4LZwcO(`dp|g*Jr}y9dZd5;WzBL|3!%31#6v&3B_`1aL_+R z!xi}#nLUps$0D1GKm++H7wl}PcIrDk98shZeNs?bCecZX&B5e_`l5$p!KYdb!-~6d zKgQ;Qy-0TPp?HdqW>HNbM zp#R;-=h>TC;|my{k1obuSW_}55ufRnP*vbk%XWKk#<)Fw`@^%~WJDI$ZH5%!;`fUA5wfKz@Ig;+1Zhy@z z-eD74lQ%P-4v1_CT_q@W(vuck4f$ye8bRJbV>>*%QO*#s*rOj2II@D-ZyG+rr4%AzxaEvfpj$|d?R2CJUY&xL3E=}XwUHRX5QSTRYT z!!VEO6Bs1yB2_^zT!r0F=m&zBqfg}P+``q;dkT9ISR=9Vn_1qI0_JtoYe6p7Bl}El z#jtpg{vSa>Yye-KJR0i8>CYgsb|iT7CCGn49{d*@NNh|MKpd-Y6l`G!waR!Wnqyv} zzOy3rBLPAAM&BRnvFGz z*mAMHR%Ba|CVKLpMLc?BcyFa%k=b@E^hP!op$X`}WUs)!;bH_uku<$IXio~T!vs=x&9o9WTUEF@w!UH$ythX$GPbRLnPfB{4kUZH!kQG(r!2VDM?p8`#)a%VMSDOz zc;vRev&fD>_C()6eDY`gYa%-e*#*86SaVOGBC;y1Ki{aBLDg|zbF5;DOOu96y474i zC4**EUQphxczl?oyTniaL2flTWmJ;bJC!D7lFIU7vP+pGy}we;!+Muu73KGcgAc%e zs$mS)cnr-MoQg51I3!Hjp=ZZ2r@4|MV4G+~)3cG79j_c>(no8ij6l{@xzFT((90h~ zNn^DYMx-ic5%zX6L_kO*Wf|T`RNNB#1ij6bSP`4HQ5Ngv(UPuYAQxI&xS64(s;AcU z9!2N5$Vayf_)Mm)l~LU21s0| zRC*p&p@*Xzoo%ruM~P(0>E-&TX(xn2FA3vsb(AsrQ)2!z*tgc+5_Vs5+Thg`pA%{> zIg@c|e}x9^b0`_CL_(>j;Yq9?q&OA!1yqmAN(65wX$V$ycEvE*JE5_E^s(ghh zv}fyf{MA7{7WkFDj7)3x@l5TBqt_Ovxhb3#N&JHV- zf2d!t8UGA1H0VEMvuZ%wD4eiTS<6^mWwFvlk_seUG1p}O$re=+uY9wx=VVE@f@`xh zK3orLM(aA|ww`?p?3;`SC~i_}RrV~<#OR12uPC#a@?G)JLRuT(+tuhltK8E^427FJ z6q|g7I&clju6oij>s94hlQc!rZ33Uy`mi|G@26?WzOOu}luKl&(zE;n;-6LRSA3O+ zl?MX*p|VPuCCSt1`P@JHw_l0=`}*yVS??=H1^Fhm_;1J#^{m9z$CW~n{fN>D<$);N zZV6}e#4gZhuBc)E8fCA@?!cvyo+!}nI6atlTKPy6?zSm?Qg&h37s@qJ_{jjL>J$$) zJf~b0rJs{p8ORV-A~1#w300mU>2`Pe4{2`j79st|#q2sasw&D;4b{}l9 z4d>&cpOxq7uLodj+VDA?eNR~=G9A=@6dnfirnGzVME@fDjoRAe&VDh#L7wcD-U5SSisO$(=8G%Za1NMH)w zni)e~ zyORu1*WET2C&sIwFcTK8RVOi+_lcH`Zziib0y6{4jZVe3sp`ifvw*MKmk7h!r#FVI zf$B4mw@i~^LR7RB&$LyWih66y(J4u(;D4!63Z|#4{}7oCs?A~pjLcHUs`4C3cQN7N z@NDU>Hsda@(26#*C0!jqy9Y-_1^$G)#2g3M^OEkGK3E>X4jHTN5XFYA+JbM9FBY3mRR1L!!&@e$rlz)RmC~velwXOC!&U|ANl}VO zX`2kW6~4!?$5iz#g+)R6I`v0Lx)?JK^X8~q1<{*28VY{$6+^{OdJQUOHL~KKB6WZ$ z`bM?_-xI0}8!S-CyAzG&*P}D(ne?!?lZ(}2QI4eEHb#49qnk8vXTmfn z>JtsPrc^Cp}Ii>AK5$om=x`In=ku+c`9tl)U4jgIb#ealpG!8C!|C2Bj&+@>B^ z3`2G76V^+2LN|1cy<2Z-(er)*@^-1?%4_J_}aYah<-FK)a3H@DsX&TX*% zIFWUS!j%MSaDT7PmVg9N#gzJN!R0OKN0s6wX{x? zgJL0v%@k8BOzWk6#C1{5qY_Qv{+n#7={XM8ALd|ZoR zYyi}n<2K=zrCL6N#B%LtC|(%X5Ui_=*YLp;npI{hT8C=&f=oVXVG!7dY4YBH0)TQ9oCqkbe48U8@6w}Uz2oS2RC&xymuL^c#p|LE(}LDOe3TIQPYjNc_8Fr zlXV&y4Pm3T^HAiBNe+sD>09!6L_YZ4G2J*LUkQ+~Nc)V9fbu(P56;a2k&Wd1EX9?} zwP^|)4fz9NUn~7S_E|1e8on{KPnk%$zNmd8l24}OInw}0TBIqMw^7?FvawLR+&BQd zTjR#V+{s!18Z6hQLRoQq6kKQ)7YzlmS_sw@X!GefYs(l89}UvXoZ)d$TWlPNEe31H z7)HLLeZ$yzlwQ>mRM{x$?hoV3D-)^bM}mDl!PuzE{hG`qlcZbr=!B(W#{=5ODs38; zBieX*^3v!1W}I_G3o!OfWtDbKldW_zj70wt?Rf^_)!J$<#{#;hKw)O1_K?>%Jp>1y z&~}S#D&#({4#2@R+D?&8gWQ3t8^ca(*F-iQGUfC}825#CPGmEHO)*Y`i;dG&^q-F(ciy$<>6!<19Sr2jzo(Ihwg~bc3v(U_F?^sh7ha%9fhf4A{KW-~@UgRrWWKUM__W@v0jd zOfnq8&juM1LqGkV#ArB zn%fBFXEPF@#gm2-IMm5N4uvk%$Kh*92noGyg=kx6m=P?v3C;{PG=sbZ)eJ|$kPUkh z)J9k~)i6?Io1tW+p*>b?GvtsuE;G=HUMFlp-`j?5Wb@RwUxXx;JX*K&soJ{d49Wa? z859mMq{5ayj$*jj)#)SOxWS7Tml%As&*wVkLDgO=-FKsbJHv!>s2*iljLR1oW{B)% zDBNpU#h(>I(OXUa1>SDXzEF`!tPu~tLDfdX$;#zi%G>_lXWI6+Lv^$gh7oHGS447b z{Mic{uAHvUiXam}OaO0m2iW%*nqt{f&ivnaDukNZh6KF6*$~3mt9a>ELt6$F{S3Vz zYp&s0m~*xLHptpmqXus&e0F)o)y zuxx>$885yQ{7=(*D%)bn!-Cm{sNjbDI{5b+w*QyJIJ4E*evjceW4qv1Ws})hRAHDe zvfUJRGms*G)GaPsgHU;p%VjTIs&%*_ug>`j9zA5J(pV%GeL!qz`&JeBBP89HQ4ci* zS;vhuVrUOtZ=^tes5=t+<|;OrecLe%mVD}nhB=EoDpY;tNW^Q$4PhdClguRp83_BK zzTEK!%s%Ug!}B!;I{zMkTj$A~iTuvc7@s_CAa6w_N?#ZrDC{7XeZ+-a{JF!1Q!g1- z3FHJRJ89^MT`n8!svIThj-&=T!j0GYl*7t;LzTq5Sbf`&DU!e9XTu0t_K^o5;UVKU z*L%W&+$^DZ_IE>!zz**>E|TPEG64VR85M|wEK{h8zez?(l#fym-^B}K!kr95G~;!F zy$6?WH>H@(4~iLMO~&D>93$zzEcin({mt!Bb{qQ$+WYH6{f)@w^N>LxGj60@O|^Xh z`O!^#VNR&=O_BWr>V}wUqYO9FMtK}6mN%RXeeR>`Ezm9QKb z_CN{Xg&1Rwku|2Xkg-OTKcX5xf!Yv-4o9iRP*skVbbE$yX4+woNVA(}kZN9qO*4(3 zG5G`)uE7lhjAKX*T_baKN=IWcW3{+pun`zc%59)PyBe}5iicSY_(5l5hQL0hP?fQf zCdEs-cexp#3=eXRPje&Y^fsSAPSPFc4!0B-mTMf1V;(oIXYwg}_!<9yDO&S=T4slH3y=5!tyML}wSyi3J$ zoB>w7WGsZN!Lce7KNf2OI;P}dj~9$@3G6E@{3UWY=j{P2NZ)#qyzc12t1uxCjqDUnU zrr6H|zmej`MN?z*ITusOU2-X)P35hVd7IZVW*=_appB#f&e8N-J6wg@Ph&g6gZTKy zIHAn=qR74jdrsptBwl_{WYQoP<|12X{EaFti2ane`3+syA^ZK<8TfpKak0pL0LHY2 zkheQ_EYSJP1yzNnKKR{!V*`;Q(L9B zhN4yRA=tRe=u_nulI{epi*?5KxbV2qAgce~`;@;q+0Rh>LezgqgLCpdT|a`o+RzYf z9~t!wvQ8UE!0!QX625)Ln8U#Qnei9i%iCZV^*5p7l(9Q>IA!dIWs?3^7Ay%=vMVoh z2iccKjUl~rS8wbQu(WXH{sND=ZuNYn0FRPRN3FLko6YLS}F0(7}q|@nvsBevR@?C27SI8=| z(LwjBkq)}|u-9t4k746m#`AhXxDVOgv{>{mHhmt{+7Gb0SIlt2Hnh^ZLGkbL7qMui zX*xe^i#o{8(ON@NvFYstw@u{6Vrc&=oeY6bWK(ZNrfu?UB1nftYj8_zG`L)I-UT*eqV<5hNq!KA-CpH?00Vb{bTzj2}<&mAIdI z{f&i6uPH{BTT&y2U?W2tn_di%GQqKa0r`6cbXPJ_xcx zK9&EfJ;&5QmQ(+SxI}_4iR4=88q*BwnvtdKZ64!b*!L~d)}UNM&>!C9iT~=;++d$V zp*kccfwxIM6sjfc&yg8z>a57EsHucMM`j-%8PQEwIIStdlhDxDiBNM>Rr#9{nEi5m z@BeC~h*W|W7knNG_8-+4-cpSSNr$3?H>037Kl2Jy9f~`{2P;K@daGurEHbIGOemtW z9sg|nonYe)shw!7?btYxz&Ba3VVL!nX@9VbjllP2+(qy{VVVB-p_|WG4EQjP^jfir z^jc%6{XBN`-{;5+`zF&3K_*<87?1g5GY15vxFgs^6D%){?e{-As833! z(oLa!Lu^x^Hr~bhS4~br-ux-a-KK1XwMFXz6WPLqeGwBN|9h4AImr1TkIbOh)_h`D z(3$c_)f1eU_B_+qydIkf^+wIW<(vG!i|V*3OJeOH`-JJJma==KKaHf;<4>u*E3g)o zHKr{RYflg#6QNGhDPlees_&Z8;GKmY3v_5=({RffQ!7=@Aj7W*f0PAYmZ)L$SElof zwJyDE`bi>i&vLLI(UJ+CWK*GOt;3EHWiE1A;~bBx|;QP?qYj9vEZZq!3c(lF1eZefC&< zn5mlI=SZ1}HYFAhry55vTy8ec(6i1sM>883THNMD4xGshH&-*Q>zV?8Co zwkaEqrW?<}@F;Vc+=;~A4Re3VSSR56X!CeR?wnhhzF{~b#{8tpy5QmF<`_xtMmlsl zWDhj=f|kkV+gh*r1N@}57bOJm;qxuciy7+;CD+=JeVl5(rm((H*d}5b=8X$4qpj}lL^1z00 zAIH2-<`RbA=9|L>a^n;iwr>TKn>TFvh{1aTIdp2)G)#i3Y3)lmZ^?whic}4i6U}rq z9|C*3`g&vDuNjF9iweyd3ZamWJZCU8cJ}>-AIvhRG5INCcQ{J3 z%@n1`iwFCcW{N-*naSgjkJ19VOMaUCBJ(MjmCQ^OMl#DV$ZvifS1mD5)w5BMm6+*+ zytQT{DFd^nN(2?z!(Ag;9B^WQf{)vpVN0~lgk>+9hl}z^YVK)Bo@s83O*WbdY&RCA zGTzEK+&G(MGx%sB%fc77o97BaUkraV0i|91cOps^{P!7@_VeFKC>`X#lTkXve+wvn z%YO?|I>vvWMd>*IokCUx|DB3b4gZ}6bya5WSK+;!PG$tZIRods=9nm8!3Fag#-2l| zj_wLGqrrE{+!EVdHlGmLEbyMv6M*ZgnE+hRqja6WI2-=8OQ^@&^=8_I=iuB8?r98X z-Z3u~2s4uOotY3-Kb!9>a$iYzZ#FH74*w+>Ai=aeaMbdiU?}n*xA_SMGQXI69sgT` zyr7xy7X)S%{gC{UIRwvDwvS=hLAD$dL*Ie5`)@dbCaC4}j;R^a~TmcAmvMRFEcGcY^JlCMdGOjyE$a#>Kd z+3LZ2X%uW%u>X=rH^i!x7Zs?+Hs=SS#t(v|?ByQP-`6q}LO1qit+EejCH zOezY{`9_)>NF@4vAc5%gKy#vnfo4RX4p0r!m_R(ykpVj0Ncn-rMDqeMM4t#WBHBMd z=P9XQz)Q4mAc|mU^bS;Gi2pcHb0tD)n%mLa!B`rV!R7nXiqN0BuQRbgR3;DjE*0Xre zPySx;r z^^Yg|5C2%AANWTTt@4i|y5FBqbfXmK>D8?cEJ3uu`HvCfE`1%yA$pOg1xRNCwB<|x4D=#;G9dS$ zpA(=qvqa3R4s@bF-U&QL6a(2r-wb3C-4p0QbY~z#r_+Vbr$N$N=Tl~dUY<{bB>y&_ z21#BUAW6!_0TQ&lAV7ka{Q(lOTo{;1baH?sEI$(<3CqI+Bw=|#ppa;fz$Bs_16;O? zhWK;o=l_Rn6ged@zB1i1UXllp!>1|uH(Ljlu5J(uKV(^AwAIDTPvERF{h#-Z{8UxE ze2Sm2Z0n(Dvvn{Pw!`*%yA$P(mS35&k_wb0B|+JO_F)*+$#PjC2lEl=U_UY2d# zL0&RQ=m0gc*cvAfwUm&@^+`)7*js8bQJ6;{BSCa)P-C?xLFQAIB(Pm#6td8X>%blv zPoA^>mIDeo$ve!qRKv%8Ev?Y{tmPJk|0h`%Ld8PMDqi+Qs69Y-&8kvM^Z&KZnv^)I zc%9{GoSScXL1614yE>l24Wlgc6%I8!+4|4^2Ib&;#Q*C-JFAqM*a*qH+>zKVU^&Ph z@o}56O%&*{bcUqimYV;Uj{V8R6F7gmWs+VVBVHDgz5UR%C|l_1 z!$;*WZb}(HLcBy*8CFlU^kvx3Z>bPi`6Gt@5Db!F`Z3|<5y14exm<>G#LDHCfij20 zEgkr0qXdlHV3F`jiG|KMgobUHbJ-A_w~_z#6k0c1{1O{V2_Kec z8G8+Sy3E}DWcgYlNVsp8r596QUnlqpTeg!&fr7_~Fg&^2k}Sxt65qR^K(!Kjq{2ez zk=;;}V{MJ?_FFy_*&f)JY9UkoAV2-=g?xvVT!DuygG9NaPp4bcpm3~pD0rP|D)jx< zvJWGxE#C-)_A7kb@-*yPFQ{<6zr_LGl(a@LerppSY<|ycgZgBv3fB9U$(ZxLE8&)E^>JP`0TaHo zd`5m6%+0k;B@Sw`tl>aRYq0I2WjKNQvS%5|+^e&YE&CRn`q~nKum4~f zAi#{HmR$VD6-zo}Z*%Uy5^(Y*OM{@-;T_0&-!c!jbhP?m!UvW;*yON9WZ3K*OHWo= zZz1d8Fw~YRRPSwG?-BInShtFt3mQ(Hcocm7tp}ju9ft%r!0LeF5>E)!rCRiO{hr0C zQsh&%PG;)+Nq>4gL|_`|I1_3Eua@_X9KR@L-ZPmQT1t zbiE7tZLL{Q*2{Vli~ZL2?63;-Wmng;nrJN_p^nyLqiD%lJ-fb_rn=V)uKVppV{5tUr{?gz28X>#iw^$%& zY}N>vd^zfIoIJ+rROJbh?)~8Me;PSQO#YnSIEN(xnjcud+DZYbKPB+c$#))07Sc1Q zFSSnpU!*XBRX%5ZQIZKkcyv^7AWc-^#Z6=V6D8d{{exoREm;^eudvMGQ-=kW*jXx8 z2i1y|jQb)h8TXec?}z4AO}w>IfXV$x<}{lc@eX|j_FdNg(4oI|5>$+|=9DH_DHUaa zbsssszNSr}<~i#^Sn0GzR4%vDQn`%2?bZVnmg{4^4&xFn!0nr3yrOT=_nNg0g9pi$ z0a(1wI!R##@L;2LvUYXJT>oT3Na{GllPRKN3+2J`S@O3VruZk}oXu7O1bkgt#_RtM z_N@@3f||2*vUMK5vdv1m>>6AeW~F?oSFK%C=~)i8Ef+$9i>VPbB2ZAt`9 z9yy+9cZkBCA6oY-Y6MU~3)Vx4?xY(C& z!gnrNI|=M=Hq5*1l)jHH75jbvLuu(j5*P6oEZWMNsfZ8&54${1U<#KAx-ba1P{#t%nL;NpoeJ@#&5s}v+- z%cL=|eu8Zzj&E*TFOp*=f0>I^bCQh$ni3|pwM8+_vMD@3ruN(Eyo$jP^@-PlN7HOs z0y9*m+wK@73h2D?FxpmJXiMb!)&k=)l~|IxWM4EjK$xplJZF@A`h~V|xWCz@k}8(S zvn@HGdaPmEqX>6@BsjxzXW zgKSGUOtE~3Z5lo`%C?AlsFOm$|0|=7JI}URWeOf0Ys(5|m)fpNOyhDMvZk(sk<@|| zz9Kw8Zte}~kXvROjqexQ+6k;d9hJ zW72Y41Cwl#beo6q#-{|U#F`gv1m}pU+-U11aTLy1Jkps3#bvgca?`al0yeai+X8|X zzi4K_N&_-I$e z0|?d<1+x>v3!yHIV(6bd6&8&Vdu&%2YmQ|L!Ui(9xIDrD6HMVwoUzZgoZQslUmTVJ zS*^m`;q&`#6u6@;ba@!Ts1Di)MwJMsdOHZsaLDF2F(+<0Zo4IDEf+r-AVg0|+aQ-L zsq%y^QX|Yx)MvIjN*S&E!j>lS6r(r0aS<$qiJ3|spHm&)^#(kcbl&zD)7mW41>CeE zq=!Ww#MsY5R=TYrFUM`*wvZcXCwxks?O!70h?dvd?p1zc6DdWM@P=u5*zUINa{(U2 zQbOpa#*TJy?w6RJQ1`v95qZ5k#5vx^BiC)6MM^48eh_mCjz%`Nz_EL_8aUM4;lY30 zvZV_w0}JoQtYUchJKG$BUjAhJkuZ*hEz-(x+t0S)3V9f_yV*K0e2m$v1eRU;B!?3y?IW15$jm#vWIC>Lw@Qg zsfh@#wg{XRVZW=VIb9fIUnx>TZ@m3?i4vmkH@7o_Fjgkn|Dl&7sk&feD1ij9BSbEn8dp{;~t9US6YUS7qQ6Jlzf%*#3dsn6|R% zoY{_OUSg-rtT?PKw$tfg)N)^dKn^bk7b7-UZU2VJWcf>@;bfijB8)j~=#OpI*<%zr zo)UO^@hZBYx7^;6;TN0ienF;qd~K)TZJ^sKM4h)sbNw@RVbcJ?1(pwb^vc%)8wc6v z?M1j?n|+?h#*^=#l7)UfXxEF-;jU*n6d$su@m@}V+#3z*@vX!5t^$<(By@s#d+iIz ztzEUT%@E2Yd&9m}W|N?BxMLQSEss;+&<=Yini-m%g1>GruTmp#Hzfb+j>DX*4OTK< zR}X z`z_`i)}6LrQzVMlpLnSEY)+^4Fb|C+M)6v5_(;$3Hv3|~I(vo4WOob(2PQ6{v)Y;qZ0m24+1ooL3O`t5r;eA*wbs|TQXHd12s=2hm zFarJzh-eEn=dH0=b;rI#krT;0P37Gl1Qm5w89)5pzFE&B;x+vr-mOV-aF>MSU+D`_ zgn#2B&cmQ0&1S`mlQJS04%a&H zcpMXDwg~qfw>ubgzhEB*MVH#YgNcz23JNWT>>iF);Qh|-g+A|-x_Rdl`zVa`Iml{V zf>oZzS)|)C917-qN~@{#mzbBq8|V0%Eyd~vjguMN8#0O0rcT_or=5&uo zA~3QFjZN~Nzn8K4OLCvE?F1`B5r z%(Cpb{a5Z>kxJ+SSarwb#ZPY86aSjzHf%rKaa>~Su`tg*i^TPPn=qKX-7e$C(T=AD zwgC!f+6h%V))A{xK)FwWqots2S~5M*hO(y%9=1nE>?W}JjL875DUM0n#uvv0D2~2w zVDKrOEkg7L?mT?4a;l@;%%j2Y&E=0KKt(5t21f-PYqXaaCkNWo&N7BS7|HcW`QqMz zcC@)fKDtx3xP5@sMDZ+sC;wrcn=2PMC_1|p5`HjDfTT|yuVLs42d%zsVEw?6gZ+yg zdpRyK;v+{XZdmIWr?4GZf7d}KSlOg@ddT~jkg`2CIS7gLD%AfKu2OPzE`Y^-1LyqzC-pxWF6K@=H*hNagta8v1Yaduw z@`-hfCYIriq|s@kTcwN|)r#_Q4B^mVwPQAJKkgvxUY4Xg6x8pNp?}9IxQc%Z|Y!`Ay1x zaa?47mxC3XUUT^L@?$i1!9n*!(O$yC{Mq&K>Y+`ZKu7LX3%WgMm2~`jiKj8|-;OOz zK1l5yhFganpW~Oe9Zh(G<&ioAWvu+{pp2EH5Pr(=H1z(`5eFN}iP>-OIeaFGg5@u9 z17{Q#XikDJR#lpuC-nTo32Qkdi~_;@a8S|79?7vp+u6I7E@vBwf3;u>0eUi=v#>JM z*HRqnUUNQ zs=p8(!<tDIY7bZkAr95oii4jE^wX^3B6aloNV2SljOI^n$Vnb%N9H1RVjyN z3UVF2{0$5#b3TDjt##HZGKE23p$+GPGY`u)I{Py1+qJqtF4>?` z@FvjBuc7@G=P~&*y?PajS38rT!(l@lQYH6IJn@?{$axr*_>9J?-A=OPzpJcpuG90} z=XKq9HGe3X`;%PXaXt7wT{ocWyp`1L9s4-=$Hxs*Vc1>!3LN#8^NzyZ^*c$6UT{8K zPk8dAGl7BOOOevt%)&_nz5WATw_3EoQ|GL4gfYBhkAuDa$k01+wqYu6df)k)%AMV> z4CA#-Ljpf^V648f#yMAFPvE@M<>Bto*{+NS4SMyq2RXM?u{unK7{UymP1g%c@C% z!7%KCbG-V~(q;iVAO11Li_SYKr}C0jhMbGez49I6;%Dv&Ae)n~#9*c^L5{Z?dCuZQ zh4_8i^(wB8aD@qY?S?aq5tiviXix8#FM-T zKd?A61z+jtB6BUPokW=P&Mplagu8fNg7hm@tU&fTk!L)*NTsQeeAC$tR^D_z3&q<+ zD}Lg2(MMP`$p2Ky0_!`T*1V&g@JNh{3?c(``N{bs_QGB1G#Tk)5l8J z$OPi}F$;bcvvhKU4W72R}BUz@P#2zvWsB;9>%e=v`YK)5(fTwb-%Oy#9e|!ilg+5~BB)`Vw3y_|RvRvp1C&-Dj2jR}Y;9)GM=y{Gt&_tl z3tXhjA|QV-iR!FB)LGiab^1{}PT|+pO@6npW__Z#*O8A__jjnr4 zZdR-hJPk>ksfi|wpAU?IEt_2dHGZ)nFq#f658eK>FPdQ57FRDb--nT3UuW_@jEVxS?qEd2w?28VBQ{= zo8e1uyT-~aiLgPgVxvqh_42k*9&mSp^B=pSSz_f0S4W9E;5Sd=w+GRI&Iws>gjukv z#ziNHmNW{jVCBGeZLs}m*KwYgncGF*6q5!wsu95UnQt`Y-S)X)*8A~^P`|$sX+53X z2BmXc*yKj}D!m@d4#z#mFlkRbIU|ZD#FGC+C#S)!E9nWPJsY_wPr-FqG`CA?-FkHE zF|AWtC$~v~S}EEEM;A2e4SN?giUeOB5entW-*b`iM-jy_N>eDyi)Fb9b%hSOu9P*sTPuV&bic3g ze9(8@1UZj!_cIVCY)gVWkICJrj$Ui_ZSAzCpl>t$b)lQk;ze71*@V7#d*O$RZYTbb z?Dhx*B3!oAorxV&-PIx;Ci0(YK%t$sZbF9jh2-->0@SQ_x507g?hW*5`Yx-apO1*fo{xE!lKodEK`XG_to}954=r}>L zis51!{NiJQ0+OJC%Yz#Q^1#n>0+UHZuRnx;QNegD80=mpaDR~e1Tb{E;QmMM`%vFZ z)}ZWN_j3qC-4g}+C`sK2x0eDWPrIMOdHL=I21@qa_ibA@B>omU2eOQwLr`!zvy&Fu(g_ zc}zvez!XRbxW}t`J9`EwMDf`}|8t(-Lunf4ogrYG@4hJ$ibAIEcI_5jaK`WM4K-`^ zi*eYKZi4p}chwKVg$vzt7{?WQ8~w+C01ZepXuCHu5xTZ?e~ky0xcdlfBou$`CZy|f zHzn$g!ooDSD!>oVM^O^Wdri&gUG4swQNpPGMIjFgZU}q9yI#nJC$nij4&NMQfIT~f zK49JL{tatN-6=9Xn1 z#vRK!)$W!LF{e=NzQTE#Paj6ehM}-cxnlB zemS%|MxJz2lI&DIffgZ6pKOLFYTa$PJ80dt&|+MB+C5oeGv3S}7Z89}T^I0flAndD zzN!HZEh44+r-XxR&=bU2@})9!P3+kF+o*Sh!1VDXC-;y9=J!cBCL@;-%u8IN?HV*+L~#E3G3V%HV`~b6&~*TH5k|7 zYqk--u6gF}=>cyl^!lu+8x z^9;F(3ZD~CG5lwQhdw{F7}JM&=uz)eiUOGv#RxKyJpUxe5M=%6q(r_L4{ZfYvGo|w zM+{Fk@w5`yGH5;CGX(RRd$x*fIn27>W+4<*d93jJopz7o_eq{mN`C=^DH1w52j~$jtS6V ze25)xs3EhkUtiBESs$3k4~5*rG#GNGirkj<*dKL!Bl+Uwb?YYtC>Hl-a0b(=2x-m> zE#{BNxg(b*C()-V@|0%(Lpmmg-wgId3Iy+2vEM`Sj3J&Ylmm+;2RSFjF&-~k{9+WM({ccFN=?DE)HI<( zW`hc$EGq{nE6WKSSeX;3Svi8GrKN(Yr8z)ZRt3aRC29XQQjFbV)pVif)ZuLU`-vx?(C_DF2k^jO+>wc7Z&M zMzzzuBbw+gCGH17BJmmBXA<21hjo!sQ5#)jy4z9LjSj6!hP84yRKZtf>Qcj$@DILi z5hEdZT#M%Qxw=PX%2lXW30Za|gT9id`$EK~))ptf%&#rf&4RoZ{M1db=e@4Op0|cK zE!4GwKl+{IM%=AH*HWVZZhjnU7&=TYK|n`HVsqvD>mCUpko_%Pt)wi*(-DMvQI{cP zs8)d!|Disg-dL^61{8GcC4&tb1bQW%{#wHM%$D z(nmCHEgms;tqv^s^%Va~aub?2RF^|@zfec~YrGEU_%hvb8GxXcR^11jGDlt^(bR4EfFKQEok&pbV^E?q?=DGo9mj;h<&;b1b=6;ZV4T2r2|`RitaqlKA-8@ zNt-z(UY8_s>K8hMY;1uWObm|0VsLDwlrB1m8dd2&(n@m9I;~qGDc7OBm@*UfAJF1n z2JAZ3`W`&!j4n(#WJg`lmB^Ll_{k?6|BZg1j6b`gOO)h0I=AQCEBf&gPr0TenY5F# z*J%-7Ri^_M0vu?83ntY~-9CW>)i#%)((=1*b|@roR>}04l5#s9SV{4f`sq}~>XwxM zi0(t~tJHrillHQ+wSJ65i&AvSlvU_bQ`O84Dse(q^T%3!iAt%)0BB1kv-HnB7y&Mv zB9;4BJ{eGPM6~{AnX&@^|7p=~)i^E=H(2EKl3xFUbbu-^>-X?JgFZ#XmPWB$jeIzIJ(p5sp?mOKxG^&OEJwTh7SGek>W;|)Fa zgJjC1_}OvJ9;1H^TmFaoH#znZ{kP!LP zsK@oMpnY@o2(d0U>oaIcsy>&F9n~k2W||%j<`Ct#(DrEVryIXnajIF|B^@l4s5fas z56Q&ypVsHe5ZjtN9wv_cQq(Y>nWgt@qzGO)OJ5;r&aP7h;QBr(_!cvQdp^Xz^ma+a zvMSF}dZ1|x#a+_%;mo=EcjQtH6jBWvWxV-CeY#R0UaW4x70dNH*lN}KN>;t9zXRS1 z6?D_ZbBEXU85-dN-_=>vbUOg`J*qUSOG9^somH)c?yLSq(MGlSyF_Q3=xsD|-2LG# zp8Aj+5vtWc>Dy4+JG!Qv+#2uUHrMn6Fw*}|Pb<0eYW;Pkkk8nm`>*$XF5ZI3ROJ-UhuwCcpY{Gpe<;aM9^ZM-)Gyjebtz zO=WuM48n*1^Zi53Ed3m@nO|Sy2}Hpy+V8*0;1^}MjK3QcwOchr%rQLzNOtQHKvGAk zP4&6_Qic8nxl~V?B|3W%8DQWIHW*~w{eZqwl71%VRPcLVSOTDD(J{S6xJba2IFD_l zYCpm=b3A$zmwv8)6p$KKKd%4$zsC$?%(MqNhbo?qZq51g^eV*GUDij-5DTntTlAFv zrSh-D4E>FxVhwj?Ec;e3NzyIK-lt!}aTE0)$~f_yexX_cm;cs=owsI|{-&rF0668J zT=JV9;iqxm>Z>S!yrCJF4%aIXpZ1eJR;i3ZjBazWsRfTNx0lTgfO5NT?tit>E%C5F z@OP&HS;%gHm_A7nTny67%#TCIzxO)nXeDQcg-PLynAu=DOw$pQUkit4WK zOcQ%Z{W$xM{tcNFLh+;YUAHA0;7XEMp)i0nBd7Ey4eS1X@(DayrJypsejqs}>O(2& z?dESVLX!3X5#mh-Lu*N^eLE_kgQTBFlzF*?u2!j*PYM8dDTB67w0=6ut^y561xJ6H zVI*T+>mZ|)eFg*&m8un#)54HLQOET-+J&ef#By9eA8x~y&3nrb3n_Id_ZZOjpR>OF%sn9D?@fL=F6h_$(8fY+FKuSx`;zD`u4F`a9vPok=phSlONZZ%*wbk;ZgU7EoUgpIR@>tkhq4?{C8 zc~_T2`L7rZR53uGKs84jVP6V?(OCPY;W0|PfVO+JG0uT21|@s>?O}#|wIE7-a^I?+ zrT>VHnTB1G#_&#bz@!M--{9_b%#e?vx;gqnQEmh)sEl0S!%!~qC*ur#!1tl(r}Ws( zCmJrPC5w>1e2Z6Q8OF&0l$Gq$k0y+u4s=+KU8{8~eLCNoVK8YGkftaQk}yI?MBf>f zrON)+69EhOVt<#0P#ReMAu4luj_5rnNl)tE=GA$I%^E@1_$X-NPvHYA4IR;uXH`N4 zO69x)gnfZv- z;#w1!iR1`LUka3NC?%=0Ae6i>jTNSz863w zgzDWuBCbmV^Aqr|fcyR3yaO2uK;KJ1#KsRc~=EcF~ zuN|F-*c|P!JUmX@I}eZ3cF4mcw5{{-2(2#rl@CdCw50B7B<>3)pZJrZXSsosw z`7_Us>y-E0A8uQ7Kq06#{gceybusT#hC!!J74*A054X46$r((DuCB3j|A{~<-UL#*F6Cx zt{(?b2<5f_3ZZ;2fI@_L0=WGD$E|2z$V0bkpUXohYNzI*`?Qnu(0$qod7}GbgQsG8 z-_akLq7TyHp}1~#0j3Ug9QA6+Id*lL)sQMkkj zGU(gGfgNtfU51s)Hia_+&hp)cdy=vx-Vw*?7j^4ojNJ#2;I@5+0a85B4*e21yNvot zRQ07E(yuF?hcl)lx_L9E>WUd;(kx8T#x0;R>h{h?(c%+${d)FH>HG=JQDx~3&fBa!k$%N*gsv9|1HhYDt zCRqXu>CRtdQVLJ?n&H;V>K+lwiIVX%8QkGho0&n$I=9gh%ez&^o|4p^r?xUrka)7z zxLk(d?y2!+98bcH=j2ikFg`WSDC-4FAFAnKUPF#FYYXlfZG^A{97uO;q6{hgwZRxG zSBm-jFqQmb#OcdoT&Hkn_ZDCFrVkyB8gX1#<1tCu56>9L@mkBD65mZSDrLx)u==h5Xj6;; zXwzv^v;`!H9!8KL2Jxn*7Nx}6KE^*~(xX)Rg$c*je#X@ThpjzgO68tu#v4JQmAeh5 zPHDZdF@4vrv4-x=i&F8Fjn;({J03Tl3&wD(9;4ii8V4o+Y}`~>+W#Mc_=G_G9}08M zDXDaCjGb$~F?JW|f@&DW{}jH8Doz{U=A=yH0TIF-tvB6xz-XJtdzL1=BrF@%;}l&7 z37M)GQy~@4H0t>9L}Moi^l{m>@PXiPT{M0j{G3vz8TTP}rmSaEe7tE&bQAH6w}S5* zNs``l@4?d_r(Klbp{T~D7{()ai}^8np7B4*iC;_zwB*q*7#m5Uqbnu_S^$j69V!|- zy`lP5^NnppMg~;|ImVfr()^Z|Unoi+8b-yxn=bP0T%%ehLC?8|8QW~05!>t-ingd@ zs4m4A&CM1X5yp)J^Ij8?t%>D4XDzh`g0&pWihLtx?KmnKY@WcAml~JLrSV*Cv$TsGt=@X1>*4Wum>OO#K%uBd@KMOSV7x{kKvdI!}_I~^146Jnybr99Gr?Y* z!zFW!V6owYCVY8zw7`V3jWf!x8mA}~U_C*e2PO++unv?dXX150-#VK#G7kUE_(YI1 z^^rxCasrhuf}?!H26!?twS26;Yy4eO!g^5U6lPvZ{#!`m|Bm0FOq(i~cC|4XDC=8e zH-184S}T`c6rOg`@EF=1T4R#-Br)Bml-92w(BVJc;3tTclkv`HfYk7&4m zN7H6W`6`-YF-682&lXk;2Fh#H&5teS}s%O z%(pizL`^Ja{ZiXETdH1&Lm-adR!=!&O-(3jwCNY%mbs6caEds)5r`(gG{*FT zgh0dGQKlty?~={MQJZZGq%EZ{rb&erS#S!3sNMnv*dDW``08yizz@iyx6IqM1pzp1 zY*=qYRBuz(a=U&@{=zJI;mX^=8&+(|KKwY~jBL|;pt?QTzI|MWadB}}-P_iL?K4bZ z`mF+A5u((lStjhjt10>woS4jWO+U(|VlH^qZ-;{J0@DJ{pPJka`19oCmJ|~}bxWYN zyLDfS^%$&APawZ_y` zfR$A$BZODinht_$MpdCk#8j*|?a+!$NHKMF@rer>U!Q=!zjw)Ysb)$@R+6eJJpqM)-+YTJA^lKAzRO(Goc|3#v zs!{4r2!ya1Al}QSJ>_+#SxRL$bnYJwVLrtZ%s%?Kv!YSMwo2Gmg$1eFfImQ?EiDDX z4TiD7JSli_ga`(H{I=;sBp#rstx@i6elv7VD?uHwY~V75d5|2Cs6t~#m+#};rN$|8 z%8E1>O8Y5yx$z4=5@iN4=2OmHfnAO=JeK2pp{aS1N|}l>z1%P{QKsgM6d5l`p`RU` z8c4x6%SMSY5e&Kumee2sKGiP#eNO53#=X442TMvi$mc$S1wzNxnCzT&&;s(%0Hv{au;C8{O)rA!wTQR3G(RGu2+wV{ zT;ndsEuTp=dZTFwMYJ>jCLN)38=SK$_8%MhN76 zY?>E*a&>vA1vyxz?JyP4joT&_*hm(HUB+8x^6XybS0(BA`&*)53@))kzO9dWp$uVz zS#MZP@DubmUqsm8Un5q>8`I1~Sx0TQ#L?=AK7{#mM zej4Wt)v3?t2D+m&sAN@4DxsG~3voczY0j=NkANQaWb?a7Sg_}WSy*>ZoBvcn%TM}A zy$I!O?%+e|7ErV6W}2JGq_fnmQ5b|}W|`M%1gmoA{e%5Va}Qc26!PchngcTBcX)a& zrS7rpAaK08@*jETP>}sNuGo|Xv}XErkKC)}2*|7satLSM;e%Jh|beWwaA|yB_KeLRa<|<IM~Zq*qIT59bwbd zggyXfonb|ERB4RhpFc7q+~Fs3j*YlP$JEAnA^$jmU)*5Ml}Qlo^M{pz9d1FWZC#mY zp=%sB&(cfcN4A-V2(_i+UFOj;@#-+Y*|^awbI(j=3%1w zQ)T?g0rQ(GK`;fM&AHR^vgk=iFztcrCYOveZ;_a*&HZH3uYW(MUD4NOJAE|SJXAbn zsan+seZ2;$@NhrXoH1|H+WY3x%7w`^naA-7ySKBwoTTPV$8b{jT#E> zvi240IllKI2!FyL1(p<|`U7zkQMqK>VM?bK$;Nl-UQhEJnjLO=lzUw=?~)Kx7-dm6 z73M0O6MIbUsVWsVWZEmnYIa>Q*CM2lmh3exe_*}77_?q*(~<)w58dl+4CSplOFsmC zCRr}?grChTBSuhuDAm%2H{LW4mdixau}E_q@3vXGKQL||lF3x}gne5<1BMuP z2PX!y7g(SJ-T$7sTtcX#1>mKOO1^Y7p`5Q9MXt6?vLeEE(~alM(ZPj@urS>tnWQ0aH>>(Lb1$@tY$ot%J&2Hye0(Xk&POG@7CG&AS#O)>yT1-Sj{|Mab6;0kbu` z%*mATkvu{O&N{ecyk(T6Y=WPesJNqb9dDXw87!B~T)Dsu_j=UR7N80is(jUai|Sst zgtI!^0wpplS1vZU0kXZ;WF*IWm^PyeEJb4Ks3CSfBf$*G)Y%p+m3FEuGV9q|ZpoE6 zCC<7A*ZG!x0$t5&8dfY`mk#F9c?(=f)y8k1SWg zwy`u3SwACZSn35`so^FsMQ^si@w(Iklf}o;<(5VFUqyIT1+~esgq5$b98@U>Alqbc z@!9gAh5SkYcIswa9j+OI_uesl#*X(bpcTQr5v5tSEY0{6VH=pucRsYJWWb=JV>ED? zuD8Ht+LEIUnpkX+uO@a{HcMlqm95RKY4sx!TX^JV%li@z;d_>vzoe8eQHsB|`FPP5 zca=ahEITbbG;PW?0kG1q207&%waaotri?|2;yAveRcO^!T29KOc#1x6xkvL>n*vmI z*U*Y8zPF^%e5l$nAHeE_Jf8*AEa0GhZuwpg*ed#p3>@xhR-8dY)JR6rNojyZ?L-vP zNsoytI`|_ge~`Wf4Rk~|qMB7Q8yy*hVAW&M&?VHLvRqYx{TTgc6D0PsSU2<08cPR6 zdvbQMsf{q2Ts-8WWur`}9Ii3VYcQ7x=F)pye#O#X2pme&6F_6RY6%EDEPK5PvJG_> zrA9RfYe`OXVYdmUjXHT-qd+>+r#Qr_vxPH!nidju{*UD|CE#LpH>!N8i=Ly5#)oj` zb~SH{&GVk+8DM15@0eSGlbK{i;y4KLS;ejkM`H-aoAj#r9_#>Y_@Z3hg6m0lmKK|D zGz@meU>}3+r@;J%xZxp=A0KfDU-`q1i_La)@P-~F6`4nI#-xY^u)by|?C153t&d4k zPfEWL37am)3Y+d>jxRPNnN`hxi-%tC7BNEz1wJMo3XQ}O5x1psmsKv4`fz$i#4_|_ ziAl}HUh9)G1ZOz&&7m@$?+r6bloD!ONSj(%2P6BabE!ESpZs&Yy+~8bEjolSL{!l3 zUo5urIO}sk?Vfj#R7k)nX>z;1A;RW~@zzk$tV8yU2q4Pf9%ADsn1zQ=-GA$(0Adm@ z4|~wi0W{`+EWO3@4YW@^puxkJ_O4|i7aNVR1sWP0W{&WXsUfqz&yx1QjxPDP6}?#e zB#lz13F|k-3hOr=JO#_I{~W?ydRZ}42SL{t&l#XKTKU6AA|698#+f?@*PTbXvfh#; z{d*Yy9_)|7lsaF`jx;NDW`U2~uL*Bx42P>*JdGT0oi8dj z{PoztP_7zhMRFM71bH0sr&e@!smB>X#bF?LXT1ZapQFmC(eeYIvD)~9$<`4< zkFoNMqdl))U>*5C?;zYUnvhH`J2p2r5!xiRJB8nak>#VQl9TyDJOB0qh{lq|7-u@xuJ zu{hA9<(&CeFcQXb^djR8AXEoT3VL2`j-(sCjWL9iKyMnJZ%m|BWF04sr`kS7HI-Q|D=ew0l<~1~HqZOmx&Uwd z@fJZ4^C>E>cGxJc+A)TonvRrDML#7CreQN8Ixov`DtO}|>p6uqnip4Dv*jXvsd^^G zKkPj8x1y#@R{o9EsZeG@-&9B+_u?tvS@R^#bA|H*8GxOH-ara>K5P94Bz1fC6`?EJ~Z%Bnpt_n}F`lZ6Mwcs|z*!Bsz$mlqmOU^#C?TiA%#Og|03)z;G zNz)}Naofg#l2|+0Zl?;jqB*5JVX7#!J+0y(W><}*{BLZbg`+bNT{o+- zmfLl(S=AVu>4~;{nP$oMIf3ztkY9q5q=j|kI|tD~(ON~JFXIXM@txz_b|Ld%8v*K1+u*=0DvVFfptw}UL8>yvaP; zd8i0~K?0_V=_V&dHdnam+Gv{&kl+*jVt}3A%(O)c)v-O%mK@$N(}szcG2ZsB1Ri6_ z;Z7p6m+b?=V@xgXa*+l)yN2>FQ*6lUw}J|~M?;@9%N8kz(pc@QNpYlp()P!L2Mv`0 z@r%3C9GlWC8(dLPR-B>M)3Gt?Cpm6pOds_8JR3w6in&D98KYO7YlHPyLUH@L!V1c> zUD2qX!o<9i_@IdhO=P8;Bjg|%o^RU%^7Ifm?w@2!;jxQt$QiQ~m0zP22?e&# zWzu_v@l$>&9Owavw#)`WkN3I0%(gE$m*B_!@Pmzsm)3==Q zx@Cparrx2skK6Hx5H$i=*CZf-Ypd;qP!g-3Y4;T->@K6x7eJUQos6aLK9u^AtbC{K zV})X}$POjMa5%29bQr))hN^wA3?JcXh>LjHZY`{v70#{p+fK@*&0A7`94QsXy>OK3 ziUmu2jA^*ta@8keJI2R7$q|p+ABWMiUmnHJT*l0i?Pyn6*3w0F2jr{i z;3)eBe&(7DLA|>;x7aQR`ewK1Q(C$GQA+uu8CWzS>fMy?lOr+D@3z4j#Wdl$2xfw) z>u67Hm~_iK*dG=VGg^wwZmgs_TXUpl8ej_Nlr;O3f&!tgcyn%GDtx$eDRqIp0W6|{ zu5O`}cGv#A=-!?9tE93?4sT&vNh3~p)&42A|DAI5cD_zqv^v2^aY^>+qBwggdaTMp z=ceGL(-zx1aIwbzB+x_3em9{>VZ~rAJHqYX%T@d1I>og^?)s7TXLxRu{bj(2kX?~K z#1F^Vcd9{pjST!3M7{})kI)5+eLhIg{RuRMTX9HqEd zn_(E;Z{nS@!n&uzsdZj&(0HE0l#jwW?WzrE&9pD% z33TpRJJ6yK^>M2ILXOR*w;fVsUs3JtCUFnSg&pJsXR7S0G5pdrR<0Oge@Lc08P};x zJUJr~wTG8}#r4DNjpfqUNZe>&2y8pj?htQgytyYLf;oG+y$`^vG4^sLXqNFZ`!wG9 ziXGbI^PaLVkcqq?k>PQFjgQB8%@q4+kst)ijGdQM%5ltXlWqS>259lv727u6KEn=- z_H1E%g@`cHknC7%cO&g7IbVo{uVlUbpj^7j zse`)#=*hpGe1#)6+kbgktbz<>7}AS zY;ZvAwQrzJ@1?Y+xB{<&He7D1=BWql%LGNTq=nr}6=p>W4+vM_s8rWh4%M?z1#G1d zHE5A1?AY55+p)LZ$+QiK@SM6JZYx*_Z_dBJ^9ebc(h`g35 zpV+(O$oE5XJU?>YzFm_3pjvG=c){1%H4L%52o1cz^RC)olq+xH*4tDW)(rxt$l}5& zm+gHq)a_V5{#rl(ZoQuL{4W^bcPQTAn9k4Mv?CiMLU`^yC=#Ja3b9t+ThSpf3;g7% zjKP;A6CeEtB%qLE$BrE(=krz$gvLtc}s$&JXur^d0FQn;!;doiCoC}qa8KO9IsL=$+c3#)tfruY4qtN3u{T&t=I|exb3^k=(cNDyv z?Hu78KiF|xNS@XD6oU!V2|>fuRSkg75d`SszY6R1uh$ey{M;yqK?v04k9SN90&f}< zKa%d~DT#){?5)dg97a*E+O0*&FbeKW0^vY1lXI>Ei_R2>M=QO+{bxEh%alfx%tmt) z967Z1ImckiNpeK+W9g305?kjupbciH`ecWXO4~WQ(T-%t2=QOxTs_y(RxUXxvqR(+ za#TjOWk;^#dl~S!^wVL`FUWHsVO5AC|&2-En+Yv`QnzYDKs&udG6PVBT#f}^;dafvPJR}mi*18g!(j>nxj%|vB zelkj^z*%geDj`4}-*z04{1o5FhZt{vLJ=Qa;pl=4uN?M?<5!9QC~<_!km5C6kGNoeEIg(K}rqhdtoW1 zW9to3sLt?;CWH4>2ftXcG_Vmg30!;JYR2tn9Dj1@9mfyB zg&+}XTgebU{n8Ol8H3d-in^OLdRv@xfsF0HI7X^4;phF~cu}SVS5MOo8TOo3QH&)> zY3EHgDx53TN)=RKJ)%G>uq0_7dT&@Bu)oNrz;#rHL~Qp0em_MgkYVf-N#=6@XjVbnz-63xy}cIF1(prgafz2Wql&e@7S{nF8j0vD|@ z+_a%WP7-~ zux^0!ngj}5W~CF9jx;AI9YZK}xT_hr8tlZmWGL0NcK^Y5hBLM+ zh2G0>_EHYpHX|>T>oS~?a%DPRI-D{s?m;|staF3NE{hP}-XfpzB+Ae6JE(M^OGU-E zT{ix6qEjm}&gNQNzff8jG|V>SYM8RBH8&{#qNkeDo^#ENitmEVb?rN}YuCO5$c&m1 zlwkwHj&Q|>(5c}OK?aQb(i z-tvDJp*0l;oKH%boL=MEj|ZH0t)lTSJ6B3$IQ@bLJ6_deS_9Rbc6ShS>Pb%j(E}tR zCD*+Tjky@p6G&O+UH4?F_}rP!75UDG0GCmw%<~~f&2g4XwDxCDKi*U%IyZt>t-xf} zPT1Kf53x7DJE*d;D}#ouf*wMS&)bO8Ryj9G0;tm5^Pe~c$i=mnMEc#v+nqROOry%@ z+})_|xcg`Bu*-Q=$ibDJbWi2!70v>Y45jR}+XhRg!Znr`eCnJh10Ghk&oz*WJA1Ek zw=bNHwF*S^TndI!747l(Xw%7<2;Onr*+Wu3jS|n~+U-sNn~}+Y{42J)SJTP1nrP9w z8I+Rk8qU{FI(3rtEak5D$8qsX&I34-^>l-QY9Hgy!ZFVU03}589OV{k{ZyLddYV$6 zb5(Gu!-X}_k>h@ZPn>nO7D-pihP#F#aTI!7q8{Hn_eisGE_3yutXDPRJotjMu|@;~ zU3-BF*1HkUEO=etoQ#P@hh5UPgiUoSri>cJH;on(74Vy8E+Yeav0UVN2c{UJna4;6U*L3)8#Lg%T@u^Uv6Jr8oMUt4zJHMiCa*F+FA5*OI960{j#zlKbfv4i4GoTQnM8#| z2*680e}<6F4Gn(D_!8vT1(bb6yO-`g>z+p|+iJRSRhBDHAmW;rIlik4tcHKpFd($$ z;*(t^T#@cfhF>8;^DtN3ah?n=o{$$V(afOY7v06%HoATcKIT=5eh&#|<9fMZ0ahv0 zu0xsz6O~+tt zwkA4D@SpPJAxboUEf1$uJ$>%oiRJ2Q1GWTLnvpu z>pV{y%KVf#9iir-k-3p36=UGS@^C0Z;SHHCrC|#+=wO_27P59dxu2@0Ii~hlLsQH1mrF%S@R@Sq$U=V<8$XE9<6mR3BIV9Q?9$7s?MA4CxH9zB+yp0B%hBM2Fkndm1d zWkshqsOsB)ZrdLsqESd05CpXQ_pRtyQWm)u%X!#-6WN8b>zp1E{_|qeyB?!O16|KNX!kav=pR$rEX;))X)f?j zgoVJc5H<&=)po9{aE<|baNDU3uE_=BhEKRG$F0FmIoDM}6;HY0{tMCU;IcfoSNiW( z=R-GK;}nvC<8QjcCGD5vc3NQJP-wl8xvNnUH_g4ld)+gH{80HQfD|*v5J`x zn5T8GL1JFczUb^PBBtN+y*%gW3>B<40vEI zL?jTG?}~?G^*7yX%P#9K3;Bo`dgwLRt{_{I(p0)QzO8qw6@Uzdh!U5EdtkYXVaFJD zw%|Pc9CT3EIn+(7wTilZ!A^_oQR)5fT`%|=o-Y1Qp_Z(y5|PlyukU9 z`1UKRzToUGCeDjkp%cAvl-A7Efis%B(5io}U}5Eh-2lH%a#@+HuZ*j5oMpk6evNd| zt}1dEJ#bszw@HHrVbEl`LD+|`)5Ov4w*ej2*SfH_p!MhSk}>WXl5~peF9tu_?<}I? zyEy%z{ksOAdz$Mni?6CixB#SGbwvk1{g&&mxlUtFHFpi=_EX)*l+u~P+NbpF_`}sz z#zUTUZA=s3joCw!+jvEK6T9|~I49F?ECSu|# z)PjDYIS=g%7|$6?fSs3q?@ptXBhKZ#{uTFQD*1(uPjdV_&bL8(z3FViTMMxNf`yp+ zl2aw)5hvYi8umBB{x(27>k_5D;!L6qLpA9XWlMzH>ypPQ_Pu`GW~UnzhsJNa>!lyK z#FEqz)yXxLYKripoRPvZOgW|rEjrrJUkNHz@r}4RT-abblo@^urnV8}#WN_ib*o*Zq|QbQ0Ete%l5QJaAJ# zb1wt*nAr$Qd>I$r#UMT&boWsLVXWWkN|SMMy?cGIZ))VR6@+xi1Z`VBd2 zTyC0n%U$rG5W$vxEjW#CQGJCgol_P$^Cenc;a*C`b6waZOPzNq=bSqr{SJ#)6HoK* zxdSwHpIb%P*tGmvjXO~;{lWF0yVk<^LE|zS_eGUt=W|!x4!II!NzHAf)Nv*R$HDA> zH`+(R(%vEGE$2BZy`|D}@d*@Q9 zkLWxdL0+WP{BUf=FLzUMvB3j_TuqrLeJ6sMXc^gxyC6jO9c`X?hKB0rB_ki>_c439 zhttzbEfmnNbrk2cVHBC`F_t&;+>_GeJewB`!FJ1JI%^)Sp|N>T1+^Xc45ZBueg^L!6Q{P>eTCC;PwGfLm% z7fL-rk~65rmGhD}iW0^{L)D{_`0`8-IBU>I{?IR0PS1I@h^xFk>OoPF{ue>DS|^n( z4FBXGJ%(c53Kr8v1vA1c9t@pNxNedMCxLuNvxQ<|&-x$b$F_Q=hbj=3c{8X@{MXnz3HV&=#~)Qb ztWEgGSZbJC7||nwC5h*<8NS!BMNEjz2o{HLf9gTFUt4m{_n#BfYPBSa5KL{YZO4^^ zJ-ISbg6AbMS19{1l67Yd)0#w!gv!gm@_edL`axz)dC)AUv2KKDMLcz3?VMf^*9_Z5 zDL0(!gyH=H{0ZkgUqO1i_O>fAcs|@Gle#Rcb=L+@g^W`nd~-3cIvbXPu2idV_Yhm9 zL*j{-J#Wjv6pZ@Z31{|I&liFzn46*bI=E4C-C^f`iGk8QAwdSwF;tB$_NE70Y%)pJ z(I5qedg~xNnACVC=ltoxnYdedBO$5&mu&j?G%vOBP%gE4BZEzqB63Zf+;-aAOfF#0 zIifp0(x|ERI?ZferSOiEBWrTy4^hBkv|YmCqv|qPU41L>g$?}FtC-Fz2s zH+eC+!mmfAQqCREvtoGlppAb_9`7XOz|F1mnsJ54+ecFM$u0Ee#d4$% zZJ`8YtbGJ>O0L%^YOfu*WP8^q{AM%nBpJBOCG~D>4=ug5a;YE1BOH)zab9>N`%}Fw z90$hsUK|()Ad{UF9DvT=V`|V_VFx3V)*ep}o{-{QAt-(Em7aSa$a{K)WMcfM9xxty zd%<{kl;Xee02S-!1u8a};*WUx^1w7N+{{BLzS=W~Ul{CtNi97_153O!d487n7S1Z8 zy+5gxpu4Z0OC@FUhR9)Bz0?~4caZjpg06Wj!7XdZMO;%R*9Iet#rG2dOlybdkII8L zumoUsnY=sIHBxEl&81$Wn7Bjn_c-O>^g1~w%lp2>ho16wR)Nk}n$pZnX*a!@;`4wS zSY+A)FAmgI4=3yS&}{D+l>#TNvWEC#yc6E`5^t<{UBCB^d(jII8J>n?Euw2@cw=bln_lq7cl(swdZD*TxDs)$tFjty$5UUys@%QV zT1puY?0DL{-bFN;yu~8FvUWU`jq>i`JzpAKu;Y82ak!h1mmQ1VJg-#wO}^2VtZ0D3DL1l)tQ%dhb^3Y~SJ zOI~}Nr(cIaRGEBOd94>#z%-P4b_1I=1`$X1>|toL_qeAEqLj-CD zEq&*N&|!Y1BbkR)d)GoLysZz&-XgxE^U2{OJ?Z@(6vK`_qY_$&@rqaz*DUfa!ii&? zuZCYs_RSJlr1Ouk4wSLMH<9eiv@ukX9X^O0dp)1?u~Z-85(=ntL2Ml*Rr!ET9qt^; zQ9XUX$iN`Hkq-YrT5sPLkpiR45)P=cpKqU9T1L`hpO;ef&6@F`!M-vO1}R>yg;>-u z-wSf+7{;r$Z1=r6lPuN!H-+@y=ssHJJm-q)NUWQ)4O)J}mLiA#@e+i80#~QuQiO>2zlK?WN z?g`%mAC&(YVag>^yT}Can_u^|;!kG#pu4l0(jV1Acz>?%Be}9TzJ1${l$xzgJq@FR%B^5seExnzb9hwPxC6gAI(imVU$J5l5o-%Us!mdx_O zC$`lGpV&sqjqra!1K;sOHRNNT8)3xAPw!i*Q6z~2K#&ucF&&1r?_nRv1zV}0sRubyt9%Cp4bbV-R`Rr)zTOf?ob>%B zAwW3w`^06`yuZ)Lo4@g;V`x+A4~gK9eCL~{QFeoOXM||%DLnL|?=eZU{gc*th=_*8 zDD;TqO#W8n`oVWbS%$KF!kIJus{v7pK^C_CMv;PO?*`cf)D1c!drJWSo}pGD{TYAw9n;h!uAk+1RzUmME!1yr;&j~}!5ASJhm-AgIYhj*ks zuZ6*Be$sdH!2xC-7Y~T-7_9gquFa24#i4VuuQShU?Oz}v%vbu*KY=#2i%q8t^1Q(V z;{D+oMXFGiMXuNsiW=hYSkw&I^R)G0sMrvkTZ9P$G){Yrqb2`a!I_-RDDq87s-mcu zJ$0PX-}4dNT|IsC#VEWaRdZFQKMtKX3d3+gFF(|kk5kkV4`OC|`(1J<8>TMO4r-VQ zTsPbUdr?7``gNeG@|w-+#J3WSZBx&OFl&VHC1Par*eum z7Up{XGvQg{2)b8_>;y&Qw)m%ATu1!s8>$_kZ9*A)V>j`E41bbbIz`zpYhg2v^}}X7 zP4#1vA#OU+ze26-i4H=JfWiJbMPob>531f@f+tLSp`v?U53wt%#F!l;_QLNrKa%&5 zBIM$InfW20i2QXQp~=S6#%KKLLT^!frXk?RF)wxu;!no;fo4tXN zdkkl&Y5hDMf_(-gt}^yZ{(7#zr4U0@z0EW*mGUiX9Pagl1vw1X(WwbsLqFMJ2kE#%(^=3b^O z35Thy6#vNJN%99uZ|g}D9r!g@yx<3^4>M?4uuwm8W+;A3Q5!w$87s+F31q(dT`m)+ zb@fcXzodzd>?xJ6^#cI?sR6jH`P{!2j>tAz2)(}nQ%LmQRhFEw*jO{J`u1XHiwS>O ze0q(u-xAAz&f0$!flvexI6}17IeQhpXUFTYeUX{>9Y4^E5bX`len;FDcPSRcp#;y{ zgvIqo@l73Pzc0Qi)k5T1j4jUD>p!g&vBFnd|KFaTD?;DRqV5mN`G>;Cblm|!k=NrU>W$e%l=t1#0{r^>UoT&y8Igc z+#73>@sc!8oFra7RJu*+UwDEqhYRV(obUkG{Oos&(BbqWo}~{;umC{JB5gij`_11} zl4O8>x0$GRW;jv)yD;$UR)+QF>l0&}3fwREWo>MEXcC^&>*?5CB1~9% zGI_hOyp9L=!2wjd%LjNdB-Bb7&6|0Jxs^|K%jJVOY-TK}mEd9A3jOyO7UhhWu&0BGk>fWBtEjD4p~jU_g=&Nr3&bvtn&>+OR1WA}I$FUlYGW zUX*2?Cahl?dsQTvtXIUgmc;9hij^EGatq?M?RnR!*oS0rO?zGnKD!y$hsSOO$o>~9 zN*mKXj}YGdmbj@o6vsUXpjjLHnb5T>2!LaXRcRhf@&r%KgMQyG3NlpSf7PB!8Qv^+pl^U4Zs)DJ<(iBU}$_2|x%THlxy9zC4 zi}`=wJELj!`Tl>sUJgCyZs(roKKI;n?peCwUnZw{XXvb;e$MD!HTl!rBVGCKt;9PUQusZ_G=0tU`zecs&)FFMmsAFa2)5Oa- zj_<+-NVmS*;|0aW%IAsw5pv>C4{(0SEZ@!j=j&brb1GXJzVl5{+XS*^{ByEW+-(xD z+1=x2LEHWsM2@P->Apd9^o@a)DOj|$h~+)e3Tg?paqu^(>5Tr;@4 z6&rEzC9dJ_-}Zp>qmL8*?AA)*wr6{^hk^>1)jbYtb%;h7*^`S8c7GCz+Pdy5=<=Q2 zlBnRZ=xS;>AD$p4){9DY-IvjTTf0qWb!&I<)1n1EhRXMhAYsS4e?fVxA|kdm>03cL z2=BRwc?$hr*ljhZhU&i%(e{pxjevE2K~c9;vQZx@+#1zQaJ7|)D{*JH0n`+u&*J{E zdL>+!53%2VJ(0w6A1GwTJ-Te5)1N9Q8{k;g7RS~>?ewr7yMam{i=M{?4c+I6``Jij z;a(cumj|TkcOu^`?R_oEPN^NES8_wT-lkOsQrenu$QM2I2f{_FvhSpXmWSi1zD}d- zhYoI{l3%)(ka{*endY6J1;K3A^4P6n@RWCLj*JOTUAPeoYv~ zMvuN-m=2Z#yT=HnMn7JXqsL|6VDy-exKVmoJx|onQh4xieW?6+M8;Zud1MH@jUn0~ z-x+^6Os`jT2rwEsg7!|*4-j=ZkfByz93C<=!9%RkVtagFi;F9;03i!t&gvuTylxF~F?>4w-thKAmrvpx-4-8k_s;k>+x; zeqR^@?}ZfUE5n6%@Wvb%WA^&1E2?-8xzg$?=mI0B@ZJd`zuDu@>!)jAZMb)`p_i5}X%dqV zW#6!bQqSuX#X6cwd#4%-sNH3KE)|S6L~(7c{${N*jViYo5QuZD{$d!y7Fu@c@g3cX z`bAV(+NRw#LyoG~zbMQQ6EYIdW8xp<1&Ds{;RH(}oCRvn=}+>WclCpGA=p8J@qY{6 z)6WtJ&x@E{)4B{^!>^mKo7ZTuM?6r|rVKWs@9Ce{&8Qw*HinkIuP+k1J0v!*JF0&O zcL#b{RNDbS4$0^AZ%7IfD7czif2=>Jz(b>Xy&+D+pKa2EDWrU+KOF*#LyU{S1E=*5 zYvHh4nqioyxspAtky3v{dRqiEm?Ng}P@p+NJLy&Kb538cQ|1H)6)$YIs4|yJz6KJM zlh#o_&!fseS{bQ+N>V)c`a>+SQmR|1Z_RnthQ2s%O)|*vC6V*F;m=k$NQ&_|{!YUi z@>6*j!Ojwq?s=*~&-X?BJLR-9Y@OGl zMcgQVU;GaD_rY(zKNrzn<$wQ#$KB}9L7o17Sb4|w^kc({Gy1de+tm+~^0*Fu97E$; z`eExH7v)Fz*VsS&7W{ta$0bqh8Gi#3&_9OOg>ii?%a(t?Pa*G!6 zZTy&ae6)YwB>d6%G5ffS{t5U!=LZeqKJnj%-=lueAnq+cXb|_BANy?F%l@(W-RK{K z-)cXo68E?t^oU#P2PNVb_(6#{zaKP+EAfK{akKrHecS_n%sy_0AG43U+Ygo%H^q-> z$4&Czh=mh3);|Eh|MB<7?`S_}ANd&X?P);xv7r+Ub&!%5>tX!eB62bB?G0$vtua4~ zkKBlGT5I%eDOQ)5PUHIh^ae7)Y$s zK`AYB{Z)w0>h+0hp&}T9?FS~a=ntYwo&loD3enAOetozBmmF1OnP=!hW=G;floD$g z!GDZ0JP;N#QDpy4*d1XZ$!!Jm;raqYgC>0CbD3omka#=boGiJLn5PJg8TkZTLJUV> z)+&eW*FcYv2;vPpv1$Vkyw zc;$D3r>w%iwY0Y$J96e3{ZSkTgPa#fq!y9SP)&+qyx_qKj4Xp&^Kwb3- z*tLTUw2_J~>&vNOl)*&v>h!}Y?^Z*&=x9Ax>k`L9k21h8m!|(17Qx@HFtisc?ZO8| zD!wNXW~bsIM+D`yjEv%OD-G+z5b-j^G6@S6s;dwEEsJ)Z7i;#3k&x4vyS5wT@?b{S0VH_W{bmq=dx zj^SQKw;98|OhpePRY?1T2KdcxrQFX9Ft}+jz~E*Zha5BD&W#an*8r{E4i0G)e_w%B zjsYp-P8&9ah1@N2o68ps9NJRR_l7Rvd)8XZrilfRn-r7H$G->F!gsEVESriX9|0BP zHTWLr-kCfGelS2Ui(Ee;#!Mt>O>**`KN)ay zvzwd4jTaRD?N>ttl-%1wjKFL!)i1zFvqy*#{w=RlT~xS@3NoPv85nMSMH~7?ApUv& z#GG!V#<$n8J=%zS^!*%?C|bYCA?=KVBb8#x?`)hB+QGjhsjLV-K*lM$15f0XO^1E7 z@rZ685PX}IkJ}-hL%Q)xsINKUm5lT7?fTjpIC{NH39n^r zGKt+Xr5$MGdz5e@16TY5jJV>5>E~w9>&VS^3okvP7USsifNGRq66`)-7Dcz%EmZJ` zs%Q0e3*t&XsCFcExG|QSESV3=iXR|-sHHy_oyn+x;mtT>YpQ?Mc%tfNBOIk}G1?HY z^5{-FiRbGf=8h{bU_`Uc9I zR-0OJ&IofojL(0{_)SaOBL*)k*XiH!vUg7Ok?j%hcu1+==pmw>aeVVEX@SU%y@$~WZOr(ZNGs8ftC^Js3t}|5q zl<4d=*;%+XFo`d5OD~{%)r&CRe9{QZ$*)LxMQz7>Vyw9u9=pc4K~cV@>Sxh)gWep& z2i{iQP#W6I7XEmx7#AkkFN!V>$&T9vJN}lcHw$czsvchboNfrZI#d$t6e62>{{mTnSynJr5sw4)`3eYq>qOr8jcpsW ztY*_01u-oXYCyEPXKnNG3f-!c$F)?GWbGJAE4Sp(<@MIjcy*%sUm?6j#Ug5p86nxd zrVvhbo3K;FQRO>kFIW6(gE&{z-!V)!j;G3HRwULtVQzy!uhw`C?@3d4%Ay3SRP3Fo zagZaG8bj?Jc#~ouhNeS;O$Ib@>kLPJ_jmiBy!5QE@V2QY@U|qu+x95@MzJXe5h<@{Y*C&5#@M1#{>Ip%Qm-(!`6e*7w7)U7sLuan zY`CPop0P!x2N_$135>1l|72`Y-TogLTU7V|gRwnrvMD|O2V+}n0%Ozv-;52J@%{&6 z!`;gND`Sf?{SU_Wvgt$Er3M(=R?ob7WH zIGg7>&i17VoXz_`INP^kT;IQOwy3OYIa`wnoGtrW&i0cDoUP~o&Do-Q{f)Cl<@^uM z7M1%q&KA|1z}cqZA~a)}R_XI^TrH~a-?&;-zaUpj%m7#G|3A4}6yjk1gR4aixSp#; z-S{`I7B%p1TrFzQbzIGyfen1{zj3vwo37((&J1w1A^*nJqL6*&pIj{p_XhvuYEk+B z%GF@zdX=l){CBQ~*iC)gO7j8Y3nI1 z6S)zE){*1nG_~(?L zWaZw0%J*{0Mfu!6@H_({CFS$L!1GMXy-m}Ks#}}Gamk+f7{V}HqP8{IRE$3)P~|>O z39&t?@R}1D6E#qzm+rF6)BbgqCY+@$0`CX7v>qi_#WyOs!Hk=p7E!afbf0Kqe$^jKUSdAas+ldjLAj`+l zB-~VCdl|q_?d`$jw#)==q>Mm=wuU>$}_p?X_uO8V0dwNr~Ip>?$N z=5bqXYf(MSB&$EeNjtII{GUPpTu+oZ^}9|J`?Byc^v;B6k>J;Ms0y!uDXUC9*d z7$f@JK)L0%T!;mkt+;5PtwKw+zXv*cR#K7F1Gb~w$zk~%nu!uC?BiQRJx539Sq;3o z#F`I!JOg?>Pt6IY4#;e2Ed=CQKwhB2mL@4v6#&;`wwBbsvqRX3M!iT$$89&j%EE$6 zue^#tmoHI$o&~a7tr@c0MmoCO+K#FXjyD4m+c#Uy9bh%fNvFk3Q}w1WI=|DLsBDIM zI#aTp`(UYUcibhVf?CdrRqOGYx*b^(P=^Rtj$|I&Qhf%7E4MjX^0+LAK^ASHVyDT# zO-@t1!h4>Vf`@8~Kt5T=0|MEXDZy^C(vXX`uPE;ab9)~0t8EK}{DA@DZ{?g$7z$QJ z=42`fwTJMu0gjHc=WV3)F&=5)kVERIabv}@ix$)(?SSZCGmF9v0{7xp;sww zw52;2lvt`k+=Bt)?xelxcC4FrcC4Ecd!Xhn&gm(sG&xA6*C=C_5Kuz*njCN%F8i;3#bSR)0gU+3n0HBJNJ*m73Nd~a|_bS89~ z`?&d5S+Fixu%Da9O2BhLz?r~PpZZ`w2f2Bc1ndg} z4sr7w2{;f09OmXy^%7q3XycvWwYNjtBs7RnG^(uyYDc))FB>!j8#Hk9LJ2q)1RUk& zB>-HnGOUyMyvNOzqUegE@O`SjSE#dAsPOh^5%oSduaI3e2D?IF%qJw^bP(_XH?Nj} zuY-UOxw%FHz7GOE!nL&oG+9a%f)Ws_@D@?Ew&hvhf>X})OuY!G`HCuaf6oc+<=$OtA|m#RuLO!dIe|~Pd9Umw+8S60pKKB_Hj6EVG~T z1*hGkeg?DfZT4`^+-`>rW=XDD@}tw7b{~p_zAssR0%thwK?&Fw1boS9b0y$_B?X=* z0fpbsf=pj=+I(4ZFj)0#PJ2WG8iIgtIBgLC;y`kfQ24=q@>|aJTA`%?N85nhNk6M3 zy84cDdjd-H#+ys4dI_!BVw;RE8-;M3y+ujRQdx9RDOr~o+}DLmaFI-Sx#mm5z>y#kF^SPltbh=)6JzqCAdpgX`)k67U;pg zwm*ZD&}pNj43w24Mb*5G#$;~Xp9!x;Xevj`)(=4txS|_eCA;{MbH|CIh8JxxQn+Am z!sS#`prfBS_cqz;VYIrUD9l6oPl58EId_sM7c7v$0#9QqiU~>ZrdZ{%@dD>gvEBsF z$zP4Bi0HY%Y^f?WhS1zsZ1TMI3+LV~yI(4h3ThEoOQbGx?me>SJ+>HbIF)JBz??Vt zJ^>QEk--~}ft(}Eq14c(WgEIH+|)z7jo)am#^j)iPcqv=)t>pXR{5QC=Za>vgG`uS z8waKbR**_X@uqaq;t$T9Z$-cwsdpULoVi}3T;kkEBwp9*9cv_Be{$|3Q6$(UgI#_F zDkqsF)h}~yxomY+`Iz@-CM1FuoV!fGuP7fsM3ZzA0@L-g=;+8PTLiFx-AZnisMNUA zjFrIVdjunuuQ*!6xlhV|ua)8MgHhZ!Hlt{&<=i#a#}!@~quzxmpH%vjc_=^Sc1*-^ za=jJC#Vw+Bbh6p@giuIA-4IHa3$~72@Pf4(cbwp)3{DEF)c=H`>nB>^-qs>Ij4Z#| zlKIZQ4nj9|fo{Sn;YL%M;GfHJ+JqL8poN4xWQ*tsKB?H#H9{X*f$0r%=;*cXYJVjX ze#S_FuA6bF!cRY8Db&!CudFb0Z4up?>kJaQ zT0qq&R0v_;StVWDaGhBe)ySgNINR<%Zxym(bX%^oqKF!h#ubr-)o?Btt3IPaES@^2 zZ1TKpvR>^>n}4wyM3eSh=aoepfY6g~!Y;OD)c;!8?_{@ZHZZz;V5Ni}4<0#=GU;@AQOF*hTc1 z0>3Ry52|j;=*0EgjX020j4-yRoZHn9&KqvLRqWQ$shoEJgItjmZ331?r&gQVGb9e2 z4NLOPU1ZJ9R9IkiamgfmiNZ_I;+{y z^#+iG!J08B#7NnzQ=GXPq!=mZfFP%zX6X6I7Nh0=UKqm5G1^UO`A~0EjJ6knk2|e> zsNptE7Jarz?Z`)V7(Wuh2%<^xLSVopFxJg=x4u$zi1t!KPNw@>Z9>JF42g?R-1`dL zj#=b$7Ug!(bP+m)7ypt)d?Y1RZzS1hW2w0SfR~ll$EA35bjYeGGhg894yIM1BQ zxW#)*;&TJ%O%Tnc2>Q~?HaHr$K-`PmpN(m(ewf(+&U}}qL)HD(RL<;df%D9b)SN1= ztJ5vmCI?dGB%_xK9yWIn*LTm!E(amrwCGYwpu66%br)R@ri3&NBJZe{V8;aPn!}n-a?rRN3Cth0g6Xx4f#>gnS8>=#+FF z$(3f)bT|Yw+q(0dv$jbRdJ9)t1yrrD;6`e_6*p2%4pTTi{i98A@aR!oIX7eabwXzK zF9Gu3N@?$!TXClj>gVY7TPPM951GFcM}p|lT-g)7@}4>&n$CMaFtPt|Wp6Q7UVl?E zS4^|qtAR4MvcCW|eq;&faXP!qAs#)JD+kKvuZiaIZ$e64^_e+S^gNC$hlmE(3!2+w z?O(`&$5Z7n)7{t0nYT;w6maE8+2`A$Pqim*pb7cEdb*cd$S0HSVUl9EbLDNKs9^|L_w-wEb^F&v9^oP{cYB59lMvku@JNzb zIyrTP!mTPWd0HNIUjP1`HhjYYgR*VUkUq zP=A%>MQq+;#2l_;nh++6$@0Al1ND8DeOiP{XdYqi2e%!2<5d$GgepIyNa0q%np?K8@~UZk4Oxj zM~9(UI&;+9so8F82WdgaNsEMB(bOCJ;)#u_41ym$mxe<7%9-U7kGdcp^Y~Jwz~hQ- z%NL3cot4-rEy~()TdEa1Qz>710#$?^O91!zd}*}=>*U>G5lUG4I?TgqBhK zS!;W4oRgUf`dQ3@)#j(M;HI3HXvGqLgi4=>_V^QjW>-}41gkvCm+I_@-+wvT8iH5} zRQiLxJLe6v*WxI1LhUMF*Fq$)Ft+8KkvR7Jo3T__qz!hn(TiB!XK9eScFEr!qrHNg zrkJd!MSO&`o6I;3UpYEeDMBWSrl)Pz35b-SHi(u|&)(>=c2UY{Z(>U@Dz_DkYH2{E zWr(yRB|;Slh-U3YyT_Y*UtxfE$c?3v=G_iitznTllLuAU220>Fns*0)L0gvlBy2en zVgS~twWLzc3D_$@Guu}Sqtx7uM(7aptnUk>)Oq&`S+?5tkZe;0M|NWht-0TP8|4Ho zT2hf!xjwTy7p=E-m#7gHzGSqq_Xqo%;G^FgwGz6L=FJmby%g*Un&d7Tj59%u1C!J{ ztZli|pLXosjgU_n@+tO`rzmZ>5RgyEce=#9M=nbQbM2Vnqb7pjIW*K!r&Qq-$|aTN z%d&Vi&08*{)f9*x(AD;nR;<4pyKzRW<%9ce@5&ZW3t}Sb&{O8z>zHPh z#Jrm3JuNUl7{nYg7kXOs@S=4LVTh!DNtw0Ro50*ILb@g#x3%I9ogH671CnG4kYODa ze{6GeuWpXLfKJW`K-W`3x~4UiKW2>;#xK{(pA7l)fW&eG&0~Sb=^!4@Qt=CBJNvAT z{a|7k3)K(fkdDbS)Q=*@z;&RIX9_j_X7*b~_ELV9?YZct5 z1*rzkJ-p7sKCg@4LmP|+_@T8SA(EBzg3(6&yr-6#xSP_dv7nAA6leUn6S z6BS>!_2A4Q4rqa{$e4Zjq|P2dVlyR#+oko(8K@{AY%+w+^Rj6zRc^2*^T`Y~9mB); z1x%D=NgdUVFd3<6m}%+toV2Z^{1&pPrhJZfs@T7-n7}-NBZS)&BUtpy2y%mgI^G84 zDW}xZjXw23Kx=v;!^UwP>o&8kvs_~*UFfAHyub_esnowa>8aN}q$u+xW_t%<~4w9ehTU_(H zD7wOH2P$xww)IgEeWG%kv4;>eaJ4eztWi(kvl555sqmt)wU9&WF@uwVnZCnC_ka?D z;r7G)8w1dHx#&JYpTD^7?hIQ$jdGBS9+b6(`KYk6kyJRuMRR5CYguj=lz$&6Kg>n* zW%*URQG(s5Ygzn>g^EuoELb8QafBe4-Y&;ryVVyM+Kgt z(vBC;B{v%7oWA9>L|I-CDE|(DTIKTuYqHR>eXn|~l)uE5EzCpnz-@mrPL&@5BD$uE ziV!Z7bnvZ;M)=lr*|I3m(|JzoA)jXio|~w0f;s=%yG=-zHz>`Vrpjuw1J!<@G`r;z zD{tF0TIEMN)f*Ov?GM`EFz^$VwufRUxxoe*@@G!VkRq#CoefpKt@?_;zfy%#e+Hmn)t(qi-e&@7NvV2{j z{0~kWBc9_kP4QIloK>=bONbPd(T0kAkdFRwNeTJ!Hcj-OwD&`71KAy5CCZLpZHF|P z=*yfoS@ykE_8rrL)27Pj9f4 z(`Jk3BWG<;AAV&PYcfX1X(h5z|3D+;b}AFk!3oBMaoPg$oOdiRC^WpknPJZQ*9GJG zH2eNgkxy&UN`%C1nIkyPNqluHE!_p%*?~c#=;(XyL@r4;;+7MdQ23p+h(X?W+#Dk1 zlO4NE%vCM~4@rx>+=z*#!e*&3u!EJv(Y&uLzN^MAxf)^WGE*?m7-(y&)izhfynLJ} zoW@8fKGeHpc|w5ysC~siEqQ8=F#|+`f^$WKZJ+3%)%6k`t_^)d><2_-hEHF%cjo^V ztJpWM+%IjGeZm@csMsQhi$2>>^PL(f7H6rdhV%9X(Qhlx+cx^_Jxl!cO00J@S9Xcz zP~9#)BfTQZ)W>AU?S)wj#MN)qeB53x2tqqh={6(I?(bP}{=aGq!_Z>|NY#-FU&N;X z)h5{Zbq)#-$zGGL@l9ZGnLw-L0E1yLm;j*DHN3_Afc*n4@=6KGh*M_UPiu9lx4SK{ zwe&*Hg80@2bNxQpFzu@37H~fZbk~`8K98-I^L`3egGP3cy)Ck)!_EhiT6Yv(3>KyT z<%JMv-1RC0DbVnPRrZC*EXD9W5dDQ9`~cQgOm}sX>Z1JP##U8b%pshz3RuEw*3wCM zF6iO8KshcUaIdvL41-xAtBKY~gC&V#;GJ&^P9R+kpyk8}2+t6c2|6BmtVTp?JtNzc1>0D;?i&eM5Cqt`?yLahxvha=>|EC@0a-zSgX?}) zab;DMrfJVbAJ~^`VB@O%Xw2v824evfhqs#}spyiL3w3G?<@dL?hPS>MtSTs?-7EC0 zG04DdZNu#w?bu&ET&J^$G4p~$c)2b@0)__xKCX+AfKfpJVzhn^Nk4wHwFyVSYp)eY zN#bO4U2EB(AlRTMol4bou6hhd_#qeV+q6nAu1l6RCI@Tea9tVzlCKCIWu@#Wm+QL9 zYDK|ny}3>=0W*StK3ta}0S^QLeYwse0keaEeq85}fRZ4fKi7Expu939wk>+k93^2xjvwW`bmp3_*HOg?VE0&|}3XV2{>t;$o zeGmYP)mfrT@D&3Uz-EPRvZ|)*Wurtn%q>*9A)^;UoLE-y@i7jgRv86rSJ~OYU}rF0 z^^4B(W?5X^Dan4HY&e?h7RqYJg4O;53s(s^4#4&z$HO6^vve&MpBxN#!k+Zj49A>^ z@yl;0djRRMTM7_AHWT-Zp=13^Tb12UY4d_(TI;w~3>FG6nGR z;7Ov(UnEKI<%A86D23w=IetO}ST6m+IS;~Gxg%bTuoq#SikvT19dvkc1aeBPf6RSs zIVJ{3o$Zu_y)87KC{>Rcym{JwImMVN??uf=bIcM4QX!W+e4lsn%!k&-VvzF;5+i`s>pR_<`Y$NV|Re)$>~2@+&*e1Z$K{O=%V3~w?xM<@v1 z3V0VW3=9~6;31`|hZC;lK?HY71eZ|Fk^sU1qJ|4B%LULXW_`~!FIBwddn7^OJzwtl zP7oN32mQ7Ci=xz&>^vs=s37Hx1BShS;``ct$+z;PT7DK@@ZNKn}i=bN-N{qy~a z=PLSnN>C}43YIu8aoRNJ=NcHi=AU*{2#RzR1Rt&??bK_QL_msI!}-S@NmvpOIln+4 zSm4t2uch#W=(t)^=bEJuf5v%SzUmsP{K5ej(+Jls3K#pG%QQ$c)v4TZUJx-xzR+hl zVSqCMraleM0aUx$8NrjvovRhnE^xLAyn9gnI1+Kb?{J8zbQb>y-{5k`T%~HU(|&b* z?2z4U5V#=!%9W2!ClGv=625obBNlZm&$;NFEo(kUb&DOZ5H^!`SJ%V>F^O3I=yj(a z26EW77@vJB1(vXzE{S)%&iOK>hPrN~yoa4P(RXhF+lDutDvschu6Dd{gR>WMQ{f`f ziOapz1J+~A%9Y*$HjV*S&?FP3Cgt>W8gXuBp=3kKR92;divfe84=Xnz|bh^1q;|E z4zob+u%z;yzp>%^z``!ccJ|md$c0#2d#UEAW68g6B#ezjhN6sl9kDl@Z^(7R@e!^c zMeeD>zRstiDynph6;s?N`b93YRrm%3j(xeLmFwXUwKSJW)tyqa zTsoeS>RKuy+t&4RA(^6~eKalZ8|b~?rlwf zS6lAb!}YaDVBgrw)t2hVBapsXb+u-X$@PvF@ogs$a;>C_k-#Nmr7Mazs;-e*+P;STIDc@xLudEx+9nu?tA;XlDTV^>r?0zsmAAm zWSQfF%!VXWFU3QZ)7J%2<2?ilLleXfSf#oUNp`U70j+Y35=P>LfKKnC4wp4sv0<|7gceG| z_*{^vz~?gajZ#A&LWiT<%_!l-dR=;Eqy9fWF-l%*~x z$R2k=LG~qmQ|5x*=t>vtM!!OcuMn6*t#ZAgjr!VKcwgb2QwwjKI+0Re1RYE2Gz<8J zY8P_dd_#NJxn}aLb*@EPM@2cV_pL5+QT<dQI~z3`_BDBR9H! z)xZh=)CmP46>DAJYn8LKcOUN2+in#PPzvsLJ*M!|S6nkR%6W>}?JDPGyIjR0c~i~1 zP^mO-bJZyP>Rwm-2;GCa7XH2PKSSP)`ZaM;lyo6FyeeOd!`!>BBf9*D=l8Fd*SEX@(t84N6tg<G2z~=-gb24xM%S7 z2+ibuk?vkfnAW1&ZK_JAc6eMOH)$x}5bfR-rs$|{sAmu~%UU=%yzDmf(~0g0!c??6 z(_KK{{@`-(6YbnnL~5qu1)krz*6w}~0V_JW7b&{%)MCA!R&_F_Q@pohGT)f$E({MX zn-|jJ3rcP_odJf zoWwp6iKFF9_j1t)H!?JfkYa5pZNJw=YOb#xVXQ1_EcQ&`A4j?4;R{cd)7%Kx@tAu6 zW9Wt9IxwSMEd{0z5W1MeMS6EXu;)A6=XD}tSqDxq;8jq=K5svoea!tI{^Cw|ss;}6 zM<;t1@{+0U``{2yxu3X^`k=_IhKGb8#+yhVA@RzkBagd>v0;|`MkTz{+8N@4c>h(b zd-1OiBE^ZwC?A``X=hzs75Z$8dkw!e$DO57QsLw7h4XKTds&#$neqo~)8y+WyzZ@Z z{-En|YD(9|a>W`?5spFoJzt5})P?FiUg$3tyHmn-cyYT2i`mU%Afjq@X{gbSEEPSG z-(aO1N`UT^*6ixZc@b`C+>w|go!?yT&W7bA-TjPb8I^pBtU6DZc-zpC2RvgqvBrH~ z6Q#fBo{4wQ7(e6AX%ngPMNez)vd%p&A_PK~3_2xe-W58*SmTTL`$OT<;EvVky5iYH z4WD*wjYzbf2&i$~UvhYz`*)a5lG57UpI5!=EX{B&(CkujeZ*iyLQ~My$%^eDIDV5ymy;t;cZ$ti7Ez<*Azg$ZA)#YMei01(8 z8Tn|ACsRvtzLrMH?Ca@G)lr_?l|H0o!va6=y@XWSd7Eboe;@7HAEt{&W`d%?^m1Bz z-U{!xbGSb$q{S~(vnoweZ7_ov6BQ8%HMT!ju5jNgKZ;C&^4DD6!821qIMn>Nyq(0Z zK9$RpJTtWl@|$(`-bhU&Jd0MS_}qKG>UHw;G|%H27&q2@;Chovx_c*5eNWFCKGfCY z)My4;sCjGK_S~t52kd(gDc{7KucBW-B|Td@8F=?oIOl@|U=t-mc4-?Y2s~*H; zzlqZPVQIXygQpnk6L-6C%Ixi)uiqF2}2!R^7pVJPgBz1=CVtM?$+YdksV zYMFNdm;yHHMU`z36DY(pg_@Ql{_411p7k({JbFh8>{5DoKG%lz8J-F{V#V1T0BO2yk-x8jNz z5BB%UiJq;Yx>)4?LyTUrPVpj<&-e!KOH|v=Gk_Q0?Ll-egx`xDLzb~E5l8iXcNTA| zbGJrZ-C_?E2xDpQJa@0EkHHMrAMlRjgqfZm5hD5bcDXb@A?#ych((Urez65q9O{09 z-zxDSNn#<@O!0osUzT~2p{%2{&YpMR9N_6mU!`@#$q;*CnAi*NRg}rxY<7p?1Dxpzm){P7@Nw*@@f_Abu~${? z?u<~|o-u^|>;};=f(q`63?aOWJla%)QZ>%KfE(6(ehdw18PWoIa<^#%+nNYbdDnW6 zKOv;WJNF69_RG&67GJSbI_Yzh=#6g${7I{IW!#HiisacY&j$r9!6 z!rgaxPKGH(RJY0d5#?NTA4SSv_pO3&jpqrkd!80nho{nY9SC!3N7LW(w&p?mJUD9J zL-k9%$ewV(^HZ1(-f#Q+3OuHY(6+G;RQK{HhP2pA&1pEB;k?vUAUtEO$B*RL`y|5s z#C1*Vbo`t7H-sY;GJoXx05*ug7C9u2dyqroema`wMP87Tp1Lq7FbZLz9C4QQkanKFH}U;MczQ^bd=eBjc^9Rtx2S=6dn( zr=x%2YQnxdb}p5sdI_e}JvURuaL;I7_p4{TMwv%-Ga*A)f9lB(yvFz%cL>#<^$eq; z0-UXK4!MW3^O6TK>Dq{ZiGnXPsM4qrNt2GNQFV;Fomd}tUB9jeb3se*&QM+3kQVQzi`Q^cE{9Td{wP=4y*3R! zIoCZD29ds&Jl)~x4r8QM?nuGlFm8&sm9l{A&F(~nZYp&@gnV82_SE_ATj-qX9zg|l zS)s6q@r3i?C0>(4-*oYIP!>|!qn@EF&Ux%qvd#^_|a{S9LR#;ZgROQ|vy2k7&!c*Y6*+tQ!?-MydJ|T~3I1iKx3!{M zUGpD*M@qQgdrr3!Q&~fnDmU`LJ>YHBLcfRIH=9bH_7rf57mdQiYGhFk7Ydn~=AInFL z^-ja7_EqmT>>W5?75F?J+PTgvl$^2axOts74~*rocMhfO!Zhk{^>pKyW!@V@b+D{B zY!*{kK%EYy#$noE8of4oU&CSitm`%U%;*lI%};srbT#PeS+Z;a)4?+o*ZbW%?y%bX zjRs*fE!(}RSS&xdM)B+#@1q*1_4ZEl;#OvzcV)OP1rpvQG05#=w|a4Xh`$rI*XVy4 zwqDU~K$VxS9wd?8?w@Gg$IouT>JfhLPxi#Ye5>~}kt3=y#tW9Z!wZ(Wnd%DMt?BT3 zZ!s_0<((A<^<3_Q?o1x~Y48*t$9L@auF^mYcl0fHCjEKBa}R?nE)Ub;!`SQ;xQ%IL z!Hba*&|`P3&GV;WFHV=!ptz&nKXhB4D)6Ur{CnQ>imnz|Z==E+yiZ-fd!D5nr}vYq zA~JUA7O~qo_kw2+3}C7~@6nfYym6Gb*zG3uPxpbq>#N`486_$*lGpctpU-)SRWRaK`datBjogg1u=f9>TkWf$eojcrXm^J8c6vL^4`FeG0{ zxafUc3E%zrKz|p+PZ!ZRd-8X`dJ{Feofu^gWmlxW&TszVMSh`r&VD@gVGTd3@y!-V zqe{AWgRUjShr`U}wUff6Z)oZnf`i-LEuUaKi)7XSaPPh9CB6MAm8)>09 z1!VJ^**=d(_a?e;;KCuEr|_PFg7_Ft?(IWxyrX3KNIOhy?{b$+R`}t5z7h@6L-oq? z{)fj8@GXeYbwk|KXk3qax!W+`2?Y488t&^WvbdH%2&kJ&hx^Wjz=5skR^O_y5NM|1 zqdldSn+6p6G9!*Jp6!P(+Y_@<)x})s8=%pB2#m1Jzm`-*skg+O+#VT@JIM8OvUMIT7vC`00T$g*ZPi&Kg4n zgJY(XaY@!oRn18-E56@%Hbkh+K5CUsH+m{&T<7!qnkIQ>nQ~N#vAczSCOGg;8*~ zg=QkSQ=mZ zs^DWy39le2Ox%2=o2bYP&p^_R$VnV=*0(l1#3E!qNXky0W6gpHoBDRRUhK)2p0oLp z3$qC~CqGQMdnAfv&B#+f(AugLj#SQ7LsHZPn&p9Dk5b`xVx;IL2^hyim z+K8;1HHwy%(#}&Ms>Eb1ht7m7H-+blkv~S1iZ)pYBpAvyhaKzoeDO{P0x!V3%byu4C3(LAKGH z++9bqXTa5ih)xk7cU(Nz?@wE41xFv2D;BEaFRaKHOqoq^W|xs_~!mu_D~%> zch5>32{?w+Q`3=%@wdTQI;{?`IWCcvnDn7g!n~f6Dl!p2$uYySknFHE^2~L1UY!A= z`HUTrwLzn_;pPrmamw}hUh{$lnT08OTw5e8&MKlTZPvc4xGxqLL2>PcN2qQHU)IV(&Zrcnv~@Y4S^r!8S#1BxOQq5GA(wh9O}ox<{5F? zcTnHEv(`o=JvzaUNIOe~iHd{LG3oG*uY~&H+x`RPUqFh%E5w+fwAx;jg>5RCDvPza z5}A>OZ!CpVC;Iv-JYY`NPE8ct*4@}P(!8wZ%Mj|o}KCQ z@vg;Lk3{LbNU}T$_*&?Jm06DP?u$qI;gtS_U_v(jdSzC3O+>ea6a4Ow7R$x7tTgbc ztZhpA_EiG?9mW9X9`J4LYfxvUq%by?UK7l?F}7VcP= zm8=OjRl58>k-iyD|pRa5#5Yzsp>x8~X$q?)Csb?L&Z zI?l{Ttr3}6I%A^WuhM0wv*Fb&u(eDoyuT;ng73#Aa3mf3 z-@YvDe^$11=m8CH!vpCaj(R5xS$}ObZ-u9ZX1C2Qqk^wOqv-83nl|)wfzq1CAIe%6 zsyJxxmaG}z>*EzXHZN$DH8?s(QPt>U7>HX^U}$t)b*-CWo~HKI1d+gO21d($o*Lh)YIAKz`A9nHPI&)O$ccQso> z#;>T?g!5fZSt~_2$fuWfFQlfMVne9maF&nP{ggF3LdoW|KeIknL?V>99Ja(q_f#mw z67iovCU|va_j~1%&c)8x{g3UsY^`uWzM9gAo5HhOiGYvA$Gg9yRK3={n(vOyUZH6E z+F^v2yP4d=UBXZI0G#m!0CdD>{ChKL*Ba@s6b z93pdehjwK(HG6X;^oNax>?yi|m0kV4Xs9u}R(Atx4x+k@1Z;;*3D}HH+1QK+bBLOa zTa=qP#4i30!8Kww)>a<9csVYQUWkfs$&+%j>%w)pxQG#(i^_v<%zjy;6PX=uroH{L zk%z2Y6Gr3xnlR2BoDF?yA6SQp(~HV)56^yI(T!Mkv%fdjjLaUV=tOdek@VQ$?ECn^ zQQ7xKD}DLggzN;Za?AF~**AxZOqNw*$*a8J?(F-a2HReg4I{VyAuS%G{Gyf?zOgtP zSzZQk?5ykpC4AgtI{yu5BKVqts~^lBujoXMit$wmt&j7`+1a>uEuhNhvvF5mlKn*( z6j*y|vT*~tAR9NJx6`R-vQy{|UqT$6c{#fynb&3SVBM1JKQ&NWz4>f5MA3?Dh@umz z_|1qksxHrtqxj^u$(;Xqc6o$yBR8(jPLY{~;)HFPpx~YK;mg@DNnDq`B0@J1%IPux zUt8xN6~%SMab{+R-IX;AWd)_M3%D+dKO!1XtMg_sdeq|21Y?iKUx)@OT0zlx8WX{= zw*Hn7xssA2o0ynrh!`WUZ6tyxMq7V?zvB;#oM=lL8$nGy8jStU;*ZS==kU+W&YREN zdGEe?_uh9eo+g3cs8kg(I16a=ld&2>EOg5zsW)Fxq3W=0|6uRTH|wCM%dn3eFs^sggMDakVfhqK8cK=}Fq$MZY30Xi)B&QLgLZRys@r4{xUEjTBf`E^ z_kGMzns`k8b4hL2i9GV4dL4-isjkY|z)v4m_ji`ZLkZ=hB^T{Gs}8p=S-r$F4hrWF zj}ArCsB`LH<;7@wDS7u>yHI_0rz~FZwR%59n807ZsuoJ}D>(Z{yqTB*SRlvt7H5-O*JMeg8H9` zE#Pmrsj2X8#l2K*V^EewrKe)rs>4{8#i*gRBieX4jy4vG@*BARPvq6i@!TEFR$Anj zOhMZWX~*(oE*36W*Ogg4lX2q+;~3!>+~%))vq7z+PV|E9r_+f$xnHlq;M)?hT> zji>8urzCGcGsTpe+e4$isl95qOCy?T$Zx7yEd zA#aXrCN)I55@^FRc7e~yU|U6@j5j6r!u+B9Z25vW&1LZ-%q)44*0nV2pYB1lLb0_x z)|lNmZhl@ivIO>at?h_sx`3>KlS5_iOs@YAr!k{ON&KHx)kLJHYA2=&OGOU}e+1*MKKCDKO~QcmeqM>*Fj z*_Wd5F*jAQ1=iqcrl7mCk}0fGA5K@6MW#{Z+YxQ0pR)&sRU~v5&nO#g#01qa!~|7Q z-jLrQ9bPTNk{8yELu@}4cpNWN?mrkN!h;OUg-^+QF*=H_+#NL5I6R#nI?O7~oe(M0 zI4}7D{wVL7HHq(PU=trEq}FOV!@{uxk}`gfviC03iY4>xlp**L zr;LqJQ28shUA*BE8;ERtB_}4JhHRpYMVP_I-DRJO@@Hshe@UTz z2A|!=ys%Ip8)qyEb{$va0fn!QI$pQKslj2?$ZC9({DG3x?(WAl)rPU6)$4qf@I0fb ze2ZSjXI*3O85Rpaq=Qc(edUkTRl8{ko{2B2EyH--7;UI%odd2f@Q(-}Hwv6T7FlN> z12W_NlJW?F@;q-`CbX%Je2KcTMOGHRFY8>2lh%7+1V zYEPlP2kBG#8cKlC)^Ez-Z_Tj%J95!d{J25-t4#Fc8t32$-(pEcRI?b$%Q zb5G&<1o*W--g$pK-#fkFkC&}2!OY89uC`3*bm?e}CnHdpC&AoENom@VJq0KL)(&18 z5xd#YLYFD&j-#ITS30xs*1z(}_#346RMV(H(h5jlsnr{uaklTw6;g8a7V4YmbQvA8 z*>|vs;=W~Zlt}tn>TlDCDjd$a{EkPni3s=!d*1#mzVs#7?$g3tgnoLAs?sH-bXaYO zu`?$Z6+#D>`lUTN>t_e|6Y1{vFse zngjdqcY)&nPsif_-e3IJAB*3@e_N%&4gFt#@qcFYj?9O>;~E6o(ji=HAl%JBxLbj6 zw>yUW(I4)AkKrDT_dCCY8x$hn0Mxw>p?(U4Y72zA9|-kx$50O*LbYj7LP1ZU_D;|- zoCJR+V>t28uW2Jh`7X+&nK~j<+}ST zPv~i|h4{0X^pucb1>1%c?A!Cx*F$vZ>(D@bttkHbTGyek!#dR0%CFk>^=KXXI^3Vf z{)DGpR9*aW()AWgaF#Kg^>*DDGG`DLMhc4lDae=B9COe&mnhhI;+9|m4N|(1a9mBr zK#muA*2{XiAfOm>cc-)Tq;oudvsoWv3}r$zTCt8yR#lx$jH+_<7o}e#8N;L_miYEr zh8nCeAM4*a;lv11qNy;!35UN;OXn+c^&(_W!)6ezkzXv=oruc`QXG8JI&Fc#bG-US zLnA28_NP!z$q77dxjx(~Wb+LkJx`P)aW$|PNB~|u9qm8)# E1I_?k9smFU From 18efe17553c8c777452607d6605cf77a00142418 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 7 Oct 2023 16:07:02 +0000 Subject: [PATCH 027/242] Fix a problem with the changes on this branch and tables that use an implicit primary key. FossilOrigin-Name: 1f9d10235ff32e72074be695049567135b02e681068ce117b66adc14a6214449 --- ext/session/sessionalter.test | 27 +++++++++++++++++++++++++++ ext/session/sqlite3session.c | 2 ++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/ext/session/sessionalter.test b/ext/session/sessionalter.test index fb64b26d26..15c9bf4c70 100644 --- a/ext/session/sessionalter.test +++ b/ext/session/sessionalter.test @@ -106,9 +106,14 @@ reset_db do_execsql_test 3.0 { CREATE TABLE t1(x INTEGER PRIMARY KEY, y); CREATE TABLE t2(x PRIMARY KEY, y); + CREATE TABLE t3(x, y); + CREATE TABLE t4(y PRIMARY KEY, x) WITHOUT ROWID; INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6); INSERT INTO t2 VALUES('one', 'two'), ('three', 'four'), ('five', 'six'); + INSERT INTO t3 VALUES(1, 2), (3, 4), (5, 6); + + INSERT INTO t4(x, y) VALUES(1, 2), (3, 4), (5, 6); } db_save_and_close @@ -163,6 +168,26 @@ foreach {tn sql1 at sql2} { ALTER TABLE t2 ADD COLUMN d DEFAULT NULL; } { } + + 7 { + INSERT INTO t3(x, y) VALUES(7, 8); + UPDATE t3 SET y='fourteen' WHERE x=1; + DELETE FROM t3 WHERE x=3; + } { + ALTER TABLE t3 ADD COLUMN c; + } { + INSERT INTO t3(x, y, c) VALUES(9, 10, 11); + } + + 8 { + INSERT INTO t4(x, y) VALUES(7, 8); + UPDATE t4 SET y='fourteen' WHERE x=1; + DELETE FROM t4 WHERE x=3; + } { + ALTER TABLE t4 ADD COLUMN c; + } { + INSERT INTO t4(x, y, c) VALUES(9, 10, 11); + } } { db_restore_and_reopen @@ -196,6 +221,8 @@ foreach {tn sql1 at sql2} { sqlite3changeset_apply_v2 db $T2 xConflict set S2 [scksum db main] + # if { $tn==7 } { puts [changeset_to_list $T1] } + do_test 3.1.$tn.2 { set S1 } $S2 } diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index bc84736471..80783805cd 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -1101,6 +1101,8 @@ static int sessionTableInfo( pAlloc = sessionMalloc64(pSession, nByte); if( pAlloc==0 ){ rc = SQLITE_NOMEM; + }else{ + memset(pAlloc, 0, nByte); } } if( rc==SQLITE_OK ){ diff --git a/manifest b/manifest index ea3c50c411..17d2603f3a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\ssource\scode\scomments\sand\sfix\sother\sissues\swith\sthe\snew\scode\son\sthis\sbranch. -D 2023-10-06T20:39:42.133 +C Fix\sa\sproblem\swith\sthe\schanges\son\sthis\sbranch\sand\stables\sthat\suse\san\simplicit\sprimary\skey. +D 2023-10-07T16:07:02.856 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -529,7 +529,7 @@ F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d0 F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859 F ext/session/session_common.tcl e5598096425486b363718e2cda48ee85d660c96b4f8ea9d9d7a4c3ef514769da F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3 -F ext/session/sessionalter.test 29d77c44087263c63d69be69219734d636ea68635307500d5b0f07a056e4d432 +F ext/session/sessionalter.test 06ac2da2f14fd722409b91d865c840caea4d7670eb759eeb6b64581f37737f4f F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec @@ -545,7 +545,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c 26ea9b58ccd9fdfd211163bb637833d12c2beb491160e04fd415fd0519aa2685 +F ext/session/sqlite3session.c a371d74dd1b545d43c40363ecfc52cece93521db61a90c152034b47f125de451 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 F ext/session/test_session.c 0b4bc954e5e411baa723e52abd46380ca428797dff39ed62c610001777a2b70f F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -2125,8 +2125,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 897e926a5eaa0eab7e09e5003e4c15c974897be298a18ae85345962dc3f410a1 -R 99b1a1d1e6fc326e3288fb4d2006c57d +P df39fbe9ab87937beb77af353cd55602290b185e222e0a92a3ebf9a9a0b9e2e7 +R 87820a64ef2d678a0a08630e2b1112e2 U dan -Z 6d17292d226b837db6fc5d0737e14243 +Z 7f46b239846dc0ee500d5b995bf91280 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5f9fbc9ffc..3f5907db20 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -df39fbe9ab87937beb77af353cd55602290b185e222e0a92a3ebf9a9a0b9e2e7 \ No newline at end of file +1f9d10235ff32e72074be695049567135b02e681068ce117b66adc14a6214449 \ No newline at end of file From 3b381b4afccd90e1c2cdd5cd5ea3ba9f15ba358b Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 7 Oct 2023 17:29:10 +0000 Subject: [PATCH 028/242] Fix a problem with sqlite3changegroup_schema() and patchsets. FossilOrigin-Name: c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889 --- ext/session/sessionalter.test | 77 +++++++++++++++++++---------------- ext/session/sqlite3session.c | 7 +++- manifest | 15 ++++--- manifest.uuid | 2 +- 4 files changed, 54 insertions(+), 47 deletions(-) diff --git a/ext/session/sessionalter.test b/ext/session/sessionalter.test index 15c9bf4c70..96a810d8c7 100644 --- a/ext/session/sessionalter.test +++ b/ext/session/sessionalter.test @@ -189,44 +189,49 @@ foreach {tn sql1 at sql2} { INSERT INTO t4(x, y, c) VALUES(9, 10, 11); } } { - db_restore_and_reopen - - set C1 [changeset_from_sql $sql1] - execsql $at - set C2 [changeset_from_sql $sql2] - - sqlite3changegroup grp - grp schema db main - grp add $C1 - grp add $C2 - set T1 [grp output] - grp delete - - db_restore_and_reopen - execsql $at - set T2 [changeset_from_sql "$sql1 ; $sql2"] - - if {[string range $tn end end]!="*"} { - do_test 3.1.$tn.1 { changeset_to_list $T1 } [changeset_to_list $T2] - } else { - set tn [string range $tn 0 end-1] + foreach {tn2 cmd} { + 1 changeset_from_sql + 2 patchset_from_sql + } { + db_restore_and_reopen + + set C1 [$cmd $sql1] + execsql $at + set C2 [$cmd $sql2] + + sqlite3changegroup grp + grp schema db main + grp add $C1 + grp add $C2 + set T1 [grp output] + grp delete + + db_restore_and_reopen + execsql $at + set T2 [$cmd "$sql1 ; $sql2"] + + if {[string range $tn end end]!="*"} { + do_test 3.1.$tn.$tn2.1 { changeset_to_list $T1 } [changeset_to_list $T2] + set testname "$tn.$tn2" + } else { + set testname "[string range $tn 0 end-1].$tn2" + } + + db_restore_and_reopen + proc xConflict {args} { return "REPLACE" } + sqlite3changeset_apply_v2 db $T1 xConflict + set S1 [scksum db main] + + db_restore_and_reopen + sqlite3changeset_apply_v2 db $T2 xConflict + set S2 [scksum db main] + + # if { $tn==7 } { puts [changeset_to_list $T1] } + + do_test 3.1.$tn.2 { set S1 } $S2 } - - db_restore_and_reopen - proc xConflict {args} { return "REPLACE" } - sqlite3changeset_apply_v2 db $T1 xConflict - set S1 [scksum db main] - - db_restore_and_reopen - sqlite3changeset_apply_v2 db $T2 xConflict - set S2 [scksum db main] - - # if { $tn==7 } { puts [changeset_to_list $T1] } - - do_test 3.1.$tn.2 { set S1 } $S2 } - - finish_test + diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 80783805cd..7ae407154c 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -5684,11 +5684,11 @@ static int sessionChangesetExtendRecord( break; } } - }else{ + }else if( op==SQLITE_UPDATE ){ /* Append missing "undefined" entries to the old.* record. And, if this ** is an UPDATE, to the new.* record as well. */ int iOff = 0; - if( op==SQLITE_UPDATE ){ + if( pGrp->bPatch==0 ){ for(ii=0; iinCol-nCol); ii++){ sessionAppendByte(pOut, 0x00, &rc); } + }else{ + assert( op==SQLITE_DELETE && pGrp->bPatch ); + sessionAppendBlob(pOut, aRec, nRec, &rc); } return rc; diff --git a/manifest b/manifest index 11bf73e11c..c2d9ae50d3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3changegroup_schema()\sAPI.\sTo\sallow\schangegroup\sobjects\sto\supgrade\sthe\sschema\sof\sa\schangeset/patchset\sunder\ssome\scircumstances. -D 2023-10-07T16:32:02.752 +C Fix\sa\sproblem\swith\ssqlite3changegroup_schema()\sand\spatchsets. +D 2023-10-07T17:29:10.275 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -529,7 +529,7 @@ F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d0 F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859 F ext/session/session_common.tcl e5598096425486b363718e2cda48ee85d660c96b4f8ea9d9d7a4c3ef514769da F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3 -F ext/session/sessionalter.test 06ac2da2f14fd722409b91d865c840caea4d7670eb759eeb6b64581f37737f4f +F ext/session/sessionalter.test 72722f6f971c7cb6302a1a3c43ff256c0db1aaf19ae625ecdf710d53f08b1237 F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec @@ -545,7 +545,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c a371d74dd1b545d43c40363ecfc52cece93521db61a90c152034b47f125de451 +F ext/session/sqlite3session.c ea28d07a280dc82efd4e98417a10b582058dc11a0f2a6ac3b194aa20d233d758 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 F ext/session/test_session.c 0b4bc954e5e411baa723e52abd46380ca428797dff39ed62c610001777a2b70f F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -2125,9 +2125,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f99ff655d09763c4a22d065041644ece793d84c82c644931e89ccf50c4f4564a 1f9d10235ff32e72074be695049567135b02e681068ce117b66adc14a6214449 -R d865b9cfb63e018f64f1f6aad13ad521 -T +closed 1f9d10235ff32e72074be695049567135b02e681068ce117b66adc14a6214449 +P 03f9e50b15c9c2fb4636dee24c1491c45322578b9fed08c6f4360be07c5c3830 +R 557213144d25aabc74ea3d95f8466dc7 U dan -Z a0859a12944656342c5d9a33e3014cec +Z 4ef2a0ed12272e0a936ee099de80bb27 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 29ee22a2d2..d27bb07e6c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -03f9e50b15c9c2fb4636dee24c1491c45322578b9fed08c6f4360be07c5c3830 \ No newline at end of file +c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889 \ No newline at end of file From 68585ea342d09b1daef34f42d07c933ab6193382 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 9 Oct 2023 10:30:54 +0000 Subject: [PATCH 029/242] Rename SQLite3Jni to CApi to (A) reduce name prefix collisions with incoming classes and (B) align with its counterpart in the JS build. Remove the Canonical annotation because (A) the new code separation will inherently make that distinction and (B) the line between truly canonical and semi-canonical (e.g. differing in signature overloads) is blurry enough that consistent use of that annocation is becoming an unnecessary burden. FossilOrigin-Name: ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e --- ext/jni/GNUmakefile | 9 +- ext/jni/README.md | 2 +- ext/jni/src/c/sqlite3-jni.c | 8 +- ext/jni/src/c/sqlite3-jni.h | 2218 ++++++++--------- .../org/sqlite/jni/AuthorizerCallback.java | 2 +- .../org/sqlite/jni/AutoExtensionCallback.java | 2 +- .../org/sqlite/jni/BusyHandlerCallback.java | 2 +- .../sqlite/jni/{SQLite3Jni.java => CApi.java} | 260 +- .../src/org/sqlite/jni/CollationCallback.java | 2 +- .../sqlite/jni/CollationNeededCallback.java | 2 +- .../org/sqlite/jni/CommitHookCallback.java | 2 +- .../src/org/sqlite/jni/ConfigLogCallback.java | 2 +- .../org/sqlite/jni/ConfigSqllogCallback.java | 2 +- .../org/sqlite/jni/PrepareMultiCallback.java | 10 +- .../org/sqlite/jni/PreupdateHookCallback.java | 2 +- .../sqlite/jni/ProgressHandlerCallback.java | 2 +- ext/jni/src/org/sqlite/jni/ResultCode.java | 208 +- .../org/sqlite/jni/RollbackHookCallback.java | 2 +- ext/jni/src/org/sqlite/jni/SQLTester.java | 4 +- ext/jni/src/org/sqlite/jni/Tester1.java | 8 +- ext/jni/src/org/sqlite/jni/TesterFts5.java | 2 +- .../src/org/sqlite/jni/TraceV2Callback.java | 2 +- .../org/sqlite/jni/UpdateHookCallback.java | 2 +- .../org/sqlite/jni/annotation/Canonical.java | 48 - ext/jni/src/org/sqlite/jni/package-info.java | 2 +- ext/jni/src/org/sqlite/jni/sqlite3.java | 6 +- .../src/org/sqlite/jni/sqlite3_backup.java | 2 +- ext/jni/src/org/sqlite/jni/sqlite3_blob.java | 2 +- .../src/org/sqlite/jni/sqlite3_context.java | 2 +- ext/jni/src/org/sqlite/jni/sqlite3_stmt.java | 4 +- manifest | 71 +- manifest.uuid | 2 +- 32 files changed, 1296 insertions(+), 1598 deletions(-) rename ext/jni/src/org/sqlite/jni/{SQLite3Jni.java => CApi.java} (96%) delete mode 100644 ext/jni/src/org/sqlite/jni/annotation/Canonical.java diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 0ff9cb6289..661685b3f7 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -45,9 +45,9 @@ DISTCLEAN_FILES := $(dir.jni)/*~ $(dir.src.c)/*~ $(dir.src.jni)/*~ sqlite3-jni.h := $(dir.src.c)/sqlite3-jni.h .NOTPARALLEL: $(sqlite3-jni.h) -SQLite3Jni.java := src/org/sqlite/jni/SQLite3Jni.java +CApi.java := src/org/sqlite/jni/CApi.java SQLTester.java := src/org/sqlite/jni/SQLTester.java -SQLite3Jni.class := $(SQLite3Jni.java:.java=.class) +CApi.class := $(CApi.java:.java=.class) SQLTester.class := $(SQLTester.java:.java=.class) ######################################################################## @@ -78,7 +78,6 @@ $(bin.version-info): $(dir.tool)/version-info.c $(sqlite3.h) $(dir.top)/Makefile # Be explicit about which Java files to compile so that we can work on # in-progress files without requiring them to be in a compilable statae. JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ - annotation/Canonical.java \ annotation/NotNull.java \ annotation/Nullable.java \ AbstractCollationCallback.java \ @@ -101,7 +100,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ ScalarFunction.java \ SQLFunction.java \ CallbackProxy.java \ - SQLite3Jni.java \ + CApi.java \ TableColumnMetadata.java \ TraceV2Callback.java \ UpdateHookCallback.java \ @@ -243,7 +242,7 @@ $$(dir.bld.c)/org_sqlite_jni$(3)_$(2).h: $(1)/$(2).java endef # Invoke ADD_JNI_H once for each Java file which includes JNI # declarations: -$(eval $(call ADD_JNI_H,$(dir.src.jni),SQLite3Jni,)) +$(eval $(call ADD_JNI_H,$(dir.src.jni),CApi,)) $(eval $(call ADD_JNI_H,$(dir.src.jni),SQLTester,)) ifeq (1,$(enable.fts5)) $(eval $(call ADD_JNI_H,$(dir.src.fts5),Fts5ExtensionApi,_fts5)) diff --git a/ext/jni/README.md b/ext/jni/README.md index dfef061bcd..f2811fddb2 100644 --- a/ext/jni/README.md +++ b/ext/jni/README.md @@ -55,7 +55,7 @@ Hello World ```java import org.sqlite.jni.*; -import static org.sqlite.jni.SQLite3Jni.*; +import static org.sqlite.jni.CApi.*; ... diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index b7297f609f..ab8dac6442 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -10,7 +10,7 @@ ** ************************************************************************* ** This file implements the JNI bindings declared in -** org.sqlite.jni.SQLiteJni (from which sqlite3-jni.h is generated). +** org.sqlite.jni.CApi (from which sqlite3-jni.h is generated). */ /* @@ -161,7 +161,7 @@ ** prefix seen in this macro. */ #define JniFuncName(Suffix) \ - Java_org_sqlite_jni_SQLite3Jni_sqlite3_ ## Suffix + Java_org_sqlite_jni_CApi_sqlite3_ ## Suffix /* Prologue for JNI function declarations and definitions. */ #define JniDecl(ReturnType,Suffix) \ @@ -5661,11 +5661,11 @@ Java_org_sqlite_jni_SQLTester_installCustomExtensions(JniArgsEnvClass){ //////////////////////////////////////////////////////////////////////// /* -** Called during static init of the SQLite3Jni class to set up global +** Called during static init of the CApi class to set up global ** state. */ JNIEXPORT void JNICALL -Java_org_sqlite_jni_SQLite3Jni_init(JniArgsEnvClass){ +Java_org_sqlite_jni_CApi_init(JniArgsEnvClass){ jclass klazz; memset(&S3JniGlobal, 0, sizeof(S3JniGlobal)); diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 3bcbf2d01e..6d38adf06e 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1,2118 +1,2118 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ #include -/* Header for class org_sqlite_jni_SQLite3Jni */ +/* Header for class org_sqlite_jni_CApi */ -#ifndef _Included_org_sqlite_jni_SQLite3Jni -#define _Included_org_sqlite_jni_SQLite3Jni +#ifndef _Included_org_sqlite_jni_CApi +#define _Included_org_sqlite_jni_CApi #ifdef __cplusplus extern "C" { #endif -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_EXISTS -#define org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_EXISTS 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_READWRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_READWRITE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_READ -#define org_sqlite_jni_SQLite3Jni_SQLITE_ACCESS_READ 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DENY -#define org_sqlite_jni_SQLite3Jni_SQLITE_DENY 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IGNORE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IGNORE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_INDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_INDEX 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TABLE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_INDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_INDEX 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_TABLE 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_TRIGGER 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_VIEW -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TEMP_VIEW 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_TRIGGER 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_VIEW -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_VIEW 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DELETE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DELETE 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_INDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_INDEX 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TABLE 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_INDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_INDEX 12L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_TABLE 13L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_TRIGGER 14L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_VIEW -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TEMP_VIEW 15L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_TRIGGER 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_VIEW -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_VIEW 17L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INSERT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INSERT 18L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PRAGMA -#define org_sqlite_jni_SQLite3Jni_SQLITE_PRAGMA 19L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READ -#define org_sqlite_jni_SQLite3Jni_SQLITE_READ 20L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SELECT -#define org_sqlite_jni_SQLite3Jni_SQLITE_SELECT 21L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRANSACTION -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRANSACTION 22L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UPDATE -#define org_sqlite_jni_SQLite3Jni_SQLITE_UPDATE 23L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ATTACH -#define org_sqlite_jni_SQLite3Jni_SQLITE_ATTACH 24L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DETACH -#define org_sqlite_jni_SQLite3Jni_SQLITE_DETACH 25L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ALTER_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_ALTER_TABLE 26L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_REINDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_REINDEX 27L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ANALYZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_ANALYZE 28L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_VTABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CREATE_VTABLE 29L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DROP_VTABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DROP_VTABLE 30L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FUNCTION -#define org_sqlite_jni_SQLite3Jni_SQLITE_FUNCTION 31L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SAVEPOINT -#define org_sqlite_jni_SQLite3Jni_SQLITE_SAVEPOINT 32L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_RECURSIVE -#define org_sqlite_jni_SQLite3Jni_SQLITE_RECURSIVE 33L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATIC 0LL -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRANSIENT -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRANSIENT -1LL -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETSTART_INVERT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETSTART_INVERT 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_NOSAVEPOINT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_NOSAVEPOINT 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_INVERT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_INVERT 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_IGNORENOOP -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESETAPPLY_IGNORENOOP 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_DATA -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_DATA 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_NOTFOUND -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_NOTFOUND 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_CONFLICT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_CONFLICT 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_CONSTRAINT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_CONSTRAINT 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_FOREIGN_KEY -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_FOREIGN_KEY 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_OMIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_OMIT 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_REPLACE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_REPLACE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_ABORT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CHANGESET_ABORT 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SINGLETHREAD -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SINGLETHREAD 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MULTITHREAD -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MULTITHREAD 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SERIALIZED -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SERIALIZED 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MALLOC -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MALLOC 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETMALLOC -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETMALLOC 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SCRATCH -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SCRATCH 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PAGECACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PAGECACHE 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_HEAP -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_HEAP 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MEMSTATUS -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MEMSTATUS 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MUTEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MUTEX 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETMUTEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETMUTEX 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_LOOKASIDE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_LOOKASIDE 13L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE 14L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETPCACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETPCACHE 15L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_LOG -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_LOG 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_URI -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_URI 17L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE2 -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE2 18L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETPCACHE2 -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_GETPCACHE2 19L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_COVERING_INDEX_SCAN -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_COVERING_INDEX_SCAN 20L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SQLLOG -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SQLLOG 21L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MMAP_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MMAP_SIZE 22L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_WIN32_HEAPSIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_WIN32_HEAPSIZE 23L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE_HDRSZ -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PCACHE_HDRSZ 24L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PMASZ -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_PMASZ 25L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_STMTJRNL_SPILL -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_STMTJRNL_SPILL 26L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SMALL_MALLOC -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SMALL_MALLOC 27L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SORTERREF_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_SORTERREF_SIZE 28L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MEMDB_MAXSIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONFIG_MEMDB_MAXSIZE 29L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INTEGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_INTEGER 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FLOAT -#define org_sqlite_jni_SQLite3Jni_SQLITE_FLOAT 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TEXT -#define org_sqlite_jni_SQLite3Jni_SQLITE_TEXT 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_BLOB -#define org_sqlite_jni_SQLite3Jni_SQLITE_BLOB 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_NULL 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_MAINDBNAME -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_MAINDBNAME 1000L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LOOKASIDE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LOOKASIDE 1001L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_FKEY -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_FKEY 1002L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_TRIGGER 1003L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_QPSG -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_QPSG 1007L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_TRIGGER_EQP -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_TRIGGER_EQP 1008L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_RESET_DATABASE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_RESET_DATABASE 1009L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DEFENSIVE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DEFENSIVE 1010L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_WRITABLE_SCHEMA -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DQS_DML -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DQS_DML 1013L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DQS_DDL -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_DQS_DDL 1014L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_VIEW -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_ENABLE_VIEW 1015L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_TRUSTED_SCHEMA -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_STMT_SCANSTATUS -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_STMT_SCANSTATUS 1018L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_REVERSE_SCANORDER -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_REVERSE_SCANORDER 1019L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_MAX -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBCONFIG_MAX 1019L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_USED 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_USED 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_SCHEMA_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_SCHEMA_USED 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_STMT_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_STMT_USED 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_HIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_HIT 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_HIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_HIT 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_MISS -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_MISS 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_WRITE 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_DEFERRED_FKS -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_DEFERRED_FKS 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_USED_SHARED -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_SPILL -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_CACHE_SPILL 12L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_MAX -#define org_sqlite_jni_SQLite3Jni_SQLITE_DBSTATUS_MAX 12L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UTF8 -#define org_sqlite_jni_SQLite3Jni_SQLITE_UTF8 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UTF16LE -#define org_sqlite_jni_SQLite3Jni_SQLITE_UTF16LE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UTF16BE -#define org_sqlite_jni_SQLite3Jni_SQLITE_UTF16BE 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UTF16 -#define org_sqlite_jni_SQLite3Jni_SQLITE_UTF16 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_UTF16_ALIGNED -#define org_sqlite_jni_SQLite3Jni_SQLITE_UTF16_ALIGNED 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LOCKSTATE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LOCKSTATE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_GET_LOCKPROXYFILE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_GET_LOCKPROXYFILE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SET_LOCKPROXYFILE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SET_LOCKPROXYFILE 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LAST_ERRNO -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LAST_ERRNO 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SIZE_HINT -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SIZE_HINT 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CHUNK_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CHUNK_SIZE 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_FILE_POINTER -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_FILE_POINTER 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SYNC_OMITTED -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SYNC_OMITTED 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_AV_RETRY -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_AV_RETRY 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PERSIST_WAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PERSIST_WAL 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_OVERWRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_OVERWRITE 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_VFSNAME -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_VFSNAME 12L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_POWERSAFE_OVERWRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_POWERSAFE_OVERWRITE 13L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PRAGMA -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PRAGMA 14L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_BUSYHANDLER -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_BUSYHANDLER 15L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_TEMPFILENAME -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_TEMPFILENAME 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_MMAP_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_MMAP_SIZE 18L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_TRACE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_TRACE 19L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_HAS_MOVED -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_HAS_MOVED 20L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SYNC -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SYNC 21L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_COMMIT_PHASETWO -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_COMMIT_PHASETWO 22L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_SET_HANDLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_SET_HANDLE 23L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WAL_BLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WAL_BLOCK 24L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_ZIPVFS -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_ZIPVFS 25L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RBU -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RBU 26L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_VFS_POINTER -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_VFS_POINTER 27L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_JOURNAL_POINTER -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_JOURNAL_POINTER 28L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_GET_HANDLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_WIN32_GET_HANDLE 29L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PDB -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_PDB 30L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LOCK_TIMEOUT -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_LOCK_TIMEOUT 34L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_DATA_VERSION -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_DATA_VERSION 35L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SIZE_LIMIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_SIZE_LIMIT 36L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKPT_DONE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKPT_DONE 37L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RESERVE_BYTES -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RESERVE_BYTES 38L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKPT_START -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKPT_START 39L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_EXTERNAL_READER -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_EXTERNAL_READER 40L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKSM_FILE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_CKSM_FILE 41L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RESET_CACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_FCNTL_RESET_CACHE 42L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_NONE -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_NONE 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_SHARED -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_SHARED 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_RESERVED -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_RESERVED 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_PENDING -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_PENDING 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_EXCLUSIVE -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCK_EXCLUSIVE 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC512 -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC512 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC1K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC1K 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC2K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC2K 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC4K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC4K 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC8K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC8K 32L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC16K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC16K 64L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC32K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC32K 128L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC64K -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_ATOMIC64K 256L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_SAFE_APPEND -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_SAFE_APPEND 512L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_SEQUENTIAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_SEQUENTIAL 1024L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 2048L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_POWERSAFE_OVERWRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_POWERSAFE_OVERWRITE 4096L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_IMMUTABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_IMMUTABLE 8192L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_BATCH_ATOMIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOCAP_BATCH_ATOMIC 16384L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_LENGTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_LENGTH 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_SQL_LENGTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_SQL_LENGTH 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_COLUMN -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_COLUMN 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_EXPR_DEPTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_EXPR_DEPTH 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_COMPOUND_SELECT -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_COMPOUND_SELECT 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_VDBE_OP -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_VDBE_OP 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_FUNCTION_ARG -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_FUNCTION_ARG 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_ATTACHED -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_ATTACHED 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_LIKE_PATTERN_LENGTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_VARIABLE_NUMBER -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_VARIABLE_NUMBER 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_TRIGGER_DEPTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_TRIGGER_DEPTH 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_WORKER_THREADS -#define org_sqlite_jni_SQLite3Jni_SQLITE_LIMIT_WORKER_THREADS 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_READONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_READONLY 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_READWRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_READWRITE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_CREATE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_CREATE 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_URI -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_URI 64L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MEMORY -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MEMORY 128L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_NOMUTEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_NOMUTEX 32768L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_FULLMUTEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_FULLMUTEX 65536L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SHAREDCACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SHAREDCACHE 131072L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_PRIVATECACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_PRIVATECACHE 262144L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_EXRESCODE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_EXRESCODE 33554432L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_NOFOLLOW -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_NOFOLLOW 16777216L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MAIN_DB -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MAIN_DB 256L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MAIN_JOURNAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_MAIN_JOURNAL 2048L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TEMP_DB -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TEMP_DB 512L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TEMP_JOURNAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TEMP_JOURNAL 4096L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TRANSIENT_DB -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_TRANSIENT_DB 1024L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SUBJOURNAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SUBJOURNAL 8192L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SUPER_JOURNAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_SUPER_JOURNAL 16384L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_WAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_WAL 524288L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_DELETEONCLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_DELETEONCLOSE 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_EXCLUSIVE -#define org_sqlite_jni_SQLite3Jni_SQLITE_OPEN_EXCLUSIVE 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_PERSISTENT -#define org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_PERSISTENT 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_NORMALIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_NORMALIZE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_NO_VTAB -#define org_sqlite_jni_SQLite3Jni_SQLITE_PREPARE_NO_VTAB 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OK -#define org_sqlite_jni_SQLite3Jni_SQLITE_OK 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ERROR -#define org_sqlite_jni_SQLite3Jni_SQLITE_ERROR 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INTERNAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_INTERNAL 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PERM -#define org_sqlite_jni_SQLite3Jni_SQLITE_PERM 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ABORT -#define org_sqlite_jni_SQLite3Jni_SQLITE_ABORT 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_BUSY -#define org_sqlite_jni_SQLite3Jni_SQLITE_BUSY 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOMEM -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOMEM 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INTERRUPT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INTERRUPT 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR 10L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT 11L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOTFOUND -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOTFOUND 12L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_FULL 13L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN 14L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_PROTOCOL -#define org_sqlite_jni_SQLite3Jni_SQLITE_PROTOCOL 15L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_EMPTY -#define org_sqlite_jni_SQLite3Jni_SQLITE_EMPTY 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SCHEMA -#define org_sqlite_jni_SQLite3Jni_SQLITE_SCHEMA 17L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TOOBIG -#define org_sqlite_jni_SQLite3Jni_SQLITE_TOOBIG 18L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT 19L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_MISMATCH -#define org_sqlite_jni_SQLite3Jni_SQLITE_MISMATCH 20L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_MISUSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_MISUSE 21L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOLFS -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOLFS 22L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_AUTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_AUTH 23L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FORMAT -#define org_sqlite_jni_SQLite3Jni_SQLITE_FORMAT 24L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_RANGE -#define org_sqlite_jni_SQLite3Jni_SQLITE_RANGE 25L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOTADB -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOTADB 26L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE 27L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_WARNING -#define org_sqlite_jni_SQLite3Jni_SQLITE_WARNING 28L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ROW -#define org_sqlite_jni_SQLite3Jni_SQLITE_ROW 100L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DONE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DONE 101L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_MISSING_COLLSEQ -#define org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_MISSING_COLLSEQ 257L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_RETRY -#define org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_RETRY 513L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_SNAPSHOT -#define org_sqlite_jni_SQLite3Jni_SQLITE_ERROR_SNAPSHOT 769L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_READ -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_READ 266L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHORT_READ -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHORT_READ 522L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_WRITE 778L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_FSYNC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_FSYNC 1034L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DIR_FSYNC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DIR_FSYNC 1290L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_TRUNCATE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_TRUNCATE 1546L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_FSTAT -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_FSTAT 1802L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_UNLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_UNLOCK 2058L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_RDLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_RDLOCK 2314L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DELETE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DELETE 2570L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_BLOCKED -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_BLOCKED 2826L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_NOMEM -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_NOMEM 3082L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_ACCESS -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_ACCESS 3338L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CHECKRESERVEDLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CHECKRESERVEDLOCK 3594L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_LOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_LOCK 3850L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CLOSE 4106L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DIR_CLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DIR_CLOSE 4362L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMOPEN -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMOPEN 4618L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMSIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMSIZE 4874L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMLOCK 5130L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMMAP -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SHMMAP 5386L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SEEK -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_SEEK 5642L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DELETE_NOENT -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DELETE_NOENT 5898L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_MMAP -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_MMAP 6154L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_GETTEMPPATH -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_GETTEMPPATH 6410L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CONVPATH -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CONVPATH 6666L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_VNODE -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_VNODE 6922L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_AUTH -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_AUTH 7178L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_BEGIN_ATOMIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_BEGIN_ATOMIC 7434L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_COMMIT_ATOMIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_COMMIT_ATOMIC 7690L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_ROLLBACK_ATOMIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_ROLLBACK_ATOMIC 7946L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DATA -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_DATA 8202L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CORRUPTFS -#define org_sqlite_jni_SQLite3Jni_SQLITE_IOERR_CORRUPTFS 8458L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED_SHAREDCACHE -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED_SHAREDCACHE 262L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED_VTAB -#define org_sqlite_jni_SQLite3Jni_SQLITE_LOCKED_VTAB 518L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_RECOVERY -#define org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_RECOVERY 261L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_SNAPSHOT -#define org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_SNAPSHOT 517L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_TIMEOUT -#define org_sqlite_jni_SQLite3Jni_SQLITE_BUSY_TIMEOUT 773L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_NOTEMPDIR -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_NOTEMPDIR 270L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_ISDIR -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_ISDIR 526L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_FULLPATH -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_FULLPATH 782L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_CONVPATH -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_CONVPATH 1038L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_SYMLINK -#define org_sqlite_jni_SQLite3Jni_SQLITE_CANTOPEN_SYMLINK 1550L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_VTAB -#define org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_VTAB 267L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_SEQUENCE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_SEQUENCE 523L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_INDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_CORRUPT_INDEX 779L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_RECOVERY -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_RECOVERY 264L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_CANTLOCK -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_CANTLOCK 520L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_ROLLBACK -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_ROLLBACK 776L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_DBMOVED -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_DBMOVED 1032L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_CANTINIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_CANTINIT 1288L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_DIRECTORY -#define org_sqlite_jni_SQLite3Jni_SQLITE_READONLY_DIRECTORY 1544L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ABORT_ROLLBACK -#define org_sqlite_jni_SQLite3Jni_SQLITE_ABORT_ROLLBACK 516L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_CHECK -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_CHECK 275L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_COMMITHOOK -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_COMMITHOOK 531L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_FOREIGNKEY -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_FOREIGNKEY 787L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_FUNCTION -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_FUNCTION 1043L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_NOTNULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_NOTNULL 1299L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_PRIMARYKEY -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_PRIMARYKEY 1555L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_TRIGGER -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_TRIGGER 1811L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_UNIQUE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_UNIQUE 2067L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_VTAB -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_VTAB 2323L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_ROWID -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_ROWID 2579L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_PINNED -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_PINNED 2835L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_DATATYPE -#define org_sqlite_jni_SQLite3Jni_SQLITE_CONSTRAINT_DATATYPE 3091L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE_RECOVER_WAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE_RECOVER_WAL 283L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE_RECOVER_ROLLBACK -#define org_sqlite_jni_SQLite3Jni_SQLITE_NOTICE_RECOVER_ROLLBACK 539L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_WARNING_AUTOINDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_WARNING_AUTOINDEX 284L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_AUTH_USER -#define org_sqlite_jni_SQLite3Jni_SQLITE_AUTH_USER 279L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_OK_LOAD_PERMANENTLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_OK_LOAD_PERMANENTLY 256L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SERIALIZE_NOCOPY -#define org_sqlite_jni_SQLite3Jni_SQLITE_SERIALIZE_NOCOPY 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_FREEONCLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_FREEONCLOSE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_READONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_READONLY 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_RESIZEABLE -#define org_sqlite_jni_SQLite3Jni_SQLITE_DESERIALIZE_RESIZEABLE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SESSION_CONFIG_STRMSIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_SESSION_CONFIG_STRMSIZE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SESSION_OBJCONFIG_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_SESSION_OBJCONFIG_SIZE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MEMORY_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MEMORY_USED 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_USED -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_USED 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_OVERFLOW -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_OVERFLOW 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MALLOC_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MALLOC_SIZE 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PARSER_STACK -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PARSER_STACK 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_SIZE -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_PAGECACHE_SIZE 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MALLOC_COUNT -#define org_sqlite_jni_SQLite3Jni_SQLITE_STATUS_MALLOC_COUNT 9L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FULLSCAN_STEP -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FULLSCAN_STEP 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_SORT -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_SORT 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_AUTOINDEX -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_AUTOINDEX 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_VM_STEP -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_VM_STEP 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_REPREPARE -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_REPREPARE 5L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_RUN -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_RUN 6L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FILTER_MISS -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FILTER_MISS 7L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FILTER_HIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_FILTER_HIT 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_MEMUSED -#define org_sqlite_jni_SQLite3Jni_SQLITE_STMTSTATUS_MEMUSED 99L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_NORMAL -#define org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_NORMAL 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_FULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_FULL 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_DATAONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_SYNC_DATAONLY 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_STMT -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_STMT 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_PROFILE -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_PROFILE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_ROW -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_ROW 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_CLOSE -#define org_sqlite_jni_SQLite3Jni_SQLITE_TRACE_CLOSE 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TXN_NONE -#define org_sqlite_jni_SQLite3Jni_SQLITE_TXN_NONE 0L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TXN_READ -#define org_sqlite_jni_SQLite3Jni_SQLITE_TXN_READ 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_TXN_WRITE -#define org_sqlite_jni_SQLite3Jni_SQLITE_TXN_WRITE 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DETERMINISTIC -#define org_sqlite_jni_SQLite3Jni_SQLITE_DETERMINISTIC 2048L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_DIRECTONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_DIRECTONLY 524288L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INNOCUOUS -#define org_sqlite_jni_SQLite3Jni_SQLITE_INNOCUOUS 2097152L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_SCAN_UNIQUE -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_SCAN_UNIQUE 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_EQ -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_EQ 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GT 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LE -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LE 8L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LT 16L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GE -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GE 32L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_MATCH -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_MATCH 64L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LIKE -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LIKE 65L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GLOB -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_GLOB 66L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_REGEXP -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_REGEXP 67L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_NE -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_NE 68L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNOT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNOT 69L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNOTNULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNULL -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_ISNULL 71L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_IS -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_IS 72L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LIMIT -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_LIMIT 73L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_OFFSET -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_OFFSET 74L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_FUNCTION -#define org_sqlite_jni_SQLite3Jni_SQLITE_INDEX_CONSTRAINT_FUNCTION 150L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_CONSTRAINT_SUPPORT -#define org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_CONSTRAINT_SUPPORT 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_INNOCUOUS -#define org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_INNOCUOUS 2L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_DIRECTONLY -#define org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_DIRECTONLY 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_USES_ALL_SCHEMAS -#define org_sqlite_jni_SQLite3Jni_SQLITE_VTAB_USES_ALL_SCHEMAS 4L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_ROLLBACK -#define org_sqlite_jni_SQLite3Jni_SQLITE_ROLLBACK 1L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_FAIL -#define org_sqlite_jni_SQLite3Jni_SQLITE_FAIL 3L -#undef org_sqlite_jni_SQLite3Jni_SQLITE_REPLACE -#define org_sqlite_jni_SQLite3Jni_SQLITE_REPLACE 5L +#undef org_sqlite_jni_CApi_SQLITE_ACCESS_EXISTS +#define org_sqlite_jni_CApi_SQLITE_ACCESS_EXISTS 0L +#undef org_sqlite_jni_CApi_SQLITE_ACCESS_READWRITE +#define org_sqlite_jni_CApi_SQLITE_ACCESS_READWRITE 1L +#undef org_sqlite_jni_CApi_SQLITE_ACCESS_READ +#define org_sqlite_jni_CApi_SQLITE_ACCESS_READ 2L +#undef org_sqlite_jni_CApi_SQLITE_DENY +#define org_sqlite_jni_CApi_SQLITE_DENY 1L +#undef org_sqlite_jni_CApi_SQLITE_IGNORE +#define org_sqlite_jni_CApi_SQLITE_IGNORE 2L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_INDEX +#define org_sqlite_jni_CApi_SQLITE_CREATE_INDEX 1L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TABLE +#define org_sqlite_jni_CApi_SQLITE_CREATE_TABLE 2L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_INDEX +#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_INDEX 3L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TABLE +#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TABLE 4L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TRIGGER 5L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_VIEW +#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_VIEW 6L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_CREATE_TRIGGER 7L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_VIEW +#define org_sqlite_jni_CApi_SQLITE_CREATE_VIEW 8L +#undef org_sqlite_jni_CApi_SQLITE_DELETE +#define org_sqlite_jni_CApi_SQLITE_DELETE 9L +#undef org_sqlite_jni_CApi_SQLITE_DROP_INDEX +#define org_sqlite_jni_CApi_SQLITE_DROP_INDEX 10L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TABLE +#define org_sqlite_jni_CApi_SQLITE_DROP_TABLE 11L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_INDEX +#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_INDEX 12L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TABLE +#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TABLE 13L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TRIGGER 14L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_VIEW +#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_VIEW 15L +#undef org_sqlite_jni_CApi_SQLITE_DROP_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_DROP_TRIGGER 16L +#undef org_sqlite_jni_CApi_SQLITE_DROP_VIEW +#define org_sqlite_jni_CApi_SQLITE_DROP_VIEW 17L +#undef org_sqlite_jni_CApi_SQLITE_INSERT +#define org_sqlite_jni_CApi_SQLITE_INSERT 18L +#undef org_sqlite_jni_CApi_SQLITE_PRAGMA +#define org_sqlite_jni_CApi_SQLITE_PRAGMA 19L +#undef org_sqlite_jni_CApi_SQLITE_READ +#define org_sqlite_jni_CApi_SQLITE_READ 20L +#undef org_sqlite_jni_CApi_SQLITE_SELECT +#define org_sqlite_jni_CApi_SQLITE_SELECT 21L +#undef org_sqlite_jni_CApi_SQLITE_TRANSACTION +#define org_sqlite_jni_CApi_SQLITE_TRANSACTION 22L +#undef org_sqlite_jni_CApi_SQLITE_UPDATE +#define org_sqlite_jni_CApi_SQLITE_UPDATE 23L +#undef org_sqlite_jni_CApi_SQLITE_ATTACH +#define org_sqlite_jni_CApi_SQLITE_ATTACH 24L +#undef org_sqlite_jni_CApi_SQLITE_DETACH +#define org_sqlite_jni_CApi_SQLITE_DETACH 25L +#undef org_sqlite_jni_CApi_SQLITE_ALTER_TABLE +#define org_sqlite_jni_CApi_SQLITE_ALTER_TABLE 26L +#undef org_sqlite_jni_CApi_SQLITE_REINDEX +#define org_sqlite_jni_CApi_SQLITE_REINDEX 27L +#undef org_sqlite_jni_CApi_SQLITE_ANALYZE +#define org_sqlite_jni_CApi_SQLITE_ANALYZE 28L +#undef org_sqlite_jni_CApi_SQLITE_CREATE_VTABLE +#define org_sqlite_jni_CApi_SQLITE_CREATE_VTABLE 29L +#undef org_sqlite_jni_CApi_SQLITE_DROP_VTABLE +#define org_sqlite_jni_CApi_SQLITE_DROP_VTABLE 30L +#undef org_sqlite_jni_CApi_SQLITE_FUNCTION +#define org_sqlite_jni_CApi_SQLITE_FUNCTION 31L +#undef org_sqlite_jni_CApi_SQLITE_SAVEPOINT +#define org_sqlite_jni_CApi_SQLITE_SAVEPOINT 32L +#undef org_sqlite_jni_CApi_SQLITE_RECURSIVE +#define org_sqlite_jni_CApi_SQLITE_RECURSIVE 33L +#undef org_sqlite_jni_CApi_SQLITE_STATIC +#define org_sqlite_jni_CApi_SQLITE_STATIC 0LL +#undef org_sqlite_jni_CApi_SQLITE_TRANSIENT +#define org_sqlite_jni_CApi_SQLITE_TRANSIENT -1LL +#undef org_sqlite_jni_CApi_SQLITE_CHANGESETSTART_INVERT +#define org_sqlite_jni_CApi_SQLITE_CHANGESETSTART_INVERT 2L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT +#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT 1L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_INVERT +#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_INVERT 2L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP +#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP 4L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_DATA +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_DATA 1L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_NOTFOUND +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_NOTFOUND 2L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_CONFLICT +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_CONFLICT 3L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_CONSTRAINT +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_CONSTRAINT 4L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_FOREIGN_KEY +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_FOREIGN_KEY 5L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_OMIT +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_OMIT 0L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_REPLACE +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_REPLACE 1L +#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_ABORT +#define org_sqlite_jni_CApi_SQLITE_CHANGESET_ABORT 2L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SINGLETHREAD +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SINGLETHREAD 1L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MULTITHREAD +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MULTITHREAD 2L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SERIALIZED +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SERIALIZED 3L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MALLOC +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MALLOC 4L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETMALLOC +#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETMALLOC 5L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SCRATCH +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SCRATCH 6L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PAGECACHE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_PAGECACHE 7L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_HEAP +#define org_sqlite_jni_CApi_SQLITE_CONFIG_HEAP 8L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MEMSTATUS +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MEMSTATUS 9L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MUTEX +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MUTEX 10L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETMUTEX +#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETMUTEX 11L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_LOOKASIDE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_LOOKASIDE 13L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE 14L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE 15L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_LOG +#define org_sqlite_jni_CApi_SQLITE_CONFIG_LOG 16L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_URI +#define org_sqlite_jni_CApi_SQLITE_CONFIG_URI 17L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE2 +#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE2 18L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE2 +#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE2 19L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN +#define org_sqlite_jni_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN 20L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SQLLOG +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SQLLOG 21L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MMAP_SIZE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MMAP_SIZE 22L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE 23L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE_HDRSZ +#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE_HDRSZ 24L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PMASZ +#define org_sqlite_jni_CApi_SQLITE_CONFIG_PMASZ 25L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_STMTJRNL_SPILL +#define org_sqlite_jni_CApi_SQLITE_CONFIG_STMTJRNL_SPILL 26L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SMALL_MALLOC +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SMALL_MALLOC 27L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SORTERREF_SIZE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_SORTERREF_SIZE 28L +#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE +#define org_sqlite_jni_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE 29L +#undef org_sqlite_jni_CApi_SQLITE_INTEGER +#define org_sqlite_jni_CApi_SQLITE_INTEGER 1L +#undef org_sqlite_jni_CApi_SQLITE_FLOAT +#define org_sqlite_jni_CApi_SQLITE_FLOAT 2L +#undef org_sqlite_jni_CApi_SQLITE_TEXT +#define org_sqlite_jni_CApi_SQLITE_TEXT 3L +#undef org_sqlite_jni_CApi_SQLITE_BLOB +#define org_sqlite_jni_CApi_SQLITE_BLOB 4L +#undef org_sqlite_jni_CApi_SQLITE_NULL +#define org_sqlite_jni_CApi_SQLITE_NULL 5L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAINDBNAME +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAINDBNAME 1000L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LOOKASIDE +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LOOKASIDE 1001L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FKEY +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FKEY 1002L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER 1003L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_QPSG +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_QPSG 1007L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRIGGER_EQP +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRIGGER_EQP 1008L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_RESET_DATABASE +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_RESET_DATABASE 1009L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DEFENSIVE +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DEFENSIVE 1010L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DML +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DML 1013L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DDL +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DDL 1014L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_VIEW +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_VIEW 1015L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS 1018L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER 1019L +#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAX +#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAX 1019L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED 0L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED 1L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_SCHEMA_USED +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_SCHEMA_USED 2L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_STMT_USED +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_STMT_USED 3L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT 4L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_HIT +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_HIT 7L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_MISS +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_MISS 8L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_WRITE +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_WRITE 9L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_DEFERRED_FKS +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_DEFERRED_FKS 10L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_SPILL +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_SPILL 12L +#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_MAX +#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_MAX 12L +#undef org_sqlite_jni_CApi_SQLITE_UTF8 +#define org_sqlite_jni_CApi_SQLITE_UTF8 1L +#undef org_sqlite_jni_CApi_SQLITE_UTF16LE +#define org_sqlite_jni_CApi_SQLITE_UTF16LE 2L +#undef org_sqlite_jni_CApi_SQLITE_UTF16BE +#define org_sqlite_jni_CApi_SQLITE_UTF16BE 3L +#undef org_sqlite_jni_CApi_SQLITE_UTF16 +#define org_sqlite_jni_CApi_SQLITE_UTF16 4L +#undef org_sqlite_jni_CApi_SQLITE_UTF16_ALIGNED +#define org_sqlite_jni_CApi_SQLITE_UTF16_ALIGNED 8L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LOCKSTATE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_LOCKSTATE 1L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE 2L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE 3L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LAST_ERRNO +#define org_sqlite_jni_CApi_SQLITE_FCNTL_LAST_ERRNO 4L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_HINT +#define org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_HINT 5L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CHUNK_SIZE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_CHUNK_SIZE 6L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_FILE_POINTER +#define org_sqlite_jni_CApi_SQLITE_FCNTL_FILE_POINTER 7L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC_OMITTED +#define org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC_OMITTED 8L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_AV_RETRY +#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_AV_RETRY 9L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PERSIST_WAL +#define org_sqlite_jni_CApi_SQLITE_FCNTL_PERSIST_WAL 10L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_OVERWRITE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_OVERWRITE 11L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_VFSNAME +#define org_sqlite_jni_CApi_SQLITE_FCNTL_VFSNAME 12L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE 13L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PRAGMA +#define org_sqlite_jni_CApi_SQLITE_FCNTL_PRAGMA 14L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_BUSYHANDLER +#define org_sqlite_jni_CApi_SQLITE_FCNTL_BUSYHANDLER 15L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_TEMPFILENAME +#define org_sqlite_jni_CApi_SQLITE_FCNTL_TEMPFILENAME 16L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_MMAP_SIZE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_MMAP_SIZE 18L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_TRACE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_TRACE 19L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_HAS_MOVED +#define org_sqlite_jni_CApi_SQLITE_FCNTL_HAS_MOVED 20L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC +#define org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC 21L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_PHASETWO +#define org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_PHASETWO 22L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE 23L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WAL_BLOCK +#define org_sqlite_jni_CApi_SQLITE_FCNTL_WAL_BLOCK 24L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_ZIPVFS +#define org_sqlite_jni_CApi_SQLITE_FCNTL_ZIPVFS 25L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RBU +#define org_sqlite_jni_CApi_SQLITE_FCNTL_RBU 26L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_VFS_POINTER +#define org_sqlite_jni_CApi_SQLITE_FCNTL_VFS_POINTER 27L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_JOURNAL_POINTER +#define org_sqlite_jni_CApi_SQLITE_FCNTL_JOURNAL_POINTER 28L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE 29L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PDB +#define org_sqlite_jni_CApi_SQLITE_FCNTL_PDB 30L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LOCK_TIMEOUT +#define org_sqlite_jni_CApi_SQLITE_FCNTL_LOCK_TIMEOUT 34L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_DATA_VERSION +#define org_sqlite_jni_CApi_SQLITE_FCNTL_DATA_VERSION 35L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_LIMIT +#define org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_LIMIT 36L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_DONE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_DONE 37L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RESERVE_BYTES +#define org_sqlite_jni_CApi_SQLITE_FCNTL_RESERVE_BYTES 38L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_START +#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_START 39L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_EXTERNAL_READER +#define org_sqlite_jni_CApi_SQLITE_FCNTL_EXTERNAL_READER 40L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKSM_FILE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKSM_FILE 41L +#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RESET_CACHE +#define org_sqlite_jni_CApi_SQLITE_FCNTL_RESET_CACHE 42L +#undef org_sqlite_jni_CApi_SQLITE_LOCK_NONE +#define org_sqlite_jni_CApi_SQLITE_LOCK_NONE 0L +#undef org_sqlite_jni_CApi_SQLITE_LOCK_SHARED +#define org_sqlite_jni_CApi_SQLITE_LOCK_SHARED 1L +#undef org_sqlite_jni_CApi_SQLITE_LOCK_RESERVED +#define org_sqlite_jni_CApi_SQLITE_LOCK_RESERVED 2L +#undef org_sqlite_jni_CApi_SQLITE_LOCK_PENDING +#define org_sqlite_jni_CApi_SQLITE_LOCK_PENDING 3L +#undef org_sqlite_jni_CApi_SQLITE_LOCK_EXCLUSIVE +#define org_sqlite_jni_CApi_SQLITE_LOCK_EXCLUSIVE 4L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC 1L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC512 +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC512 2L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC1K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC1K 4L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC2K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC2K 8L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC4K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC4K 16L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC8K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC8K 32L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC16K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC16K 64L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC32K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC32K 128L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC64K +#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC64K 256L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_SAFE_APPEND +#define org_sqlite_jni_CApi_SQLITE_IOCAP_SAFE_APPEND 512L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_SEQUENTIAL +#define org_sqlite_jni_CApi_SQLITE_IOCAP_SEQUENTIAL 1024L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +#define org_sqlite_jni_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 2048L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE +#define org_sqlite_jni_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE 4096L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_IMMUTABLE +#define org_sqlite_jni_CApi_SQLITE_IOCAP_IMMUTABLE 8192L +#undef org_sqlite_jni_CApi_SQLITE_IOCAP_BATCH_ATOMIC +#define org_sqlite_jni_CApi_SQLITE_IOCAP_BATCH_ATOMIC 16384L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_LENGTH +#define org_sqlite_jni_CApi_SQLITE_LIMIT_LENGTH 0L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_SQL_LENGTH +#define org_sqlite_jni_CApi_SQLITE_LIMIT_SQL_LENGTH 1L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_COLUMN +#define org_sqlite_jni_CApi_SQLITE_LIMIT_COLUMN 2L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_EXPR_DEPTH +#define org_sqlite_jni_CApi_SQLITE_LIMIT_EXPR_DEPTH 3L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_COMPOUND_SELECT +#define org_sqlite_jni_CApi_SQLITE_LIMIT_COMPOUND_SELECT 4L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_VDBE_OP +#define org_sqlite_jni_CApi_SQLITE_LIMIT_VDBE_OP 5L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_FUNCTION_ARG +#define org_sqlite_jni_CApi_SQLITE_LIMIT_FUNCTION_ARG 6L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_ATTACHED +#define org_sqlite_jni_CApi_SQLITE_LIMIT_ATTACHED 7L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH +#define org_sqlite_jni_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_VARIABLE_NUMBER +#define org_sqlite_jni_CApi_SQLITE_LIMIT_VARIABLE_NUMBER 9L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_TRIGGER_DEPTH +#define org_sqlite_jni_CApi_SQLITE_LIMIT_TRIGGER_DEPTH 10L +#undef org_sqlite_jni_CApi_SQLITE_LIMIT_WORKER_THREADS +#define org_sqlite_jni_CApi_SQLITE_LIMIT_WORKER_THREADS 11L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_READONLY +#define org_sqlite_jni_CApi_SQLITE_OPEN_READONLY 1L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_READWRITE +#define org_sqlite_jni_CApi_SQLITE_OPEN_READWRITE 2L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_CREATE +#define org_sqlite_jni_CApi_SQLITE_OPEN_CREATE 4L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_URI +#define org_sqlite_jni_CApi_SQLITE_OPEN_URI 64L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_MEMORY +#define org_sqlite_jni_CApi_SQLITE_OPEN_MEMORY 128L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_NOMUTEX +#define org_sqlite_jni_CApi_SQLITE_OPEN_NOMUTEX 32768L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_FULLMUTEX +#define org_sqlite_jni_CApi_SQLITE_OPEN_FULLMUTEX 65536L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_SHAREDCACHE +#define org_sqlite_jni_CApi_SQLITE_OPEN_SHAREDCACHE 131072L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE +#define org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE 262144L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE +#define org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE 33554432L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW +#define org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW 16777216L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_DB +#define org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_DB 256L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_JOURNAL +#define org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_JOURNAL 2048L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_DB +#define org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_DB 512L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_JOURNAL +#define org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_JOURNAL 4096L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_TRANSIENT_DB +#define org_sqlite_jni_CApi_SQLITE_OPEN_TRANSIENT_DB 1024L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_SUBJOURNAL +#define org_sqlite_jni_CApi_SQLITE_OPEN_SUBJOURNAL 8192L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_SUPER_JOURNAL +#define org_sqlite_jni_CApi_SQLITE_OPEN_SUPER_JOURNAL 16384L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_WAL +#define org_sqlite_jni_CApi_SQLITE_OPEN_WAL 524288L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_DELETEONCLOSE +#define org_sqlite_jni_CApi_SQLITE_OPEN_DELETEONCLOSE 8L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXCLUSIVE +#define org_sqlite_jni_CApi_SQLITE_OPEN_EXCLUSIVE 16L +#undef org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT +#define org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT 1L +#undef org_sqlite_jni_CApi_SQLITE_PREPARE_NORMALIZE +#define org_sqlite_jni_CApi_SQLITE_PREPARE_NORMALIZE 2L +#undef org_sqlite_jni_CApi_SQLITE_PREPARE_NO_VTAB +#define org_sqlite_jni_CApi_SQLITE_PREPARE_NO_VTAB 4L +#undef org_sqlite_jni_CApi_SQLITE_OK +#define org_sqlite_jni_CApi_SQLITE_OK 0L +#undef org_sqlite_jni_CApi_SQLITE_ERROR +#define org_sqlite_jni_CApi_SQLITE_ERROR 1L +#undef org_sqlite_jni_CApi_SQLITE_INTERNAL +#define org_sqlite_jni_CApi_SQLITE_INTERNAL 2L +#undef org_sqlite_jni_CApi_SQLITE_PERM +#define org_sqlite_jni_CApi_SQLITE_PERM 3L +#undef org_sqlite_jni_CApi_SQLITE_ABORT +#define org_sqlite_jni_CApi_SQLITE_ABORT 4L +#undef org_sqlite_jni_CApi_SQLITE_BUSY +#define org_sqlite_jni_CApi_SQLITE_BUSY 5L +#undef org_sqlite_jni_CApi_SQLITE_LOCKED +#define org_sqlite_jni_CApi_SQLITE_LOCKED 6L +#undef org_sqlite_jni_CApi_SQLITE_NOMEM +#define org_sqlite_jni_CApi_SQLITE_NOMEM 7L +#undef org_sqlite_jni_CApi_SQLITE_READONLY +#define org_sqlite_jni_CApi_SQLITE_READONLY 8L +#undef org_sqlite_jni_CApi_SQLITE_INTERRUPT +#define org_sqlite_jni_CApi_SQLITE_INTERRUPT 9L +#undef org_sqlite_jni_CApi_SQLITE_IOERR +#define org_sqlite_jni_CApi_SQLITE_IOERR 10L +#undef org_sqlite_jni_CApi_SQLITE_CORRUPT +#define org_sqlite_jni_CApi_SQLITE_CORRUPT 11L +#undef org_sqlite_jni_CApi_SQLITE_NOTFOUND +#define org_sqlite_jni_CApi_SQLITE_NOTFOUND 12L +#undef org_sqlite_jni_CApi_SQLITE_FULL +#define org_sqlite_jni_CApi_SQLITE_FULL 13L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN 14L +#undef org_sqlite_jni_CApi_SQLITE_PROTOCOL +#define org_sqlite_jni_CApi_SQLITE_PROTOCOL 15L +#undef org_sqlite_jni_CApi_SQLITE_EMPTY +#define org_sqlite_jni_CApi_SQLITE_EMPTY 16L +#undef org_sqlite_jni_CApi_SQLITE_SCHEMA +#define org_sqlite_jni_CApi_SQLITE_SCHEMA 17L +#undef org_sqlite_jni_CApi_SQLITE_TOOBIG +#define org_sqlite_jni_CApi_SQLITE_TOOBIG 18L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT 19L +#undef org_sqlite_jni_CApi_SQLITE_MISMATCH +#define org_sqlite_jni_CApi_SQLITE_MISMATCH 20L +#undef org_sqlite_jni_CApi_SQLITE_MISUSE +#define org_sqlite_jni_CApi_SQLITE_MISUSE 21L +#undef org_sqlite_jni_CApi_SQLITE_NOLFS +#define org_sqlite_jni_CApi_SQLITE_NOLFS 22L +#undef org_sqlite_jni_CApi_SQLITE_AUTH +#define org_sqlite_jni_CApi_SQLITE_AUTH 23L +#undef org_sqlite_jni_CApi_SQLITE_FORMAT +#define org_sqlite_jni_CApi_SQLITE_FORMAT 24L +#undef org_sqlite_jni_CApi_SQLITE_RANGE +#define org_sqlite_jni_CApi_SQLITE_RANGE 25L +#undef org_sqlite_jni_CApi_SQLITE_NOTADB +#define org_sqlite_jni_CApi_SQLITE_NOTADB 26L +#undef org_sqlite_jni_CApi_SQLITE_NOTICE +#define org_sqlite_jni_CApi_SQLITE_NOTICE 27L +#undef org_sqlite_jni_CApi_SQLITE_WARNING +#define org_sqlite_jni_CApi_SQLITE_WARNING 28L +#undef org_sqlite_jni_CApi_SQLITE_ROW +#define org_sqlite_jni_CApi_SQLITE_ROW 100L +#undef org_sqlite_jni_CApi_SQLITE_DONE +#define org_sqlite_jni_CApi_SQLITE_DONE 101L +#undef org_sqlite_jni_CApi_SQLITE_ERROR_MISSING_COLLSEQ +#define org_sqlite_jni_CApi_SQLITE_ERROR_MISSING_COLLSEQ 257L +#undef org_sqlite_jni_CApi_SQLITE_ERROR_RETRY +#define org_sqlite_jni_CApi_SQLITE_ERROR_RETRY 513L +#undef org_sqlite_jni_CApi_SQLITE_ERROR_SNAPSHOT +#define org_sqlite_jni_CApi_SQLITE_ERROR_SNAPSHOT 769L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_READ +#define org_sqlite_jni_CApi_SQLITE_IOERR_READ 266L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHORT_READ +#define org_sqlite_jni_CApi_SQLITE_IOERR_SHORT_READ 522L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_WRITE +#define org_sqlite_jni_CApi_SQLITE_IOERR_WRITE 778L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_FSYNC +#define org_sqlite_jni_CApi_SQLITE_IOERR_FSYNC 1034L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_DIR_FSYNC +#define org_sqlite_jni_CApi_SQLITE_IOERR_DIR_FSYNC 1290L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_TRUNCATE +#define org_sqlite_jni_CApi_SQLITE_IOERR_TRUNCATE 1546L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_FSTAT +#define org_sqlite_jni_CApi_SQLITE_IOERR_FSTAT 1802L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_UNLOCK +#define org_sqlite_jni_CApi_SQLITE_IOERR_UNLOCK 2058L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_RDLOCK +#define org_sqlite_jni_CApi_SQLITE_IOERR_RDLOCK 2314L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_DELETE +#define org_sqlite_jni_CApi_SQLITE_IOERR_DELETE 2570L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_BLOCKED +#define org_sqlite_jni_CApi_SQLITE_IOERR_BLOCKED 2826L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_NOMEM +#define org_sqlite_jni_CApi_SQLITE_IOERR_NOMEM 3082L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_ACCESS +#define org_sqlite_jni_CApi_SQLITE_IOERR_ACCESS 3338L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK +#define org_sqlite_jni_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK 3594L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_LOCK +#define org_sqlite_jni_CApi_SQLITE_IOERR_LOCK 3850L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_CLOSE +#define org_sqlite_jni_CApi_SQLITE_IOERR_CLOSE 4106L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_DIR_CLOSE +#define org_sqlite_jni_CApi_SQLITE_IOERR_DIR_CLOSE 4362L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMOPEN +#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMOPEN 4618L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMSIZE +#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMSIZE 4874L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMLOCK +#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMLOCK 5130L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMMAP +#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMMAP 5386L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_SEEK +#define org_sqlite_jni_CApi_SQLITE_IOERR_SEEK 5642L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_DELETE_NOENT +#define org_sqlite_jni_CApi_SQLITE_IOERR_DELETE_NOENT 5898L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_MMAP +#define org_sqlite_jni_CApi_SQLITE_IOERR_MMAP 6154L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_GETTEMPPATH +#define org_sqlite_jni_CApi_SQLITE_IOERR_GETTEMPPATH 6410L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_CONVPATH +#define org_sqlite_jni_CApi_SQLITE_IOERR_CONVPATH 6666L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_VNODE +#define org_sqlite_jni_CApi_SQLITE_IOERR_VNODE 6922L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_AUTH +#define org_sqlite_jni_CApi_SQLITE_IOERR_AUTH 7178L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_BEGIN_ATOMIC +#define org_sqlite_jni_CApi_SQLITE_IOERR_BEGIN_ATOMIC 7434L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_COMMIT_ATOMIC +#define org_sqlite_jni_CApi_SQLITE_IOERR_COMMIT_ATOMIC 7690L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC +#define org_sqlite_jni_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC 7946L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_DATA +#define org_sqlite_jni_CApi_SQLITE_IOERR_DATA 8202L +#undef org_sqlite_jni_CApi_SQLITE_IOERR_CORRUPTFS +#define org_sqlite_jni_CApi_SQLITE_IOERR_CORRUPTFS 8458L +#undef org_sqlite_jni_CApi_SQLITE_LOCKED_SHAREDCACHE +#define org_sqlite_jni_CApi_SQLITE_LOCKED_SHAREDCACHE 262L +#undef org_sqlite_jni_CApi_SQLITE_LOCKED_VTAB +#define org_sqlite_jni_CApi_SQLITE_LOCKED_VTAB 518L +#undef org_sqlite_jni_CApi_SQLITE_BUSY_RECOVERY +#define org_sqlite_jni_CApi_SQLITE_BUSY_RECOVERY 261L +#undef org_sqlite_jni_CApi_SQLITE_BUSY_SNAPSHOT +#define org_sqlite_jni_CApi_SQLITE_BUSY_SNAPSHOT 517L +#undef org_sqlite_jni_CApi_SQLITE_BUSY_TIMEOUT +#define org_sqlite_jni_CApi_SQLITE_BUSY_TIMEOUT 773L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_NOTEMPDIR +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_NOTEMPDIR 270L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_ISDIR +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_ISDIR 526L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_FULLPATH +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_FULLPATH 782L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_CONVPATH +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_CONVPATH 1038L +#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_SYMLINK +#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_SYMLINK 1550L +#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_VTAB +#define org_sqlite_jni_CApi_SQLITE_CORRUPT_VTAB 267L +#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_SEQUENCE +#define org_sqlite_jni_CApi_SQLITE_CORRUPT_SEQUENCE 523L +#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_INDEX +#define org_sqlite_jni_CApi_SQLITE_CORRUPT_INDEX 779L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_RECOVERY +#define org_sqlite_jni_CApi_SQLITE_READONLY_RECOVERY 264L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_CANTLOCK +#define org_sqlite_jni_CApi_SQLITE_READONLY_CANTLOCK 520L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_ROLLBACK +#define org_sqlite_jni_CApi_SQLITE_READONLY_ROLLBACK 776L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_DBMOVED +#define org_sqlite_jni_CApi_SQLITE_READONLY_DBMOVED 1032L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_CANTINIT +#define org_sqlite_jni_CApi_SQLITE_READONLY_CANTINIT 1288L +#undef org_sqlite_jni_CApi_SQLITE_READONLY_DIRECTORY +#define org_sqlite_jni_CApi_SQLITE_READONLY_DIRECTORY 1544L +#undef org_sqlite_jni_CApi_SQLITE_ABORT_ROLLBACK +#define org_sqlite_jni_CApi_SQLITE_ABORT_ROLLBACK 516L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_CHECK +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_CHECK 275L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_COMMITHOOK +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_COMMITHOOK 531L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FOREIGNKEY +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FOREIGNKEY 787L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FUNCTION +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FUNCTION 1043L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_NOTNULL +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_NOTNULL 1299L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PRIMARYKEY +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PRIMARYKEY 1555L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_TRIGGER +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_TRIGGER 1811L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_UNIQUE +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_UNIQUE 2067L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_VTAB +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_VTAB 2323L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_ROWID +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_ROWID 2579L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PINNED +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PINNED 2835L +#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_DATATYPE +#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_DATATYPE 3091L +#undef org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_WAL +#define org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_WAL 283L +#undef org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK +#define org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK 539L +#undef org_sqlite_jni_CApi_SQLITE_WARNING_AUTOINDEX +#define org_sqlite_jni_CApi_SQLITE_WARNING_AUTOINDEX 284L +#undef org_sqlite_jni_CApi_SQLITE_AUTH_USER +#define org_sqlite_jni_CApi_SQLITE_AUTH_USER 279L +#undef org_sqlite_jni_CApi_SQLITE_OK_LOAD_PERMANENTLY +#define org_sqlite_jni_CApi_SQLITE_OK_LOAD_PERMANENTLY 256L +#undef org_sqlite_jni_CApi_SQLITE_SERIALIZE_NOCOPY +#define org_sqlite_jni_CApi_SQLITE_SERIALIZE_NOCOPY 1L +#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_FREEONCLOSE +#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_FREEONCLOSE 1L +#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_READONLY +#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_READONLY 4L +#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_RESIZEABLE +#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_RESIZEABLE 2L +#undef org_sqlite_jni_CApi_SQLITE_SESSION_CONFIG_STRMSIZE +#define org_sqlite_jni_CApi_SQLITE_SESSION_CONFIG_STRMSIZE 1L +#undef org_sqlite_jni_CApi_SQLITE_SESSION_OBJCONFIG_SIZE +#define org_sqlite_jni_CApi_SQLITE_SESSION_OBJCONFIG_SIZE 1L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_MEMORY_USED +#define org_sqlite_jni_CApi_SQLITE_STATUS_MEMORY_USED 0L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_USED +#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_USED 1L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW +#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW 2L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_SIZE +#define org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_SIZE 5L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_PARSER_STACK +#define org_sqlite_jni_CApi_SQLITE_STATUS_PARSER_STACK 6L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_SIZE +#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_SIZE 7L +#undef org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_COUNT +#define org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_COUNT 9L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP 1L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_SORT +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_SORT 2L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_AUTOINDEX +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_AUTOINDEX 3L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_VM_STEP +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_VM_STEP 4L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_REPREPARE +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_REPREPARE 5L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_RUN +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_RUN 6L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_MISS +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_MISS 7L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_HIT +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_HIT 8L +#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_MEMUSED +#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_MEMUSED 99L +#undef org_sqlite_jni_CApi_SQLITE_SYNC_NORMAL +#define org_sqlite_jni_CApi_SQLITE_SYNC_NORMAL 2L +#undef org_sqlite_jni_CApi_SQLITE_SYNC_FULL +#define org_sqlite_jni_CApi_SQLITE_SYNC_FULL 3L +#undef org_sqlite_jni_CApi_SQLITE_SYNC_DATAONLY +#define org_sqlite_jni_CApi_SQLITE_SYNC_DATAONLY 16L +#undef org_sqlite_jni_CApi_SQLITE_TRACE_STMT +#define org_sqlite_jni_CApi_SQLITE_TRACE_STMT 1L +#undef org_sqlite_jni_CApi_SQLITE_TRACE_PROFILE +#define org_sqlite_jni_CApi_SQLITE_TRACE_PROFILE 2L +#undef org_sqlite_jni_CApi_SQLITE_TRACE_ROW +#define org_sqlite_jni_CApi_SQLITE_TRACE_ROW 4L +#undef org_sqlite_jni_CApi_SQLITE_TRACE_CLOSE +#define org_sqlite_jni_CApi_SQLITE_TRACE_CLOSE 8L +#undef org_sqlite_jni_CApi_SQLITE_TXN_NONE +#define org_sqlite_jni_CApi_SQLITE_TXN_NONE 0L +#undef org_sqlite_jni_CApi_SQLITE_TXN_READ +#define org_sqlite_jni_CApi_SQLITE_TXN_READ 1L +#undef org_sqlite_jni_CApi_SQLITE_TXN_WRITE +#define org_sqlite_jni_CApi_SQLITE_TXN_WRITE 2L +#undef org_sqlite_jni_CApi_SQLITE_DETERMINISTIC +#define org_sqlite_jni_CApi_SQLITE_DETERMINISTIC 2048L +#undef org_sqlite_jni_CApi_SQLITE_DIRECTONLY +#define org_sqlite_jni_CApi_SQLITE_DIRECTONLY 524288L +#undef org_sqlite_jni_CApi_SQLITE_INNOCUOUS +#define org_sqlite_jni_CApi_SQLITE_INNOCUOUS 2097152L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_SCAN_UNIQUE +#define org_sqlite_jni_CApi_SQLITE_INDEX_SCAN_UNIQUE 1L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_EQ +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_EQ 2L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GT +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GT 4L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LE +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LE 8L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LT +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LT 16L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GE +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GE 32L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_MATCH +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_MATCH 64L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIKE +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIKE 65L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GLOB +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GLOB 66L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP 67L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_NE +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_NE 68L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT 69L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL 71L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_IS +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_IS 72L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT 73L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET 74L +#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION +#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION 150L +#undef org_sqlite_jni_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT +#define org_sqlite_jni_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT 1L +#undef org_sqlite_jni_CApi_SQLITE_VTAB_INNOCUOUS +#define org_sqlite_jni_CApi_SQLITE_VTAB_INNOCUOUS 2L +#undef org_sqlite_jni_CApi_SQLITE_VTAB_DIRECTONLY +#define org_sqlite_jni_CApi_SQLITE_VTAB_DIRECTONLY 3L +#undef org_sqlite_jni_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS +#define org_sqlite_jni_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS 4L +#undef org_sqlite_jni_CApi_SQLITE_ROLLBACK +#define org_sqlite_jni_CApi_SQLITE_ROLLBACK 1L +#undef org_sqlite_jni_CApi_SQLITE_FAIL +#define org_sqlite_jni_CApi_SQLITE_FAIL 3L +#undef org_sqlite_jni_CApi_SQLITE_REPLACE +#define org_sqlite_jni_CApi_SQLITE_REPLACE 5L /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: init * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_init +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_init (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_java_uncache_thread * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1java_1uncache_1thread +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1java_1uncache_1thread (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_aggregate_context * Signature: (Lorg/sqlite/jni/sqlite3_context;Z)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1aggregate_1context +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1aggregate_1context (JNIEnv *, jclass, jobject, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_auto_extension * Signature: (Lorg/sqlite/jni/AutoExtensionCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1auto_1extension +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1auto_1extension (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_backup_finish * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1finish +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1finish (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_backup_init * Signature: (JLjava/lang/String;JLjava/lang/String;)Lorg/sqlite/jni/sqlite3_backup; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1init +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1init (JNIEnv *, jclass, jlong, jstring, jlong, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_backup_pagecount * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1pagecount +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1pagecount (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_backup_remaining * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1remaining +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1remaining (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_backup_step * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1step +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1step (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_blob * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1blob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1blob (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_double * Signature: (JID)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1double +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1double (JNIEnv *, jclass, jlong, jint, jdouble); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_int * Signature: (JII)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1int (JNIEnv *, jclass, jlong, jint, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_int64 * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1int64 (JNIEnv *, jclass, jlong, jint, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_java_object * Signature: (JILjava/lang/Object;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1java_1object +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1java_1object (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_null * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1null +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1null (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_parameter_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_parameter_index * Signature: (J[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1index +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1index (JNIEnv *, jclass, jlong, jbyteArray); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_parameter_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_text * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_text16 * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text16 (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_zeroblob * Signature: (JII)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1zeroblob (JNIEnv *, jclass, jlong, jint, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_zeroblob64 * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1zeroblob64 (JNIEnv *, jclass, jlong, jint, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_bytes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1bytes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_close * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1close +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1close (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_open * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/OutputPointer/sqlite3_blob;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1open +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1open (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_read * Signature: (J[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1read +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1read (JNIEnv *, jclass, jlong, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_reopen * Signature: (JJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1reopen +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1reopen (JNIEnv *, jclass, jlong, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_blob_write * Signature: (J[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1blob_1write +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1write (JNIEnv *, jclass, jlong, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_busy_handler * Signature: (JLorg/sqlite/jni/BusyHandlerCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1busy_1handler +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1busy_1handler (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_busy_timeout * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1busy_1timeout +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1busy_1timeout (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_cancel_auto_extension * Signature: (Lorg/sqlite/jni/AutoExtensionCallback;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1cancel_1auto_1extension +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1cancel_1auto_1extension (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_changes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1changes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_changes64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1changes64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_clear_bindings * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1clear_1bindings +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1clear_1bindings (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_close * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1close +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1close (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_close_v2 * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1close_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1close_1v2 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_blob * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1blob +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1blob (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_bytes * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1bytes (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_bytes16 * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1bytes16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1bytes16 (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_decltype * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1decltype +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1decltype (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_double * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1double +JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1double (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_int * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1int (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_int64 * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1int64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1int64 (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_database_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1database_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1database_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_origin_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1origin_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1origin_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_table_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1table_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1table_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_text * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1text +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1text (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_text16 * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1text16 +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1text16 (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_type * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1type (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_column_value * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Lorg/sqlite/jni/sqlite3_value; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1value +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1value (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_collation_needed * Signature: (JLorg/sqlite/jni/CollationNeededCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1collation_1needed +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1collation_1needed (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_commit_hook * Signature: (JLorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1commit_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1commit_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_compileoption_get * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1compileoption_1get +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1compileoption_1get (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_compileoption_used * Signature: (Ljava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1compileoption_1used +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1compileoption_1used (JNIEnv *, jclass, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_complete * Signature: ([B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1complete +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1complete (JNIEnv *, jclass, jbyteArray); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_config * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1config__I +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__I (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_config * Signature: (Lorg/sqlite/jni/ConfigSqllogCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1config__Lorg_sqlite_jni_ConfigSqllogCallback_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__Lorg_sqlite_jni_ConfigSqllogCallback_2 (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_config * Signature: (Lorg/sqlite/jni/ConfigLogCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1config__Lorg_sqlite_jni_ConfigLogCallback_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__Lorg_sqlite_jni_ConfigLogCallback_2 (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_context_db_handle * Signature: (Lorg/sqlite/jni/sqlite3_context;)Lorg/sqlite/jni/sqlite3; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1context_1db_1handle +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1context_1db_1handle (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_create_collation * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;ILorg/sqlite/jni/CollationCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1create_1collation +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1create_1collation (JNIEnv *, jclass, jobject, jstring, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_create_function * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;IILorg/sqlite/jni/SQLFunction;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1create_1function +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1create_1function (JNIEnv *, jclass, jobject, jstring, jint, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_data_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1data_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1data_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_config * Signature: (Lorg/sqlite/jni/sqlite3;IILorg/sqlite/jni/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_Int32_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_Int32_2 (JNIEnv *, jclass, jobject, jint, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_config * Signature: (Lorg/sqlite/jni/sqlite3;ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 (JNIEnv *, jclass, jobject, jint, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_filename * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1filename +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1filename (JNIEnv *, jclass, jobject, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_handle * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Lorg/sqlite/jni/sqlite3; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1handle +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1handle (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_release_memory * Signature: (Lorg/sqlite/jni/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1release_1memory +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1release_1memory (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_db_status * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1status (JNIEnv *, jclass, jobject, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_errcode * Signature: (Lorg/sqlite/jni/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errcode +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errcode (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_errmsg * Signature: (Lorg/sqlite/jni/sqlite3;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errmsg +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errmsg (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_error_offset * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1error_1offset +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1error_1offset (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_errstr * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errstr +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errstr (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_expanded_sql * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1expanded_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1expanded_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_extended_errcode * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1errcode +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1extended_1errcode (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_extended_result_codes * Signature: (Lorg/sqlite/jni/sqlite3;Z)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1result_1codes +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1extended_1result_1codes (JNIEnv *, jclass, jobject, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_get_autocommit * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocommit +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1get_1autocommit (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_get_auxdata * Signature: (Lorg/sqlite/jni/sqlite3_context;I)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1auxdata +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1get_1auxdata (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_finalize * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1finalize +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1finalize (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_initialize * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1initialize +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1initialize (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_interrupt * Signature: (Lorg/sqlite/jni/sqlite3;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1interrupt +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1interrupt (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_is_interrupted * Signature: (Lorg/sqlite/jni/sqlite3;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1is_1interrupted +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1is_1interrupted (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_keyword_check * Signature: (Ljava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1keyword_1check +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1check (JNIEnv *, jclass, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_keyword_count * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1keyword_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1count (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_keyword_name * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1keyword_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1name (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_last_insert_rowid * Signature: (Lorg/sqlite/jni/sqlite3;)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1last_1insert_1rowid +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1last_1insert_1rowid (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_libversion * Signature: ()Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1libversion +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1libversion (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_libversion_number * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1libversion_1number +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1libversion_1number (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_limit * Signature: (Lorg/sqlite/jni/sqlite3;II)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1limit +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1limit (JNIEnv *, jclass, jobject, jint, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_normalized_sql * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1normalized_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1normalized_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_open * Signature: (Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1open +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1open (JNIEnv *, jclass, jstring, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_open_v2 * Signature: (Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/sqlite3;ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1open_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1open_1v2 (JNIEnv *, jclass, jstring, jobject, jint, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_prepare * Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_prepare_v2 * Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare_1v2 (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_prepare_v3 * Signature: (J[BIILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare_1v3 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare_1v3 (JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_blobwrite * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1blobwrite +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1blobwrite (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_depth * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1depth +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1depth (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_hook * Signature: (JLorg/sqlite/jni/PreupdateHookCallback;)Lorg/sqlite/jni/PreupdateHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_new * Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1new +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1new (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_preupdate_old * Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1old +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1old (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_progress_handler * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/ProgressHandlerCallback;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1progress_1handler +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1progress_1handler (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_randomness * Signature: ([B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1randomness +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1randomness (JNIEnv *, jclass, jbyteArray); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_release_memory * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1release_1memory +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1release_1memory (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_reset * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1reset +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1reset (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_reset_auto_extension * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1reset_1auto_1extension +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1reset_1auto_1extension (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_double * Signature: (Lorg/sqlite/jni/sqlite3_context;D)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1double +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1double (JNIEnv *, jclass, jobject, jdouble); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_error * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1error +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_error_toobig * Signature: (Lorg/sqlite/jni/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1error_1toobig +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1toobig (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_error_nomem * Signature: (Lorg/sqlite/jni/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1error_1nomem +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1nomem (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_error_code * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1error_1code +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1code (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_null * Signature: (Lorg/sqlite/jni/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1null +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1null (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_int * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1int +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1int (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_int64 * Signature: (Lorg/sqlite/jni/sqlite3_context;J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1int64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1int64 (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_java_object * Signature: (Lorg/sqlite/jni/sqlite3_context;Ljava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1java_1object +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1java_1object (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_value * Signature: (Lorg/sqlite/jni/sqlite3_context;Lorg/sqlite/jni/sqlite3_value;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1value +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1value (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_zeroblob * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1zeroblob +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1zeroblob (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_zeroblob64 * Signature: (Lorg/sqlite/jni/sqlite3_context;J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1zeroblob64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1zeroblob64 (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_blob * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1blob +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1blob (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_blob64 * Signature: (Lorg/sqlite/jni/sqlite3_context;[BJ)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1blob64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1blob64 (JNIEnv *, jclass, jobject, jbyteArray, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_text * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1text +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1text (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_result_text64 * Signature: (Lorg/sqlite/jni/sqlite3_context;[BJI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1text64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1text64 (JNIEnv *, jclass, jobject, jbyteArray, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_rollback_hook * Signature: (JLorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1rollback_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1rollback_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_set_authorizer * Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/AuthorizerCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1set_1authorizer +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1authorizer (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_set_auxdata * Signature: (Lorg/sqlite/jni/sqlite3_context;ILjava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1set_1auxdata +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1auxdata (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_set_last_insert_rowid * Signature: (Lorg/sqlite/jni/sqlite3;J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1set_1last_1insert_1rowid +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1last_1insert_1rowid (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_shutdown * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1shutdown +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1shutdown (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_sleep * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1sleep +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sleep (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_sourceid * Signature: ()Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1sourceid +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sourceid (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_sql * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_status * Signature: (ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1status (JNIEnv *, jclass, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_status64 * Signature: (ILorg/sqlite/jni/OutputPointer/Int64;Lorg/sqlite/jni/OutputPointer/Int64;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1status64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1status64 (JNIEnv *, jclass, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_step * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1step +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1step (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_stmt_busy * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1busy +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1busy (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_stmt_explain * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1explain +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1explain (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_stmt_isexplain * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1isexplain +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1isexplain (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_stmt_readonly * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1readonly +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1readonly (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_stmt_status * Signature: (Lorg/sqlite/jni/sqlite3_stmt;IZ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1status (JNIEnv *, jclass, jobject, jint, jboolean); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_strglob * Signature: ([B[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1strglob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1strglob (JNIEnv *, jclass, jbyteArray, jbyteArray); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_strlike * Signature: ([B[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1strlike +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1strlike (JNIEnv *, jclass, jbyteArray, jbyteArray, jint); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_system_errno * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1system_1errno +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1system_1errno (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_table_column_metadata * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/String;Lorg/sqlite/jni/OutputPointer/String;Lorg/sqlite/jni/OutputPointer/Bool;Lorg/sqlite/jni/OutputPointer/Bool;Lorg/sqlite/jni/OutputPointer/Bool;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1table_1column_1metadata +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1table_1column_1metadata (JNIEnv *, jclass, jobject, jstring, jstring, jstring, jobject, jobject, jobject, jobject, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_threadsafe * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1threadsafe +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1threadsafe (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_total_changes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1total_1changes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_total_changes64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1total_1changes64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_trace_v2 * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/TraceV2Callback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1trace_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1trace_1v2 (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_txn_state * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1txn_1state +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1txn_1state (JNIEnv *, jclass, jobject, jstring); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_update_hook * Signature: (JLorg/sqlite/jni/UpdateHookCallback;)Lorg/sqlite/jni/UpdateHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1update_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1update_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_blob * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1blob +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1blob (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_bytes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1bytes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_bytes16 * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1bytes16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1bytes16 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_double * Signature: (J)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1double +JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1double (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_dup * Signature: (J)Lorg/sqlite/jni/sqlite3_value; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1dup +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1dup (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_encoding * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1encoding +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1encoding (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1free +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1free (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_frombind * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1frombind +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1frombind (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_int * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1int (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_int64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1int64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1int64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_java_object * Signature: (J)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1java_1object +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1java_1object (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_nochange * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1nochange +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1nochange (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_numeric_type * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1numeric_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1numeric_1type (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_subtype * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1subtype +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1subtype (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_text * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1text (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_text16 * Signature: (J)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1text16 +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1text16 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_value_type * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1type (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_SQLite3Jni + * Class: org_sqlite_jni_CApi * Method: sqlite3_jni_internal_details * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1jni_1internal_1details +JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1jni_1internal_1details (JNIEnv *, jclass); #ifdef __cplusplus diff --git a/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java b/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java index 6dbd9cb77b..cd3eb06c2a 100644 --- a/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java +++ b/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java @@ -15,7 +15,7 @@ package org.sqlite.jni; import org.sqlite.jni.annotation.*; /** - Callback for use with {@link SQLite3Jni#sqlite3_set_authorizer}. + Callback for use with {@link CApi#sqlite3_set_authorizer}. */ public interface AuthorizerCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java b/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java index 4a36941306..96a63cafb2 100644 --- a/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java +++ b/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with the {@link SQLite3Jni#sqlite3_auto_extension} + Callback for use with the {@link CApi#sqlite3_auto_extension} family of APIs. */ public interface AutoExtensionCallback extends CallbackProxy { diff --git a/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java b/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java index 30a5edc037..0f1670e17d 100644 --- a/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java +++ b/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_busy_handler}. + Callback for use with {@link CApi#sqlite3_busy_handler}. */ public interface BusyHandlerCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java b/ext/jni/src/org/sqlite/jni/CApi.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/SQLite3Jni.java rename to ext/jni/src/org/sqlite/jni/CApi.java index 866c9b9615..26b83d1971 100644 --- a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java +++ b/ext/jni/src/org/sqlite/jni/CApi.java @@ -27,7 +27,7 @@ import java.util.Arrays; use, a static import is recommended:
    {@code
    -  import static org.sqlite.jni.SQLite3Jni.*;
    +  import static org.sqlite.jni.CApi.*;
       }

    The C-side part can be found in sqlite3-jni.c. @@ -76,7 +76,7 @@ import java.util.Arrays; Java strings converted to byte arrays for encoding purposes are not NUL-terminated, and conversion to a Java byte array must sometimes be careful to add one. Functions which take a length do not require - this so long as the length is provided. Search the SQLite3Jni class + this so long as the length is provided. Search the CApi class for "\0" for many examples. @@ -90,12 +90,12 @@ import java.util.Arrays;

    https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html#modified-utf-8 */ -final class SQLite3Jni { +final class CApi { static { System.loadLibrary("sqlite3-jni"); } //! Not used - private SQLite3Jni(){} + private CApi(){} //! Called from static init code. private static native void init(); @@ -153,7 +153,6 @@ final class SQLite3Jni { allocation error. In all casses, 0 is considered the sentinel "not a key" value. */ - @Canonical public static native long sqlite3_aggregate_context(sqlite3_context cx, boolean initialize); /** @@ -172,24 +171,19 @@ final class SQLite3Jni {

    See the AutoExtension class docs for more information. */ - @Canonical public static native int sqlite3_auto_extension(@NotNull AutoExtensionCallback callback); - @Canonical static native int sqlite3_backup_finish(@NotNull long ptrToBackup); - @Canonical public static int sqlite3_backup_finish(@NotNull sqlite3_backup b){ return sqlite3_backup_finish(b.clearNativePointer()); } - @Canonical static native sqlite3_backup sqlite3_backup_init( @NotNull long ptrToDbDest, @NotNull String destTableName, @NotNull long ptrToDbSrc, @NotNull String srcTableName ); - @Canonical public static sqlite3_backup sqlite3_backup_init( @NotNull sqlite3 dbDest, @NotNull String destTableName, @NotNull sqlite3 dbSrc, @NotNull String srcTableName @@ -198,31 +192,24 @@ final class SQLite3Jni { dbSrc.getNativePointer(), srcTableName ); } - @Canonical static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup); - @Canonical public static int sqlite3_backup_pagecount(@NotNull sqlite3_backup b){ return sqlite3_backup_pagecount(b.getNativePointer()); } - @Canonical static native int sqlite3_backup_remaining(@NotNull long ptrToBackup); - @Canonical public static int sqlite3_backup_remaining(@NotNull sqlite3_backup b){ return sqlite3_backup_remaining(b.getNativePointer()); } - @Canonical static native int sqlite3_backup_step(@NotNull long ptrToBackup, int nPage); - @Canonical public static int sqlite3_backup_step(@NotNull sqlite3_backup b, int nPage){ return sqlite3_backup_step(b.getNativePointer(), nPage); } - @Canonical static native int sqlite3_bind_blob( @NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int n ); @@ -230,7 +217,6 @@ final class SQLite3Jni { /** Results are undefined if data is not null and n<0 || n>=data.length. */ - @Canonical public static int sqlite3_bind_blob( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int n ){ @@ -245,36 +231,30 @@ final class SQLite3Jni { : sqlite3_bind_blob(stmt.getNativePointer(), ndx, data, data.length); } - @Canonical static native int sqlite3_bind_double( @NotNull long ptrToStmt, int ndx, double v ); - @Canonical public static int sqlite3_bind_double( @NotNull sqlite3_stmt stmt, int ndx, double v ){ return sqlite3_bind_double(stmt.getNativePointer(), ndx, v); } - @Canonical static native int sqlite3_bind_int( @NotNull long ptrToStmt, int ndx, int v ); - @Canonical public static int sqlite3_bind_int( @NotNull sqlite3_stmt stmt, int ndx, int v ){ return sqlite3_bind_int(stmt.getNativePointer(), ndx, v); } - @Canonical static native int sqlite3_bind_int64( @NotNull long ptrToStmt, int ndx, long v ); - @Canonical public static int sqlite3_bind_int64(@NotNull sqlite3_stmt stmt, int ndx, long v){ return sqlite3_bind_int64( stmt.getNativePointer(), ndx, v ); } @@ -295,18 +275,14 @@ final class SQLite3Jni { return sqlite3_bind_java_object(stmt.getNativePointer(), ndx, o); } - @Canonical static native int sqlite3_bind_null(@NotNull long ptrToStmt, int ndx); - @Canonical public static int sqlite3_bind_null(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_bind_null(stmt.getNativePointer(), ndx); } - @Canonical static native int sqlite3_bind_parameter_count(@NotNull long ptrToStmt); - @Canonical public static int sqlite3_bind_parameter_count(@NotNull sqlite3_stmt stmt){ return sqlite3_bind_parameter_count(stmt.getNativePointer()); } @@ -321,12 +297,10 @@ final class SQLite3Jni { overload than to do that in C, so that signature is the public-facing one. */ - @Canonical static native int sqlite3_bind_parameter_index( @NotNull long ptrToStmt, @NotNull byte[] paramName ); - @Canonical public static int sqlite3_bind_parameter_index( @NotNull sqlite3_stmt stmt, @NotNull String paramName ){ @@ -334,17 +308,14 @@ final class SQLite3Jni { return null==utf8 ? 0 : sqlite3_bind_parameter_index(stmt.getNativePointer(), utf8); } - @Canonical static native String sqlite3_bind_parameter_name( @NotNull long ptrToStmt, int index ); - @Canonical public static String sqlite3_bind_parameter_name(@NotNull sqlite3_stmt stmt, int index){ return sqlite3_bind_parameter_name(stmt.getNativePointer(), index); } - @Canonical static native int sqlite3_bind_text( @NotNull long ptrToStmt, int ndx, @Nullable byte[] utf8, int maxBytes ); @@ -358,7 +329,6 @@ final class SQLite3Jni { maxBytes>=utf8.length. If maxBytes is negative then results are undefined if data is not null and does not contain a NUL byte. */ - @Canonical public static int sqlite3_bind_text( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] utf8, int maxBytes ){ @@ -389,7 +359,6 @@ final class SQLite3Jni { : sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, utf8.length); } - @Canonical static native int sqlite3_bind_text16( @NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int maxBytes ); @@ -399,7 +368,6 @@ final class SQLite3Jni { signature but requires that its input be encoded in UTF-16 in platform byte order. */ - @Canonical public static int sqlite3_bind_text16( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int maxBytes ){ @@ -432,48 +400,38 @@ final class SQLite3Jni { : sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, data.length); } - @Canonical static native int sqlite3_bind_zeroblob(@NotNull long ptrToStmt, int ndx, int n); - @Canonical public static int sqlite3_bind_zeroblob(@NotNull sqlite3_stmt stmt, int ndx, int n){ return sqlite3_bind_zeroblob(stmt.getNativePointer(), ndx, n); } - @Canonical static native int sqlite3_bind_zeroblob64( @NotNull long ptrToStmt, int ndx, long n ); - @Canonical public static int sqlite3_bind_zeroblob64(@NotNull sqlite3_stmt stmt, int ndx, long n){ return sqlite3_bind_zeroblob64(stmt.getNativePointer(), ndx, n); } - @Canonical static native int sqlite3_blob_bytes(@NotNull long ptrToBlob); - @Canonical public static int sqlite3_blob_bytes(@NotNull sqlite3_blob blob){ return sqlite3_blob_bytes(blob.getNativePointer()); } - @Canonical static native int sqlite3_blob_close(@Nullable long ptrToBlob); - @Canonical public static int sqlite3_blob_close(@Nullable sqlite3_blob blob){ return sqlite3_blob_close(blob.clearNativePointer()); } - @Canonical static native int sqlite3_blob_open( @NotNull long ptrToDb, @NotNull String dbName, @NotNull String tableName, @NotNull String columnName, long iRow, int flags, @NotNull OutputPointer.sqlite3_blob out ); - @Canonical public static int sqlite3_blob_open( @NotNull sqlite3 db, @NotNull String dbName, @NotNull String tableName, @NotNull String columnName, @@ -496,41 +454,34 @@ final class SQLite3Jni { return out.take(); }; - @Canonical static native int sqlite3_blob_read( @NotNull long ptrToBlob, @NotNull byte[] target, int iOffset ); - @Canonical public static int sqlite3_blob_read( @NotNull sqlite3_blob b, @NotNull byte[] target, int iOffset ){ return sqlite3_blob_read(b.getNativePointer(), target, iOffset); } - @Canonical static native int sqlite3_blob_reopen( @NotNull long ptrToBlob, long newRowId ); - @Canonical public static int sqlite3_blob_reopen(@NotNull sqlite3_blob b, long newRowId){ return sqlite3_blob_reopen(b.getNativePointer(), newRowId); } - @Canonical static native int sqlite3_blob_write( @NotNull long ptrToBlob, @NotNull byte[] bytes, int iOffset ); - @Canonical public static int sqlite3_blob_write( @NotNull sqlite3_blob b, @NotNull byte[] bytes, int iOffset ){ return sqlite3_blob_write(b.getNativePointer(), bytes, iOffset); } - @Canonical static native int sqlite3_busy_handler( @NotNull long ptrToDb, @Nullable BusyHandlerCallback handler ); @@ -540,54 +491,42 @@ final class SQLite3Jni { BusyHandlerCallback instance in place of a callback function. Pass it a null handler to clear the busy handler. */ - @Canonical public static int sqlite3_busy_handler( @NotNull sqlite3 db, @Nullable BusyHandlerCallback handler ){ return sqlite3_busy_handler(db.getNativePointer(), handler); } - @Canonical static native int sqlite3_busy_timeout(@NotNull long ptrToDb, int ms); - @Canonical public static int sqlite3_busy_timeout(@NotNull sqlite3 db, int ms){ return sqlite3_busy_timeout(db.getNativePointer(), ms); } - @Canonical public static native boolean sqlite3_cancel_auto_extension( @NotNull AutoExtensionCallback ax ); - @Canonical static native int sqlite3_changes(@NotNull long ptrToDb); - @Canonical public static int sqlite3_changes(@NotNull sqlite3 db){ return sqlite3_changes(db.getNativePointer()); } - @Canonical static native long sqlite3_changes64(@NotNull long ptrToDb); - @Canonical public static long sqlite3_changes64(@NotNull sqlite3 db){ return sqlite3_changes64(db.getNativePointer()); } - @Canonical static native int sqlite3_clear_bindings(@NotNull long ptrToStmt); - @Canonical public static int sqlite3_clear_bindings(@NotNull sqlite3_stmt stmt){ return sqlite3_clear_bindings(stmt.getNativePointer()); } - @Canonical static native int sqlite3_close(@Nullable long ptrToDb); - @Canonical public static int sqlite3_close(@Nullable sqlite3 db){ int rc = 0; if( null!=db ){ @@ -597,94 +536,72 @@ final class SQLite3Jni { return rc; } - @Canonical static native int sqlite3_close_v2(@Nullable long ptrToDb); - @Canonical public static int sqlite3_close_v2(@Nullable sqlite3 db){ return db==null ? 0 : sqlite3_close_v2(db.clearNativePointer()); } - @Canonical public static native byte[] sqlite3_column_blob( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical static native int sqlite3_column_bytes(@NotNull long ptrToStmt, int ndx); - @Canonical public static int sqlite3_column_bytes(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_bytes(stmt.getNativePointer(), ndx); } - @Canonical static native int sqlite3_column_bytes16(@NotNull long ptrToStmt, int ndx); - @Canonical public static int sqlite3_column_bytes16(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_bytes16(stmt.getNativePointer(), ndx); } - @Canonical static native int sqlite3_column_count(@NotNull long ptrToStmt); - @Canonical public static int sqlite3_column_count(@NotNull sqlite3_stmt stmt){ return sqlite3_column_count(stmt.getNativePointer()); } - @Canonical static native String sqlite3_column_decltype(@NotNull long ptrToStmt, int ndx); - @Canonical public static String sqlite3_column_decltype(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_decltype(stmt.getNativePointer(), ndx); } - @Canonical public static native double sqlite3_column_double( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical public static native int sqlite3_column_int( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical public static native long sqlite3_column_int64( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical static native String sqlite3_column_name(@NotNull long ptrToStmt, int ndx); - @Canonical public static String sqlite3_column_name(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_name(stmt.getNativePointer(), ndx); } - @Canonical static native String sqlite3_column_database_name(@NotNull long ptrToStmt, int ndx); - @Canonical public static String sqlite3_column_database_name(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_database_name(stmt.getNativePointer(), ndx); } - @Canonical static native String sqlite3_column_origin_name(@NotNull long ptrToStmt, int ndx); - @Canonical public static String sqlite3_column_origin_name(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_origin_name(stmt.getNativePointer(), ndx); } - @Canonical static native String sqlite3_column_table_name(@NotNull long ptrToStmt, int ndx); - @Canonical public static String sqlite3_column_table_name(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_table_name(stmt.getNativePointer(), ndx); } @@ -697,12 +614,10 @@ final class SQLite3Jni { @see #sqlite3_column_text16(sqlite3_stmt,int) */ - @Canonical public static native byte[] sqlite3_column_text( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical public static native String sqlite3_column_text16( @NotNull sqlite3_stmt stmt, int ndx ); @@ -744,20 +659,16 @@ final class SQLite3Jni { // return rv; // } - @Canonical static native int sqlite3_column_type(@NotNull long ptrToStmt, int ndx); - @Canonical public static int sqlite3_column_type(@NotNull sqlite3_stmt stmt, int ndx){ return sqlite3_column_type(stmt.getNativePointer(), ndx); } - @Canonical public static native sqlite3_value sqlite3_column_value( @NotNull sqlite3_stmt stmt, int ndx ); - @Canonical static native int sqlite3_collation_needed( @NotNull long ptrToDb, @Nullable CollationNeededCallback callback ); @@ -766,36 +677,30 @@ final class SQLite3Jni { This functions like C's sqlite3_collation_needed16() because Java's string type is inherently compatible with that interface. */ - @Canonical public static int sqlite3_collation_needed( @NotNull sqlite3 db, @Nullable CollationNeededCallback callback ){ return sqlite3_collation_needed(db.getNativePointer(), callback); } - @Canonical static native CommitHookCallback sqlite3_commit_hook( @NotNull long ptrToDb, @Nullable CommitHookCallback hook ); - @Canonical public static CommitHookCallback sqlite3_commit_hook( @NotNull sqlite3 db, @Nullable CommitHookCallback hook ){ return sqlite3_commit_hook(db.getNativePointer(), hook); } - @Canonical public static native String sqlite3_compileoption_get(int n); - @Canonical public static native boolean sqlite3_compileoption_used(String optName); /** This implementation is private because it's too easy to pass it non-NUL-terminated byte arrays from client code. */ - @Canonical public static native int sqlite3_complete( @NotNull byte[] nulTerminatedUtf8Sql ); @@ -804,7 +709,6 @@ final class SQLite3Jni { Unlike the C API, this returns SQLITE_MISUSE if its argument is null (as opposed to invoking UB). */ - @Canonical() static int sqlite3_complete(@NotNull String sql){ return sqlite3_complete( nulTerminateUtf8(sql) ); } @@ -825,9 +729,6 @@ final class SQLite3Jni { the rest of the library. This must not be called when any other library APIs are being called. */ - @Canonical(comment="Option subset: "+ - "SQLITE_CONFIG_SINGLETHREAD, SQLITE_CONFIG_MULTITHREAD, "+ - "SQLITE_CONFIG_SERIALIZED") public static native int sqlite3_config(int op); /** @@ -844,26 +745,22 @@ final class SQLite3Jni { the rest of the library. This must not be called when any other library APIs are being called. */ - @Canonical(comment="Option subset: SQLITE_CONFIG_SQLLOG") public static native int sqlite3_config( @Nullable ConfigSqllogCallback logger ); /** The sqlite3_config() overload for handling the SQLITE_CONFIG_LOG option. */ - @Canonical(comment="Option subset: SQLITE_CONFIG_LOG") public static native int sqlite3_config( @Nullable ConfigLogCallback logger ); /** Unlike the C API, this returns null if its argument is null (as opposed to invoking UB). */ - @Canonical public static native sqlite3 sqlite3_context_db_handle( @NotNull sqlite3_context cx ); - @Canonical public static native int sqlite3_create_collation( @NotNull sqlite3 db, @NotNull String name, int eTextRep, @NotNull CollationCallback col @@ -880,16 +777,13 @@ final class SQLite3Jni {

    Unlike the C API, this returns SQLITE_MISUSE null if its db or functionName arguments are null (as opposed to invoking UB). */ - @Canonical public static native int sqlite3_create_function( @NotNull sqlite3 db, @NotNull String functionName, int nArg, int eTextRep, @NotNull SQLFunction func ); - @Canonical static native int sqlite3_data_count(@NotNull long ptrToStmt); - @Canonical public static int sqlite3_data_count(@NotNull sqlite3_stmt stmt){ return sqlite3_data_count(stmt.getNativePointer()); } @@ -902,7 +796,6 @@ final class SQLite3Jni {

    Unlike the C API, this returns SQLITE_MISUSE if its db argument are null (as opposed to invoking UB). */ - @Canonical public static native int sqlite3_db_config( @NotNull sqlite3 db, int op, int onOff, @Nullable OutputPointer.Int32 out ); @@ -914,122 +807,92 @@ final class SQLite3Jni { SQLITE_DBCONFIG_MAINDBNAME, but that set of options may be extended in future versions. */ - @Canonical(comment="Supports only a subset of options.") public static native int sqlite3_db_config( @NotNull sqlite3 db, int op, @NotNull String val ); - @Canonical public static native String sqlite3_db_filename( @NotNull sqlite3 db, @NotNull String dbName ); - @Canonical public static native sqlite3 sqlite3_db_handle(@NotNull sqlite3_stmt stmt); - @Canonical public static native int sqlite3_db_release_memory(sqlite3 db); - @Canonical public static native int sqlite3_db_status( @NotNull sqlite3 db, int op, @NotNull OutputPointer.Int32 pCurrent, @NotNull OutputPointer.Int32 pHighwater, boolean reset ); - @Canonical public static native int sqlite3_errcode(@NotNull sqlite3 db); - @Canonical public static native String sqlite3_errmsg(@NotNull sqlite3 db); - @Canonical static native int sqlite3_error_offset(@NotNull long ptrToDb); /** Note that the returned byte offset values assume UTF-8-encoded inputs, so won't always match character offsets in Java Strings. */ - @Canonical public static int sqlite3_error_offset(@NotNull sqlite3 db){ return sqlite3_error_offset(db.getNativePointer()); } - @Canonical public static native String sqlite3_errstr(int resultCode); - @Canonical public static native String sqlite3_expanded_sql(@NotNull sqlite3_stmt stmt); - @Canonical static native int sqlite3_extended_errcode(@NotNull long ptrToDb); - @Canonical public static int sqlite3_extended_errcode(@NotNull sqlite3 db){ return sqlite3_extended_errcode(db.getNativePointer()); } - @Canonical public static native boolean sqlite3_extended_result_codes( @NotNull sqlite3 db, boolean onoff ); - @Canonical static native boolean sqlite3_get_autocommit(@NotNull long ptrToDb); - @Canonical public static boolean sqlite3_get_autocommit(@NotNull sqlite3 db){ return sqlite3_get_autocommit(db.getNativePointer()); } - @Canonical public static native Object sqlite3_get_auxdata( @NotNull sqlite3_context cx, int n ); - @Canonical static native int sqlite3_finalize(long ptrToStmt); - @Canonical public static int sqlite3_finalize(@NotNull sqlite3_stmt stmt){ return null==stmt ? 0 : sqlite3_finalize(stmt.clearNativePointer()); } - @Canonical public static native int sqlite3_initialize(); - @Canonical public static native void sqlite3_interrupt(@NotNull sqlite3 db); - @Canonical public static native boolean sqlite3_is_interrupted(@NotNull sqlite3 db); - @Canonical public static native boolean sqlite3_keyword_check(@NotNull String word); - @Canonical public static native int sqlite3_keyword_count(); - @Canonical public static native String sqlite3_keyword_name(int index); - @Canonical public static native long sqlite3_last_insert_rowid(@NotNull sqlite3 db); - @Canonical public static native String sqlite3_libversion(); - @Canonical public static native int sqlite3_libversion_number(); - @Canonical public static native int sqlite3_limit(@NotNull sqlite3 db, int id, int newVal); /** Only available if built with SQLITE_ENABLE_NORMALIZE. If not, it always returns null. */ - @Canonical public static native String sqlite3_normalized_sql(@NotNull sqlite3_stmt stmt); /** @@ -1045,7 +908,6 @@ final class SQLite3Jni { object and it is up to the caller to sqlite3_close() that db handle. */ - @Canonical public static native int sqlite3_open( @Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb ); @@ -1064,7 +926,6 @@ final class SQLite3Jni { return out.take(); }; - @Canonical public static native int sqlite3_open_v2( @Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb, int flags, @Nullable String zVfs @@ -1109,7 +970,6 @@ final class SQLite3Jni { more ways to shoot themselves in the foot without providing any real utility. */ - @Canonical static native int sqlite3_prepare( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1124,7 +984,6 @@ final class SQLite3Jni {

    Several overloads provided simplified call signatures. */ - @Canonical public static int sqlite3_prepare( @NotNull sqlite3 db, @NotNull byte[] sqlUtf8, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1169,7 +1028,6 @@ final class SQLite3Jni { /** @see #sqlite3_prepare */ - @Canonical static native int sqlite3_prepare_v2( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1181,7 +1039,6 @@ final class SQLite3Jni { output paramter is returned as the index offset into the given byte array at which SQL parsing stopped. */ - @Canonical public static int sqlite3_prepare_v2( @NotNull sqlite3 db, @NotNull byte[] sqlUtf8, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1223,7 +1080,6 @@ final class SQLite3Jni { /** @see #sqlite3_prepare */ - @Canonical static native int sqlite3_prepare_v3( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, int prepFlags, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1235,7 +1091,6 @@ final class SQLite3Jni { output paramter is returned as the index offset into the given byte array at which SQL parsing stopped. */ - @Canonical public static int sqlite3_prepare_v3( @NotNull sqlite3 db, @NotNull byte[] sqlUtf8, int prepFlags, @NotNull OutputPointer.sqlite3_stmt outStmt, @@ -1379,7 +1234,6 @@ final class SQLite3Jni { return sqlite3_prepare_multi(db, sql, 0, p); } - @Canonical static native int sqlite3_preupdate_blobwrite(@NotNull long ptrToDb); /** @@ -1387,12 +1241,10 @@ final class SQLite3Jni { acts as a proxy for C's sqlite3_preupdate_blobwrite(), else it returns SQLITE_MISUSE with no side effects. */ - @Canonical public static int sqlite3_preupdate_blobwrite(@NotNull sqlite3 db){ return sqlite3_preupdate_blobwrite(db.getNativePointer()); } - @Canonical static native int sqlite3_preupdate_count(@NotNull long ptrToDb); /** @@ -1400,12 +1252,10 @@ final class SQLite3Jni { acts as a proxy for C's sqlite3_preupdate_count(), else it returns SQLITE_MISUSE with no side effects. */ - @Canonical public static int sqlite3_preupdate_count(@NotNull sqlite3 db){ return sqlite3_preupdate_count(db.getNativePointer()); } - @Canonical static native int sqlite3_preupdate_depth(@NotNull long ptrToDb); /** @@ -1413,12 +1263,10 @@ final class SQLite3Jni { acts as a proxy for C's sqlite3_preupdate_depth(), else it returns SQLITE_MISUSE with no side effects. */ - @Canonical public static int sqlite3_preupdate_depth(@NotNull sqlite3 db){ return sqlite3_preupdate_depth(db.getNativePointer()); } - @Canonical static native PreupdateHookCallback sqlite3_preupdate_hook( @NotNull long ptrToDb, @Nullable PreupdateHookCallback hook ); @@ -1428,14 +1276,12 @@ final class SQLite3Jni { acts as a proxy for C's sqlite3_preupdate_hook(), else it returns null with no side effects. */ - @Canonical public static PreupdateHookCallback sqlite3_preupdate_hook( @NotNull sqlite3 db, @Nullable PreupdateHookCallback hook ){ return sqlite3_preupdate_hook(db.getNativePointer(), hook); } - @Canonical static native int sqlite3_preupdate_new(@NotNull long ptrToDb, int col, @NotNull OutputPointer.sqlite3_value out); @@ -1444,7 +1290,6 @@ final class SQLite3Jni { this acts as a proxy for C's sqlite3_preupdate_new(), else it returns SQLITE_MISUSE with no side effects. */ - @Canonical public static int sqlite3_preupdate_new(@NotNull sqlite3 db, int col, @NotNull OutputPointer.sqlite3_value out){ return sqlite3_preupdate_new(db.getNativePointer(), col, out); @@ -1460,7 +1305,6 @@ final class SQLite3Jni { return out.take(); } - @Canonical static native int sqlite3_preupdate_old(@NotNull long ptrToDb, int col, @NotNull OutputPointer.sqlite3_value out); @@ -1469,7 +1313,6 @@ final class SQLite3Jni { this acts as a proxy for C's sqlite3_preupdate_old(), else it returns SQLITE_MISUSE with no side effects. */ - @Canonical public static int sqlite3_preupdate_old(@NotNull sqlite3 db, int col, @NotNull OutputPointer.sqlite3_value out){ return sqlite3_preupdate_old(db.getNativePointer(), col, out); @@ -1485,18 +1328,14 @@ final class SQLite3Jni { return out.take(); } - @Canonical public static native void sqlite3_progress_handler( @NotNull sqlite3 db, int n, @Nullable ProgressHandlerCallback h ); - @Canonical public static native void sqlite3_randomness(byte[] target); - @Canonical public static native int sqlite3_release_memory(int n); - @Canonical public static native int sqlite3_reset(@NotNull sqlite3_stmt stmt); /** @@ -1504,10 +1343,8 @@ final class SQLite3Jni { extensions are currently running. (The JNI-level list of extensions cannot be manipulated while it is being traversed.) */ - @Canonical public static native void sqlite3_reset_auto_extension(); - @Canonical public static native void sqlite3_result_double( @NotNull sqlite3_context cx, double v ); @@ -1519,19 +1356,16 @@ final class SQLite3Jni { results in the C-level sqlite3_result_error() being called with a complaint about the invalid argument. */ - @Canonical static native void sqlite3_result_error( @NotNull sqlite3_context cx, @NotNull byte[] msg, int eTextRep ); - @Canonical public static void sqlite3_result_error( @NotNull sqlite3_context cx, @NotNull byte[] utf8 ){ sqlite3_result_error(cx, utf8, SQLITE_UTF8); } - @Canonical public static void sqlite3_result_error( @NotNull sqlite3_context cx, @NotNull String msg ){ @@ -1564,32 +1398,26 @@ final class SQLite3Jni { sqlite3_result_error(cx, e.toString()); } - @Canonical public static native void sqlite3_result_error_toobig( @NotNull sqlite3_context cx ); - @Canonical public static native void sqlite3_result_error_nomem( @NotNull sqlite3_context cx ); - @Canonical public static native void sqlite3_result_error_code( @NotNull sqlite3_context cx, int c ); - @Canonical public static native void sqlite3_result_null( @NotNull sqlite3_context cx ); - @Canonical public static native void sqlite3_result_int( @NotNull sqlite3_context cx, int v ); - @Canonical public static native void sqlite3_result_int64( @NotNull sqlite3_context cx, long v ); @@ -1674,17 +1502,14 @@ final class SQLite3Jni { else sqlite3_result_blob(cx, blob, blob.length); } - @Canonical public static native void sqlite3_result_value( @NotNull sqlite3_context cx, @NotNull sqlite3_value v ); - @Canonical public static native void sqlite3_result_zeroblob( @NotNull sqlite3_context cx, int n ); - @Canonical public static native int sqlite3_result_zeroblob64( @NotNull sqlite3_context cx, long n ); @@ -1693,12 +1518,10 @@ final class SQLite3Jni { This overload is private because its final parameter is arguably unnecessary in Java. */ - @Canonical public static native void sqlite3_result_blob( @NotNull sqlite3_context cx, @Nullable byte[] blob, int maxLen ); - @Canonical public static void sqlite3_result_blob( @NotNull sqlite3_context cx, @Nullable byte[] blob ){ @@ -1723,12 +1546,10 @@ final class SQLite3Jni {

    This overload is private because its final parameter is arguably unnecessary in Java.

    */ - @Canonical public static native void sqlite3_result_blob64( @NotNull sqlite3_context cx, @Nullable byte[] blob, long maxLen ); - @Canonical public static void sqlite3_result_blob64( @NotNull sqlite3_context cx, @Nullable byte[] blob ){ @@ -1739,19 +1560,16 @@ final class SQLite3Jni { This overload is private because its final parameter is arguably unnecessary in Java. */ - @Canonical public static native void sqlite3_result_text( @NotNull sqlite3_context cx, @Nullable byte[] utf8, int maxLen ); - @Canonical public static void sqlite3_result_text( @NotNull sqlite3_context cx, @Nullable byte[] utf8 ){ sqlite3_result_text(cx, utf8, null==utf8 ? 0 : utf8.length); } - @Canonical public static void sqlite3_result_text( @NotNull sqlite3_context cx, @Nullable String text ){ @@ -1785,7 +1603,6 @@ final class SQLite3Jni { This overload is private because its maxLength parameter is arguably unnecessary in Java. */ - @Canonical public static native void sqlite3_result_text64( @NotNull sqlite3_context cx, @Nullable byte[] text, long maxLength, int encoding @@ -1795,14 +1612,12 @@ final class SQLite3Jni { Sets the current UDF result to the given bytes, which are assumed be encoded in UTF-16 using the platform's byte order. */ - @Canonical public static void sqlite3_result_text16( @NotNull sqlite3_context cx, @Nullable byte[] utf16 ){ sqlite3_result_text64(cx, utf16, utf16.length, SQLITE_UTF16); } - @Canonical public static void sqlite3_result_text16( @NotNull sqlite3_context cx, @Nullable String text ){ @@ -1813,29 +1628,24 @@ final class SQLite3Jni { } } - @Canonical static native RollbackHookCallback sqlite3_rollback_hook( @NotNull long ptrToDb, @Nullable RollbackHookCallback hook ); - @Canonical public static RollbackHookCallback sqlite3_rollback_hook( @NotNull sqlite3 db, @Nullable RollbackHookCallback hook ){ return sqlite3_rollback_hook(db.getNativePointer(), hook); } - @Canonical public static native int sqlite3_set_authorizer( @NotNull sqlite3 db, @Nullable AuthorizerCallback auth ); - @Canonical public static native void sqlite3_set_auxdata( @NotNull sqlite3_context cx, int n, @Nullable Object data ); - @Canonical public static native void sqlite3_set_last_insert_rowid( @NotNull sqlite3 db, long rowid ); @@ -1850,58 +1660,44 @@ final class SQLite3Jni { to use those objects after this routine is called invoked undefined behavior. */ - @Canonical public static synchronized native int sqlite3_shutdown(); - @Canonical public static native int sqlite3_sleep(int ms); - @Canonical public static native String sqlite3_sourceid(); - @Canonical public static native String sqlite3_sql(@NotNull sqlite3_stmt stmt); //! Consider removing this. We can use sqlite3_status64() instead, // or use that one's impl with this one's name. - @Canonical public static native int sqlite3_status( int op, @NotNull OutputPointer.Int32 pCurrent, @NotNull OutputPointer.Int32 pHighwater, boolean reset ); - @Canonical public static native int sqlite3_status64( int op, @NotNull OutputPointer.Int64 pCurrent, @NotNull OutputPointer.Int64 pHighwater, boolean reset ); - @Canonical public static native int sqlite3_step(@NotNull sqlite3_stmt stmt); - @Canonical public static native boolean sqlite3_stmt_busy(@NotNull sqlite3_stmt stmt); - @Canonical static native int sqlite3_stmt_explain(@NotNull long ptrToStmt, int op); - @Canonical public static int sqlite3_stmt_explain(@NotNull sqlite3_stmt stmt, int op){ return sqlite3_stmt_explain(stmt.getNativePointer(), op); } - @Canonical static native int sqlite3_stmt_isexplain(@NotNull long ptrToStmt); - @Canonical public static int sqlite3_stmt_isexplain(@NotNull sqlite3_stmt stmt){ return sqlite3_stmt_isexplain(stmt.getNativePointer()); } - @Canonical public static native boolean sqlite3_stmt_readonly(@NotNull sqlite3_stmt stmt); - @Canonical public static native int sqlite3_stmt_status( @NotNull sqlite3_stmt stmt, int op, boolean reset ); @@ -1917,12 +1713,10 @@ final class SQLite3Jni { (sqlite3_strglob(String,String)) than to do that in C, so that signature is the public-facing one. */ - @Canonical public static native int sqlite3_strglob( @NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8 ); - @Canonical public static int sqlite3_strglob( @NotNull String glob, @NotNull String txt ){ @@ -1933,13 +1727,11 @@ final class SQLite3Jni { /** The LIKE counterpart of the private sqlite3_strglob() method. */ - @Canonical public static native int sqlite3_strlike( @NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8, int escChar ); - @Canonical public static int sqlite3_strlike( @NotNull String glob, @NotNull String txt, char escChar ){ @@ -1948,15 +1740,12 @@ final class SQLite3Jni { (int)escChar); } - @Canonical static native int sqlite3_system_errno(@NotNull long ptrToDb); - @Canonical public static int sqlite3_system_errno(@NotNull sqlite3 db){ return sqlite3_system_errno(db.getNativePointer()); } - @Canonical public static native int sqlite3_table_column_metadata( @NotNull sqlite3 db, @NotNull String zDbName, @NotNull String zTableName, @NotNull String zColumnName, @@ -1995,21 +1784,16 @@ final class SQLite3Jni { ) ? out : null; } - @Canonical public static native int sqlite3_threadsafe(); - @Canonical static native int sqlite3_total_changes(@NotNull long ptrToDb); - @Canonical public static int sqlite3_total_changes(@NotNull sqlite3 db){ return sqlite3_total_changes(db.getNativePointer()); } - @Canonical static native long sqlite3_total_changes64(@NotNull long ptrToDb); - @Canonical public static long sqlite3_total_changes64(@NotNull sqlite3 db){ return sqlite3_total_changes64(db.getNativePointer()); } @@ -2023,22 +1807,18 @@ final class SQLite3Jni { this implementation returns non-0 if initialization of the tracer mapping state fails (e.g. on OOM). */ - @Canonical public static native int sqlite3_trace_v2( @NotNull sqlite3 db, int traceMask, @Nullable TraceV2Callback tracer ); - @Canonical public static native int sqlite3_txn_state( @NotNull sqlite3 db, @Nullable String zSchema ); - @Canonical static native UpdateHookCallback sqlite3_update_hook( @NotNull long ptrToDb, @Nullable UpdateHookCallback hook ); - @Canonical public static UpdateHookCallback sqlite3_update_hook( @NotNull sqlite3 db, @Nullable UpdateHookCallback hook ){ @@ -2055,82 +1835,62 @@ final class SQLite3Jni { sqlite3_create_function(). */ - @Canonical static native byte[] sqlite3_value_blob(@NotNull long ptrToValue); - @Canonical public static byte[] sqlite3_value_blob(@NotNull sqlite3_value v){ return sqlite3_value_blob(v.getNativePointer()); } - @Canonical static native int sqlite3_value_bytes(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_bytes(@NotNull sqlite3_value v){ return sqlite3_value_bytes(v.getNativePointer()); } - @Canonical static native int sqlite3_value_bytes16(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_bytes16(@NotNull sqlite3_value v){ return sqlite3_value_bytes16(v.getNativePointer()); } - @Canonical static native double sqlite3_value_double(@NotNull long ptrToValue); - @Canonical public static double sqlite3_value_double(@NotNull sqlite3_value v){ return sqlite3_value_double(v.getNativePointer()); } - @Canonical static native sqlite3_value sqlite3_value_dup(@NotNull long ptrToValue); - @Canonical public static sqlite3_value sqlite3_value_dup(@NotNull sqlite3_value v){ return sqlite3_value_dup(v.getNativePointer()); } - @Canonical static native int sqlite3_value_encoding(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_encoding(@NotNull sqlite3_value v){ return sqlite3_value_encoding(v.getNativePointer()); } - @Canonical static native void sqlite3_value_free(@Nullable long ptrToValue); - @Canonical public static void sqlite3_value_free(@Nullable sqlite3_value v){ sqlite3_value_free(v.getNativePointer()); } - @Canonical static native boolean sqlite3_value_frombind(@NotNull long ptrToValue); - @Canonical public static boolean sqlite3_value_frombind(@NotNull sqlite3_value v){ return sqlite3_value_frombind(v.getNativePointer()); } - @Canonical static native int sqlite3_value_int(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_int(@NotNull sqlite3_value v){ return sqlite3_value_int(v.getNativePointer()); } - @Canonical static native long sqlite3_value_int64(@NotNull long ptrToValue); - @Canonical public static long sqlite3_value_int64(@NotNull sqlite3_value v){ return sqlite3_value_int64(v.getNativePointer()); } @@ -2161,31 +1921,24 @@ final class SQLite3Jni { return type.isInstance(o) ? (T)o : null; } - @Canonical static native int sqlite3_value_nochange(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_nochange(@NotNull sqlite3_value v){ return sqlite3_value_nochange(v.getNativePointer()); } - @Canonical static native int sqlite3_value_numeric_type(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_numeric_type(@NotNull sqlite3_value v){ return sqlite3_value_numeric_type(v.getNativePointer()); } - @Canonical static native int sqlite3_value_subtype(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_subtype(@NotNull sqlite3_value v){ return sqlite3_value_subtype(v.getNativePointer()); } - @Canonical static native byte[] sqlite3_value_text(@NotNull long ptrToValue); /** @@ -2194,23 +1947,18 @@ final class SQLite3Jni { null if the underlying C-level sqlite3_value_text() returns NULL or on allocation error. */ - @Canonical public static byte[] sqlite3_value_text(@NotNull sqlite3_value v){ return sqlite3_value_text(v.getNativePointer()); } - @Canonical static native String sqlite3_value_text16(@NotNull long ptrToValue); - @Canonical public static String sqlite3_value_text16(@NotNull sqlite3_value v){ return sqlite3_value_text16(v.getNativePointer()); } - @Canonical static native int sqlite3_value_type(@NotNull long ptrToValue); - @Canonical public static int sqlite3_value_type(@NotNull sqlite3_value v){ return sqlite3_value_type(v.getNativePointer()); } diff --git a/ext/jni/src/org/sqlite/jni/CollationCallback.java b/ext/jni/src/org/sqlite/jni/CollationCallback.java index 7f0e79a3fa..0e35296326 100644 --- a/ext/jni/src/org/sqlite/jni/CollationCallback.java +++ b/ext/jni/src/org/sqlite/jni/CollationCallback.java @@ -15,7 +15,7 @@ package org.sqlite.jni; import org.sqlite.jni.annotation.NotNull; /** - Callback for use with {@link SQLite3Jni#sqlite3_create_collation}. + Callback for use with {@link CApi#sqlite3_create_collation}. @see AbstractCollationCallback */ diff --git a/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java b/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java index b72cf1ba53..21b014ba11 100644 --- a/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java +++ b/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_collation_needed}. + Callback for use with {@link CApi#sqlite3_collation_needed}. */ public interface CollationNeededCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/CommitHookCallback.java b/ext/jni/src/org/sqlite/jni/CommitHookCallback.java index 2e9a68d25d..c6e4538bbd 100644 --- a/ext/jni/src/org/sqlite/jni/CommitHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/CommitHookCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_commit_hook}. + Callback for use with {@link CApi#sqlite3_commit_hook}. */ public interface CommitHookCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java b/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java index 2198f1e104..d5af70fa52 100644 --- a/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java +++ b/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java @@ -19,7 +19,7 @@ package org.sqlite.jni; public interface ConfigLogCallback { /** Must function as described for a C-level callback for - {@link SQLite3Jni#sqlite3_config(ConfigLogCallback)}, with the slight signature change. + {@link CApi#sqlite3_config(ConfigLogCallback)}, with the slight signature change. */ void call(int errCode, String msg); } diff --git a/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java b/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java index 9bdd209a7a..9a5a201aac 100644 --- a/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java +++ b/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java @@ -19,7 +19,7 @@ package org.sqlite.jni; public interface ConfigSqllogCallback { /** Must function as described for a C-level callback for - {@link SQLite3Jni#sqlite3_config(ConfigSqllogCallback)}, with the slight signature change. + {@link CApi#sqlite3_config(ConfigSqllogCallback)}, with the slight signature change. */ void call(sqlite3 db, String msg, int msgType ); } diff --git a/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java b/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java index d2d56157c4..2599c1cd7f 100644 --- a/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java +++ b/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_prepare_multi}. + Callback for use with {@link CApi#sqlite3_prepare_multi}. */ public interface PrepareMultiCallback extends CallbackProxy { @@ -53,7 +53,7 @@ public interface PrepareMultiCallback extends CallbackProxy { try { return this.p.call(st); }finally{ - SQLite3Jni.sqlite3_finalize(st); + CApi.sqlite3_finalize(st); } } } @@ -70,9 +70,9 @@ public interface PrepareMultiCallback extends CallbackProxy { else the result of the final step is returned. */ @Override public int call(sqlite3_stmt st){ - int rc = SQLite3Jni.SQLITE_DONE; - while( SQLite3Jni.SQLITE_ROW == (rc = SQLite3Jni.sqlite3_step(st)) ){} - return SQLite3Jni.SQLITE_DONE==rc ? 0 : rc; + int rc = CApi.SQLITE_DONE; + while( CApi.SQLITE_ROW == (rc = CApi.sqlite3_step(st)) ){} + return CApi.SQLITE_DONE==rc ? 0 : rc; } } } diff --git a/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java b/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java index a606139328..29088726f0 100644 --- a/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_preupdate_hook}. + Callback for use with {@link CApi#sqlite3_preupdate_hook}. */ public interface PreupdateHookCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java b/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java index bc15377037..2bc56665cb 100644 --- a/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java +++ b/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_progress_handler}. + Callback for use with {@link CApi#sqlite3_progress_handler}. */ public interface ProgressHandlerCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/ResultCode.java b/ext/jni/src/org/sqlite/jni/ResultCode.java index 0989bc744d..e6f0ad89dc 100644 --- a/ext/jni/src/org/sqlite/jni/ResultCode.java +++ b/ext/jni/src/org/sqlite/jni/ResultCode.java @@ -20,110 +20,110 @@ package org.sqlite.jni; find it useful to map SQLite result codes to human-readable names. */ public enum ResultCode { - SQLITE_OK(SQLite3Jni.SQLITE_OK), - SQLITE_ERROR(SQLite3Jni.SQLITE_ERROR), - SQLITE_INTERNAL(SQLite3Jni.SQLITE_INTERNAL), - SQLITE_PERM(SQLite3Jni.SQLITE_PERM), - SQLITE_ABORT(SQLite3Jni.SQLITE_ABORT), - SQLITE_BUSY(SQLite3Jni.SQLITE_BUSY), - SQLITE_LOCKED(SQLite3Jni.SQLITE_LOCKED), - SQLITE_NOMEM(SQLite3Jni.SQLITE_NOMEM), - SQLITE_READONLY(SQLite3Jni.SQLITE_READONLY), - SQLITE_INTERRUPT(SQLite3Jni.SQLITE_INTERRUPT), - SQLITE_IOERR(SQLite3Jni.SQLITE_IOERR), - SQLITE_CORRUPT(SQLite3Jni.SQLITE_CORRUPT), - SQLITE_NOTFOUND(SQLite3Jni.SQLITE_NOTFOUND), - SQLITE_FULL(SQLite3Jni.SQLITE_FULL), - SQLITE_CANTOPEN(SQLite3Jni.SQLITE_CANTOPEN), - SQLITE_PROTOCOL(SQLite3Jni.SQLITE_PROTOCOL), - SQLITE_EMPTY(SQLite3Jni.SQLITE_EMPTY), - SQLITE_SCHEMA(SQLite3Jni.SQLITE_SCHEMA), - SQLITE_TOOBIG(SQLite3Jni.SQLITE_TOOBIG), - SQLITE_CONSTRAINT(SQLite3Jni.SQLITE_CONSTRAINT), - SQLITE_MISMATCH(SQLite3Jni.SQLITE_MISMATCH), - SQLITE_MISUSE(SQLite3Jni.SQLITE_MISUSE), - SQLITE_NOLFS(SQLite3Jni.SQLITE_NOLFS), - SQLITE_AUTH(SQLite3Jni.SQLITE_AUTH), - SQLITE_FORMAT(SQLite3Jni.SQLITE_FORMAT), - SQLITE_RANGE(SQLite3Jni.SQLITE_RANGE), - SQLITE_NOTADB(SQLite3Jni.SQLITE_NOTADB), - SQLITE_NOTICE(SQLite3Jni.SQLITE_NOTICE), - SQLITE_WARNING(SQLite3Jni.SQLITE_WARNING), - SQLITE_ROW(SQLite3Jni.SQLITE_ROW), - SQLITE_DONE(SQLite3Jni.SQLITE_DONE), - SQLITE_ERROR_MISSING_COLLSEQ(SQLite3Jni.SQLITE_ERROR_MISSING_COLLSEQ), - SQLITE_ERROR_RETRY(SQLite3Jni.SQLITE_ERROR_RETRY), - SQLITE_ERROR_SNAPSHOT(SQLite3Jni.SQLITE_ERROR_SNAPSHOT), - SQLITE_IOERR_READ(SQLite3Jni.SQLITE_IOERR_READ), - SQLITE_IOERR_SHORT_READ(SQLite3Jni.SQLITE_IOERR_SHORT_READ), - SQLITE_IOERR_WRITE(SQLite3Jni.SQLITE_IOERR_WRITE), - SQLITE_IOERR_FSYNC(SQLite3Jni.SQLITE_IOERR_FSYNC), - SQLITE_IOERR_DIR_FSYNC(SQLite3Jni.SQLITE_IOERR_DIR_FSYNC), - SQLITE_IOERR_TRUNCATE(SQLite3Jni.SQLITE_IOERR_TRUNCATE), - SQLITE_IOERR_FSTAT(SQLite3Jni.SQLITE_IOERR_FSTAT), - SQLITE_IOERR_UNLOCK(SQLite3Jni.SQLITE_IOERR_UNLOCK), - SQLITE_IOERR_RDLOCK(SQLite3Jni.SQLITE_IOERR_RDLOCK), - SQLITE_IOERR_DELETE(SQLite3Jni.SQLITE_IOERR_DELETE), - SQLITE_IOERR_BLOCKED(SQLite3Jni.SQLITE_IOERR_BLOCKED), - SQLITE_IOERR_NOMEM(SQLite3Jni.SQLITE_IOERR_NOMEM), - SQLITE_IOERR_ACCESS(SQLite3Jni.SQLITE_IOERR_ACCESS), - SQLITE_IOERR_CHECKRESERVEDLOCK(SQLite3Jni.SQLITE_IOERR_CHECKRESERVEDLOCK), - SQLITE_IOERR_LOCK(SQLite3Jni.SQLITE_IOERR_LOCK), - SQLITE_IOERR_CLOSE(SQLite3Jni.SQLITE_IOERR_CLOSE), - SQLITE_IOERR_DIR_CLOSE(SQLite3Jni.SQLITE_IOERR_DIR_CLOSE), - SQLITE_IOERR_SHMOPEN(SQLite3Jni.SQLITE_IOERR_SHMOPEN), - SQLITE_IOERR_SHMSIZE(SQLite3Jni.SQLITE_IOERR_SHMSIZE), - SQLITE_IOERR_SHMLOCK(SQLite3Jni.SQLITE_IOERR_SHMLOCK), - SQLITE_IOERR_SHMMAP(SQLite3Jni.SQLITE_IOERR_SHMMAP), - SQLITE_IOERR_SEEK(SQLite3Jni.SQLITE_IOERR_SEEK), - SQLITE_IOERR_DELETE_NOENT(SQLite3Jni.SQLITE_IOERR_DELETE_NOENT), - SQLITE_IOERR_MMAP(SQLite3Jni.SQLITE_IOERR_MMAP), - SQLITE_IOERR_GETTEMPPATH(SQLite3Jni.SQLITE_IOERR_GETTEMPPATH), - SQLITE_IOERR_CONVPATH(SQLite3Jni.SQLITE_IOERR_CONVPATH), - SQLITE_IOERR_VNODE(SQLite3Jni.SQLITE_IOERR_VNODE), - SQLITE_IOERR_AUTH(SQLite3Jni.SQLITE_IOERR_AUTH), - SQLITE_IOERR_BEGIN_ATOMIC(SQLite3Jni.SQLITE_IOERR_BEGIN_ATOMIC), - SQLITE_IOERR_COMMIT_ATOMIC(SQLite3Jni.SQLITE_IOERR_COMMIT_ATOMIC), - SQLITE_IOERR_ROLLBACK_ATOMIC(SQLite3Jni.SQLITE_IOERR_ROLLBACK_ATOMIC), - SQLITE_IOERR_DATA(SQLite3Jni.SQLITE_IOERR_DATA), - SQLITE_IOERR_CORRUPTFS(SQLite3Jni.SQLITE_IOERR_CORRUPTFS), - SQLITE_LOCKED_SHAREDCACHE(SQLite3Jni.SQLITE_LOCKED_SHAREDCACHE), - SQLITE_LOCKED_VTAB(SQLite3Jni.SQLITE_LOCKED_VTAB), - SQLITE_BUSY_RECOVERY(SQLite3Jni.SQLITE_BUSY_RECOVERY), - SQLITE_BUSY_SNAPSHOT(SQLite3Jni.SQLITE_BUSY_SNAPSHOT), - SQLITE_BUSY_TIMEOUT(SQLite3Jni.SQLITE_BUSY_TIMEOUT), - SQLITE_CANTOPEN_NOTEMPDIR(SQLite3Jni.SQLITE_CANTOPEN_NOTEMPDIR), - SQLITE_CANTOPEN_ISDIR(SQLite3Jni.SQLITE_CANTOPEN_ISDIR), - SQLITE_CANTOPEN_FULLPATH(SQLite3Jni.SQLITE_CANTOPEN_FULLPATH), - SQLITE_CANTOPEN_CONVPATH(SQLite3Jni.SQLITE_CANTOPEN_CONVPATH), - SQLITE_CANTOPEN_SYMLINK(SQLite3Jni.SQLITE_CANTOPEN_SYMLINK), - SQLITE_CORRUPT_VTAB(SQLite3Jni.SQLITE_CORRUPT_VTAB), - SQLITE_CORRUPT_SEQUENCE(SQLite3Jni.SQLITE_CORRUPT_SEQUENCE), - SQLITE_CORRUPT_INDEX(SQLite3Jni.SQLITE_CORRUPT_INDEX), - SQLITE_READONLY_RECOVERY(SQLite3Jni.SQLITE_READONLY_RECOVERY), - SQLITE_READONLY_CANTLOCK(SQLite3Jni.SQLITE_READONLY_CANTLOCK), - SQLITE_READONLY_ROLLBACK(SQLite3Jni.SQLITE_READONLY_ROLLBACK), - SQLITE_READONLY_DBMOVED(SQLite3Jni.SQLITE_READONLY_DBMOVED), - SQLITE_READONLY_CANTINIT(SQLite3Jni.SQLITE_READONLY_CANTINIT), - SQLITE_READONLY_DIRECTORY(SQLite3Jni.SQLITE_READONLY_DIRECTORY), - SQLITE_ABORT_ROLLBACK(SQLite3Jni.SQLITE_ABORT_ROLLBACK), - SQLITE_CONSTRAINT_CHECK(SQLite3Jni.SQLITE_CONSTRAINT_CHECK), - SQLITE_CONSTRAINT_COMMITHOOK(SQLite3Jni.SQLITE_CONSTRAINT_COMMITHOOK), - SQLITE_CONSTRAINT_FOREIGNKEY(SQLite3Jni.SQLITE_CONSTRAINT_FOREIGNKEY), - SQLITE_CONSTRAINT_FUNCTION(SQLite3Jni.SQLITE_CONSTRAINT_FUNCTION), - SQLITE_CONSTRAINT_NOTNULL(SQLite3Jni.SQLITE_CONSTRAINT_NOTNULL), - SQLITE_CONSTRAINT_PRIMARYKEY(SQLite3Jni.SQLITE_CONSTRAINT_PRIMARYKEY), - SQLITE_CONSTRAINT_TRIGGER(SQLite3Jni.SQLITE_CONSTRAINT_TRIGGER), - SQLITE_CONSTRAINT_UNIQUE(SQLite3Jni.SQLITE_CONSTRAINT_UNIQUE), - SQLITE_CONSTRAINT_VTAB(SQLite3Jni.SQLITE_CONSTRAINT_VTAB), - SQLITE_CONSTRAINT_ROWID(SQLite3Jni.SQLITE_CONSTRAINT_ROWID), - SQLITE_CONSTRAINT_PINNED(SQLite3Jni.SQLITE_CONSTRAINT_PINNED), - SQLITE_CONSTRAINT_DATATYPE(SQLite3Jni.SQLITE_CONSTRAINT_DATATYPE), - SQLITE_NOTICE_RECOVER_WAL(SQLite3Jni.SQLITE_NOTICE_RECOVER_WAL), - SQLITE_NOTICE_RECOVER_ROLLBACK(SQLite3Jni.SQLITE_NOTICE_RECOVER_ROLLBACK), - SQLITE_WARNING_AUTOINDEX(SQLite3Jni.SQLITE_WARNING_AUTOINDEX), - SQLITE_AUTH_USER(SQLite3Jni.SQLITE_AUTH_USER), - SQLITE_OK_LOAD_PERMANENTLY(SQLite3Jni.SQLITE_OK_LOAD_PERMANENTLY); + SQLITE_OK(CApi.SQLITE_OK), + SQLITE_ERROR(CApi.SQLITE_ERROR), + SQLITE_INTERNAL(CApi.SQLITE_INTERNAL), + SQLITE_PERM(CApi.SQLITE_PERM), + SQLITE_ABORT(CApi.SQLITE_ABORT), + SQLITE_BUSY(CApi.SQLITE_BUSY), + SQLITE_LOCKED(CApi.SQLITE_LOCKED), + SQLITE_NOMEM(CApi.SQLITE_NOMEM), + SQLITE_READONLY(CApi.SQLITE_READONLY), + SQLITE_INTERRUPT(CApi.SQLITE_INTERRUPT), + SQLITE_IOERR(CApi.SQLITE_IOERR), + SQLITE_CORRUPT(CApi.SQLITE_CORRUPT), + SQLITE_NOTFOUND(CApi.SQLITE_NOTFOUND), + SQLITE_FULL(CApi.SQLITE_FULL), + SQLITE_CANTOPEN(CApi.SQLITE_CANTOPEN), + SQLITE_PROTOCOL(CApi.SQLITE_PROTOCOL), + SQLITE_EMPTY(CApi.SQLITE_EMPTY), + SQLITE_SCHEMA(CApi.SQLITE_SCHEMA), + SQLITE_TOOBIG(CApi.SQLITE_TOOBIG), + SQLITE_CONSTRAINT(CApi.SQLITE_CONSTRAINT), + SQLITE_MISMATCH(CApi.SQLITE_MISMATCH), + SQLITE_MISUSE(CApi.SQLITE_MISUSE), + SQLITE_NOLFS(CApi.SQLITE_NOLFS), + SQLITE_AUTH(CApi.SQLITE_AUTH), + SQLITE_FORMAT(CApi.SQLITE_FORMAT), + SQLITE_RANGE(CApi.SQLITE_RANGE), + SQLITE_NOTADB(CApi.SQLITE_NOTADB), + SQLITE_NOTICE(CApi.SQLITE_NOTICE), + SQLITE_WARNING(CApi.SQLITE_WARNING), + SQLITE_ROW(CApi.SQLITE_ROW), + SQLITE_DONE(CApi.SQLITE_DONE), + SQLITE_ERROR_MISSING_COLLSEQ(CApi.SQLITE_ERROR_MISSING_COLLSEQ), + SQLITE_ERROR_RETRY(CApi.SQLITE_ERROR_RETRY), + SQLITE_ERROR_SNAPSHOT(CApi.SQLITE_ERROR_SNAPSHOT), + SQLITE_IOERR_READ(CApi.SQLITE_IOERR_READ), + SQLITE_IOERR_SHORT_READ(CApi.SQLITE_IOERR_SHORT_READ), + SQLITE_IOERR_WRITE(CApi.SQLITE_IOERR_WRITE), + SQLITE_IOERR_FSYNC(CApi.SQLITE_IOERR_FSYNC), + SQLITE_IOERR_DIR_FSYNC(CApi.SQLITE_IOERR_DIR_FSYNC), + SQLITE_IOERR_TRUNCATE(CApi.SQLITE_IOERR_TRUNCATE), + SQLITE_IOERR_FSTAT(CApi.SQLITE_IOERR_FSTAT), + SQLITE_IOERR_UNLOCK(CApi.SQLITE_IOERR_UNLOCK), + SQLITE_IOERR_RDLOCK(CApi.SQLITE_IOERR_RDLOCK), + SQLITE_IOERR_DELETE(CApi.SQLITE_IOERR_DELETE), + SQLITE_IOERR_BLOCKED(CApi.SQLITE_IOERR_BLOCKED), + SQLITE_IOERR_NOMEM(CApi.SQLITE_IOERR_NOMEM), + SQLITE_IOERR_ACCESS(CApi.SQLITE_IOERR_ACCESS), + SQLITE_IOERR_CHECKRESERVEDLOCK(CApi.SQLITE_IOERR_CHECKRESERVEDLOCK), + SQLITE_IOERR_LOCK(CApi.SQLITE_IOERR_LOCK), + SQLITE_IOERR_CLOSE(CApi.SQLITE_IOERR_CLOSE), + SQLITE_IOERR_DIR_CLOSE(CApi.SQLITE_IOERR_DIR_CLOSE), + SQLITE_IOERR_SHMOPEN(CApi.SQLITE_IOERR_SHMOPEN), + SQLITE_IOERR_SHMSIZE(CApi.SQLITE_IOERR_SHMSIZE), + SQLITE_IOERR_SHMLOCK(CApi.SQLITE_IOERR_SHMLOCK), + SQLITE_IOERR_SHMMAP(CApi.SQLITE_IOERR_SHMMAP), + SQLITE_IOERR_SEEK(CApi.SQLITE_IOERR_SEEK), + SQLITE_IOERR_DELETE_NOENT(CApi.SQLITE_IOERR_DELETE_NOENT), + SQLITE_IOERR_MMAP(CApi.SQLITE_IOERR_MMAP), + SQLITE_IOERR_GETTEMPPATH(CApi.SQLITE_IOERR_GETTEMPPATH), + SQLITE_IOERR_CONVPATH(CApi.SQLITE_IOERR_CONVPATH), + SQLITE_IOERR_VNODE(CApi.SQLITE_IOERR_VNODE), + SQLITE_IOERR_AUTH(CApi.SQLITE_IOERR_AUTH), + SQLITE_IOERR_BEGIN_ATOMIC(CApi.SQLITE_IOERR_BEGIN_ATOMIC), + SQLITE_IOERR_COMMIT_ATOMIC(CApi.SQLITE_IOERR_COMMIT_ATOMIC), + SQLITE_IOERR_ROLLBACK_ATOMIC(CApi.SQLITE_IOERR_ROLLBACK_ATOMIC), + SQLITE_IOERR_DATA(CApi.SQLITE_IOERR_DATA), + SQLITE_IOERR_CORRUPTFS(CApi.SQLITE_IOERR_CORRUPTFS), + SQLITE_LOCKED_SHAREDCACHE(CApi.SQLITE_LOCKED_SHAREDCACHE), + SQLITE_LOCKED_VTAB(CApi.SQLITE_LOCKED_VTAB), + SQLITE_BUSY_RECOVERY(CApi.SQLITE_BUSY_RECOVERY), + SQLITE_BUSY_SNAPSHOT(CApi.SQLITE_BUSY_SNAPSHOT), + SQLITE_BUSY_TIMEOUT(CApi.SQLITE_BUSY_TIMEOUT), + SQLITE_CANTOPEN_NOTEMPDIR(CApi.SQLITE_CANTOPEN_NOTEMPDIR), + SQLITE_CANTOPEN_ISDIR(CApi.SQLITE_CANTOPEN_ISDIR), + SQLITE_CANTOPEN_FULLPATH(CApi.SQLITE_CANTOPEN_FULLPATH), + SQLITE_CANTOPEN_CONVPATH(CApi.SQLITE_CANTOPEN_CONVPATH), + SQLITE_CANTOPEN_SYMLINK(CApi.SQLITE_CANTOPEN_SYMLINK), + SQLITE_CORRUPT_VTAB(CApi.SQLITE_CORRUPT_VTAB), + SQLITE_CORRUPT_SEQUENCE(CApi.SQLITE_CORRUPT_SEQUENCE), + SQLITE_CORRUPT_INDEX(CApi.SQLITE_CORRUPT_INDEX), + SQLITE_READONLY_RECOVERY(CApi.SQLITE_READONLY_RECOVERY), + SQLITE_READONLY_CANTLOCK(CApi.SQLITE_READONLY_CANTLOCK), + SQLITE_READONLY_ROLLBACK(CApi.SQLITE_READONLY_ROLLBACK), + SQLITE_READONLY_DBMOVED(CApi.SQLITE_READONLY_DBMOVED), + SQLITE_READONLY_CANTINIT(CApi.SQLITE_READONLY_CANTINIT), + SQLITE_READONLY_DIRECTORY(CApi.SQLITE_READONLY_DIRECTORY), + SQLITE_ABORT_ROLLBACK(CApi.SQLITE_ABORT_ROLLBACK), + SQLITE_CONSTRAINT_CHECK(CApi.SQLITE_CONSTRAINT_CHECK), + SQLITE_CONSTRAINT_COMMITHOOK(CApi.SQLITE_CONSTRAINT_COMMITHOOK), + SQLITE_CONSTRAINT_FOREIGNKEY(CApi.SQLITE_CONSTRAINT_FOREIGNKEY), + SQLITE_CONSTRAINT_FUNCTION(CApi.SQLITE_CONSTRAINT_FUNCTION), + SQLITE_CONSTRAINT_NOTNULL(CApi.SQLITE_CONSTRAINT_NOTNULL), + SQLITE_CONSTRAINT_PRIMARYKEY(CApi.SQLITE_CONSTRAINT_PRIMARYKEY), + SQLITE_CONSTRAINT_TRIGGER(CApi.SQLITE_CONSTRAINT_TRIGGER), + SQLITE_CONSTRAINT_UNIQUE(CApi.SQLITE_CONSTRAINT_UNIQUE), + SQLITE_CONSTRAINT_VTAB(CApi.SQLITE_CONSTRAINT_VTAB), + SQLITE_CONSTRAINT_ROWID(CApi.SQLITE_CONSTRAINT_ROWID), + SQLITE_CONSTRAINT_PINNED(CApi.SQLITE_CONSTRAINT_PINNED), + SQLITE_CONSTRAINT_DATATYPE(CApi.SQLITE_CONSTRAINT_DATATYPE), + SQLITE_NOTICE_RECOVER_WAL(CApi.SQLITE_NOTICE_RECOVER_WAL), + SQLITE_NOTICE_RECOVER_ROLLBACK(CApi.SQLITE_NOTICE_RECOVER_ROLLBACK), + SQLITE_WARNING_AUTOINDEX(CApi.SQLITE_WARNING_AUTOINDEX), + SQLITE_AUTH_USER(CApi.SQLITE_AUTH_USER), + SQLITE_OK_LOAD_PERMANENTLY(CApi.SQLITE_OK_LOAD_PERMANENTLY); public final int value; diff --git a/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java b/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java index 21600c8057..bd736e1b76 100644 --- a/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_rollback_hook}. + Callback for use with {@link CApi#sqlite3_rollback_hook}. */ public interface RollbackHookCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/SQLTester.java b/ext/jni/src/org/sqlite/jni/SQLTester.java index 2172277794..1170c86d92 100644 --- a/ext/jni/src/org/sqlite/jni/SQLTester.java +++ b/ext/jni/src/org/sqlite/jni/SQLTester.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.nio.charset.StandardCharsets; import java.util.regex.*; -import static org.sqlite.jni.SQLite3Jni.*; +import static org.sqlite.jni.CApi.*; /** Modes for how to escape (or not) column values and names from @@ -668,7 +668,7 @@ public class SQLTester { static { System.loadLibrary("sqlite3-jni") /* Interestingly, when SQLTester is the main app, we have to - load that lib from here. The same load from SQLite3Jni does + load that lib from here. The same load from CApi does not happen early enough. Without this, installCustomExtensions() is an unresolved symbol. */; } diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 621cbf2f8d..70609bc7f7 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -12,7 +12,7 @@ ** This file contains a set of tests for the sqlite3 JNI bindings. */ package org.sqlite.jni; -import static org.sqlite.jni.SQLite3Jni.*; +import static org.sqlite.jni.CApi.*; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.ArrayList; @@ -934,7 +934,7 @@ public class Tester1 implements Runnable { private void listBoundMethods(){ if(false){ final java.lang.reflect.Field[] declaredFields = - SQLite3Jni.class.getDeclaredFields(); + CApi.class.getDeclaredFields(); outln("Bound constants:\n"); for(java.lang.reflect.Field field : declaredFields) { if(java.lang.reflect.Modifier.isStatic(field.getModifiers())) { @@ -943,7 +943,7 @@ public class Tester1 implements Runnable { } } final java.lang.reflect.Method[] declaredMethods = - SQLite3Jni.class.getDeclaredMethods(); + CApi.class.getDeclaredMethods(); final java.util.List funcList = new java.util.ArrayList<>(); for(java.lang.reflect.Method m : declaredMethods){ if((m.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0){ @@ -1927,7 +1927,7 @@ public class Tester1 implements Runnable { int nNatives = 0; int nCanonical = 0; final java.lang.reflect.Method[] declaredMethods = - SQLite3Jni.class.getDeclaredMethods(); + CApi.class.getDeclaredMethods(); for(java.lang.reflect.Method m : declaredMethods){ final int mod = m.getModifiers(); if( 0!=(mod & java.lang.reflect.Modifier.STATIC) ){ diff --git a/ext/jni/src/org/sqlite/jni/TesterFts5.java b/ext/jni/src/org/sqlite/jni/TesterFts5.java index 9112a53cde..04cc7dbcfb 100644 --- a/ext/jni/src/org/sqlite/jni/TesterFts5.java +++ b/ext/jni/src/org/sqlite/jni/TesterFts5.java @@ -12,7 +12,7 @@ ** This file contains a set of tests for the sqlite3 JNI bindings. */ package org.sqlite.jni; -import static org.sqlite.jni.SQLite3Jni.*; +import static org.sqlite.jni.CApi.*; import static org.sqlite.jni.Tester1.*; import org.sqlite.jni.*; import org.sqlite.jni.fts5.*; diff --git a/ext/jni/src/org/sqlite/jni/TraceV2Callback.java b/ext/jni/src/org/sqlite/jni/TraceV2Callback.java index 4e69bd8756..b16012b60e 100644 --- a/ext/jni/src/org/sqlite/jni/TraceV2Callback.java +++ b/ext/jni/src/org/sqlite/jni/TraceV2Callback.java @@ -15,7 +15,7 @@ package org.sqlite.jni; import org.sqlite.jni.annotation.Nullable; /** - Callback for use with {@link SQLite3Jni#sqlite3_trace_v2}. + Callback for use with {@link CApi#sqlite3_trace_v2}. */ public interface TraceV2Callback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java b/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java index 4d6afb887f..32724be6d4 100644 --- a/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java @@ -14,7 +14,7 @@ package org.sqlite.jni; /** - Callback for use with {@link SQLite3Jni#sqlite3_update_hook}. + Callback for use with {@link CApi#sqlite3_update_hook}. */ public interface UpdateHookCallback extends CallbackProxy { /** diff --git a/ext/jni/src/org/sqlite/jni/annotation/Canonical.java b/ext/jni/src/org/sqlite/jni/annotation/Canonical.java deleted file mode 100644 index ebad0a44d2..0000000000 --- a/ext/jni/src/org/sqlite/jni/annotation/Canonical.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -** 2023-09-27 -** -** 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 houses the Canonical annotaion for the sqlite3 C API. -*/ -package org.sqlite.jni.annotation; - -/** - This annotation is for marking functions as "canonical", meaning - that they map directly to a function in the core sqlite3 C API. The - intent is to distinguish them from functions added specifically to - the Java API. - -

    Canonical functions, unless specifically documented, have the - same semantics as their counterparts in the C API - documentation, despite their signatures perhaps differing - slightly. Canonical forms may be native or implemented in Java. - Sometimes multiple overloads are labeled as Canonical because one - or more of them are just type- or encoding-related conversion - wrappers but provide identical semantics (e.g. from a String to a - byte[]). The Java API adds a number of convenience overloads to - simplify use, as well as a few Java-specific functions, and those - are never flagged as @Canonical. - -

    In some cases, the canonical version of a function is private - and exposed to Java via public overloads. - -

    The comment property can be used to add a comment. -*/ -@java.lang.annotation.Documented -@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) -@java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) -public @interface Canonical{ - /** - Brief comments about the binding, e.g. noting any major - semantic differences. - */ - String comment() default ""; -} diff --git a/ext/jni/src/org/sqlite/jni/package-info.java b/ext/jni/src/org/sqlite/jni/package-info.java index 853d76fd73..d669e680f7 100644 --- a/ext/jni/src/org/sqlite/jni/package-info.java +++ b/ext/jni/src/org/sqlite/jni/package-info.java @@ -2,7 +2,7 @@ This package houses a JNI binding to the SQLite3 C API.

    The primary interfaces are in {@link - org.sqlite.jni.SQLite3Jni}.

    + org.sqlite.jni.CApi}.

    API Goals and Requirements

    diff --git a/ext/jni/src/org/sqlite/jni/sqlite3.java b/ext/jni/src/org/sqlite/jni/sqlite3.java index ba515b3f4f..27a6f9f158 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3.java @@ -30,7 +30,7 @@ public final class sqlite3 extends NativePointerHolder if( 0==ptr ){ return sqlite3.class.getSimpleName()+"@null"; } - final String fn = SQLite3Jni.sqlite3_db_filename(this, "main"); + final String fn = CApi.sqlite3_db_filename(this, "main"); return sqlite3.class.getSimpleName() +"@"+String.format("0x%08x",ptr) +"["+((null == fn) ? "" : fn)+"]" @@ -39,10 +39,10 @@ public final class sqlite3 extends NativePointerHolder @Override protected void finalize(){ //System.out.println(this+".finalize()"); - SQLite3Jni.sqlite3_close_v2(this.clearNativePointer()); + CApi.sqlite3_close_v2(this.clearNativePointer()); } @Override public void close(){ - SQLite3Jni.sqlite3_close_v2(this.clearNativePointer()); + CApi.sqlite3_close_v2(this.clearNativePointer()); } } diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_backup.java b/ext/jni/src/org/sqlite/jni/sqlite3_backup.java index 1e12e65cd0..232b001818 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_backup.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3_backup.java @@ -25,7 +25,7 @@ public final class sqlite3_backup extends NativePointerHolder private sqlite3_backup(){} @Override public void close(){ - SQLite3Jni.sqlite3_backup_finish(this); + CApi.sqlite3_backup_finish(this); } } diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_blob.java b/ext/jni/src/org/sqlite/jni/sqlite3_blob.java index 46c3c90293..f84b848a40 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_blob.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3_blob.java @@ -25,7 +25,7 @@ public final class sqlite3_blob extends NativePointerHolder private sqlite3_blob(){} @Override public void close(){ - SQLite3Jni.sqlite3_blob_close(this.clearNativePointer()); + CApi.sqlite3_blob_close(this.clearNativePointer()); } } diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_context.java b/ext/jni/src/org/sqlite/jni/sqlite3_context.java index b9f11d7336..22bc62ab46 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_context.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3_context.java @@ -71,7 +71,7 @@ public final class sqlite3_context extends NativePointerHolder */ public synchronized Long getAggregateContext(boolean initIfNeeded){ if( aggregateContext==null ){ - aggregateContext = SQLite3Jni.sqlite3_aggregate_context(this, initIfNeeded); + aggregateContext = CApi.sqlite3_aggregate_context(this, initIfNeeded); if( !initIfNeeded && null==aggregateContext ) aggregateContext = 0L; } return (null==aggregateContext || 0!=aggregateContext) ? aggregateContext : null; diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java b/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java index d918d380c2..21e4bef03d 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java @@ -26,10 +26,10 @@ public final class sqlite3_stmt extends NativePointerHolder //For as-yet-unknown reasons, this triggers a JVM crash. //@Override protected void finalize(){ - // SQLite3Jni.sqlite3_finalize(this.clearNativePointer()); + // CApi.sqlite3_finalize(this.clearNativePointer()); //} @Override public void close(){ - SQLite3Jni.sqlite3_finalize(this.clearNativePointer()); + CApi.sqlite3_finalize(this.clearNativePointer()); } } diff --git a/manifest b/manifest index c2d9ae50d3..dfdd2ee2fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\ssqlite3changegroup_schema()\sand\spatchsets. -D 2023-10-07T17:29:10.275 +C Rename\sSQLite3Jni\sto\sCApi\sto\s(A)\sreduce\sname\sprefix\scollisions\swith\sincoming\sclasses\sand\s(B)\salign\swith\sits\scounterpart\sin\sthe\sJS\sbuild.\sRemove\sthe\sCanonical\sannotation\sbecause\s(A)\sthe\snew\scode\sseparation\swill\sinherently\smake\sthat\sdistinction\sand\s(B)\sthe\sline\sbetween\struly\scanonical\sand\ssemi-canonical\s(e.g.\sdiffering\sin\ssignature\soverloads)\sis\sblurry\senough\sthat\sconsistent\suse\sof\sthat\sannocation\sis\sbecoming\san\sunnecessary\sburden. +D 2023-10-09T10:30:54.032 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,41 +235,40 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 7278812b41ced95fe67a9e5823aee027d641fd26fdfabe66c62b102a3a4e0631 -F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75 +F ext/jni/GNUmakefile 8c942ede995d4e42f79c838c03b913dde62f573b443fe8f308dae547bcf04d0b +F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 2c4948634fd7f6460b074b72328b9c885ec11333bbc98144f745e4d6203a7ac2 -F ext/jni/src/c/sqlite3-jni.h 74e3da791f748f02d0d684562126cf6bfdd2a85cbb6a5d1354b14fcd46e187bc +F ext/jni/src/c/sqlite3-jni.c fb8f178d27df828e3c797b4427a0a20545b44f5147ce38d09ce9b465be5a840b +F ext/jni/src/c/sqlite3-jni.h be1fdff7ab3a2bb357197271c8ac5d2bf6ff59380c106dde3a13be88724bad22 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 -F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java e6135be32f12bf140bffa39be7fd1a45ad83b2661ed49c08dbde04c8485feb38 -F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java 5e4a75611c026730289d776469d6122cb2699d6970af5f53fe85e74d49930476 -F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java d316373b12b3bf1a421f1f7eed08128fa8dd52bb98617ba28c161aaabd71d1ee +F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 +F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 +F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 +F ext/jni/src/org/sqlite/jni/CApi.java 573a700536f8ed91584041894b35087d7183e10005b19d3e4cbb2c7f4147358d w ext/jni/src/org/sqlite/jni/SQLite3Jni.java F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 -F ext/jni/src/org/sqlite/jni/CollationCallback.java df327348e1a34ee65210208d694d690e5ee0bfe901410122e07caf6c98b2b7c8 -F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 07df5fa161a0b81154295258037f662e7c372735c2899c76e81cb3abd9fd3b39 -F ext/jni/src/org/sqlite/jni/CommitHookCallback.java 77cf8bb4f5548113e9792978f3f8a454614f420fa0ad73939421cbff4e7776f2 -F ext/jni/src/org/sqlite/jni/ConfigLogCallback.java 636ed6b89ed03f15bc2a6f6f47bf7853b8328e5a8269e52e80630708efa703a6 -F ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java e3656909eab7ed0f7e457c5b82df160ca22dd5e954c0a306ec1fca61b0d266b4 +F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d +F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 +F ext/jni/src/org/sqlite/jni/CommitHookCallback.java d15bd87ca6159a48b281966cf7a6e67dd17e2fabf974a797c9e3a66a74f361e8 +F ext/jni/src/org/sqlite/jni/ConfigLogCallback.java 16bb391d8d4ae89cc43baa3cfa0c80c988003627b7ea872deb41156a76f7e867 +F ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java 6d6b64638123acb70ffefcd5d2345b1bea3d3b528727d1684cc20cc2357f03a0 F ext/jni/src/org/sqlite/jni/NativePointerHolder.java 3eb36b5e81993a847f5ec03d23ab219a92671f817547b6a85d312667faeedd8b F ext/jni/src/org/sqlite/jni/OutputPointer.java 2f57c05672ddc9b38e3f8eed11759896cf0bf01107ffd24d5182b99f6e7254b6 -F ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java 878ed9cc8000def1a4e6d7113d52bba6fce0aa6733b4eb216d68dfbe096776ac -F ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java eccaed8dc9c6289f07ef3fc109891c6be1e7cc6c88723d90174b68706fc21cda -F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 7b9ff2218129ece98ba60c57eeedcd8447e9e3b6e5d0f5e5d3eb0f0c5037d48d -F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7ce7797f2c6c7fca2004ff12ce20f86 -F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java d12352c0e22840de484ffa9b11ed5058bb0daca2e9f218055d3c54c947a273c4 +F ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java 6f051951fecab41f2e842b1ac1d3c498706de9387c86f62564e2afbe03d026cb +F ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java 242dc2afea13c45b4809d41b6a919e0a4003508713ceffe5f6545270138c6a7b +F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 247a47f49a1dd54fda28201c27796d2600a5c904f47fa21697a5377d49febe56 +F ext/jni/src/org/sqlite/jni/ResultCode.java dc7400b8b18df10027525d8d0f04300b2c6afc617d4d980923f8b5bb14412f3a +F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1469ae7fb34c50583a23581a58d6b2f8b55bafd3 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c -F ext/jni/src/org/sqlite/jni/SQLTester.java da42be06a2d644e0b915b40508934c1f32391e5308ab8767c1e2e65a281a198f -F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 9860c1cebd8a38041306f2ee7563f2898fcbdf77e4bfa393fba25b4924edcb5d +F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java ced62ed417c3326f93d2e90b3bb64ac2db58ac42a7ad7a5965b24545434e3200 -F ext/jni/src/org/sqlite/jni/TesterFts5.java 854c737bb5c9463ee92a8ee230013e924236dd4b74d4688dd62c17f38d5837db -F ext/jni/src/org/sqlite/jni/TraceV2Callback.java beb0b064c1a5f8bfe585a324ed39a4e33edbe379a3fc60f1401661620d3ca7c0 -F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 8376f4a931f2d5612b295c003c9515ba933ee76d8f95610e89c339727376e36c +F ext/jni/src/org/sqlite/jni/Tester1.java 9326bf645accee7b4a509b7a4db1fa2ba46efaf131e0d53816a6ad109056cd97 +F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 +F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 +F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 959d4677a857c9079c6e96ddd10918b946d68359af6252b6f284379069ea3d27 F ext/jni/src/org/sqlite/jni/WindowFunction.java 488980f4dbb6bdd7067d6cb9c43e4075475e51c54d9b74a5834422654b126246 F ext/jni/src/org/sqlite/jni/XDestroyCallback.java 50c5ca124ef6c6b735a7e136e7a23a557be367e61b56d4aab5777a614ab46cc2 -F ext/jni/src/org/sqlite/jni/annotation/Canonical.java 44ea75a3c6c39513be9052eaa845b258a953f6af59e61002d715363fa52a7175 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca @@ -282,12 +281,12 @@ F ext/jni/src/org/sqlite/jni/fts5/XTokenizeCallback.java 1efd1220ea328a32f2d2a1b F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java e2ad9bc06a9d307e0a6221c11645783898906455a92b1f7d5ec9b9ff1af1b8ea F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 1fe0f5692c1d67475d12b067f0469949073446f18c56eba5ee5da6ddd06db9b9 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java ea993738b851038c16d98576abd0db3d6028a231f075a394fb8a78c7834d0f6c -F ext/jni/src/org/sqlite/jni/package-info.java a3946db2504de747a1993c4f6e8ce604bec5a8e5a134b292c3b07527bc321a99 -F ext/jni/src/org/sqlite/jni/sqlite3.java 5cd95c182a38b874ad973b3c16a70a69786fe82a6793abf147639803dec7ecac -F ext/jni/src/org/sqlite/jni/sqlite3_backup.java 12182124c4d4928d78db5a07ea285f1d7af04c7a148f0759a1972d5bfa87311e -F ext/jni/src/org/sqlite/jni/sqlite3_blob.java fc631ad52feea6e3d1d62b0d0e769ac107c01bc0ddd20eb512aff07b428cda6d -F ext/jni/src/org/sqlite/jni/sqlite3_context.java 66ca95ce904044263a4aff684abe262d56f73e6b06bca6cf650761d79d7779ad -F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java cf7f076d8b0f2a23faebbd64e12e8b3dd1977378ca828245d186f1b98458127d +F ext/jni/src/org/sqlite/jni/package-info.java 7d465cbdf9050761db0db6d0c542afaaad7dc67f61510860592159c48bfc40e8 +F ext/jni/src/org/sqlite/jni/sqlite3.java 3247101956b66c0a59333d3ddd3550eadf24b37c1ab15c322efbed5b221d0f08 +F ext/jni/src/org/sqlite/jni/sqlite3_backup.java 42db8b2f9cd8e9e16217273890e5d4afbb102603d7130a2cb1651f1c69c1cfa4 +F ext/jni/src/org/sqlite/jni/sqlite3_blob.java 7c341bca1856475fc3bf3697251e0cf1d737ddcb099c65d90afdc164aaddcc51 +F ext/jni/src/org/sqlite/jni/sqlite3_context.java ba8da75eaaeb557c986af3fb4dbc69501cf2b083ca33497f2c0c70dbc0a53f2c +F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java 38e5e88e79cde51a1dbeacfdbe7857b93ca105972f47c1198a51f0eaa48886f5 F ext/jni/src/org/sqlite/jni/sqlite3_value.java 3d1d4903e267bc0bc81d57d21f5e85978eff389a1a6ed46726dbe75f85e6914a F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2125,8 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 03f9e50b15c9c2fb4636dee24c1491c45322578b9fed08c6f4360be07c5c3830 -R 557213144d25aabc74ea3d95f8466dc7 -U dan -Z 4ef2a0ed12272e0a936ee099de80bb27 +P c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889 +R 9e5ca9b62d5fe5ed2cf201efbae39e9e +U stephan +Z 5086984ef977bc443ff4f93b9408b66c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d27bb07e6c..550c5267f1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889 \ No newline at end of file +ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e \ No newline at end of file From fd013682d66673602318e2520de94b21196c37fc Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 9 Oct 2023 10:44:10 +0000 Subject: [PATCH 030/242] Minor JNI doc and public/private cleanups. FossilOrigin-Name: c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d --- ext/jni/src/org/sqlite/jni/CApi.java | 42 ++++++++++++++-------------- manifest | 12 ++++---- manifest.uuid | 2 +- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/CApi.java b/ext/jni/src/org/sqlite/jni/CApi.java index 26b83d1971..8149d624ad 100644 --- a/ext/jni/src/org/sqlite/jni/CApi.java +++ b/ext/jni/src/org/sqlite/jni/CApi.java @@ -35,10 +35,11 @@ import java.util.Arrays;

    This class is package-private in order to keep Java clients from having direct access to the low-level C-style APIs, a design decision made by Java developers based on the C-style API being - riddled with opportunities for other Java to proverbially shoot + riddled with opportunities for Java developers to proverbially shoot themselves in the foot with. Third-party copies of this code may eliminate that guard by simply changing this class from - package-private to public. + package-private to public. Its methods which are intended to be + exposed that way are all public.

    Only functions which materially differ from their C counterparts are documented here, and only those material differences are @@ -100,8 +101,8 @@ final class CApi { private static native void init(); /** - Returns a nul-terminated copy of s as a byte array, or null if s - is null. + Returns a nul-terminated copy of s as a UTF-8-encoded byte array, + or null if s is null. */ private static byte[] nulTerminateUtf8(String s){ return null==s ? null : (s+"\0").getBytes(StandardCharsets.UTF_8); @@ -127,8 +128,7 @@ final class CApi {

    This routine returns false without side effects if the current JNIEnv is not cached, else returns true, but this information is primarily for testing of the JNI bindings and is not information - which client-level code should use to make any informed - decisions. + which client-level code can use to make any informed decisions. */ public static native boolean sqlite3_java_uncache_thread(); @@ -159,15 +159,15 @@ final class CApi { Functions almost as documented for the C API, with these exceptions: -

    - The callback interface is is shorter because of +

    - The callback interface is shorter because of cross-language differences. Specifically, 3rd argument to the C auto-extension callback interface is unnecessary here. -

    The C API docs do not specifically say so, but if the list of auto-extensions is manipulated from an auto-extension, it is undefined which, if any, auto-extensions will subsequently - execute for the current database. + execute for the current database. That is, doing so will result + in unpredictable, but not undefined, behavior.

    See the AutoExtension class docs for more information. */ @@ -297,7 +297,7 @@ final class CApi { overload than to do that in C, so that signature is the public-facing one. */ - static native int sqlite3_bind_parameter_index( + private static native int sqlite3_bind_parameter_index( @NotNull long ptrToStmt, @NotNull byte[] paramName ); @@ -701,7 +701,7 @@ final class CApi { This implementation is private because it's too easy to pass it non-NUL-terminated byte arrays from client code. */ - public static native int sqlite3_complete( + private static native int sqlite3_complete( @NotNull byte[] nulTerminatedUtf8Sql ); @@ -709,7 +709,7 @@ final class CApi { Unlike the C API, this returns SQLITE_MISUSE if its argument is null (as opposed to invoking UB). */ - static int sqlite3_complete(@NotNull String sql){ + public static int sqlite3_complete(@NotNull String sql){ return sqlite3_complete( nulTerminateUtf8(sql) ); } @@ -970,7 +970,7 @@ final class CApi { more ways to shoot themselves in the foot without providing any real utility. */ - static native int sqlite3_prepare( + private static native int sqlite3_prepare( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, @NotNull OutputPointer.sqlite3_stmt outStmt, @Nullable OutputPointer.Int32 pTailOffset @@ -1028,7 +1028,7 @@ final class CApi { /** @see #sqlite3_prepare */ - static native int sqlite3_prepare_v2( + private static native int sqlite3_prepare_v2( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, @NotNull OutputPointer.sqlite3_stmt outStmt, @Nullable OutputPointer.Int32 pTailOffset @@ -1080,7 +1080,7 @@ final class CApi { /** @see #sqlite3_prepare */ - static native int sqlite3_prepare_v3( + private static native int sqlite3_prepare_v3( @NotNull long ptrToDb, @NotNull byte[] sqlUtf8, int maxBytes, int prepFlags, @NotNull OutputPointer.sqlite3_stmt outStmt, @Nullable OutputPointer.Int32 pTailOffset @@ -1518,7 +1518,7 @@ final class CApi { This overload is private because its final parameter is arguably unnecessary in Java. */ - public static native void sqlite3_result_blob( + private static native void sqlite3_result_blob( @NotNull sqlite3_context cx, @Nullable byte[] blob, int maxLen ); @@ -1546,7 +1546,7 @@ final class CApi {

    This overload is private because its final parameter is arguably unnecessary in Java.

    */ - public static native void sqlite3_result_blob64( + private static native void sqlite3_result_blob64( @NotNull sqlite3_context cx, @Nullable byte[] blob, long maxLen ); @@ -1560,7 +1560,7 @@ final class CApi { This overload is private because its final parameter is arguably unnecessary in Java. */ - public static native void sqlite3_result_text( + private static native void sqlite3_result_text( @NotNull sqlite3_context cx, @Nullable byte[] utf8, int maxLen ); @@ -1603,7 +1603,7 @@ final class CApi { This overload is private because its maxLength parameter is arguably unnecessary in Java. */ - public static native void sqlite3_result_text64( + private static native void sqlite3_result_text64( @NotNull sqlite3_context cx, @Nullable byte[] text, long maxLength, int encoding ); @@ -1713,7 +1713,7 @@ final class CApi { (sqlite3_strglob(String,String)) than to do that in C, so that signature is the public-facing one. */ - public static native int sqlite3_strglob( + private static native int sqlite3_strglob( @NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8 ); @@ -1727,7 +1727,7 @@ final class CApi { /** The LIKE counterpart of the private sqlite3_strglob() method. */ - public static native int sqlite3_strlike( + private static native int sqlite3_strlike( @NotNull byte[] glob, @NotNull byte[] nullTerminatedUtf8, int escChar ); diff --git a/manifest b/manifest index dfdd2ee2fd..cc9a595b87 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rename\sSQLite3Jni\sto\sCApi\sto\s(A)\sreduce\sname\sprefix\scollisions\swith\sincoming\sclasses\sand\s(B)\salign\swith\sits\scounterpart\sin\sthe\sJS\sbuild.\sRemove\sthe\sCanonical\sannotation\sbecause\s(A)\sthe\snew\scode\sseparation\swill\sinherently\smake\sthat\sdistinction\sand\s(B)\sthe\sline\sbetween\struly\scanonical\sand\ssemi-canonical\s(e.g.\sdiffering\sin\ssignature\soverloads)\sis\sblurry\senough\sthat\sconsistent\suse\sof\sthat\sannocation\sis\sbecoming\san\sunnecessary\sburden. -D 2023-10-09T10:30:54.032 +C Minor\sJNI\sdoc\sand\spublic/private\scleanups. +D 2023-10-09T10:44:10.717 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -245,7 +245,7 @@ F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 -F ext/jni/src/org/sqlite/jni/CApi.java 573a700536f8ed91584041894b35087d7183e10005b19d3e4cbb2c7f4147358d w ext/jni/src/org/sqlite/jni/SQLite3Jni.java +F ext/jni/src/org/sqlite/jni/CApi.java c1dde485a3a3f43c46c8d9c527f9ba5bf303fe0409b2c0de253fb7b6e1055f7e F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 @@ -2124,8 +2124,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c4ab4200dc2538e1132d87d70fd309b26b0da8a918fede1cb09b567ea40ec889 -R 9e5ca9b62d5fe5ed2cf201efbae39e9e +P ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e +R af6221100b1b0f5eb240f10a6b3978ab U stephan -Z 5086984ef977bc443ff4f93b9408b66c +Z ff4bc4025115006080a68d26c19680b4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 550c5267f1..6ee1c62b7d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e \ No newline at end of file +c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d \ No newline at end of file From c8f829cdac5d013cf2d1d471307e82bd0390e978 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 9 Oct 2023 11:46:32 +0000 Subject: [PATCH 031/242] Add JNI Sqlite and SqliteException classes. Add Tester2.java as the main test app for the high-level API. FossilOrigin-Name: 6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381 --- ext/jni/GNUmakefile | 21 +- ext/jni/src/org/sqlite/jni/Sqlite.java | 60 +++ .../src/org/sqlite/jni/SqliteException.java | 42 ++ ext/jni/src/org/sqlite/jni/Tester1.java | 9 +- ext/jni/src/org/sqlite/jni/Tester2.java | 417 ++++++++++++++++++ .../org/sqlite/jni/fts5/Fts5ExtensionApi.java | 19 - ext/jni/src/org/sqlite/jni/fts5/fts5_api.java | 1 - ext/jni/src/org/sqlite/jni/sqlite3.java | 5 - ext/jni/src/org/sqlite/jni/sqlite3_stmt.java | 5 - manifest | 25 +- manifest.uuid | 2 +- 11 files changed, 550 insertions(+), 56 deletions(-) create mode 100644 ext/jni/src/org/sqlite/jni/Sqlite.java create mode 100644 ext/jni/src/org/sqlite/jni/SqliteException.java create mode 100644 ext/jni/src/org/sqlite/jni/Tester2.java diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 661685b3f7..1b78d97ae1 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -98,6 +98,8 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ ResultCode.java \ RollbackHookCallback.java \ ScalarFunction.java \ + Sqlite.java \ + SqliteException.java \ SQLFunction.java \ CallbackProxy.java \ CApi.java \ @@ -113,6 +115,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ ) JAVA_FILES.unittest := $(patsubst %,$(dir.src.jni)/%,\ Tester1.java \ + Tester2.java \ ) ifeq (1,$(enable.fts5)) JAVA_FILES.unittest += $(patsubst %,$(dir.src.jni)/%,\ @@ -294,19 +297,23 @@ $(package.dll): $(sqlite3-jni.c) $(MAKEFILE) all: $(package.dll) .PHONY: test test-one -test.flags ?= -test.main.flags = -ea -Djava.library.path=$(dir.bld.c) \ - $(java.flags) -cp $(classpath) \ - org.sqlite.jni.Tester1 +Tester1.flags ?= +Tester2.flags ?= +test.flags.jvm = -ea -Djava.library.path=$(dir.bld.c) \ + $(java.flags) -cp $(classpath) test.deps := $(CLASS_FILES) $(package.dll) test-one: $(test.deps) - $(bin.java) $(test.main.flags) $(test.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester1 $(Tester1.flags) +# $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 $(Tester2.flags) test-sqllog: $(test.deps) @echo "Testing with -sqllog..." - $(bin.java) $(test.main.flags) -sqllog + $(bin.java) $(test.flags.jvm) -sqllog test-mt: $(test.deps) @echo "Testing in multi-threaded mode:"; - $(bin.java) $(test.main.flags) -t 7 -r 50 -shuffle $(test.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester1 \ + -t 7 -r 50 -shuffle $(Tester1.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 \ + -t 7 -r 50 -shuffle $(Tester2.flags) test: test-one test-mt tests: test test-sqllog diff --git a/ext/jni/src/org/sqlite/jni/Sqlite.java b/ext/jni/src/org/sqlite/jni/Sqlite.java new file mode 100644 index 0000000000..541c6c7c1e --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/Sqlite.java @@ -0,0 +1,60 @@ +/* +** 2023-10-09 +** +** 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 is part of the JNI bindings for the sqlite3 C API. +*/ +package org.sqlite.jni; +import static org.sqlite.jni.CApi.*; + +/** + This class represents a database connection, analog to the C-side + sqlite3 class but with added argument validation, exceptions, and + similar "smoothing of sharp edges" to make the API safe to use from + Java. It also acts as a namespace for other types for which + individual instances are tied to a specific database connection. +*/ +public final class Sqlite implements AutoCloseable { + private sqlite3 db = null; + + //! Used only by the open() factory functions. + private Sqlite(sqlite3 db){ + this.db = db; + } + + public static Sqlite open(String filename, int flags, String zVfs){ + final OutputPointer.sqlite3 out = new OutputPointer.sqlite3(); + final int rc = sqlite3_open_v2(filename, out, flags, zVfs); + final sqlite3 n = out.take(); + if( 0!=rc ){ + if( null==n ) throw new SqliteException(rc); + else throw new SqliteException(n); + } + return new Sqlite(n); + } + + public static Sqlite open(String filename, int flags){ + return open(filename, flags, null); + } + + public static Sqlite open(String filename){ + return open(filename, 0, null); + } + + @Override public void close(){ + if(null!=this.db){ + this.db.close(); + this.db = null; + } + } + + sqlite3 dbHandle(){ return this.db; } + +} diff --git a/ext/jni/src/org/sqlite/jni/SqliteException.java b/ext/jni/src/org/sqlite/jni/SqliteException.java new file mode 100644 index 0000000000..6eaf825dc3 --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/SqliteException.java @@ -0,0 +1,42 @@ +/* +** 2023-10-09 +** +** 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 is part of the JNI bindings for the sqlite3 C API. +*/ +package org.sqlite.jni; +import static org.sqlite.jni.CApi.*; + +/** + A wrapper for communicating C-level (sqlite3*) instances with + Java. These wrappers do not own their associated pointer, they + simply provide a type-safe way to communicate it between Java + and C via JNI. +*/ +public final class SqliteException extends java.lang.RuntimeException { + + public SqliteException(String msg){ + super(msg); + } + + public SqliteException(int sqlite3ResultCode){ + super(sqlite3_errstr(sqlite3ResultCode)); + } + + public SqliteException(sqlite3 db){ + super(sqlite3_errmsg(db)); + db.close(); + } + + public SqliteException(Sqlite db){ + this(db.dbHandle()); + } + +} diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 70609bc7f7..0ff1c98dbe 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -1925,7 +1925,6 @@ public class Tester1 implements Runnable { sqlite3_shutdown(); int nMethods = 0; int nNatives = 0; - int nCanonical = 0; final java.lang.reflect.Method[] declaredMethods = CApi.class.getDeclaredMethods(); for(java.lang.reflect.Method m : declaredMethods){ @@ -1934,20 +1933,16 @@ public class Tester1 implements Runnable { final String name = m.getName(); if(name.startsWith("sqlite3_")){ ++nMethods; - if( m.isAnnotationPresent( org.sqlite.jni.annotation.Canonical.class ) ){ - ++nCanonical; - } if( 0!=(mod & java.lang.reflect.Modifier.NATIVE) ){ ++nNatives; } } } } - outln("\tSQLite3Jni.sqlite3_*() methods: "+ + outln("\tCApi.sqlite3_*() methods: "+ nMethods+" total, with "+ nNatives+" native, "+ - (nMethods - nNatives)+" Java, ", - nCanonical," @Canonical" + (nMethods - nNatives)+" Java" ); outln("\tTotal test time = " +(timeEnd - timeStart)+"ms"); diff --git a/ext/jni/src/org/sqlite/jni/Tester2.java b/ext/jni/src/org/sqlite/jni/Tester2.java new file mode 100644 index 0000000000..a150eecb4d --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/Tester2.java @@ -0,0 +1,417 @@ +/* +** 2023-10-09 +** +** 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 contains a set of tests for the sqlite3 JNI bindings. +*/ +package org.sqlite.jni; +import static org.sqlite.jni.CApi.*; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class Tester2 implements Runnable { + //! True when running in multi-threaded mode. + private static boolean mtMode = false; + //! True to sleep briefly between tests. + private static boolean takeNaps = false; + //! True to shuffle the order of the tests. + private static boolean shuffle = false; + //! True to dump the list of to-run tests to stdout. + private static boolean listRunTests = false; + //! True to squelch all out() and outln() output. + private static boolean quietMode = false; + //! Total number of runTests() calls. + private static int nTestRuns = 0; + //! List of test*() methods to run. + private static List testMethods = null; + //! List of exceptions collected by run() + private static List listErrors = new ArrayList<>(); + private static final class Metrics { + //! Number of times createNewDb() (or equivalent) is invoked. + volatile int dbOpen = 0; + } + + //! Instance ID. + private Integer tId; + + Tester2(Integer id){ + tId = id; + } + + static final Metrics metrics = new Metrics(); + + public static synchronized void outln(){ + if( !quietMode ){ + System.out.println(""); + } + } + + public static synchronized void outPrefix(){ + if( !quietMode ){ + System.out.print(Thread.currentThread().getName()+": "); + } + } + + public static synchronized void outln(Object val){ + if( !quietMode ){ + outPrefix(); + System.out.println(val); + } + } + + public static synchronized void out(Object val){ + if( !quietMode ){ + System.out.print(val); + } + } + + @SuppressWarnings("unchecked") + public static synchronized void out(Object... vals){ + if( !quietMode ){ + outPrefix(); + for(Object v : vals) out(v); + } + } + + @SuppressWarnings("unchecked") + public static synchronized void outln(Object... vals){ + if( !quietMode ){ + out(vals); out("\n"); + } + } + + static volatile int affirmCount = 0; + public static synchronized int affirm(Boolean v, String comment){ + ++affirmCount; + if( false ) assert( v /* prefer assert over exception if it's enabled because + the JNI layer sometimes has to suppress exceptions, + so they might be squelched on their way back to the + top. */); + if( !v ) throw new RuntimeException(comment); + return affirmCount; + } + + public static void affirm(Boolean v){ + affirm(v, "Affirmation failed."); + } + + @SingleThreadOnly /* because it's thread-agnostic */ + private void test1(){ + affirm(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER); + } + + /* Copy/paste/rename this to add new tests. */ + private void _testTemplate(){ + //final sqlite3 db = createNewDb(); + //sqlite3_stmt stmt = prepare(db,"SELECT 1"); + //sqlite3_finalize(stmt); + //sqlite3_close_v2(db); + } + + private void nap() throws InterruptedException { + if( takeNaps ){ + Thread.sleep(java.util.concurrent.ThreadLocalRandom.current().nextInt(3, 17), 0); + } + } + + @ManualTest /* because we only want to run this test on demand */ + private void testFail(){ + affirm( false, "Intentional failure." ); + } + + private void runTests(boolean fromThread) throws Exception { + List mlist = testMethods; + affirm( null!=mlist ); + if( shuffle ){ + mlist = new ArrayList<>( testMethods.subList(0, testMethods.size()) ); + java.util.Collections.shuffle(mlist); + } + if( listRunTests ){ + synchronized(this.getClass()){ + if( !fromThread ){ + out("Initial test"," list: "); + for(java.lang.reflect.Method m : testMethods){ + out(m.getName()+" "); + } + outln(); + outln("(That list excludes some which are hard-coded to run.)"); + } + out("Running"," tests: "); + for(java.lang.reflect.Method m : mlist){ + out(m.getName()+" "); + } + outln(); + } + } + for(java.lang.reflect.Method m : mlist){ + nap(); + try{ + m.invoke(this); + }catch(java.lang.reflect.InvocationTargetException e){ + outln("FAILURE: ",m.getName(),"(): ", e.getCause()); + throw e; + } + } + synchronized( this.getClass() ){ + ++nTestRuns; + } + } + + public void run() { + try { + runTests(0!=this.tId); + }catch(Exception e){ + synchronized( listErrors ){ + listErrors.add(e); + } + }finally{ + affirm( sqlite3_java_uncache_thread() ); + affirm( !sqlite3_java_uncache_thread() ); + } + } + + /** + Runs the basic sqlite3 JNI binding sanity-check suite. + + CLI flags: + + -q|-quiet: disables most test output. + + -t|-thread N: runs the tests in N threads + concurrently. Default=1. + + -r|-repeat N: repeats the tests in a loop N times, each one + consisting of the -thread value's threads. + + -shuffle: randomizes the order of most of the test functions. + + -naps: sleep small random intervals between tests in order to add + some chaos for cross-thread contention. + + -list-tests: outputs the list of tests being run, minus some + which are hard-coded. This is noisy in multi-threaded mode. + + -fail: forces an exception to be thrown during the test run. Use + with -shuffle to make its appearance unpredictable. + + -v: emit some developer-mode info at the end. + */ + public static void main(String[] args) throws Exception { + Integer nThread = 1; + boolean doSomethingForDev = false; + Integer nRepeat = 1; + boolean forceFail = false; + boolean sqlLog = false; + boolean configLog = false; + boolean squelchTestOutput = false; + for( int i = 0; i < args.length; ){ + String arg = args[i++]; + if(arg.startsWith("-")){ + arg = arg.replaceFirst("-+",""); + if(arg.equals("v")){ + doSomethingForDev = true; + //listBoundMethods(); + }else if(arg.equals("t") || arg.equals("thread")){ + nThread = Integer.parseInt(args[i++]); + }else if(arg.equals("r") || arg.equals("repeat")){ + nRepeat = Integer.parseInt(args[i++]); + }else if(arg.equals("shuffle")){ + shuffle = true; + }else if(arg.equals("list-tests")){ + listRunTests = true; + }else if(arg.equals("fail")){ + forceFail = true; + }else if(arg.equals("sqllog")){ + sqlLog = true; + }else if(arg.equals("configlog")){ + configLog = true; + }else if(arg.equals("naps")){ + takeNaps = true; + }else if(arg.equals("q") || arg.equals("quiet")){ + squelchTestOutput = true; + }else{ + throw new IllegalArgumentException("Unhandled flag:"+arg); + } + } + } + + if( sqlLog ){ + if( sqlite3_compileoption_used("ENABLE_SQLLOG") ){ + final ConfigSqllogCallback log = new ConfigSqllogCallback() { + @Override public void call(sqlite3 db, String msg, int op){ + switch(op){ + case 0: outln("Opening db: ",db); break; + case 1: outln("SQL ",db,": ",msg); break; + case 2: outln("Closing db: ",db); break; + } + } + }; + int rc = sqlite3_config( log ); + affirm( 0==rc ); + rc = sqlite3_config( (ConfigSqllogCallback)null ); + affirm( 0==rc ); + rc = sqlite3_config( log ); + affirm( 0==rc ); + }else{ + outln("WARNING: -sqllog is not active because library was built ", + "without SQLITE_ENABLE_SQLLOG."); + } + } + if( configLog ){ + final ConfigLogCallback log = new ConfigLogCallback() { + @Override public void call(int code, String msg){ + outln("ConfigLogCallback: ",ResultCode.getEntryForInt(code),": ", msg); + }; + }; + int rc = sqlite3_config( log ); + affirm( 0==rc ); + rc = sqlite3_config( (ConfigLogCallback)null ); + affirm( 0==rc ); + rc = sqlite3_config( log ); + affirm( 0==rc ); + } + + quietMode = squelchTestOutput; + outln("If you just saw warning messages regarding CallStaticObjectMethod, ", + "you are very likely seeing the side effects of a known openjdk8 ", + "bug. It is unsightly but does not affect the library."); + + { + // Build list of tests to run from the methods named test*(). + testMethods = new ArrayList<>(); + int nSkipped = 0; + for(final java.lang.reflect.Method m : Tester2.class.getDeclaredMethods()){ + final String name = m.getName(); + if( name.equals("testFail") ){ + if( forceFail ){ + testMethods.add(m); + } + }else if( !m.isAnnotationPresent( ManualTest.class ) ){ + if( nThread>1 && m.isAnnotationPresent( SingleThreadOnly.class ) ){ + if( 0==nSkipped++ ){ + out("Skipping tests in multi-thread mode:"); + } + out(" "+name+"()"); + }else if( name.startsWith("test") ){ + testMethods.add(m); + } + } + } + if( nSkipped>0 ) out("\n"); + } + + final long timeStart = System.currentTimeMillis(); + int nLoop = 0; + switch( sqlite3_threadsafe() ){ /* Sanity checking */ + case 0: + affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ), + "Could not switch to single-thread mode." ); + affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_MULTITHREAD ), + "Could switch to multithread mode." ); + affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_SERIALIZED ), + "Could not switch to serialized threading mode." ); + outln("This is a single-threaded build. Not using threads."); + nThread = 1; + break; + case 1: + case 2: + affirm( 0==sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ), + "Could not switch to single-thread mode." ); + affirm( 0==sqlite3_config( SQLITE_CONFIG_MULTITHREAD ), + "Could not switch to multithread mode." ); + affirm( 0==sqlite3_config( SQLITE_CONFIG_SERIALIZED ), + "Could not switch to serialized threading mode." ); + break; + default: + affirm( false, "Unhandled SQLITE_THREADSAFE value." ); + } + outln("libversion_number: ", + sqlite3_libversion_number(),"\n", + sqlite3_libversion(),"\n",SQLITE_SOURCE_ID,"\n", + "SQLITE_THREADSAFE=",sqlite3_threadsafe()); + final boolean showLoopCount = (nRepeat>1 && nThread>1); + if( showLoopCount ){ + outln("Running ",nRepeat," loop(s) with ",nThread," thread(s) each."); + } + if( takeNaps ) outln("Napping between tests is enabled."); + for( int n = 0; n < nRepeat; ++n ){ + ++nLoop; + if( showLoopCount ) out((1==nLoop ? "" : " ")+nLoop); + if( nThread<=1 ){ + new Tester2(0).runTests(false); + continue; + } + Tester2.mtMode = true; + final ExecutorService ex = Executors.newFixedThreadPool( nThread ); + for( int i = 0; i < nThread; ++i ){ + ex.submit( new Tester2(i), i ); + } + ex.shutdown(); + try{ + ex.awaitTermination(nThread*200, java.util.concurrent.TimeUnit.MILLISECONDS); + ex.shutdownNow(); + }catch (InterruptedException ie){ + ex.shutdownNow(); + Thread.currentThread().interrupt(); + } + if( !listErrors.isEmpty() ){ + quietMode = false; + outln("TEST ERRORS:"); + Exception err = null; + for( Exception e : listErrors ){ + e.printStackTrace(); + if( null==err ) err = e; + } + if( null!=err ) throw err; + } + } + if( showLoopCount ) outln(); + quietMode = false; + + final long timeEnd = System.currentTimeMillis(); + outln("Tests done. Metrics across ",nTestRuns," total iteration(s):"); + outln("\tAssertions checked: ",affirmCount); + outln("\tDatabases opened: ",metrics.dbOpen); + if( doSomethingForDev ){ + sqlite3_jni_internal_details(); + } + affirm( 0==sqlite3_release_memory(1) ); + sqlite3_shutdown(); + int nMethods = 0; + int nNatives = 0; + int nCanonical = 0; + final java.lang.reflect.Method[] declaredMethods = + CApi.class.getDeclaredMethods(); + for(java.lang.reflect.Method m : declaredMethods){ + final int mod = m.getModifiers(); + if( 0!=(mod & java.lang.reflect.Modifier.STATIC) ){ + final String name = m.getName(); + if(name.startsWith("sqlite3_")){ + ++nMethods; + if( 0!=(mod & java.lang.reflect.Modifier.NATIVE) ){ + ++nNatives; + } + } + } + } + outln("\tCApi.sqlite3_*() methods: "+ + nMethods+" total, with "+ + nNatives+" native, "+ + (nMethods - nNatives)+" Java" + ); + outln("\tTotal test time = " + +(timeEnd - timeStart)+"ms"); + } +} diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java index 79de05ff3d..7829104cd9 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java +++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java @@ -33,67 +33,51 @@ public final class Fts5ExtensionApi extends NativePointerHolder { */ public static synchronized native fts5_api getInstanceForDb(@NotNull sqlite3 db); - @Canonical public synchronized native int xCreateFunction(@NotNull String name, @Nullable Object userData, @NotNull fts5_extension_function xFunction); diff --git a/ext/jni/src/org/sqlite/jni/sqlite3.java b/ext/jni/src/org/sqlite/jni/sqlite3.java index 27a6f9f158..c358e91c8f 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3.java @@ -37,11 +37,6 @@ public final class sqlite3 extends NativePointerHolder ; } - @Override protected void finalize(){ - //System.out.println(this+".finalize()"); - CApi.sqlite3_close_v2(this.clearNativePointer()); - } - @Override public void close(){ CApi.sqlite3_close_v2(this.clearNativePointer()); } diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java b/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java index 21e4bef03d..e773b73631 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java +++ b/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java @@ -24,11 +24,6 @@ public final class sqlite3_stmt extends NativePointerHolder // Only invoked from JNI. private sqlite3_stmt(){} - //For as-yet-unknown reasons, this triggers a JVM crash. - //@Override protected void finalize(){ - // CApi.sqlite3_finalize(this.clearNativePointer()); - //} - @Override public void close(){ CApi.sqlite3_finalize(this.clearNativePointer()); } diff --git a/manifest b/manifest index cc9a595b87..cd5140dc7a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\sJNI\sdoc\sand\spublic/private\scleanups. -D 2023-10-09T10:44:10.717 +C Add\sJNI\sSqlite\sand\sSqliteException\sclasses.\sAdd\sTester2.java\sas\sthe\smain\stest\sapp\sfor\sthe\shigh-level\sAPI. +D 2023-10-09T11:46:32.020 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 8c942ede995d4e42f79c838c03b913dde62f573b443fe8f308dae547bcf04d0b +F ext/jni/GNUmakefile 8c44e22bad18ecc266dd8c521f215e95dc3741d9e337c51b175029abaedcfb35 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c fb8f178d27df828e3c797b4427a0a20545b44f5147ce38d09ce9b465be5a840b @@ -262,8 +262,11 @@ F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c +F ext/jni/src/org/sqlite/jni/Sqlite.java 04c1efa37eda02e5695a890479f2de5cc54abdbec61042611419f0141e05f83b +F ext/jni/src/org/sqlite/jni/SqliteException.java cabf37b09f519b6b8aebecd100e7f66fffc1d244d3e46f62c2b12120b9e2a33c F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 9326bf645accee7b4a509b7a4db1fa2ba46efaf131e0d53816a6ad109056cd97 +F ext/jni/src/org/sqlite/jni/Tester1.java f7b85fe24cf6c3e43bdf7e390617657e8137359f804d76921829c2a8c41b6df1 +F ext/jni/src/org/sqlite/jni/Tester2.java 75aa079e2baf8f73d95299da092e611656be0f6e12fe2fa051fdd984657857e2 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 959d4677a857c9079c6e96ddd10918b946d68359af6252b6f284379069ea3d27 @@ -274,19 +277,19 @@ F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7 F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41 F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 7058da97059b8e156c17561a47ecd7faa0fc3e2d8c2588b9a28dbff8d06202dd -F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java e2680721bd83129d0d650ba845b44d7634a9489a90a56c5ce3c54508bf470743 +F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java c8e06475a6172a7cd61b2bad9cfb18b6f059ffdd2935e62856f95785a14fe0e5 F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 2a7f3d76a1206e6a43d4c4ed9609b294d5431cc7d8fb875d8419f76efa6e56dc F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java cc9a53846a168a215238af224c31cef0e8379780e36e8a5e743b00c08145cf19 F ext/jni/src/org/sqlite/jni/fts5/XTokenizeCallback.java 1efd1220ea328a32f2d2a1b16c735864159e929480f71daad4de9d5944839167 -F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java e2ad9bc06a9d307e0a6221c11645783898906455a92b1f7d5ec9b9ff1af1b8ea +F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java 90f09477331c371a8abe0a6504cfe094bc075b29a800be9d72a2c92a7bb49db1 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 1fe0f5692c1d67475d12b067f0469949073446f18c56eba5ee5da6ddd06db9b9 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java ea993738b851038c16d98576abd0db3d6028a231f075a394fb8a78c7834d0f6c F ext/jni/src/org/sqlite/jni/package-info.java 7d465cbdf9050761db0db6d0c542afaaad7dc67f61510860592159c48bfc40e8 -F ext/jni/src/org/sqlite/jni/sqlite3.java 3247101956b66c0a59333d3ddd3550eadf24b37c1ab15c322efbed5b221d0f08 +F ext/jni/src/org/sqlite/jni/sqlite3.java 4fa76f9c618264ed17ab613570076002c0b78717261b263350cd92d6d6b01242 F ext/jni/src/org/sqlite/jni/sqlite3_backup.java 42db8b2f9cd8e9e16217273890e5d4afbb102603d7130a2cb1651f1c69c1cfa4 F ext/jni/src/org/sqlite/jni/sqlite3_blob.java 7c341bca1856475fc3bf3697251e0cf1d737ddcb099c65d90afdc164aaddcc51 F ext/jni/src/org/sqlite/jni/sqlite3_context.java ba8da75eaaeb557c986af3fb4dbc69501cf2b083ca33497f2c0c70dbc0a53f2c -F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java 38e5e88e79cde51a1dbeacfdbe7857b93ca105972f47c1198a51f0eaa48886f5 +F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java fa0703004721c49d6d08a0c1e99439fadb8cebaebf42b81ee3f427d7f950d1eb F ext/jni/src/org/sqlite/jni/sqlite3_value.java 3d1d4903e267bc0bc81d57d21f5e85978eff389a1a6ed46726dbe75f85e6914a F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2124,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ca216b4486aff7d206ebfc3a5e84d48919c282425d4313396bc19313ffca8a0e -R af6221100b1b0f5eb240f10a6b3978ab +P c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d +R fe6b079fd83fb48b0f0881df379b853e U stephan -Z ff4bc4025115006080a68d26c19680b4 +Z 8f2bcd17cd435607663eb211630fda5f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6ee1c62b7d..d42a4747b6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d \ No newline at end of file +6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381 \ No newline at end of file From 4a111420725bfd6d2f4c80ce93e7b5491d3743ce Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 12:39:59 +0000 Subject: [PATCH 032/242] Fix harmless compiler warning in the test module for sessions. FossilOrigin-Name: 3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68 --- ext/session/test_session.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/session/test_session.c b/ext/session/test_session.c index df42884efc..2e8870db61 100644 --- a/ext/session/test_session.c +++ b/ext/session/test_session.c @@ -1529,7 +1529,7 @@ static int SQLITE_TCLAPI test_changegroup_cmd( case 2: { /* output */ int nByte = 0; - const u8 *aByte = 0; + u8 *aByte = 0; rc = sqlite3changegroup_output(p->pGrp, &nByte, (void**)&aByte); if( rc!=SQLITE_OK ){ rc = test_session_error(interp, rc, 0); diff --git a/manifest b/manifest index cd5140dc7a..83fa2b3dc8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sJNI\sSqlite\sand\sSqliteException\sclasses.\sAdd\sTester2.java\sas\sthe\smain\stest\sapp\sfor\sthe\shigh-level\sAPI. -D 2023-10-09T11:46:32.020 +C Fix\sharmless\scompiler\swarning\sin\sthe\stest\smodule\sfor\ssessions. +D 2023-10-09T12:39:59.903 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -549,7 +549,7 @@ F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb4 F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc F ext/session/sqlite3session.c ea28d07a280dc82efd4e98417a10b582058dc11a0f2a6ac3b194aa20d233d758 F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 -F ext/session/test_session.c 0b4bc954e5e411baa723e52abd46380ca428797dff39ed62c610001777a2b70f +F ext/session/test_session.c be0610a8ab717c3f9c898576d8b4c43e5eb75384a47fed0a0b22768067552778 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb @@ -2127,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c49d36ece283274963ce2e5a4db1e8f586dffa22e47f4adb93c625f918c3fd5d -R fe6b079fd83fb48b0f0881df379b853e -U stephan -Z 8f2bcd17cd435607663eb211630fda5f +P 6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381 +R b6511d973ff6f4fe2616bdecdd85eae3 +U drh +Z a23b7d6675008bfc1be60599cdc88bc0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d42a4747b6..db4a47bea3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381 \ No newline at end of file +3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68 \ No newline at end of file From 66dacae4c3f818d0a9e94ecb4433c823a69a98aa Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 9 Oct 2023 12:45:28 +0000 Subject: [PATCH 033/242] Flesh out the error state captured by SqliteException.java. Doc additions. FossilOrigin-Name: 5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858 --- ext/jni/src/org/sqlite/jni/Sqlite.java | 13 ++++++-- .../src/org/sqlite/jni/SqliteException.java | 31 +++++++++++++++++++ manifest | 16 +++++----- manifest.uuid | 2 +- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/Sqlite.java b/ext/jni/src/org/sqlite/jni/Sqlite.java index 541c6c7c1e..23ceaa4b47 100644 --- a/ext/jni/src/org/sqlite/jni/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/Sqlite.java @@ -29,9 +29,14 @@ public final class Sqlite implements AutoCloseable { this.db = db; } - public static Sqlite open(String filename, int flags, String zVfs){ + /** + Returns a newly-opened db connection or throws SqliteException if + opening fails. All arguments are as documented for + sqlite3_open_v2(). + */ + public static Sqlite open(String filename, int flags, String vfsName){ final OutputPointer.sqlite3 out = new OutputPointer.sqlite3(); - final int rc = sqlite3_open_v2(filename, out, flags, zVfs); + final int rc = sqlite3_open_v2(filename, out, flags, vfsName); final sqlite3 n = out.take(); if( 0!=rc ){ if( null==n ) throw new SqliteException(rc); @@ -55,6 +60,10 @@ public final class Sqlite implements AutoCloseable { } } + /** + Returns this object's underlying native db handle, or null if + this instance has been closed. + */ sqlite3 dbHandle(){ return this.db; } } diff --git a/ext/jni/src/org/sqlite/jni/SqliteException.java b/ext/jni/src/org/sqlite/jni/SqliteException.java index 6eaf825dc3..3da5d8c583 100644 --- a/ext/jni/src/org/sqlite/jni/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/SqliteException.java @@ -21,22 +21,53 @@ import static org.sqlite.jni.CApi.*; and C via JNI. */ public final class SqliteException extends java.lang.RuntimeException { + int errCode = SQLITE_ERROR; + int xerrCode = SQLITE_ERROR; + int errOffset = -1; + int sysErrno = 0; + /** + Records the given error string and uses SQLITE_ERROR for both the + error code and extended error code. + */ public SqliteException(String msg){ super(msg); } + /** + Uses sqlite3_errstr(sqlite3ResultCode) for the error string and + sets both the error code and extended error code to the given + value. + */ public SqliteException(int sqlite3ResultCode){ super(sqlite3_errstr(sqlite3ResultCode)); + errCode = xerrCode = sqlite3ResultCode; } + /** + Records the current error state of db (which must not be null and + must refer to an opened db object) then closes it. + */ public SqliteException(sqlite3 db){ super(sqlite3_errmsg(db)); + errCode = sqlite3_errcode(db); + xerrCode = sqlite3_extended_errcode(db); + errOffset = sqlite3_error_offset(db); + sysErrno = sqlite3_system_errno(db); db.close(); } + /** + Records the current error state of db (which must not be null and must + refer to an open database) then closes it. + */ public SqliteException(Sqlite db){ this(db.dbHandle()); } + public int errcode(){ return errCode; } + public int extendedErrcode(){ return xerrCode; } + public int errorOffset(){ return errOffset; } + public int systemErrno(){ return sysErrno; } + } diff --git a/manifest b/manifest index 83fa2b3dc8..f7d7fb70fc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\sin\sthe\stest\smodule\sfor\ssessions. -D 2023-10-09T12:39:59.903 +C Flesh\sout\sthe\serror\sstate\scaptured\sby\sSqliteException.java.\sDoc\sadditions. +D 2023-10-09T12:45:28.189 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -262,8 +262,8 @@ F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c -F ext/jni/src/org/sqlite/jni/Sqlite.java 04c1efa37eda02e5695a890479f2de5cc54abdbec61042611419f0141e05f83b -F ext/jni/src/org/sqlite/jni/SqliteException.java cabf37b09f519b6b8aebecd100e7f66fffc1d244d3e46f62c2b12120b9e2a33c +F ext/jni/src/org/sqlite/jni/Sqlite.java 44b23a929e5d625b35c83fd49a80ada944bdd8b2bdece3ca7d400b33a2652fbd +F ext/jni/src/org/sqlite/jni/SqliteException.java f5d17a10202c0983fb074f66a0b48cf1e573b1da2eaeda679825e3edc1829706 F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab F ext/jni/src/org/sqlite/jni/Tester1.java f7b85fe24cf6c3e43bdf7e390617657e8137359f804d76921829c2a8c41b6df1 F ext/jni/src/org/sqlite/jni/Tester2.java 75aa079e2baf8f73d95299da092e611656be0f6e12fe2fa051fdd984657857e2 @@ -2127,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6acf52be7abce8dcf434c5ebf0d5e88859b033e6418077846247ecf00ccf9381 -R b6511d973ff6f4fe2616bdecdd85eae3 -U drh -Z a23b7d6675008bfc1be60599cdc88bc0 +P 3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68 +R 3bc0c08a6ca17f2adf136645f965b46a +U stephan +Z a1ea6d2e83650fdb0f8b2c765c106868 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index db4a47bea3..c10b55961a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68 \ No newline at end of file +5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858 \ No newline at end of file From faef28e6bd654e5061561423cb1ece6ca84f1f1f Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 12:46:53 +0000 Subject: [PATCH 034/242] Fix a potential UAF caused by JSON parser cache spill. [forum:/forumpost/b25edc1d46|Forum post b25edc1d46]. FossilOrigin-Name: a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/json.c | 6 ++++-- test/json101.test | 27 +++++++++++++++++++++++++-- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index f7d7fb70fc..b8dc175a79 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Flesh\sout\sthe\serror\sstate\scaptured\sby\sSqliteException.java.\sDoc\sadditions. -D 2023-10-09T12:45:28.189 +C Fix\sa\spotential\sUAF\scaused\sby\sJSON\sparser\scache\sspill.\n[forum:/forumpost/b25edc1d46|Forum\spost\sb25edc1d46]. +D 2023-10-09T12:46:53.137 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -674,7 +674,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c c6675e01fcd15b22e7f7189ddc8f98fc32a41adb576a96c0c6268f152e7459a7 +F src/json.c 82b9cef53ebc00069d516a06be4aa971e2e70caffe3417bd6001bf00177bb1bf F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 @@ -1306,7 +1306,7 @@ F test/json/README.md 63e3e589e1df8fd3cc1588ba1faaff659214003f8b77a15af5c6452b35 F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd28656fb261bddc8a3f F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307 F test/json/json-speed-check.sh 8b7babf530faa58bd59d6d362cec8e9036a68c5457ff46f3b1f1511d21af6737 x -F test/json101.test dc9d5a2a5b1fd1b54dbd71c538b17933cc98d84b4c1f821ead754933663dca55 +F test/json101.test 4d78048b185ffb9ae37645fa6934d48fc182473ae0bae088a1e2f7ba483c3a71 F test/json102.test 4c69694773a470f1fda34e5f4ba24920b35184fb66050b450fc2ef9ab5ad310b F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1 @@ -2127,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3d5ec99397c183cfb8c5d31e1967e0df8a4d6edbea92bbdf728571e3a6a36d68 -R 3bc0c08a6ca17f2adf136645f965b46a -U stephan -Z a1ea6d2e83650fdb0f8b2c765c106868 +P 5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858 +R ef96c768d43529a9f0e56ea07269cc45 +U drh +Z b75470c169946884c1cac663c7d92420 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c10b55961a..e3e070c26a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858 \ No newline at end of file +a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60 \ No newline at end of file diff --git a/src/json.c b/src/json.c index adcb691130..b28ba7ecdc 100644 --- a/src/json.c +++ b/src/json.c @@ -2902,6 +2902,7 @@ static void jsonReplaceFunc( } pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); if( pParse==0 ) return; + pParse->nJPRef++; for(i=1; i<(u32)argc; i+=2){ zPath = (const char*)sqlite3_value_text(argv[i]); pParse->useMod = 1; @@ -2914,6 +2915,7 @@ static void jsonReplaceFunc( jsonReturnJson(pParse, pParse->aNode, ctx, 1); replace_err: jsonDebugPrintParse(pParse); + jsonParseFree(pParse); } @@ -2948,6 +2950,7 @@ static void jsonSetFunc( } pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); if( pParse==0 ) return; + pParse->nJPRef++; for(i=1; i<(u32)argc; i+=2){ zPath = (const char*)sqlite3_value_text(argv[i]); bApnd = 0; @@ -2964,9 +2967,8 @@ static void jsonSetFunc( } jsonDebugPrintParse(pParse); jsonReturnJson(pParse, pParse->aNode, ctx, 1); - jsonSetDone: - /* no cleanup required */; + jsonParseFree(pParse); } /* diff --git a/test/json101.test b/test/json101.test index 4da1d132cc..4590330740 100644 --- a/test/json101.test +++ b/test/json101.test @@ -1013,8 +1013,31 @@ do_execsql_test json101-21.27 { SELECT json_group_object(x,y) FROM c; } {{{"a":1,"b":2.0,"c":null,:"three","e":"four"}}} - - +# 2023-10-09 https://sqlite.org/forum/forumpost/b25edc1d46 +# UAF due to JSON cache overflow +# +do_execsql_test json101-22.1 { + SELECT json_set( + '{}', + '$.a', json('1'), + '$.a', json('2'), + '$.b', json('3'), + '$.b', json('4'), + '$.c', json('5'), + '$.c', json('6') + ); +} {{{"a":2,"b":4,"c":6}}} +do_execsql_test json101-22.2 { + SELECT json_replace( + '{"a":7,"b":8,"c":9}', + '$.a', json('1'), + '$.a', json('2'), + '$.b', json('3'), + '$.b', json('4'), + '$.c', json('5'), + '$.c', json('6') + ); +} {{{"a":2,"b":4,"c":6}}} finish_test From 50da20d5b112b393683dcc2bff6b08d618383441 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 14:05:21 +0000 Subject: [PATCH 035/242] Turn on SEH by default when building using MSVC. FossilOrigin-Name: f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd --- Makefile.msc | 11 ++++++----- autoconf/Makefile.msc | 11 ++++++----- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/ctime.c | 3 +++ src/sqliteInt.h | 10 ++++++++++ tool/mkctimec.tcl | 1 + 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index fe442ff027..8ef8bd13b1 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -52,8 +52,8 @@ MINIMAL_AMALGAMATION = 0 USE_STDCALL = 0 !ENDIF -# Set this non-0 to use structured exception handling (SEH) for WAL mode -# in the core library. +# Use the USE_SEH=0 option on the nmake command line to omit structured +# exception handling (SEH) support. SEH is on by default. # !IFNDEF USE_SEH USE_SEH = 1 @@ -403,10 +403,11 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1 !ENDIF # Should structured exception handling (SEH) be enabled for WAL mode in -# the core library? +# the core library? It is on by default. Only omit it if the +# USE_SEH=0 option is provided on the nmake command-line. # -!IF $(USE_SEH)!=0 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_USE_SEH=1 +!IF $(USE_SEH)==0 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1 !ENDIF # These are the "extended" SQLite compilation options used when compiling for diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 13663d8777..8a64e8f46f 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -52,8 +52,8 @@ MINIMAL_AMALGAMATION = 0 USE_STDCALL = 0 !ENDIF -# Set this non-0 to use structured exception handling (SEH) for WAL mode -# in the core library. +# Use the USE_SEH=0 option on the nmake command line to omit structured +# exception handling (SEH) support. SEH is on by default. # !IFNDEF USE_SEH USE_SEH = 1 @@ -325,10 +325,11 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1 !ENDIF # Should structured exception handling (SEH) be enabled for WAL mode in -# the core library? +# the core library? It is on by default. Only omit it if the +# USE_SEH=0 option is provided on the nmake command-line. # -!IF $(USE_SEH)!=0 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_USE_SEH=1 +!IF $(USE_SEH)==0 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1 !ENDIF # These are the "extended" SQLite compilation options used when compiling for diff --git a/manifest b/manifest index b8dc175a79..c0e78b388d 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Fix\sa\spotential\sUAF\scaused\sby\sJSON\sparser\scache\sspill.\n[forum:/forumpost/b25edc1d46|Forum\spost\sb25edc1d46]. -D 2023-10-09T12:46:53.137 +C Turn\son\sSEH\sby\sdefault\swhen\sbuilding\susing\sMSVC. +D 2023-10-09T14:05:21.110 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in bbf02cb8a9fb22d1cb78da7e5fb5e7e85a5b18cf5cb9e14c1b624db07029916d F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc f926abe4737ffa3303aeb67d8ea74857f4038754a95605c332be1c9dbf8b96c7 +F Makefile.msc e5c93ed28696ab0065e72ce352c7ec766c8b9e91f93fd1bb15000c6e35dfe58c F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.msc 3248809e70cf439a13e9faf82a4e12cbdb7b042006300ac67175fc5125b5c031 +F autoconf/Makefile.msc 3dfe7dc4677569256724e4988db59521f10b1d8b8fba393ea8a255eb038b9825 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 42cfd21d0b19dc7d5d85fb5c405c5f3c6a4c923021c39128f6ba685355d8fd56 F autoconf/configure.ac ec7fa914c5e74ff212fe879f9bb6918e1234497e05facfb641f30c4d5893b277 @@ -659,7 +659,7 @@ F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc F src/build.c 79a4edcee69df5f20963d7b11faf0820d25e6f8c11ef3a9f868d14be87834711 F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e -F src/ctime.c db847fac81837ff5e5028a5f7505147ac645ae676104adc5bc08e356f243de40 +F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 @@ -719,7 +719,7 @@ F src/shell.c.in b34146fe139a7d0f5f49de5059e7bbe6892f9d5dce952c6f9f7a602e5df8646 F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 1fc2a2ee3016dd3ce433db8432bef50b8266d017527d38ccb8abed87c8305d76 +F src/sqliteInt.h c387a6d478db286330e611a97eb2beecbea1181b2a04abb30c5b90de74c26810 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2048,7 +2048,7 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkautoconfamal.sh 7077151b62ecb2848c5b2d36cdbcd8caa0b58f2c12dcdac6e982da39d29d213c F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x -F tool/mkctimec.tcl c7246946f847d3d6d022f5276650e0290e2aa648793be2fb8c3f206347baa356 x +F tool/mkctimec.tcl 372452e24267dfe1b496eec3992d10c6e5e7d7870a152560cdcfe5404bc8cc04 x F tool/mkkeywordhash.c b9faa0ae7e14e4dbbcd951cddd786bf46b8a65bb07b129ba8c0cfade723aaffd F tool/mkmsvcmin.tcl 8897d515ef7f94772322db95a3b6fce6c614d84fe0bdd06ba5a1c786351d5a1d F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef @@ -2127,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5c5397ff15543f4b3620244d9e57e15708eafcab1d42c9f87b4a60f0c01e8858 -R ef96c768d43529a9f0e56ea07269cc45 +P a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60 +R d8e67e543c6bc2983d62b297a1d54a3f U drh -Z b75470c169946884c1cac663c7d92420 +Z d910e6ddf87b0ff9b9f8c8908129c67e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e3e070c26a..341c8d3981 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60 \ No newline at end of file +f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd \ No newline at end of file diff --git a/src/ctime.c b/src/ctime.c index 03c89ff726..cf761299fe 100644 --- a/src/ctime.c +++ b/src/ctime.c @@ -639,6 +639,9 @@ static const char * const sqlite3azCompileOpt[] = { #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS "OMIT_SCHEMA_VERSION_PRAGMAS", #endif +#ifdef SQLITE_OMIT_SEH + "OMIT_SEH", +#endif #ifdef SQLITE_OMIT_SHARED_CACHE "OMIT_SHARED_CACHE", #endif diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 7221974991..086570d66b 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -318,6 +318,16 @@ # endif #endif +/* +** Enable SQLITE_USE_SEH by default on MSVC builds. Only omit +** SEH support if the -DSQLITE_OMIT_SEH option is given. +*/ +#if defined(_MSC_VER) && !defined(SQLITE_OMIT_SEH) +# define SQLITE_USE_SEH 1 +#else +# undef SQLITE_USE_SEH 0 +#endif + /* ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. ** 0 means mutexes are permanently disable and the library is never diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl index 23726a722f..098bf16e3b 100755 --- a/tool/mkctimec.tcl +++ b/tool/mkctimec.tcl @@ -239,6 +239,7 @@ set boolean_defnil_options { SQLITE_OMIT_REINDEX SQLITE_OMIT_SCHEMA_PRAGMAS SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS + SQLITE_OMIT_SEH SQLITE_OMIT_SHARED_CACHE SQLITE_OMIT_SHUTDOWN_DIRECTORIES SQLITE_OMIT_SUBQUERY From 7e60f6dbf109fd46d963fa91da7a0367e486c0bc Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 14:47:25 +0000 Subject: [PATCH 036/242] Fix a compiler warning caused by the previous check-in. FossilOrigin-Name: 7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqliteInt.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c0e78b388d..3e53e86cce 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Turn\son\sSEH\sby\sdefault\swhen\sbuilding\susing\sMSVC. -D 2023-10-09T14:05:21.110 +C Fix\sa\scompiler\swarning\scaused\sby\sthe\sprevious\scheck-in. +D 2023-10-09T14:47:25.814 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -719,7 +719,7 @@ F src/shell.c.in b34146fe139a7d0f5f49de5059e7bbe6892f9d5dce952c6f9f7a602e5df8646 F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h c387a6d478db286330e611a97eb2beecbea1181b2a04abb30c5b90de74c26810 +F src/sqliteInt.h 3c8a3f1bf889a632dbbaecbd3334e9e8d7fdb63b26ee09d6d384af0cc757d64c F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2127,8 +2127,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a163fecca90cab9d1b7bf8ebac78d498775eed7b6d81e7920e3401633c3a4b60 -R d8e67e543c6bc2983d62b297a1d54a3f +P f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd +R 7d888a965eb459cec17310ccf81e043c U drh -Z d910e6ddf87b0ff9b9f8c8908129c67e +Z 6f1f41a6145e7a01f70d3d3a152db721 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 341c8d3981..5d0fdd084f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd \ No newline at end of file +7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 086570d66b..54f8db50a5 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -325,7 +325,7 @@ #if defined(_MSC_VER) && !defined(SQLITE_OMIT_SEH) # define SQLITE_USE_SEH 1 #else -# undef SQLITE_USE_SEH 0 +# undef SQLITE_USE_SEH #endif /* From 01a5a19919b1129560aa45ef46d9641250c97be0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 14:56:15 +0000 Subject: [PATCH 037/242] Add a TCL script that does various verification checks on the source tree to make sure that generated code has been updated correctly. FossilOrigin-Name: 1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122 --- Makefile.in | 14 +++++--- manifest | 13 +++---- manifest.uuid | 2 +- tool/srctree-check.tcl | 79 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 tool/srctree-check.tcl diff --git a/Makefile.in b/Makefile.in index d30246ab0b..0287915717 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1328,17 +1328,23 @@ testrunner: testfixture$(TEXE) # Runs both fuzztest and testrunner, consecutively. # -devtest: testfixture$(TEXE) fuzztest testrunner +devtest: srctree-check testfixture$(TEXE) fuzztest testrunner -mdevtest: has_tclsh85 +mdevtest: srctree-check has_tclsh85 $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest sdevtest: has_tclsh85 $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest +# Validate that various generated files in the source tree +# are up-to-date. +# +srctree-check: $(TOP)/tool/srctree-check.tcl + $(TCLSH_CMD) $(TOP)/tool/srctree-check.tcl + # Testing for a release # -releasetest: testfixture$(TEXE) +releasetest: srctree-check testfixture$(TEXE) ./testfixture$(TEXE) $(TOP)/test/testrunner.tcl release # Minimal testing that runs in less than 3 minutes @@ -1349,7 +1355,7 @@ quicktest: ./testfixture$(TEXE) # This is the common case. Run many tests that do not take too long, # including fuzzcheck, sqlite3_analyzer, and sqldiff tests. # -test: fuzztest sourcetest $(TESTPROGS) tcltest +test: srctree-check fuzztest sourcetest $(TESTPROGS) tcltest # Run a test using valgrind. This can take a really long time # because valgrind is so much slower than a native machine. diff --git a/manifest b/manifest index 3e53e86cce..b59410745b 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sa\scompiler\swarning\scaused\sby\sthe\sprevious\scheck-in. -D 2023-10-09T14:47:25.814 +C Add\sa\sTCL\sscript\sthat\sdoes\svarious\sverification\schecks\son\sthe\ssource\stree\nto\smake\ssure\sthat\sgenerated\scode\shas\sbeen\supdated\scorrectly. +D 2023-10-09T14:56:15.716 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in bbf02cb8a9fb22d1cb78da7e5fb5e7e85a5b18cf5cb9e14c1b624db07029916d +F Makefile.in 2ea4105b72561483befe0a18a37f94ca3adbc2324bad3770f99555d95fb9b0ea F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc e5c93ed28696ab0065e72ce352c7ec766c8b9e91f93fd1bb15000c6e35dfe58c F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 @@ -2095,6 +2095,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 41c586dee84d0b190ad13e0282ed83d4a65ec9fefde9adf4943efdf6558eea7f F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f +F tool/srctree-check.tcl cef630bc4ff21a460d72479c43a42bf1c1ed61897659305c35c8d72e91bcb176 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2127,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f57e8275cf1ab3ad8027044cda0893282d1c403a5aa9fabbb1c7de280597b5cd -R 7d888a965eb459cec17310ccf81e043c +P 7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904 +R 12c539e104384e89d6175d6c2ff0dac1 U drh -Z 6f1f41a6145e7a01f70d3d3a152db721 +Z ea1222de532c1395014340ac1b27f9c9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5d0fdd084f..57c74292ca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904 \ No newline at end of file +1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122 \ No newline at end of file diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl new file mode 100644 index 0000000000..234e70fae9 --- /dev/null +++ b/tool/srctree-check.tcl @@ -0,0 +1,79 @@ +#!/usr/bin/tclsh +# +# Run this script from the top of the source tree in order to confirm that +# various aspects of the source tree are up-to-date. Items checked include: +# +# * Makefile.msc and autoconf/Makefile.msc agree +# * src/ctime.tcl is consistent with tool/mkctimec.tcl +# * VERSION agrees with autoconf/tea/configure.ac +# * src/pragma.h agrees with tool/mkpragmatab.tcl +# +# Other tests might be added later. +# +# Error messages are printed and the process exists non-zero if problems +# are found. If everything is ok, no output is generated and the process +# exits with 0. +# + +# Read an entire file. +# +proc readfile {filename} { + set fd [open $filename rb] + set txt [read $fd] + close $fd + return $txt +} + +# Find the root of the tree. +# +set ROOT [file dir [file dir [file normalize $argv0]]] +cd $ROOT + +# Name of the TCL interpreter +# +set TCLSH [info nameofexe] + +######################### autoconf/tea/configure.ac ########################### + +set confac [readfile $ROOT/autoconf/tea/configure.ac] +set vers [readfile $ROOT/VERSION] +set pattern {AC_INIT([sqlite],[} +append pattern [string trim $vers] +append pattern {])} +if {[string first $pattern $confac]<=0} { + puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION" + exit 1 +} + +######################### autoconf/Makefile.msc ############################### + +set f1 [readfile $ROOT/autoconf/Makefile.msc] +exec mv $ROOT/autoconf/Makefile.msc $ROOT/autoconf/Makefile.msc.tmp +exec $TCLSH $ROOT/tool/mkmsvcmin.tcl +set f2 [readfile $ROOT/autoconf/Makefile.msc] +exec mv $ROOT/autoconf/Makefile.msc.tmp $ROOT/autoconf/Makefile.msc +if {$f1 != $f2} { + puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc" +} + +######################### src/pragma.h ######################################## + +set f1 [readfile $ROOT/src/pragma.h] +exec mv $ROOT/src/pragma.h $ROOT/src/pragma.h.tmp +exec $TCLSH $ROOT/tool/mkpragmatab.tcl +set f2 [readfile $ROOT/src/pragma.h] +exec mv $ROOT/src/pragma.h.tmp $ROOT/src/pragma.h +if {$f1 != $f2} { + puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl" +} + +######################### src/ctime.c ######################################## + +set f1 [readfile $ROOT/src/ctime.c] +exec mv $ROOT/src/ctime.c $ROOT/src/ctime.c.tmp +exec $TCLSH $ROOT/tool/mkctimec.tcl +set f2 [readfile $ROOT/src/ctime.c] +exec mv $ROOT/src/ctime.c.tmp $ROOT/src/ctime.c +if {$f1 != $f2} { + puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl" +} From 6c96bf2c3f0ccdb6a9d81d8e172d5dfe6931906b Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 9 Oct 2023 17:54:34 +0000 Subject: [PATCH 038/242] Avoid calling sqlite3_randomness and taking the PRNG mutex when writing a journal header in "journal_mode=memory" mode. FossilOrigin-Name: c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 25 ++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b59410745b..a81ff4f7ce 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\sTCL\sscript\sthat\sdoes\svarious\sverification\schecks\son\sthe\ssource\stree\nto\smake\ssure\sthat\sgenerated\scode\shas\sbeen\supdated\scorrectly. -D 2023-10-09T14:56:15.716 +C Avoid\scalling\ssqlite3_randomness\sand\staking\sthe\sPRNG\smutex\swhen\swriting\sa\sjournal\sheader\sin\s"journal_mode=memory"\smode. +D 2023-10-09T17:54:34.805 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -701,7 +701,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c 2e8b12107f75d1bd16412f312b4c5d5103191807a37836d3b81beb26436ad81b F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 993445a19b611d473ca007542ab3149840661a4c7e9f2d9e1ec008b7cc2abe78 +F src/pager.c bbd9b93c014679d8148235cc42b73bebda3f598d4f63a63cf7723ddf3087fd58 F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7e8768bf8b4002b1c287f2bc95262548e2ae81b437936154f2bb1ea1f739a904 -R 12c539e104384e89d6175d6c2ff0dac1 -U drh -Z ea1222de532c1395014340ac1b27f9c9 +P 1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122 +R cb97a01edd9563d34e6c8de016f82192 +U dan +Z 70f60047d69ba97a07899a1fb54836c4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 57c74292ca..b357ab07fe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122 \ No newline at end of file +c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index a53dc1889a..af21ad6114 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1492,9 +1492,32 @@ static int writeJournalHdr(Pager *pPager){ memset(zHeader, 0, sizeof(aJournalMagic)+4); } + + /* The random check-hash initializer */ - sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); + if( pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){ + sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); + } +#ifdef SQLITE_DEBUG + else{ + /* The Pager.cksumInit variable is usually randomized above to protect + ** against there being existing records in the journal file. This is + ** dangerous, as following a crash they may be mistaken for records + ** written by the current transaction and rolled back into the database + ** file, causing corruption. The following assert statements verify + ** that this is not required in "journal_mode=memory" mode, as in that + ** case the journal file is always 0 bytes in size at this point. + ** It is advantageous to avoid the sqlite3_randomness() call if possible + ** as it takes the global PRNG mutex. */ + i64 sz = 0; + sqlite3OsFileSize(pPager->jfd, &sz); + assert( sz==0 ); + assert( pPager->journalOff==journalHdrOffset(pPager) ); + assert( sqlite3JournalIsInMemory(pPager->jfd) ); + } +#endif put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit); + /* The initial database size */ put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize); /* The assumed sector size for this process */ From aaf1341dcd0b0a3479a23a9f725cee859de27558 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 9 Oct 2023 22:45:10 +0000 Subject: [PATCH 039/242] Use snprintf() in place of sprintf() in a debugging function in the CLI. FossilOrigin-Name: 5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index a81ff4f7ce..9f26054415 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\scalling\ssqlite3_randomness\sand\staking\sthe\sPRNG\smutex\swhen\swriting\sa\sjournal\sheader\sin\s"journal_mode=memory"\smode. -D 2023-10-09T17:54:34.805 +C Use\ssnprintf()\sin\splace\sof\ssprintf()\sin\sa\sdebugging\sfunction\sin\sthe\sCLI. +D 2023-10-09T22:45:10.768 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -715,7 +715,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa -F src/shell.c.in b34146fe139a7d0f5f49de5059e7bbe6892f9d5dce952c6f9f7a602e5df86466 +F src/shell.c.in 6d26db96a7d53e7b499c8ae2f794dfc020a96e64d5757aebd0e4cf743b6de031 F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1f1a358af77f4386f98010eeae8487e6d39548a6dfe58c2664552490e7661122 -R cb97a01edd9563d34e6c8de016f82192 -U dan -Z 70f60047d69ba97a07899a1fb54836c4 +P c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11 +R 3906d2c8d8a5a36ffb2dadbfe6d4a26b +U drh +Z 827ed6f013493fe3f4e23b8be3f541d3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b357ab07fe..57d4f80344 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11 \ No newline at end of file +5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index f9bea8e7af..1699820a69 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -1228,7 +1228,7 @@ static void shellDtostr( char z[400]; if( n<1 ) n = 1; if( n>350 ) n = 350; - sprintf(z, "%#+.*e", n, r); + snprintf(z, sizeof(z)-1, "%#+.*e", n, r); sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); } From 0b29d37ef976c4380aaea83bba8ae375998b67a2 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 10 Oct 2023 12:16:04 +0000 Subject: [PATCH 040/242] Start adding tests for the second JNI layer. FossilOrigin-Name: 0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b --- ext/jni/GNUmakefile | 2 +- ext/jni/src/org/sqlite/jni/Sqlite.java | 2 +- ext/jni/src/org/sqlite/jni/Tester2.java | 7 +++++++ manifest | 18 +++++++++--------- manifest.uuid | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 1b78d97ae1..bea26745f5 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -304,7 +304,7 @@ test.flags.jvm = -ea -Djava.library.path=$(dir.bld.c) \ test.deps := $(CLASS_FILES) $(package.dll) test-one: $(test.deps) $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester1 $(Tester1.flags) -# $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 $(Tester2.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 $(Tester2.flags) test-sqllog: $(test.deps) @echo "Testing with -sqllog..." $(bin.java) $(test.flags.jvm) -sqllog diff --git a/ext/jni/src/org/sqlite/jni/Sqlite.java b/ext/jni/src/org/sqlite/jni/Sqlite.java index 23ceaa4b47..b964c57b33 100644 --- a/ext/jni/src/org/sqlite/jni/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/Sqlite.java @@ -50,7 +50,7 @@ public final class Sqlite implements AutoCloseable { } public static Sqlite open(String filename){ - return open(filename, 0, null); + return open(filename, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, null); } @Override public void close(){ diff --git a/ext/jni/src/org/sqlite/jni/Tester2.java b/ext/jni/src/org/sqlite/jni/Tester2.java index a150eecb4d..b7701f1a92 100644 --- a/ext/jni/src/org/sqlite/jni/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/Tester2.java @@ -126,6 +126,13 @@ public class Tester2 implements Runnable { } } + void testOpenDb1(){ + Sqlite db = Sqlite.open(":memory:"); + affirm( 0!=db.dbHandle().getNativePointer() ); + db.close(); + affirm( null==db.dbHandle() ); + } + @ManualTest /* because we only want to run this test on demand */ private void testFail(){ affirm( false, "Intentional failure." ); diff --git a/manifest b/manifest index 9f26054415..c7ff7d7fae 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\ssnprintf()\sin\splace\sof\ssprintf()\sin\sa\sdebugging\sfunction\sin\sthe\sCLI. -D 2023-10-09T22:45:10.768 +C Start\sadding\stests\sfor\sthe\ssecond\sJNI\slayer. +D 2023-10-10T12:16:04.095 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 8c44e22bad18ecc266dd8c521f215e95dc3741d9e337c51b175029abaedcfb35 +F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c fb8f178d27df828e3c797b4427a0a20545b44f5147ce38d09ce9b465be5a840b @@ -262,11 +262,11 @@ F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c -F ext/jni/src/org/sqlite/jni/Sqlite.java 44b23a929e5d625b35c83fd49a80ada944bdd8b2bdece3ca7d400b33a2652fbd +F ext/jni/src/org/sqlite/jni/Sqlite.java 713f973764de9f918500b8723f347e67d29da226ad34b18e1f37865397c0efcb F ext/jni/src/org/sqlite/jni/SqliteException.java f5d17a10202c0983fb074f66a0b48cf1e573b1da2eaeda679825e3edc1829706 F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab F ext/jni/src/org/sqlite/jni/Tester1.java f7b85fe24cf6c3e43bdf7e390617657e8137359f804d76921829c2a8c41b6df1 -F ext/jni/src/org/sqlite/jni/Tester2.java 75aa079e2baf8f73d95299da092e611656be0f6e12fe2fa051fdd984657857e2 +F ext/jni/src/org/sqlite/jni/Tester2.java 3e7b3c05c08bdbf899684074f095724e1853dc16912dfb53306a03e5c4cbd614 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 959d4677a857c9079c6e96ddd10918b946d68359af6252b6f284379069ea3d27 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c84e4483cb44f827416d8caafa22f076b2f31b2024fe8c5b5bcb0c9955149d11 -R 3906d2c8d8a5a36ffb2dadbfe6d4a26b -U drh -Z 827ed6f013493fe3f4e23b8be3f541d3 +P 5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46 +R 5e127cc43d17bc7acef7ac6f70b2b0dd +U stephan +Z 249ac2e75c5aef6851d9f60a37635ecd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 57d4f80344..252db7ee88 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46 \ No newline at end of file +0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b \ No newline at end of file From 853fb5e723a284347051756157a42bd65b53ebc4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 10 Oct 2023 15:33:05 +0000 Subject: [PATCH 041/242] Fix a bug in the mkautoconfamal.sh script, introduced by check-in [3308fdda4b81c110] so that the "snapshot-tarball" and "amalgamation-tarball" makefile targets work again when run from outside of the source tree. FossilOrigin-Name: 65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/mkautoconfamal.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c7ff7d7fae..afe0936b4a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Start\sadding\stests\sfor\sthe\ssecond\sJNI\slayer. -D 2023-10-10T12:16:04.095 +C Fix\sa\sbug\sin\sthe\smkautoconfamal.sh\sscript,\sintroduced\sby\scheck-in\s[3308fdda4b81c110]\nso\sthat\sthe\s"snapshot-tarball"\sand\s"amalgamation-tarball"\smakefile\stargets\nwork\sagain\swhen\srun\sfrom\soutside\sof\sthe\ssource\stree. +D 2023-10-10T15:33:05.058 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2046,7 +2046,7 @@ F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669 F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 -F tool/mkautoconfamal.sh 7077151b62ecb2848c5b2d36cdbcd8caa0b58f2c12dcdac6e982da39d29d213c +F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x F tool/mkctimec.tcl 372452e24267dfe1b496eec3992d10c6e5e7d7870a152560cdcfe5404bc8cc04 x F tool/mkkeywordhash.c b9faa0ae7e14e4dbbcd951cddd786bf46b8a65bb07b129ba8c0cfade723aaffd @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5e5e4d2b4958c329578d1e5af4ed25c1b774f0ed2d15fa6747d7d7fbbba4fa46 -R 5e127cc43d17bc7acef7ac6f70b2b0dd -U stephan -Z 249ac2e75c5aef6851d9f60a37635ecd +P 0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b +R 37373df44eb3bf4c68a7092e403d96f0 +U drh +Z 33418d47ecf8795ddbe386dcc10d96d2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 252db7ee88..6472fbbabb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b \ No newline at end of file +65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c \ No newline at end of file diff --git a/tool/mkautoconfamal.sh b/tool/mkautoconfamal.sh index b7483189da..35dbfb41e0 100644 --- a/tool/mkautoconfamal.sh +++ b/tool/mkautoconfamal.sh @@ -28,7 +28,7 @@ DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\). # Verify that the version number in the TEA autoconf file is correct. # Fail with an error if not. # -if grep $VERSION autoconf/tea/configure.ac +if grep $VERSION $TOP/autoconf/tea/configure.ac then echo "TEA version number ok" else echo "TEA version number mismatch. Should be $VERSION"; exit 1 fi From 58c7b770de961b817888320d73139d7817de23b9 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 11 Oct 2023 13:34:18 +0000 Subject: [PATCH 042/242] Simplification to sqlite3ApiExit(). Generates identical machine code, but easier for humans to read. FossilOrigin-Name: 793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/malloc.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index afe0936b4a..9f914a5a70 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbug\sin\sthe\smkautoconfamal.sh\sscript,\sintroduced\sby\scheck-in\s[3308fdda4b81c110]\nso\sthat\sthe\s"snapshot-tarball"\sand\s"amalgamation-tarball"\smakefile\stargets\nwork\sagain\swhen\srun\sfrom\soutside\sof\sthe\ssource\stree. -D 2023-10-10T15:33:05.058 +C Simplification\sto\ssqlite3ApiExit().\s\sGenerates\sidentical\smachine\scode,\sbut\neasier\sfor\shumans\sto\sread. +D 2023-10-11T13:34:18.514 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -678,7 +678,7 @@ F src/json.c 82b9cef53ebc00069d516a06be4aa971e2e70caffe3417bd6001bf00177bb1bf F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 -F src/malloc.c 47b82c5daad557d9b963e3873e99c22570fb470719082c6658bf64e3012f7d23 +F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 F src/mem2.c c8bfc9446fd0798bddd495eb5d9dbafa7d4b7287d8c22d50a83ac9daa26d8a75 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0177f4dfe8a5c03c1d5dd279c6babe5a87b596c2351373f845b89fc6abf7947b -R 37373df44eb3bf4c68a7092e403d96f0 +P 65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c +R af91c5cebf078db7ff8defd10c43084e U drh -Z 33418d47ecf8795ddbe386dcc10d96d2 +Z ee511a7822e958c17cba502a0e5ae3ed # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6472fbbabb..7f818d81f4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c \ No newline at end of file +793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3 \ No newline at end of file diff --git a/src/malloc.c b/src/malloc.c index 48c4600606..356750682e 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -896,5 +896,5 @@ int sqlite3ApiExit(sqlite3* db, int rc){ if( db->mallocFailed || rc ){ return apiHandleError(db, rc); } - return rc & db->errMask; + return 0; } From 582d65cce31cc4e17124ceac92fcba89ff0e52d0 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 11 Oct 2023 13:52:05 +0000 Subject: [PATCH 043/242] Add (prepare, step, reset, finalize) parts of the JNI level-2 stmt wrapper and associated tests. FossilOrigin-Name: a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249 --- ext/jni/src/org/sqlite/jni/Sqlite.java | 126 +++++++++++++++++- .../src/org/sqlite/jni/SqliteException.java | 14 +- ext/jni/src/org/sqlite/jni/Tester2.java | 51 +++++-- manifest | 18 +-- manifest.uuid | 2 +- 5 files changed, 187 insertions(+), 24 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/Sqlite.java b/ext/jni/src/org/sqlite/jni/Sqlite.java index b964c57b33..5c2c456296 100644 --- a/ext/jni/src/org/sqlite/jni/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/Sqlite.java @@ -12,6 +12,7 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni; +import java.nio.charset.StandardCharsets; import static org.sqlite.jni.CApi.*; /** @@ -22,7 +23,7 @@ import static org.sqlite.jni.CApi.*; individual instances are tied to a specific database connection. */ public final class Sqlite implements AutoCloseable { - private sqlite3 db = null; + private sqlite3 db; //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ @@ -33,6 +34,9 @@ public final class Sqlite implements AutoCloseable { Returns a newly-opened db connection or throws SqliteException if opening fails. All arguments are as documented for sqlite3_open_v2(). + + Design question: do we want static factory functions or should + this be reformulated as a constructor? */ public static Sqlite open(String filename, int flags, String vfsName){ final OutputPointer.sqlite3 out = new OutputPointer.sqlite3(); @@ -40,7 +44,9 @@ public final class Sqlite implements AutoCloseable { final sqlite3 n = out.take(); if( 0!=rc ){ if( null==n ) throw new SqliteException(rc); - else throw new SqliteException(n); + final SqliteException ex = new SqliteException(n); + n.close(); + throw ex; } return new Sqlite(n); } @@ -64,6 +70,120 @@ public final class Sqlite implements AutoCloseable { Returns this object's underlying native db handle, or null if this instance has been closed. */ - sqlite3 dbHandle(){ return this.db; } + sqlite3 nativeHandle(){ return this.db; } + + private void affirmOpen(){ + if( null==db || 0==db.getNativePointer() ){ + throw new IllegalArgumentException("This database instance is closed."); + } + } + + // private byte[] stringToUtf8(String s){ + // return s==null ? null : s.getBytes(StandardCharsets.UTF_8); + // } + + private void affirmRcOk(int rc){ + if( 0!=rc ){ + throw new SqliteException(db); + } + } + + public final class Stmt implements AutoCloseable { + private Sqlite _db = null; + private sqlite3_stmt stmt = null; + /** Only called by the prepare() factory functions. */ + Stmt(Sqlite db, sqlite3_stmt stmt){ + this._db = db; + this.stmt = stmt; + } + + sqlite3_stmt nativeHandle(){ + return stmt; + } + + private sqlite3_stmt affirmOpen(){ + if( null==stmt || 0==stmt.getNativePointer() ){ + throw new IllegalArgumentException("This Stmt has been finalized."); + } + return stmt; + } + + /** + Corresponds to sqlite3_finalize(), but we cannot override the + name finalize() here because this one requires a different + signature. We do not throw on error here because "destructors + do not throw." If it returns non-0, the object is still + finalized. + */ + public int finalizeStmt(){ + int rc = 0; + if( null!=stmt ){ + sqlite3_finalize(stmt); + stmt = null; + } + return rc; + } + + @Override public void close(){ + finalizeStmt(); + } + + /** + Throws if rc is any value other than 0, SQLITE_ROW, or + SQLITE_DONE, else returns rc. + */ + private int checkRc(int rc){ + switch(rc){ + case 0: + case SQLITE_ROW: + case SQLITE_DONE: return rc; + default: + throw new SqliteException(this); + } + } + + /** + Works like sqlite3_step() but throws SqliteException for any + result other than 0, SQLITE_ROW, or SQLITE_DONE. + */ + public int step(){ + return checkRc(sqlite3_step(affirmOpen())); + } + + public Sqlite db(){ return this._db; } + + /** + Works like sqlite3_reset() but throws on error. + */ + public void reset(){ + checkRc(sqlite3_reset(affirmOpen())); + } + + public void clearBindings(){ + sqlite3_clear_bindings( affirmOpen() ); + } + } + + + /** + prepare() TODOs include: + + - overloads taking byte[] and ByteBuffer. + + - multi-statement processing, like CApi.sqlite3_prepare_multi() + but using a callback specific to the higher-level Stmt class + rather than the sqlite3_stmt class. + */ + public Stmt prepare(String sql, int prepFlags){ + affirmOpen(); + final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); + final int rc = sqlite3_prepare_v3(this.db, sql, prepFlags, out); + affirmRcOk(rc); + return new Stmt(this, out.take()); + } + + public Stmt prepare(String sql){ + return prepare(sql, 0); + } } diff --git a/ext/jni/src/org/sqlite/jni/SqliteException.java b/ext/jni/src/org/sqlite/jni/SqliteException.java index 3da5d8c583..c15cb34919 100644 --- a/ext/jni/src/org/sqlite/jni/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/SqliteException.java @@ -46,7 +46,12 @@ public final class SqliteException extends java.lang.RuntimeException { /** Records the current error state of db (which must not be null and - must refer to an opened db object) then closes it. + must refer to an opened db object). Note that this does NOT close + the db. + + Design note: closing the db on error is likely only useful during + a failed db-open operation, and the place(s) where that can + happen are inside this library, not client-level code. */ public SqliteException(sqlite3 db){ super(sqlite3_errmsg(db)); @@ -54,7 +59,6 @@ public final class SqliteException extends java.lang.RuntimeException { xerrCode = sqlite3_extended_errcode(db); errOffset = sqlite3_error_offset(db); sysErrno = sqlite3_system_errno(db); - db.close(); } /** @@ -62,7 +66,11 @@ public final class SqliteException extends java.lang.RuntimeException { refer to an open database) then closes it. */ public SqliteException(Sqlite db){ - this(db.dbHandle()); + this(db.nativeHandle()); + } + + public SqliteException(Sqlite.Stmt stmt){ + this( stmt.db() ); } public int errcode(){ return errCode; } diff --git a/ext/jni/src/org/sqlite/jni/Tester2.java b/ext/jni/src/org/sqlite/jni/Tester2.java index b7701f1a92..e75f56e064 100644 --- a/ext/jni/src/org/sqlite/jni/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/Tester2.java @@ -126,16 +126,51 @@ public class Tester2 implements Runnable { } } - void testOpenDb1(){ - Sqlite db = Sqlite.open(":memory:"); - affirm( 0!=db.dbHandle().getNativePointer() ); - db.close(); - affirm( null==db.dbHandle() ); + Sqlite openDb(String name){ + return Sqlite.open(name, SQLITE_OPEN_READWRITE| + SQLITE_OPEN_CREATE| + SQLITE_OPEN_EXRESCODE); } - @ManualTest /* because we only want to run this test on demand */ - private void testFail(){ - affirm( false, "Intentional failure." ); + Sqlite openDb(){ return openDb(":memory:"); } + + void testOpenDb1(){ + Sqlite db = openDb(); + affirm( 0!=db.nativeHandle().getNativePointer() ); + db.close(); + affirm( null==db.nativeHandle() ); + + SqliteException ex = null; + try { + db = openDb("/no/such/dir/.../probably"); + }catch(SqliteException e){ + ex = e; + } + affirm( ex!=null ); + affirm( ex.errcode() != 0 ); + affirm( ex.extendedErrcode() != 0 ); + affirm( ex.errorOffset() < 0 ); + // there's no reliable way to predict what ex.systemErrno() might be + } + + void testPrepare1(){ + try (Sqlite db = openDb()) { + Sqlite.Stmt stmt = db.prepare("SELECT 1"); + affirm( null!=stmt.nativeHandle() ); + affirm( SQLITE_ROW == stmt.step() ); + affirm( SQLITE_DONE == stmt.step() ); + stmt.reset(); + affirm( SQLITE_ROW == stmt.step() ); + affirm( SQLITE_DONE == stmt.step() ); + affirm( 0 == stmt.finalizeStmt() ); + affirm( null==stmt.nativeHandle() ); + + stmt = db.prepare("SELECT 1"); + affirm( SQLITE_ROW == stmt.step() ); + affirm( 0 == stmt.finalizeStmt() ) + /* getting a non-0 out of sqlite3_finalize() is tricky */; + affirm( null==stmt.nativeHandle() ); + } } private void runTests(boolean fromThread) throws Exception { diff --git a/manifest b/manifest index 9f914a5a70..560c66a995 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplification\sto\ssqlite3ApiExit().\s\sGenerates\sidentical\smachine\scode,\sbut\neasier\sfor\shumans\sto\sread. -D 2023-10-11T13:34:18.514 +C Add\s(prepare,\sstep,\sreset,\sfinalize)\sparts\sof\sthe\sJNI\slevel-2\sstmt\swrapper\sand\sassociated\stests. +D 2023-10-11T13:52:05.849 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -262,11 +262,11 @@ F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c -F ext/jni/src/org/sqlite/jni/Sqlite.java 713f973764de9f918500b8723f347e67d29da226ad34b18e1f37865397c0efcb -F ext/jni/src/org/sqlite/jni/SqliteException.java f5d17a10202c0983fb074f66a0b48cf1e573b1da2eaeda679825e3edc1829706 +F ext/jni/src/org/sqlite/jni/Sqlite.java 1617ea2bf3dfa493b7f031a3187cbfd6837c39bc1d406c4b3edcf9aab941639d +F ext/jni/src/org/sqlite/jni/SqliteException.java e17500e8bca2c68c260d8d0163fe4b7dc8bd0b1b90211201325c4a5566ce75ca F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab F ext/jni/src/org/sqlite/jni/Tester1.java f7b85fe24cf6c3e43bdf7e390617657e8137359f804d76921829c2a8c41b6df1 -F ext/jni/src/org/sqlite/jni/Tester2.java 3e7b3c05c08bdbf899684074f095724e1853dc16912dfb53306a03e5c4cbd614 +F ext/jni/src/org/sqlite/jni/Tester2.java 70e005d41060e398ec0f69bd39a8e1c376fd51f81629cf25e877889ec9cb6ec6 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 959d4677a857c9079c6e96ddd10918b946d68359af6252b6f284379069ea3d27 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 65ccf5fef812d43aed9e00af36c90e1a499d197e30148753790445e25ee1324c -R af91c5cebf078db7ff8defd10c43084e -U drh -Z ee511a7822e958c17cba502a0e5ae3ed +P 793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3 +R 4d3cf5230b57585fb263b4c0d4fb2b1e +U stephan +Z 39c6ded9773037a11fc3746bbfb10c12 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7f818d81f4..7b40a7c4e7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3 \ No newline at end of file +a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249 \ No newline at end of file From ac4aea5102e3a272f6cd8a601a35d2541733fa90 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 11 Oct 2023 17:24:31 +0000 Subject: [PATCH 044/242] Fix the use of an uninitialized value that occurs when doing a json_insert() of a string value that contains embedded U+0000 characters. FossilOrigin-Name: d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3 --- manifest | 17 +++++++++-------- manifest.uuid | 2 +- src/json.c | 6 ++++-- test/json101.test | 3 +++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 560c66a995..0368f0f70b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\s(prepare,\sstep,\sreset,\sfinalize)\sparts\sof\sthe\sJNI\slevel-2\sstmt\swrapper\sand\sassociated\stests. -D 2023-10-11T13:52:05.849 +C Fix\sthe\suse\sof\san\suninitialized\svalue\sthat\soccurs\swhen\sdoing\sa\sjson_insert()\nof\sa\sstring\svalue\sthat\scontains\sembedded\sU+0000\scharacters. +D 2023-10-11T17:24:31.588 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -674,7 +674,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c 82b9cef53ebc00069d516a06be4aa971e2e70caffe3417bd6001bf00177bb1bf +F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 @@ -1306,7 +1306,7 @@ F test/json/README.md 63e3e589e1df8fd3cc1588ba1faaff659214003f8b77a15af5c6452b35 F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd28656fb261bddc8a3f F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307 F test/json/json-speed-check.sh 8b7babf530faa58bd59d6d362cec8e9036a68c5457ff46f3b1f1511d21af6737 x -F test/json101.test 4d78048b185ffb9ae37645fa6934d48fc182473ae0bae088a1e2f7ba483c3a71 +F test/json101.test 1ad070e5616dee76bffbe9724e6add16ab7ad506d5af9e606627b163baf1a7b4 F test/json102.test 4c69694773a470f1fda34e5f4ba24920b35184fb66050b450fc2ef9ab5ad310b F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1 @@ -2128,8 +2128,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 793bbfa5af9721bc3a61e8e5eda46dfce2f5ff3f223a7564c9e1b09f11e53cb3 -R 4d3cf5230b57585fb263b4c0d4fb2b1e -U stephan -Z 39c6ded9773037a11fc3746bbfb10c12 +P a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249 +Q +fc5ee9e51ad4556af526a6cefca5ae5a3b1b7affc4edf09832491d6b4f4ba366 +R 93737f5b55ab3449be7057400ec68be2 +U drh +Z 222827e9ae2110e3474e6249138dc8a5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7b40a7c4e7..36f21eb598 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249 \ No newline at end of file +d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3 \ No newline at end of file diff --git a/src/json.c b/src/json.c index b28ba7ecdc..e334b22140 100644 --- a/src/json.c +++ b/src/json.c @@ -2843,11 +2843,13 @@ static void jsonReplaceNode( break; } if( sqlite3_value_subtype(pValue)!=JSON_SUBTYPE ){ - char *zCopy = sqlite3DbStrDup(0, z); + char *zCopy = sqlite3_malloc64( n+1 ); int k; if( zCopy ){ + memcpy(zCopy, z, n); + zCopy[n] = 0; jsonParseAddCleanup(p, sqlite3_free, zCopy); - }else{ + }else{ p->oom = 1; sqlite3_result_error_nomem(pCtx); } diff --git a/test/json101.test b/test/json101.test index 4590330740..d734dbb0e1 100644 --- a/test/json101.test +++ b/test/json101.test @@ -119,6 +119,9 @@ do_execsql_test json101-4.7 { do_execsql_test json101-4.8 { SELECT x FROM j1 WHERE json_insert(x)<>x; } {} +do_execsql_test json101-4.9 { + SELECT json_insert('{"a":1}','$.b',CAST(x'0000' AS text)); +} {{{"a":1,"b":"\u0000\u0000"}}} # json_extract(JSON,'$') will return objects and arrays without change. # From 6a0f297da9ca464ec2586af3db3747af5c43970d Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 11 Oct 2023 20:37:42 +0000 Subject: [PATCH 045/242] Unconditionally force use of SQLITE_ENABLE_API_ARMOR in the WASM and JNI builds. Their corresponding test suites still work. FossilOrigin-Name: c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1 --- ext/jni/src/c/sqlite3-jni.c | 8 ++++++++ ext/wasm/api/sqlite3-wasm.c | 8 ++++++++ manifest | 17 ++++++++--------- manifest.uuid | 2 +- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index ab8dac6442..7afc9a0f0f 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -43,6 +43,14 @@ /**********************************************************************/ /* SQLITE_ENABLE_... */ +/* +** Unconditionally enable API_ARMOR in the JNI build. It ensures that +** public APIs behave predictable in the face of passing illegal NULLs +** or ranges which might otherwise invoke undefined behavior. +*/ +#undef SQLITE_ENABLE_API_ARMOR +#define SQLITE_ENABLE_API_ARMOR 1 + #ifndef SQLITE_ENABLE_BYTECODE_VTAB # define SQLITE_ENABLE_BYTECODE_VTAB 1 #endif diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c index db77010d95..88a679c518 100644 --- a/ext/wasm/api/sqlite3-wasm.c +++ b/ext/wasm/api/sqlite3-wasm.c @@ -84,6 +84,14 @@ /**********************************************************************/ /* SQLITE_ENABLE_... */ +/* +** Unconditionally enable API_ARMOR in the WASM build. It ensures that +** public APIs behave predictable in the face of passing illegal NULLs +** or ranges which might otherwise invoke undefined behavior. +*/ +#undef SQLITE_ENABLE_API_ARMOR +#define SQLITE_ENABLE_API_ARMOR 1 + #ifndef SQLITE_ENABLE_BYTECODE_VTAB # define SQLITE_ENABLE_BYTECODE_VTAB 1 #endif diff --git a/manifest b/manifest index 0368f0f70b..8cc2f5b251 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\suse\sof\san\suninitialized\svalue\sthat\soccurs\swhen\sdoing\sa\sjson_insert()\nof\sa\sstring\svalue\sthat\scontains\sembedded\sU+0000\scharacters. -D 2023-10-11T17:24:31.588 +C Unconditionally\sforce\suse\sof\sSQLITE_ENABLE_API_ARMOR\sin\sthe\sWASM\sand\sJNI\sbuilds.\sTheir\scorresponding\stest\ssuites\sstill\swork. +D 2023-10-11T20:37:42.544 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c fb8f178d27df828e3c797b4427a0a20545b44f5147ce38d09ce9b465be5a840b +F ext/jni/src/c/sqlite3-jni.c bf432771fbc84da2b5f4037e0bcf20757548aac2fa782b272c4894a9c279964a F ext/jni/src/c/sqlite3-jni.h be1fdff7ab3a2bb357197271c8ac5d2bf6ff59380c106dde3a13be88724bad22 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -581,7 +581,7 @@ F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js f7c965cf9ac0b66a538cd8f6c156f3f2a235e089821ca78cabd7bce41ce16bf7 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e -F ext/wasm/api/sqlite3-wasm.c 65d60439671e24d50d9119ca805ac1c68fb36129e164377eb46f8d037bd88b07 +F ext/wasm/api/sqlite3-wasm.c c8c5b81b838cef2053b1eb6e7a79c44a2caedcf0c9e6b0d12a45d73ce0617be0 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 @@ -2128,9 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a7082f186f2b9b6666bbc65f2eadeb74d91fa0a681e3b2468b261ffd322bd249 -Q +fc5ee9e51ad4556af526a6cefca5ae5a3b1b7affc4edf09832491d6b4f4ba366 -R 93737f5b55ab3449be7057400ec68be2 -U drh -Z 222827e9ae2110e3474e6249138dc8a5 +P d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3 +R cb4e6a9a30b16c853ef3dc73ffbd4bf2 +U stephan +Z 3e4716ef7bf77cf16b30a28c2f5da5ac # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 36f21eb598..7589f45852 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3 \ No newline at end of file +c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1 \ No newline at end of file From 35d6c24fd544da6c8709b199e7f0b0115d093dee Mon Sep 17 00:00:00 2001 From: larrybr Date: Thu, 12 Oct 2023 15:12:38 +0000 Subject: [PATCH 046/242] CLI to check for rare prepare failures. [forum:/forumpost/5be6395182|See forum post 5be6395182.] FossilOrigin-Name: 286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 8cc2f5b251..039659c7cf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Unconditionally\sforce\suse\sof\sSQLITE_ENABLE_API_ARMOR\sin\sthe\sWASM\sand\sJNI\sbuilds.\sTheir\scorresponding\stest\ssuites\sstill\swork. -D 2023-10-11T20:37:42.544 +C CLI\sto\scheck\sfor\srare\sprepare\sfailures.\s[forum:/forumpost/5be6395182|See\sforum\spost\s5be6395182.] +D 2023-10-12T15:12:38.967 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -715,7 +715,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa -F src/shell.c.in 6d26db96a7d53e7b499c8ae2f794dfc020a96e64d5757aebd0e4cf743b6de031 +F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d3c0cbb90966316be9cd25e3edb501da42731e8a83c13227b90ce17d3975a2c3 -R cb4e6a9a30b16c853ef3dc73ffbd4bf2 -U stephan -Z 3e4716ef7bf77cf16b30a28c2f5da5ac +P c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1 +R 5ae72ce81eda772829c7d27c1ea987e3 +U larrybr +Z 19dab31d5c5256d717b8a79b7d715525 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7589f45852..86ed5b92e6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1 \ No newline at end of file +286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 1699820a69..beea0f9b07 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -8772,8 +8772,10 @@ static int do_meta_command(char *zLine, ShellState *p){ "SELECT rowid FROM sqlite_schema" " WHERE name GLOB 'sqlite_stat[134]'", -1, &pStmt, 0); - doStats = sqlite3_step(pStmt)==SQLITE_ROW; - sqlite3_finalize(pStmt); + if( rc==SQLITE_OK ){ + doStats = sqlite3_step(pStmt)==SQLITE_ROW; + sqlite3_finalize(pStmt); + } } if( doStats==0 ){ raw_printf(p->out, "/* No STAT tables available */\n"); From 5d9a6c6734168c8388eba41270fa4415f4dfee1c Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 12 Oct 2023 17:41:18 +0000 Subject: [PATCH 047/242] Make sure the journal file is closed when transitioning into MEMORY journal mode, to avoid an assertion fault in the new sqlite3_randomness() avoidance code added by [c84e4483cb44f827]. FossilOrigin-Name: 29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 039659c7cf..35a1ad45df 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C CLI\sto\scheck\sfor\srare\sprepare\sfailures.\s[forum:/forumpost/5be6395182|See\sforum\spost\s5be6395182.] -D 2023-10-12T15:12:38.967 +C Make\ssure\sthe\sjournal\sfile\sis\sclosed\swhen\stransitioning\sinto\sMEMORY\sjournal\nmode,\sto\savoid\san\sassertion\sfault\sin\sthe\snew\ssqlite3_randomness()\savoidance\ncode\sadded\sby\s[c84e4483cb44f827]. +D 2023-10-12T17:41:18.510 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -701,7 +701,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c 2e8b12107f75d1bd16412f312b4c5d5103191807a37836d3b81beb26436ad81b F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c bbd9b93c014679d8148235cc42b73bebda3f598d4f63a63cf7723ddf3087fd58 +F src/pager.c 4aa388e47138551c83ae265e2efd4e01f0aa5afb6a958f45579658847b3430ff F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c11394b50d0687b6d6abad9c80d5cd3cdce77e9b9c278f40601c460f463744a1 -R 5ae72ce81eda772829c7d27c1ea987e3 -U larrybr -Z 19dab31d5c5256d717b8a79b7d715525 +P 286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4 +R 63c272f1ac84380bbc1d2409b6f281ca +U drh +Z 6db7b813ea2dc81e78e187c7332821c2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 86ed5b92e6..d8626240d8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4 \ No newline at end of file +29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index af21ad6114..1423b66541 100644 --- a/src/pager.c +++ b/src/pager.c @@ -7369,7 +7369,7 @@ int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ } assert( state==pPager->eState ); } - }else if( eMode==PAGER_JOURNALMODE_OFF ){ + }else if( eMode==PAGER_JOURNALMODE_OFF || eMode==PAGER_JOURNALMODE_MEMORY ){ sqlite3OsClose(pPager->jfd); } } From a11499a1566f3e4b351550462e5b2ea7f1e15a82 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 12 Oct 2023 18:09:27 +0000 Subject: [PATCH 048/242] Add test case for [29937081]. FossilOrigin-Name: d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/dbfuzz001.test | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 35a1ad45df..a6806b5df3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sjournal\sfile\sis\sclosed\swhen\stransitioning\sinto\sMEMORY\sjournal\nmode,\sto\savoid\san\sassertion\sfault\sin\sthe\snew\ssqlite3_randomness()\savoidance\ncode\sadded\sby\s[c84e4483cb44f827]. -D 2023-10-12T17:41:18.510 +C Add\stest\scase\sfor\s[29937081]. +D 2023-10-12T18:09:27.355 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1010,7 +1010,7 @@ F test/date3.test a1b77abf05c6772fe5ca2337cac1398892f2a41e62bce7e6be0f4a08a0e64a F test/date4.test db9e5760cf6f480fcf36bb7ca8e215880ff44354a31be6fb3d7e58f9d2e057e9 F test/dbdata.test 042f49acff3438f940eeba5868d3af080ae64ddf26ae78f80c92bec3ca7d8603 F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e -F test/dbfuzz001.test 55e1a3504f8dea84155e09912fe3b1c3ad77e0b1a938ec42ca03b8e51b321e30 +F test/dbfuzz001.test 6c9a4622029d69dc38926f115864b055cb2f39badd25ec22cbfb130c8ba8e9c3 F test/dbfuzz2-seed1.db e6225c6f3d7b63f9c5b6867146a5f329d997ab105bee64644dc2b3a2f2aebaee F test/dbfuzz2.c 4b3c12de4d98b1b2d908ab03d217d4619e47c8b23d5e67f8a6f2b1bdee7cae23 F test/dbpage.test fce29035c7566fd7835ec0f19422cb4b9c6944ce0e1b936ff8452443f92e887d @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 286d1e8012a5f5d9e1fe6dce1a732f725b8a1837f66daf6aefb792e19e96f2d4 -R 63c272f1ac84380bbc1d2409b6f281ca -U drh -Z 6db7b813ea2dc81e78e187c7332821c2 +P 29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c +R 3a4380c41a5098a65122508f2e34e284 +U dan +Z 90a5fb07a2b44dcefd3540a88cf86f78 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8626240d8..a3b96cae38 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c \ No newline at end of file +d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a \ No newline at end of file diff --git a/test/dbfuzz001.test b/test/dbfuzz001.test index 2a430de12e..228dd16db6 100644 --- a/test/dbfuzz001.test +++ b/test/dbfuzz001.test @@ -371,4 +371,27 @@ do_catchsql_test dbfuzz001-330 { } {1 {database disk image is malformed}} extra_schema_checks 1 +#------------------------------------------------------------------------- +reset_db + +do_execsql_test dbfuzz001-430 { + CREATE TABLE t1(a INTEGER, b INT, c DEFAULT 0); +} + +do_execsql_test dbfuzz001-420 { + PRAGMA locking_mode=EXCLUSIVE; + PRAGMA journal_mode = memory; + INSERT INTO t1 VALUES(1,2,3); + PRAGMA journal_mode=PERSIST; +} {exclusive memory persist} + +do_execsql_test dbfuzz001-430 { + INSERT INTO t1 VALUES(4, 5, 6); +} + +do_execsql_test dbfuzz001-440 { + PRAGMA journal_mode=MEMORY; + INSERT INTO t1 VALUES(7, 8, 9); +} {memory} + finish_test From 4b136ed70a1eb656efca8cc4079e515d6fc33dd6 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 12 Oct 2023 18:46:27 +0000 Subject: [PATCH 049/242] Enable SQLITE_VTAB_INNOCUOUS for FTS3, FTS5, and RTREE. FossilOrigin-Name: f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a --- ext/fts3/fts3.c | 1 + ext/fts5/fts5_main.c | 3 +++ ext/rtree/geopoly.c | 1 + ext/rtree/rtree.c | 2 ++ manifest | 20 ++++++++++---------- manifest.uuid | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 8aa824bce4..aa2653050b 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -640,6 +640,7 @@ static void fts3DeclareVtab(int *pRc, Fts3Table *p){ zLanguageid = (p->zLanguageid ? p->zLanguageid : "__langid"); sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(p->db, SQLITE_VTAB_INNOCUOUS); /* Create a list of user columns for the virtual table */ zCols = sqlite3_mprintf("%Q, ", p->azColumn[0]); diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 6a8ed37b54..3f14300043 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -408,6 +408,9 @@ static int fts5InitVtab( if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){ rc = sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, (int)1); } + if( rc==SQLITE_OK ){ + rc = sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + } if( rc!=SQLITE_OK ){ fts5FreeVtab(pTab); diff --git a/ext/rtree/geopoly.c b/ext/rtree/geopoly.c index 7bda24a8cb..3e9c2a2713 100644 --- a/ext/rtree/geopoly.c +++ b/ext/rtree/geopoly.c @@ -1252,6 +1252,7 @@ static int geopolyInit( (void)pAux; sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); /* Allocate the sqlite3_vtab structure */ nDb = strlen(argv[1]); diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 8f01be37f6..b2667527bc 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -3615,6 +3615,8 @@ static int rtreeInit( } sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + /* Allocate the sqlite3_vtab structure */ nDb = (int)strlen(argv[1]); diff --git a/manifest b/manifest index a6806b5df3..d9b10b76b5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scase\sfor\s[29937081]. -D 2023-10-12T18:09:27.355 +C Enable\sSQLITE_VTAB_INNOCUOUS\sfor\sFTS3,\sFTS5,\sand\sRTREE. +D 2023-10-12T18:46:27.294 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -60,7 +60,7 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 4095c97f2960f508bd34fc06d40f61d54e2ad09e7fbab75dc0114f57ebb6040d +F ext/fts3/fts3.c 89298f42a071d4f08588a308cf2904fc5014f59b47ea48949a127b5747e9b90a F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h e573c6d881f7238d77cc3fd2396cbb9b2fe13efef7d2ad295a155151c4e7efbd F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 @@ -95,7 +95,7 @@ F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d F ext/fts5/fts5_index.c 5c3872a01ae519af9839b675408163aab8eb1e31917c8b3d0ce726b4ad11d942 -F ext/fts5/fts5_main.c 799ec88d2309055f6406bddb0bd6ed80148c5da5eb14594c3c5309a6e944d489 +F ext/fts5/fts5_main.c 1ea6636a1f528e9042cc6992d57b5a97c4a4e401ab1d2836c0cc805a1d27a982 F ext/fts5/fts5_storage.c 3c9b41fce41b6410f2e8f82eb035c6a29b2560483f773e6dc98cf3cb2e4ddbb5 F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee @@ -474,8 +474,8 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782 F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c335096108c12c01bddbadcec F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 -F ext/rtree/geopoly.c a7f8b4951e283300caf347cdc6097b66da9f6649797b12905fd528413b7ce267 -F ext/rtree/rtree.c b3b1c96e46fc820b57851b4fbab546c5317d40d1a2d54e23c9bb50be6090b3e0 +F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca +F ext/rtree/rtree.c 9fdb03b602ca128c4b5b786c10675cf97cd0990d18db3b8c7a312551c3cf2f59 F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree1.test 877d40b8b61b1f88cec9d4dc0ff8334f5b05299fac12a35141532e2881860e9d F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 29937081a986d88f495ad48748c35ff5829f0ac31dd4ad3e48d180ae2fcb9a0c -R 3a4380c41a5098a65122508f2e34e284 -U dan -Z 90a5fb07a2b44dcefd3540a88cf86f78 +P d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a +R d66c3f0c591f0a5c79818d4ec908dabb +U drh +Z 715f0eac07de34228b29f32483ef26b6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a3b96cae38..f80a5cef58 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a \ No newline at end of file +f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a \ No newline at end of file From 3046039309ff2dc5c3dcd17828020281c5a42954 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 12 Oct 2023 19:46:58 +0000 Subject: [PATCH 050/242] Fix a problem with an fts5 secure-delete on a rowid/term pair that follows a legacy delete of the same pair. FossilOrigin-Name: 579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b --- ext/fts5/fts5_index.c | 77 +++++++++++++++++++++------------- ext/fts5/test/fts5secure6.test | 24 +++++++++-- manifest | 16 +++---- manifest.uuid | 2 +- 4 files changed, 78 insertions(+), 41 deletions(-) diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 2b32965638..0500d54a9e 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -2904,7 +2904,6 @@ static int fts5MultiIterDoCompare(Fts5Iter *pIter, int iOut){ assert_nc( i2!=0 ); pRes->bTermEq = 1; if( p1->iRowid==p2->iRowid ){ - p1->bDel = p2->bDel; return i2; } res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : +1; @@ -5132,34 +5131,39 @@ static void fts5DoSecureDelete( /* Set variable bLastInDoclist to true if this entry happens to be ** the last rowid in the doclist for its term. */ - if( iNextOff>=iPgIdx ){ - int pgno = pSeg->iLeafPgno+1; - fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist); - iNextOff = iPgIdx; - }else{ - /* Loop through the page-footer. If iNextOff (offset of the - ** entry following the one we are removing) is equal to the - ** offset of a key on this page, then the entry is the last - ** in its doclist. */ - int iKeyOff = 0; - for(iIdx=0; iIdxbDel==0 ){ + if( iNextOff>=iPgIdx ){ + int pgno = pSeg->iLeafPgno+1; + fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist); + iNextOff = iPgIdx; + }else{ + /* Loop through the page-footer. If iNextOff (offset of the + ** entry following the one we are removing) is equal to the + ** offset of a key on this page, then the entry is the last + ** in its doclist. */ + int iKeyOff = 0; + for(iIdx=0; iIdxbDel ){ + iOff += sqlite3Fts5PutVarint(&aPg[iOff], iDelta); + aPg[iOff++] = 0x01; + }else if( bLastInDoclist==0 ){ if( iNextOff!=iPgIdx ){ u64 iNextDelta = 0; iNextOff += fts5GetVarint(&aPg[iNextOff], &iNextDelta); @@ -5271,6 +5275,15 @@ static void fts5DoSecureDelete( } } + /* Assuming no error has occurred, this block does final edits to the + ** leaf page before writing it back to disk. Input variables are: + ** + ** nPg: Total initial size of leaf page. + ** iPgIdx: Initial offset of page footer. + ** + ** iOff: Offset to move data to + ** iNextOff: Offset to move data from + */ if( p->rc==SQLITE_OK ){ const int nMove = nPg - iNextOff; /* Number of bytes to move */ int nShift = iNextOff - iOff; /* Distance to move them */ @@ -5471,10 +5484,16 @@ static void fts5FlushOneHash(Fts5Index *p){ fts5WriteFlushLeaf(p, &writer); } }else{ - int bDummy; - int nPos; - int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); - nCopy += nPos; + int bDel = 0; + int nPos = 0; + int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDel); + if( bDel && bSecureDelete ){ + fts5BufferAppendVarint(&p->rc, pBuf, nPos*2); + iOff += nCopy; + nCopy = nPos; + }else{ + nCopy += nPos; + } if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){ /* The entire poslist will fit on the current leaf. So copy ** it in one go. */ diff --git a/ext/fts5/test/fts5secure6.test b/ext/fts5/test/fts5secure6.test index ffb10cb24a..43d4f075e8 100644 --- a/ext/fts5/test/fts5secure6.test +++ b/ext/fts5/test/fts5secure6.test @@ -18,7 +18,7 @@ db progress 1 progress_handler set ::PHC 0 proc progress_handler {args} { incr ::PHC - if {($::PHC % 100000)==0} breakpoint + # if {($::PHC % 100000)==0} breakpoint return 0 } @@ -73,12 +73,12 @@ do_execsql_test 2.2 { #------------------------------------------------------------------------- reset_db -do_execsql_test 2.0 { +do_execsql_test 3.0 { CREATE VIRTUAL TABLE t1 USING fts5(x); INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd) } -do_execsql_test 2.1 { +do_execsql_test 3.1 { BEGIN; INSERT INTO t1(rowid, x) VALUES(51869, 'when whenever where weress what turn'), @@ -91,5 +91,23 @@ do_execsql_test 3.2 { INSERT INTO t1(t1) VALUES('integrity-check'); } +#------------------------------------------------------------------------- +reset_db + +do_execsql_test 4.0 { + CREATE VIRTUAL TABLE t1 USING fts5(x); + INSERT INTO t1(rowid, x) VALUES(10, 'one two'); +} +do_execsql_test 4.1 { + UPDATE t1 SET x = 'one three' WHERE rowid=10; + INSERT INTO t1(t1, rank) VALUES('secure-delete', 1); +} +do_execsql_test 4.2 { + DELETE FROM t1 WHERE rowid=10; +} +do_execsql_test 4.3 { + INSERT INTO t1(t1) VALUES('integrity-check'); +} + finish_test diff --git a/manifest b/manifest index d9b10b76b5..1976ce0af1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enable\sSQLITE_VTAB_INNOCUOUS\sfor\sFTS3,\sFTS5,\sand\sRTREE. -D 2023-10-12T18:46:27.294 +C Fix\sa\sproblem\swith\san\sfts5\ssecure-delete\son\sa\srowid/term\spair\sthat\sfollows\sa\slegacy\sdelete\sof\sthe\ssame\spair. +D 2023-10-12T19:46:58.003 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -94,7 +94,7 @@ F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b7292 F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081 F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d -F ext/fts5/fts5_index.c 5c3872a01ae519af9839b675408163aab8eb1e31917c8b3d0ce726b4ad11d942 +F ext/fts5/fts5_index.c a0f8e58e1c101d0b7959264f76b8c0c3c44914a999b29ec4264a6f55f1bccfe1 F ext/fts5/fts5_main.c 1ea6636a1f528e9042cc6992d57b5a97c4a4e401ab1d2836c0cc805a1d27a982 F ext/fts5/fts5_storage.c 3c9b41fce41b6410f2e8f82eb035c6a29b2560483f773e6dc98cf3cb2e4ddbb5 F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae @@ -204,7 +204,7 @@ F ext/fts5/test/fts5secure2.test 2e961d7eef939f294c56b5d895cac7f1c3a60b934ee2cfd F ext/fts5/test/fts5secure3.test c7e1080a6912f2a3ac68f2e05b88b72a99de38543509b2bbf427cac5c9c1c610 F ext/fts5/test/fts5secure4.test 0d10a80590c07891478700af7793b232962042677432b9846cf7fc8337b67c97 F ext/fts5/test/fts5secure5.test c07a68ced5951567ac116c22f2d2aafae497e47fe9fcb6a335c22f9c7a4f2c3a -F ext/fts5/test/fts5secure6.test 120feecc8c55b4774f858721e6c62c2094b059ecbcfd7fdc24bde886f55ef6ca +F ext/fts5/test/fts5secure6.test 6f7fbb1f96910ccbdbfd2097f761f4c77c150c03734503331e2d428f77fa2a6e F ext/fts5/test/fts5secure7.test fd03d0868d64340a1db8615b02e5508fea409de13910114e4f19eaefc120777a F ext/fts5/test/fts5securefault.test dbca2b6a1c16700017f5051138991b705410889933f2a37c57ae8a23b296b10b F ext/fts5/test/fts5simple.test a298670508c1458b88ce6030440f26a30673931884eb5f4094ac1773b3ba217b @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d3b983edf7164d30ddb8b4b745a3feff9737149d85b1c428d6ad488ac6a1960a -R d66c3f0c591f0a5c79818d4ec908dabb -U drh -Z 715f0eac07de34228b29f32483ef26b6 +P f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a +R 042a80d2d5719fd8ae111fd1b613eb4b +U dan +Z a5f84e7c870f4185af46feb29cb8159d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f80a5cef58..3ef20a6660 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a \ No newline at end of file +579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b \ No newline at end of file From 5dc4a405c59a2a8fe171efaf3bd25b1013c160c4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 12 Oct 2023 20:51:17 +0000 Subject: [PATCH 051/242] Make sure virtual tables have been connected before trying to invoke the xIntegrity method during PRAGMA integrity_check. FossilOrigin-Name: 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pragma.c | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 1976ce0af1..78fcd72b68 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\san\sfts5\ssecure-delete\son\sa\srowid/term\spair\sthat\sfollows\sa\slegacy\sdelete\sof\sthe\ssame\spair. -D 2023-10-12T19:46:58.003 +C Make\ssure\svirtual\stables\shave\sbeen\sconnected\sbefore\strying\sto\sinvoke\nthe\sxIntegrity\smethod\sduring\sPRAGMA\sintegrity_check. +D 2023-10-12T20:51:17.229 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -707,7 +707,7 @@ F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c 48becc9b683e1b4a786b5e01a3133e747acba95d3d7182271d1bb67231251114 +F src/pragma.c db6ce4f9d67722a5d46428d21dc1eaff919a92a9e009168fbb6ad227a5d781be F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c e3ba080e2f409f9bfcc8d34724e6fc160e9c718dc92d0548f6b71b8b6f860ce2 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f34c533b6c1f8ef3f69c75c1039406c12751cdde1fbdcb4d9776b24455facf8a -R 042a80d2d5719fd8ae111fd1b613eb4b -U dan -Z a5f84e7c870f4185af46feb29cb8159d +P 579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b +R f6cfb323187380b15d71317c15cb2d7b +U drh +Z b1397a2832808c4669dcf4c9bd643e96 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3ef20a6660..bfa8f62025 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b \ No newline at end of file +4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 7c8911b2ca..3b6190b2e7 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1762,6 +1762,7 @@ void sqlite3Pragma( sqlite3_vtab *pVTab; int a1; if( !IsVirtual(pTab) ) continue; + sqlite3ViewGetColumnNames(pParse, pTab); if( pTab->u.vtab.p==0 ) continue; pVTab = pTab->u.vtab.p->pVtab; if( NEVER(pVTab==0) ) continue; From 99d43979d37b1aad05407f8b5523cfd44d9e64f3 Mon Sep 17 00:00:00 2001 From: larrybr Date: Fri, 13 Oct 2023 01:39:47 +0000 Subject: [PATCH 052/242] Avoid potential overflow in hex(). [forum:/forumpost/7ac0c9c5ea|See forum post 7ac0c9c5ea.] FossilOrigin-Name: 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/func.c | 3 ++- test/unhex.test | 2 ++ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 78fcd72b68..667e06fa71 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\svirtual\stables\shave\sbeen\sconnected\sbefore\strying\sto\sinvoke\nthe\sxIntegrity\smethod\sduring\sPRAGMA\sintegrity_check. -D 2023-10-12T20:51:17.229 +C Avoid\spotential\soverflow\sin\shex().\s[forum:/forumpost/7ac0c9c5ea|See\sforum\spost\s7ac0c9c5ea.] +D 2023-10-13T01:39:47.068 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -667,7 +667,7 @@ F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 -F src/func.c 490341f0ad2d0a937ce03c9fd3d9396fd3be9b5a6b90228011830b3a7bf0dca2 +F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 @@ -1834,7 +1834,7 @@ F test/tt3_vacuum.c 71b254cde1fc49d6c8c44efd54f4668f3e57d7b3a8f4601ade069f75a999 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 1aeb81976841a91eef292723649b5c4fe3bc3cac F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a -F test/unhex.test 47b547f4b35e4f6525ecac7c7839bd3ae4eb4613d4e8932592eff55da83308f1 +F test/unhex.test 777af0bad767e4ab6219e6086ea073f8836d8c34de12f9507bd39c442e89fcf2 F test/unionall.test eb9afa030897af75fd2f0dd28354ef63c8a5897b6c76aa1f15acae61a12eabcf F test/unionall2.test 71e8fa08d5699d50dc9f9dc0c9799c2e7a6bb7931a330d369307a4df7f157fa1 F test/unionallfault.test 652bfbb630e6c43135965dc1e8f0a9a791da83aec885d626a632fe1909c56f73 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 579aea0c28e01a79620ac758edc02db3a01baaa073e7773b8f0b6f610479520b -R f6cfb323187380b15d71317c15cb2d7b -U drh -Z b1397a2832808c4669dcf4c9bd643e96 +P 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da +R b8db52c4af481f11a25564ae1b4169f0 +U larrybr +Z e40ad0deba084d2d357f307fa10fdd72 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bfa8f62025..1d7dc6eb7c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da \ No newline at end of file +2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 \ No newline at end of file diff --git a/src/func.c b/src/func.c index dcf195f983..eed67941b4 100644 --- a/src/func.c +++ b/src/func.c @@ -1256,7 +1256,8 @@ static void hexFunc( *(z++) = hexdigits[c&0xf]; } *z = 0; - sqlite3_result_text(context, zHex, n*2, sqlite3_free); + sqlite3_result_text64(context, zHex, (u64)(z-zHex), + sqlite3_free, SQLITE_UTF8); } } diff --git a/test/unhex.test b/test/unhex.test index f41e906a8f..d97438f0d6 100644 --- a/test/unhex.test +++ b/test/unhex.test @@ -55,6 +55,8 @@ do_catchsql_test 3.1 { #-------------------------------------------------------------------------- # Test the 2-argument version. # +# Zap global x array set in some previous test. +if {[array exists x]} {array unset x} foreach {tn hex} { 1 "FFFF ABCD" 2 "FFFF ABCD" From 7dc0cc45f30a310dba12dcd3aaa554a146a5bf8e Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 13 Oct 2023 12:48:35 +0000 Subject: [PATCH 053/242] Round one of an audit for SQLITE_ENABLE_API_ARMOR for functions exposed by JNI and those functions missing armor, as [forum:5e3fc453a69b49ca|reported in several forum posts]. FossilOrigin-Name: 8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939 --- ext/jni/src/c/sqlite3-jni.c | 76 +++++++++++++++++++++---------------- manifest | 25 ++++++------ manifest.uuid | 2 +- src/loadext.c | 11 +++++- src/main.c | 10 +++++ src/notify.c | 3 ++ src/vdbeapi.c | 37 +++++++++++++++--- 7 files changed, 114 insertions(+), 50 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 7afc9a0f0f..1465c9e651 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -972,6 +972,7 @@ static jstring s3jni__utf8_to_jstring(JNIEnv * const env, hypothetically do this for any strings where n<4 and z is NUL-terminated and none of z[0..3] are NUL bytes. */ rv = (*env)->NewStringUTF(env, ""); + s3jni_oom_check( rv ); }else if( z ){ jbyteArray jba; if( n<0 ) n = sqlite3Strlen30(z); @@ -985,8 +986,8 @@ static jstring s3jni__utf8_to_jstring(JNIEnv * const env, } S3JniUnrefLocal(jba); } + s3jni_oom_check( rv ); } - s3jni_oom_check( rv ); return rv; } #define s3jni_utf8_to_jstring(CStr,n) s3jni__utf8_to_jstring(env, CStr, n) @@ -1468,12 +1469,14 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph, #define PtrGet_sqlite3_stmt(OBJ) PtrGet_T(sqlite3_stmt, OBJ) #define PtrGet_sqlite3_value(OBJ) PtrGet_T(sqlite3_value, OBJ) /* -** S3JniLongPtr_T(X,Y) expects X to be an unqualified sqlite3 -** struct type name and Y to be a native pointer to such an object in -** the form of a jlong value. The jlong is simply cast to (X*). This +** S3JniLongPtr_T(X,Y) expects X to be an unqualified sqlite3 struct +** type name and Y to be a native pointer to such an object in the +** form of a jlong value. The jlong is simply cast to (X*). This ** approach is, as of 2023-09-27, supplanting the former approach. We ** now do the native pointer extraction in the Java side, rather than -** the C side, because it's reportedly significantly faster. +** the C side, because it's reportedly significantly faster. The +** intptr_t part here is necessary for compatibility with (at least) +** ARM32. */ #define S3JniLongPtr_T(T,JLongAsPtr) (T*)((intptr_t)(JLongAsPtr)) #define S3JniLongPtr_sqlite3(JLongAsPtr) S3JniLongPtr_T(sqlite3,JLongAsPtr) @@ -2616,6 +2619,10 @@ S3JniApi(sqlite3_cancel_auto_extension(),jboolean,1cancel_1auto_1extension)( S3JniAutoExtension * ax; jboolean rc = JNI_FALSE; int i; + + if( !jAutoExt ){ + return rc; + } S3JniAutoExt_mutex_enter; /* This algo corresponds to the one in the core. */ for( i = SJG.autoExt.nExt-1; i >= 0; --i ){ @@ -2778,8 +2785,8 @@ S3JniApi(sqlite3_column_text(),jbyteArray,1column_1text)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx); - const int n = sqlite3_column_bytes(stmt, (int)ndx); + const unsigned char * const p = stmt ? sqlite3_column_text(stmt, (int)ndx) : 0; + const int n = p ? sqlite3_column_bytes(stmt, (int)ndx) : 0; return p ? s3jni_new_jbyteArray(p, n) : NULL; } @@ -2789,8 +2796,8 @@ S3JniApi(sqlite3_column_text(),jstring,1column_1text)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx); - const int n = sqlite3_column_bytes(stmt, (int)ndx); + const unsigned char * const p = stmt ? sqlite3_column_text(stmt, (int)ndx) : 0; + const int n = p ? sqlite3_column_bytes(stmt, (int)ndx) : 0; return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0; } #endif @@ -2799,8 +2806,8 @@ S3JniApi(sqlite3_column_text16(),jstring,1column_1text16)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt); - const void * const p = sqlite3_column_text16(stmt, (int)ndx); - const int n = sqlite3_column_bytes16(stmt, (int)ndx); + const void * const p = stmt ? sqlite3_column_text16(stmt, (int)ndx) : 0; + const int n = p ? sqlite3_column_bytes16(stmt, (int)ndx) : 0; return s3jni_text16_to_jstring(env, p, n); } @@ -2808,7 +2815,8 @@ S3JniApi(sqlite3_column_value(),jobject,1column_1value)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ sqlite3_value * const sv = - sqlite3_column_value(PtrGet_sqlite3_stmt(jpStmt), (int)ndx); + sqlite3_column_value(PtrGet_sqlite3_stmt(jpStmt), (int)ndx) + /* reminder: returns an SQL NULL if jpStmt==NULL */; return new_java_sqlite3_value(env, sv); } @@ -2919,6 +2927,18 @@ S3JniApi(sqlite3_compileoption_get(),jstring,1compileoption_1get)( return rv; } +S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)( + JniArgsEnvClass, jstring name +){ + const char *zUtf8 = s3jni_jstring_to_mutf8(name) + /* We know these to be ASCII, so MUTF-8 is fine (and + hypothetically faster to convert). */; + const jboolean rc = + 0==sqlite3_compileoption_used(zUtf8) ? JNI_FALSE : JNI_TRUE; + s3jni_mutf8_release(name, zUtf8); + return rc; +} + S3JniApi(sqlite3_complete(),int,1complete)( JniArgsEnvClass, jbyteArray jSql ){ @@ -2935,18 +2955,6 @@ S3JniApi(sqlite3_complete(),int,1complete)( return rc; } -S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)( - JniArgsEnvClass, jstring name -){ - const char *zUtf8 = s3jni_jstring_to_mutf8(name) - /* We know these to be ASCII, so MUTF-8 is fine (and - hypothetically faster to convert). */; - const jboolean rc = - 0==sqlite3_compileoption_used(zUtf8) ? JNI_FALSE : JNI_TRUE; - s3jni_mutf8_release(name, zUtf8); - return rc; -} - S3JniApi(sqlite3_config() /*for a small subset of options.*/, jint,1config__I)(JniArgsEnvClass, jint n){ switch( n ){ @@ -3151,6 +3159,9 @@ S3JniApi(sqlite3_create_collation() sqlite3_create_collation_v2(), int rc; S3JniDb * ps; + if( !jDb || !name || !encodingTypeIsValid(eTextRep) ){ + return (jint)SQLITE_MISUSE; + } S3JniDb_mutex_enter; ps = S3JniDb_from_java(jDb); jclass const klazz = (*env)->GetObjectClass(env, oCollation); @@ -3574,6 +3585,7 @@ static int s3jni_open_pre(JNIEnv * const env, S3JniEnv **jc, S3JniDb ** ps){ int rc = 0; jobject jDb = 0; + *jc = S3JniEnv_get(); if( !*jc ){ rc = SQLITE_NOMEM; @@ -3650,6 +3662,8 @@ S3JniApi(sqlite3_open(),jint,1open)( S3JniDb * ps = 0; S3JniEnv * jc = 0; int rc; + + if( 0==jOut ) return SQLITE_MISUSE; rc = s3jni_open_pre(env, &jc, strName, &zName, &ps); if( 0==rc ){ rc = s3jni_open_post(env, jc, ps, &pOut, jOut, @@ -3662,14 +3676,17 @@ S3JniApi(sqlite3_open(),jint,1open)( S3JniApi(sqlite3_open_v2(),jint,1open_1v2)( JniArgsEnvClass, jstring strName, - jobject jOut, jint flags, jstring strVfs + jobject jOut, jint flags, jstring strVfs ){ sqlite3 * pOut = 0; char *zName = 0; S3JniDb * ps = 0; S3JniEnv * jc = 0; char *zVfs = 0; - int rc = s3jni_open_pre(env, &jc, strName, &zName, &ps); + int rc; + + if( 0==jOut ) return SQLITE_MISUSE; + rc = s3jni_open_pre(env, &jc, strName, &zName, &ps); if( 0==rc ){ if( strVfs ){ zVfs = s3jni_jstring_to_utf8( strVfs, 0); @@ -4469,7 +4486,6 @@ static int s3jni_strlike_glob(int isLike, JNIEnv *const env, jbyte * const pG = s3jni_jbyteArray_bytes(baG); jbyte * const pT = pG ? s3jni_jbyteArray_bytes(baT) : 0; - s3jni_oom_fatal(pT); /* Note that we're relying on the byte arrays having been NUL-terminated on the Java side. */ rc = isLike @@ -4509,12 +4525,8 @@ S3JniApi(sqlite3_sql(),jstring,1sql)( S3JniApi(sqlite3_step(),jint,1step)( JniArgsEnvClass,jobject jStmt ){ - int rc = SQLITE_MISUSE; sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jStmt); - if( pStmt ){ - rc = sqlite3_step(pStmt); - } - return rc; + return pStmt ? (jint)sqlite3_step(pStmt) : (jint)SQLITE_MISUSE; } S3JniApi(sqlite3_table_column_metadata(),int,1table_1column_1metadata)( diff --git a/manifest b/manifest index 667e06fa71..f9baa60087 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\spotential\soverflow\sin\shex().\s[forum:/forumpost/7ac0c9c5ea|See\sforum\spost\s7ac0c9c5ea.] -D 2023-10-13T01:39:47.068 +C Round\sone\sof\san\saudit\sfor\sSQLITE_ENABLE_API_ARMOR\sfor\sfunctions\sexposed\sby\sJNI\sand\sthose\sfunctions\smissing\sarmor,\sas\s[forum:5e3fc453a69b49ca|reported\sin\sseveral\sforum\sposts]. +D 2023-10-13T12:48:35.298 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c bf432771fbc84da2b5f4037e0bcf20757548aac2fa782b272c4894a9c279964a +F ext/jni/src/c/sqlite3-jni.c eabd48ced29954fb4f6173c4f350f7f1fce218ce19f48a75367cb560cf2da77e F ext/jni/src/c/sqlite3-jni.h be1fdff7ab3a2bb357197271c8ac5d2bf6ff59380c106dde3a13be88724bad22 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -676,8 +676,8 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa -F src/loadext.c 98cfba10989b3da6f1807ad42444017742db7f100a54f1032af7a8b1295912c0 -F src/main.c 618aeb399e993cf561864f4b0cf6a331ee4f355cf663635f8d9da3193a46aa40 +F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a +F src/main.c 7a91b372dd1bada07c5b5e36082dc0d695161c3807efe2386f563a5b32446ae6 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -692,7 +692,7 @@ F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 F src/mutex_unix.c bd52ec50e44a41fe1e3deb5a6e3fe98edb6f2059da3e46d196363d0fa3192cda F src/mutex_w32.c 38b56d0bc8d54c17c20cbaaad3719b0c36b92fd07a7e34360d0c6a18d5589912 -F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6 +F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878 F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 @@ -787,7 +787,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c cd112eb00d20fc5cc44f631d0e713838602637328b0f127c2f3c2aa8cea3cc91 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 +F src/vdbeapi.c be7d88a05df51cb3940304f74e4b0534817b51213b3406143a67eecd6f82fe21 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 4cf5aa130e96e3b52ba3fb54b7f9606c942ab988dbb32cb19cff4db24e06aeec F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 @@ -2128,8 +2128,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da -R b8db52c4af481f11a25564ae1b4169f0 -U larrybr -Z e40ad0deba084d2d357f307fa10fdd72 +P 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 +R 64d7e862f198f312cf375ff0e1b4824a +T *branch * api-armor-audit +T *sym-api-armor-audit * +T -sym-trunk * Cancelled\sby\sbranch. +U stephan +Z fb0f8b82a9c86be7bcd5823447ca13df # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1d7dc6eb7c..7b111488b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 \ No newline at end of file +8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939 \ No newline at end of file diff --git a/src/loadext.c b/src/loadext.c index e792fa5a98..cfa8ba4ca8 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -730,6 +730,9 @@ void sqlite3CloseExtensions(sqlite3 *db){ ** default so as not to open security holes in older applications. */ int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); if( onoff ){ db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc; @@ -751,7 +754,7 @@ int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ */ typedef struct sqlite3AutoExtList sqlite3AutoExtList; static SQLITE_WSD struct sqlite3AutoExtList { - u32 nExt; /* Number of entries in aExt[] */ + u32 nExt; /* Number of entries in aExt[] */ void (**aExt)(void); /* Pointers to the extension init functions */ } sqlite3Autoext = { 0, 0 }; @@ -779,6 +782,9 @@ int sqlite3_auto_extension( void (*xInit)(void) ){ int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( xInit==0 ) return SQLITE_MISUSE_BKPT; +#endif #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); if( rc ){ @@ -831,6 +837,9 @@ int sqlite3_cancel_auto_extension( int i; int n = 0; wsdAutoextInit; +#ifdef SQLITE_ENABLE_API_ARMOR + if( xInit==0 ) return 0; +#endif sqlite3_mutex_enter(mutex); for(i=(int)wsdAutoext.nExt-1; i>=0; i--){ if( wsdAutoext.aExt[i]==xInit ){ diff --git a/src/main.c b/src/main.c index a43afab168..4ddf7e24d3 100644 --- a/src/main.c +++ b/src/main.c @@ -954,6 +954,10 @@ int sqlite3_db_cacheflush(sqlite3 *db){ int sqlite3_db_config(sqlite3 *db, int op, ...){ va_list ap; int rc; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); va_start(ap, op); switch( op ){ @@ -2365,6 +2369,12 @@ void *sqlite3_preupdate_hook( void *pArg /* First callback argument */ ){ void *pRet; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 || xCallback==0 ){ + return; + } +#endif sqlite3_mutex_enter(db->mutex); pRet = db->pPreUpdateArg; db->xPreUpdateCallback = xCallback; diff --git a/src/notify.c b/src/notify.c index 4960ab76b1..6a4cab8755 100644 --- a/src/notify.c +++ b/src/notify.c @@ -152,6 +152,9 @@ int sqlite3_unlock_notify( ){ int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); enterMutex(); diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 1213dbe6d1..f8e66df87a 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -2029,10 +2029,16 @@ static UnpackedRecord *vdbeUnpackRecord( ** a field of the row currently being updated or deleted. */ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; Mem *pMem; int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 || ppValue==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif + p = db->pPreUpdate; /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if( !p || p->op==SQLITE_INSERT ){ @@ -2093,7 +2099,12 @@ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ ** the number of columns in the row being updated, deleted or inserted. */ int sqlite3_preupdate_count(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->keyinfo.nKeyField : 0); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -2111,7 +2122,12 @@ int sqlite3_preupdate_count(sqlite3 *db){ ** or SET DEFAULT action is considered a trigger. */ int sqlite3_preupdate_depth(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->v->nFrame : 0); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -2122,7 +2138,12 @@ int sqlite3_preupdate_depth(sqlite3 *db){ ** only. */ int sqlite3_preupdate_blobwrite(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->iBlobWrite : -1); } #endif @@ -2133,10 +2154,16 @@ int sqlite3_preupdate_blobwrite(sqlite3 *db){ ** a field of the row currently being updated or inserted. */ int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; int rc = SQLITE_OK; Mem *pMem; +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 || ppValue==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif + p = db->pPreUpdate; if( !p || p->op==SQLITE_DELETE ){ rc = SQLITE_MISUSE_BKPT; goto preupdate_new_out; From 98170653405fc5f0aad29bf6a9513364c50b1191 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Oct 2023 12:57:23 +0000 Subject: [PATCH 054/242] Actually prevent PRAGMA writable_schema=ON from being set in defensive mode, rather than just preventing it from functioning. FossilOrigin-Name: 2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pragma.c | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 667e06fa71..618601adcf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\spotential\soverflow\sin\shex().\s[forum:/forumpost/7ac0c9c5ea|See\sforum\spost\s7ac0c9c5ea.] -D 2023-10-13T01:39:47.068 +C Actually\sprevent\sPRAGMA\swritable_schema=ON\sfrom\sbeing\sset\sin\sdefensive\smode,\nrather\sthan\sjust\spreventing\sit\sfrom\sfunctioning. +D 2023-10-13T12:57:23.459 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -707,7 +707,7 @@ F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c db6ce4f9d67722a5d46428d21dc1eaff919a92a9e009168fbb6ad227a5d781be +F src/pragma.c 9f9b8828624ee98de22a2a9793a651daa39bc06cd9e701b6eda23c6d75260f1d F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c e3ba080e2f409f9bfcc8d34724e6fc160e9c718dc92d0548f6b71b8b6f860ce2 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4a4eccb681741917c6771101d4e329f91eae9b035f4d345218e522bb55fff6da -R b8db52c4af481f11a25564ae1b4169f0 -U larrybr -Z e40ad0deba084d2d357f307fa10fdd72 +P 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 +R 7b01763f55834ca6495d297b6d47ecf8 +U drh +Z e23aaad11f5de862bcdfc4d2c2927a81 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1d7dc6eb7c..3de2f46833 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 \ No newline at end of file +2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 3b6190b2e7..576080e10a 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1124,7 +1124,11 @@ void sqlite3Pragma( #endif if( sqlite3GetBoolean(zRight, 0) ){ - db->flags |= mask; + if( (mask & SQLITE_WriteSchema)==0 + || (db->flags & SQLITE_Defensive)==0 + ){ + db->flags |= mask; + } }else{ db->flags &= ~mask; if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; From af527231c14206ec6ab9564c93e731cc7ea56001 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Oct 2023 13:49:46 +0000 Subject: [PATCH 055/242] Immediately fail a CREATE TABLE statement that attempts to create a table that has a generated column loop. Legacy allows the table to be created but the table would not be usable for anything. FossilOrigin-Name: 3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/build.c | 7 +++++++ src/vdbe.c | 11 +++++++++-- test/gencol1.test | 5 +---- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 618601adcf..ac9ec8cf34 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Actually\sprevent\sPRAGMA\swritable_schema=ON\sfrom\sbeing\sset\sin\sdefensive\smode,\nrather\sthan\sjust\spreventing\sit\sfrom\sfunctioning. -D 2023-10-13T12:57:23.459 +C Immediately\sfail\sa\sCREATE\sTABLE\sstatement\sthat\sattempts\sto\screate\sa\ntable\sthat\shas\sa\sgenerated\scolumn\sloop.\s\sLegacy\sallows\sthe\stable\sto\sbe\ncreated\sbut\sthe\stable\swould\snot\sbe\susable\sfor\sanything. +D 2023-10-13T13:49:46.914 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -656,7 +656,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c fbbbfc51d2fed03c29f20960857d97659d9c682523f32911d5a8e7c5be6436be F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 -F src/build.c 79a4edcee69df5f20963d7b11faf0820d25e6f8c11ef3a9f868d14be87834711 +F src/build.c 4b1d6f8d2b2fcd3267ec54254ad78383c6e758f2be479f849e763947344f68d8 F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b @@ -784,7 +784,7 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c e87f66258c37f87724f46e849572c3ece4c74ef5614ba41eb221e98f0dbc95de F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c cd112eb00d20fc5cc44f631d0e713838602637328b0f127c2f3c2aa8cea3cc91 +F src/vdbe.c 4c688500c530ba8b62a4bb8f561be34a4afe7175fbdaa890b046cb15fb383c19 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 @@ -1217,7 +1217,7 @@ F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc F test/fuzzinvariants.c b34530e8431f2cf3591eff588fc7684d6fdef466916fb46141c8c5374a3d8099 F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c -F test/gencol1.test aef8b0670abd4b1ae4cae786b15a43758d86f6cd9f12b381d45d96bb51e597c9 +F test/gencol1.test e169bdfa11c7ed5e9f322a98a7db3afe9e66235750b68c923efee8e1876b46ec F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 F test/having.test a89236dd8d55aa50c4805f82ac9daf64d477a44d712d8209c118978d0ca21ec9 F test/hexlit.test 4a6a5f46e3c65c4bf1fa06f5dd5a9507a5627751 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 -R 7b01763f55834ca6495d297b6d47ecf8 +P 2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0 +R 2fc76f86f477974c5358ee799986121c U drh -Z e23aaad11f5de862bcdfc4d2c2927a81 +Z 113df2c1f11316814ff8cfbf0e8ca298 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3de2f46833..7f1ac31d9d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0 \ No newline at end of file +3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 59e3e23f09..0920b0f224 100644 --- a/src/build.c +++ b/src/build.c @@ -2920,6 +2920,13 @@ void sqlite3EndTable( /* Reparse everything to update our internal data structures */ sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0); + + /* Test for cycles in generated columns */ + if( p->tabFlags & TF_HasGenerated ){ + sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, + sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%s\"", + db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); + } } /* Add the table to the in-memory representation of the database. diff --git a/src/vdbe.c b/src/vdbe.c index 6463136507..00d365680b 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -6908,11 +6908,18 @@ case OP_CreateBtree: { /* out2 */ ** Run the SQL statement or statements specified in the P4 string. */ case OP_SqlExec: { + char *zErr; + sqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; - rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0); + zErr = 0; + rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr); db->nSqlExec--; - if( rc ) goto abort_due_to_error; + if( rc || zErr ){ + sqlite3VdbeError(p, "%s", zErr); + sqlite3_free(zErr); + goto abort_due_to_error; + } break; } diff --git a/test/gencol1.test b/test/gencol1.test index f3fbb0dfba..ed7ea567d4 100644 --- a/test/gencol1.test +++ b/test/gencol1.test @@ -662,11 +662,8 @@ do_execsql_test gencol1-23.4 { # 2023-03-07 https://sqlite.org/forum/forumpost/b312e075b5 # -do_execsql_test gencol1-23.5 { +do_catchsql_test gencol1-23.5 { CREATE TABLE v0(c1 INT, c2 AS (RAISE(IGNORE))); -} -do_catchsql_test gencol1-23.6 { - SELECT * FROM v0; } {1 {RAISE() may only be used within a trigger-program}} finish_test From d7cdfe74f66312f9be3a8a9e9e983cd48b0f90c0 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 13 Oct 2023 15:59:11 +0000 Subject: [PATCH 056/242] Fix an fts5 problem caused by a 'rebuild' followed by a DELETE in secure-delete mode. FossilOrigin-Name: 18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3 --- ext/fts5/fts5_main.c | 9 +++++++++ ext/fts5/test/fts5secure6.test | 28 ++++++++++++++++++++++++++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 3f14300043..1c21367df1 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -1533,6 +1533,7 @@ static int fts5SpecialInsert( Fts5Config *pConfig = pTab->p.pConfig; int rc = SQLITE_OK; int bError = 0; + int bLoadConfig = 0; if( 0==sqlite3_stricmp("delete-all", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ @@ -1544,6 +1545,7 @@ static int fts5SpecialInsert( }else{ rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage); } + bLoadConfig = 1; }else if( 0==sqlite3_stricmp("rebuild", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NONE ){ fts5SetVtabError(pTab, @@ -1553,6 +1555,7 @@ static int fts5SpecialInsert( }else{ rc = sqlite3Fts5StorageRebuild(pTab->pStorage); } + bLoadConfig = 1; }else if( 0==sqlite3_stricmp("optimize", zCmd) ){ rc = sqlite3Fts5StorageOptimize(pTab->pStorage); }else if( 0==sqlite3_stricmp("merge", zCmd) ){ @@ -1578,6 +1581,12 @@ static int fts5SpecialInsert( } } } + + if( rc==SQLITE_OK && bLoadConfig ){ + pTab->p.pConfig->iCookie--; + rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + } + return rc; } diff --git a/ext/fts5/test/fts5secure6.test b/ext/fts5/test/fts5secure6.test index 43d4f075e8..e2f4ceabc8 100644 --- a/ext/fts5/test/fts5secure6.test +++ b/ext/fts5/test/fts5secure6.test @@ -109,5 +109,33 @@ do_execsql_test 4.3 { INSERT INTO t1(t1) VALUES('integrity-check'); } +#------------------------------------------------------------------------- +reset_db + +do_execsql_test 5.0 { + CREATE VIRTUAL TABLE t1 USING fts5(content); + + INSERT INTO t1(t1,rank) VALUES('secure-delete',1); + INSERT INTO t1 VALUES('active'),('boomer'),('atom'),('atomic'), + ('alpha channel backup abandon test aback boomer atom alpha active'); + DELETE FROM t1 WHERE t1 MATCH 'abandon'; +} + +do_execsql_test 5.1 { + INSERT INTO t1(t1) VALUES('rebuild'); +} + +do_execsql_test 5.2 { + DELETE FROM t1 WHERE rowid NOTNULL<5; +} + +db close +sqlite3 db test.db + +do_execsql_test 5.3 { + PRAGMA integrity_check; +} {ok} + + finish_test diff --git a/manifest b/manifest index ac9ec8cf34..c9d01ed2aa 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Immediately\sfail\sa\sCREATE\sTABLE\sstatement\sthat\sattempts\sto\screate\sa\ntable\sthat\shas\sa\sgenerated\scolumn\sloop.\s\sLegacy\sallows\sthe\stable\sto\sbe\ncreated\sbut\sthe\stable\swould\snot\sbe\susable\sfor\sanything. -D 2023-10-13T13:49:46.914 +C Fix\san\sfts5\sproblem\scaused\sby\sa\s'rebuild'\sfollowed\sby\sa\sDELETE\sin\ssecure-delete\smode. +D 2023-10-13T15:59:11.452 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -95,7 +95,7 @@ F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d F ext/fts5/fts5_index.c a0f8e58e1c101d0b7959264f76b8c0c3c44914a999b29ec4264a6f55f1bccfe1 -F ext/fts5/fts5_main.c 1ea6636a1f528e9042cc6992d57b5a97c4a4e401ab1d2836c0cc805a1d27a982 +F ext/fts5/fts5_main.c 95b479e4cc1ae5d22084caa9d85295ed759044d24a0c1679115aea4910792a1f F ext/fts5/fts5_storage.c 3c9b41fce41b6410f2e8f82eb035c6a29b2560483f773e6dc98cf3cb2e4ddbb5 F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee @@ -204,7 +204,7 @@ F ext/fts5/test/fts5secure2.test 2e961d7eef939f294c56b5d895cac7f1c3a60b934ee2cfd F ext/fts5/test/fts5secure3.test c7e1080a6912f2a3ac68f2e05b88b72a99de38543509b2bbf427cac5c9c1c610 F ext/fts5/test/fts5secure4.test 0d10a80590c07891478700af7793b232962042677432b9846cf7fc8337b67c97 F ext/fts5/test/fts5secure5.test c07a68ced5951567ac116c22f2d2aafae497e47fe9fcb6a335c22f9c7a4f2c3a -F ext/fts5/test/fts5secure6.test 6f7fbb1f96910ccbdbfd2097f761f4c77c150c03734503331e2d428f77fa2a6e +F ext/fts5/test/fts5secure6.test 74bf04733cc523bccca519bb03d3b4e2ed6f6e3db7c59bf6be82c88a0ac857fd F ext/fts5/test/fts5secure7.test fd03d0868d64340a1db8615b02e5508fea409de13910114e4f19eaefc120777a F ext/fts5/test/fts5securefault.test dbca2b6a1c16700017f5051138991b705410889933f2a37c57ae8a23b296b10b F ext/fts5/test/fts5simple.test a298670508c1458b88ce6030440f26a30673931884eb5f4094ac1773b3ba217b @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2b574d9e7e922d0961ea27bfc0148d3098157ff8d4feefba469489c81d43f3e0 -R 2fc76f86f477974c5358ee799986121c -U drh -Z 113df2c1f11316814ff8cfbf0e8ca298 +P 3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802 +R 8c9ca99981e8bfe505c808816a46e21d +U dan +Z 7d08aebab325ced76a3693b193b8d8cb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7f1ac31d9d..305ace854d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802 \ No newline at end of file +18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3 \ No newline at end of file From 6f12e51313287931e6a5728c5165ace04caf681d Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Oct 2023 18:29:18 +0000 Subject: [PATCH 057/242] Do not allow triggers on shadow tables under defensive mode. FossilOrigin-Name: 44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/trigger.c | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c9d01ed2aa..0e69b9ce9a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sfts5\sproblem\scaused\sby\sa\s'rebuild'\sfollowed\sby\sa\sDELETE\sin\ssecure-delete\smode. -D 2023-10-13T15:59:11.452 +C Do\snot\sallow\striggers\son\sshadow\stables\sunder\sdefensive\smode. +D 2023-10-13T18:29:18.041 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -778,7 +778,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 F src/treeview.c 1d52fbc4e97161e65858d36e3424ea6e3fc045dd8a679c82b4b9593dc30de3bd -F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0 +F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3237bf964117c1ef71143042837ef21872bb3d04bfd682075672e768953ec802 -R 8c9ca99981e8bfe505c808816a46e21d -U dan -Z 7d08aebab325ced76a3693b193b8d8cb +P 18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3 +R e5fc1c8bca38142f52450113ed88aad4 +U drh +Z 4766bec696af50a50338444506de89e1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 305ace854d..70647abd29 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3 \ No newline at end of file +44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88 \ No newline at end of file diff --git a/src/trigger.c b/src/trigger.c index bcb2132f0b..2decea8206 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -183,6 +183,10 @@ void sqlite3BeginTrigger( sqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables"); goto trigger_orphan_error; } + if( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(db) ){ + sqlite3ErrorMsg(pParse, "cannot create triggers on shadow tables"); + goto trigger_orphan_error; + } /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ From cc67a62fa01ecf2ebab6ddb52adc58d41d95f66a Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Oct 2023 19:41:20 +0000 Subject: [PATCH 058/242] Apply the correct affinity to DEFAULT values that are TRUE or FALSE. FossilOrigin-Name: 4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbemem.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 0e69b9ce9a..506e60566b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sallow\striggers\son\sshadow\stables\sunder\sdefensive\smode. -D 2023-10-13T18:29:18.041 +C Apply\sthe\scorrect\saffinity\sto\sDEFAULT\svalues\sthat\sare\sTRUE\sor\sFALSE. +D 2023-10-13T19:41:20.296 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -790,7 +790,7 @@ F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 4cf5aa130e96e3b52ba3fb54b7f9606c942ab988dbb32cb19cff4db24e06aeec -F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 +F src/vdbemem.c ba9e21c579b58979a63d85e79088c9a9860b0ff4359f59a0db37427fb7807f66 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 18be505c628d9b13431ca6cfe822d4aeae119c53ae08aef26a67f310a8bd7bd3 -R e5fc1c8bca38142f52450113ed88aad4 +P 44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88 +R 47a32fc26da21940b710878ed0c79b18 U drh -Z 4766bec696af50a50338444506de89e1 +Z 63c76777fa129ac386380e87c8a0efdb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 70647abd29..c606ba903c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88 \ No newline at end of file +4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be \ No newline at end of file diff --git a/src/vdbemem.c b/src/vdbemem.c index e25efc9771..27dfc73fd0 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1716,6 +1716,7 @@ static int valueFromExpr( if( pVal ){ pVal->flags = MEM_Int; pVal->u.i = pExpr->u.zToken[4]==0; + sqlite3ValueApplyAffinity(pVal, affinity, enc); } } From 9132b8816aba57e5f00d22637008d2eb588e768b Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 13 Oct 2023 22:19:23 +0000 Subject: [PATCH 059/242] Earlier detection of a host of errors in CREATE TABLE, such the CREATE TABLE statement itself fails, rather than generating an error on the first attempted use of the created table. FossilOrigin-Name: 348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 1 + src/build.c | 10 +++++++--- src/vdbe.c | 13 +++++++++++++ 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 506e60566b..dba744e3b8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Apply\sthe\scorrect\saffinity\sto\sDEFAULT\svalues\sthat\sare\sTRUE\sor\sFALSE. -D 2023-10-13T19:41:20.296 +C Earlier\sdetection\sof\sa\shost\sof\serrors\sin\sCREATE\sTABLE,\ssuch\sthe\sCREATE\sTABLE\nstatement\sitself\sfails,\srather\sthan\sgenerating\san\serror\son\sthe\sfirst\sattempted\nuse\sof\sthe\screated\stable. +D 2023-10-13T22:19:23.580 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -653,10 +653,10 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c fbbbfc51d2fed03c29f20960857d97659d9c682523f32911d5a8e7c5be6436be +F src/btree.c 63fb3269c93924e734e0586c22816effa530cee933df4aeb2b2e045de0339280 F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 -F src/build.c 4b1d6f8d2b2fcd3267ec54254ad78383c6e758f2be479f849e763947344f68d8 +F src/build.c 1a9061ab67987cfa9c7f9d52ccc862a31d37ad2b05faaf0d72eeb4b4b5ee37cf F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b @@ -784,7 +784,7 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c e87f66258c37f87724f46e849572c3ece4c74ef5614ba41eb221e98f0dbc95de F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c 4c688500c530ba8b62a4bb8f561be34a4afe7175fbdaa890b046cb15fb383c19 +F src/vdbe.c ae873b02ade06478b217ea38d90229dff68180d7a1fe526910b0d62a0fe0595a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 4184402246172220418c0ef49ff4cf1a19ced9a4ac6c843c2f0773fb5c543f37 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 44b932ff16e35814febd842d11215cf243393f173aade33ceded473598221e88 -R 47a32fc26da21940b710878ed0c79b18 +P 4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be +R 341f9d0d74439d9b617811c449fe1fb8 U drh -Z 63c76777fa129ac386380e87c8a0efdb +Z bbfdb16e7d47445e024bdf790c59ad23 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c606ba903c..01e58cbbf3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be \ No newline at end of file +348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 1575d7d942..3c4f00d154 100644 --- a/src/btree.c +++ b/src/btree.c @@ -10708,6 +10708,7 @@ static int checkTreePage( if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){ checkAppendMsg(pCheck, "unable to get the page. error code=%d", rc); + if( rc==SQLITE_IOERR_NOMEM ) pCheck->rc = SQLITE_NOMEM; goto end_of_check; } diff --git a/src/build.c b/src/build.c index 0920b0f224..24f5d3f96a 100644 --- a/src/build.c +++ b/src/build.c @@ -2921,12 +2921,16 @@ void sqlite3EndTable( sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0); - /* Test for cycles in generated columns */ + /* Test for cycles in generated columns and illegal expressions + ** in CHECK constraints and in DEFAULT clauses. */ if( p->tabFlags & TF_HasGenerated ){ - sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, - sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%s\"", + sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0, + sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"", db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); } + sqlite3VdbeAddOp4(v, OP_SqlExec, 1, 0, 0, + sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)", + db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); } /* Add the table to the in-memory representation of the database. diff --git a/src/vdbe.c b/src/vdbe.c index 00d365680b..ce094f9970 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -6906,18 +6906,31 @@ case OP_CreateBtree: { /* out2 */ /* Opcode: SqlExec * * * P4 * ** ** Run the SQL statement or statements specified in the P4 string. +** Disable Auth and Trace callbacks while those statements are running if +** P1 is true. */ case OP_SqlExec: { char *zErr; + sqlite3_xauth xAuth; + u8 mTrace; sqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; zErr = 0; + xAuth = db->xAuth; + mTrace = db->mTrace; + if( pOp->p1 ){ + db->xAuth = 0; + db->mTrace = 0; + } rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr); db->nSqlExec--; + db->xAuth = xAuth; + db->mTrace = mTrace; if( rc || zErr ){ sqlite3VdbeError(p, "%s", zErr); sqlite3_free(zErr); + if( rc==SQLITE_NOMEM ) goto no_mem; goto abort_due_to_error; } break; From c84a0b2195055e76df9772b030b59fe0221cb394 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 14 Oct 2023 10:54:37 +0000 Subject: [PATCH 060/242] Bug fix in sqlite3_analyzer: for databases larger than 1GiB, take into account the lock-byte page when calculating the number of freelist pages. FossilOrigin-Name: 26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/spaceanal.tcl | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index dba744e3b8..3f1b563ebc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Earlier\sdetection\sof\sa\shost\sof\serrors\sin\sCREATE\sTABLE,\ssuch\sthe\sCREATE\sTABLE\nstatement\sitself\sfails,\srather\sthan\sgenerating\san\serror\son\sthe\sfirst\sattempted\nuse\sof\sthe\screated\stable. -D 2023-10-13T22:19:23.580 +C Bug\sfix\sin\ssqlite3_analyzer:\sfor\sdatabases\slarger\sthan\s1GiB,\stake\sinto\naccount\sthe\slock-byte\spage\swhen\scalculating\sthe\snumber\sof\sfreelist\spages. +D 2023-10-14T10:54:37.378 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2080,7 +2080,7 @@ F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a80 F tool/showstat4.c 0682ebea7abf4d3657f53c4a243f2e7eab48eab344ed36a94bb75dcd19a5c2a1 F tool/showwal.c 65ecabae3a2dcff4116301d5a8dbb8c4964814da1b2aff6d85c806a88b71fa4e F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe -F tool/spaceanal.tcl 1b5be34c6223cb1af06da2a10fb77863eb869b1962d055820b0a11cf2336ab45 +F tool/spaceanal.tcl 70c87c04cfd2e77b3e6f21c33ca768296aa8f67d4ab4874786ac8fbb28433477 F tool/speed-check.sh 72dc85b2c0484af971ee3e7d10775f72b4e771e27e162c2099b3bf25517c25fb F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355 F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4958db70c8103e249748fdeffc35f1c385e2e550e8a48697b82fcd797f3016be -R 341f9d0d74439d9b617811c449fe1fb8 +P 348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5 +R 491b395fcb54d24388cea619b1896c53 U drh -Z bbfdb16e7d47445e024bdf790c59ad23 +Z 11377a3945484d066aca86a95198dde7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 01e58cbbf3..5e9c11cf71 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5 \ No newline at end of file +26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6 \ No newline at end of file diff --git a/tool/spaceanal.tcl b/tool/spaceanal.tcl index d0c5e65e38..8fe72b99b1 100644 --- a/tool/spaceanal.tcl +++ b/tool/spaceanal.tcl @@ -581,6 +581,7 @@ set inuse_pgcnt [expr wide([mem eval $sql])] set inuse_percent [percent $inuse_pgcnt $file_pgcnt] set free_pgcnt [expr {$file_pgcnt-$inuse_pgcnt-$av_pgcnt}] +if {$file_bytes>1073741824 && $free_pgcnt>0} {incr free_pgcnt -1} set free_percent [percent $free_pgcnt $file_pgcnt] set free_pgcnt2 [db one {PRAGMA freelist_count}] set free_percent2 [percent $free_pgcnt2 $file_pgcnt] From 2ba1acce81f9b043a3aba36fd28f372f3132a297 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 12:19:59 +0000 Subject: [PATCH 061/242] Add missing JNI bindings for sqlite3_db_readonly() and sqlite3_db_name(). Code-adjacent tweaks for the API_ARMOR audit. FossilOrigin-Name: e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d --- ext/jni/src/c/sqlite3-jni.c | 87 ++++++++++++++++--------- ext/jni/src/c/sqlite3-jni.h | 16 +++++ ext/jni/src/org/sqlite/jni/CApi.java | 9 +++ ext/jni/src/org/sqlite/jni/Tester1.java | 8 +++ manifest | 21 +++--- manifest.uuid | 2 +- 6 files changed, 98 insertions(+), 45 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 1465c9e651..919f48bc13 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -909,7 +909,7 @@ static S3JniEnv * S3JniEnv__get(JNIEnv * const env){ ** ** For purposes of certain hand-crafted JNI function bindings, we ** need a way of reporting errors which is consistent with the rest of -** the C API, as opposed to throwing JS exceptions. To that end, this +** the C API, as opposed to throwing Java exceptions. To that end, this ** internal-use-only function is a thin proxy around ** sqlite3ErrorWithMessage(). The intent is that it only be used from ** JNI bindings such as sqlite3_prepare_v2/v3(), and definitely not @@ -2057,6 +2057,13 @@ static void udf_xInverse(sqlite3_context* cx, int argc, JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \ return (jlong)CName(S3JniLongPtr_sqlite3(jpDb)); \ } +/** Create a trivial JNI wrapper for (jstring CName(sqlite3*,int)). */ +#define WRAP_STR_DB_INT(JniNameSuffix,CName) \ + JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jlong jpDb, jint ndx){ \ + return s3jni_utf8_to_jstring( \ + CName(S3JniLongPtr_sqlite3(jpDb), (int)ndx), \ + -1); \ + } /** Create a trivial JNI wrapper for (int CName(sqlite3_value*)). */ #define WRAP_INT_SVALUE(JniNameSuffix,CName) \ JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \ @@ -2082,6 +2089,7 @@ WRAP_STR_STMT_INT(1column_1origin_1name, sqlite3_column_origin_name) WRAP_STR_STMT_INT(1column_1table_1name, sqlite3_column_table_name) WRAP_INT_STMT_INT(1column_1type, sqlite3_column_type) WRAP_INT_STMT(1data_1count, sqlite3_data_count) +WRAP_STR_DB_INT(1db_1name, sqlite3_db_name) WRAP_INT_DB(1error_1offset, sqlite3_error_offset) WRAP_INT_DB(1extended_1errcode, sqlite3_extended_errcode) WRAP_BOOL_DB(1get_1autocommit, sqlite3_get_autocommit) @@ -2125,6 +2133,7 @@ WRAP_INT_SVALUE(1value_1type, sqlite3_value_type) #undef WRAP_INT_VOID #undef WRAP_MUTF8_VOID #undef WRAP_STR_STMT_INT +#undef WRAP_STR_DB_INT S3JniApi(sqlite3_aggregate_context(),jlong,1aggregate_1context)( JniArgsEnvClass, jobject jCx, jboolean initialize @@ -2866,7 +2875,7 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env, S3JniDb_mutex_enter; ps = S3JniDb_from_jlong(jpDb); if( !ps ){ - s3jni_db_error(ps->pDb, SQLITE_NOMEM, 0); + s3jni_db_error(ps->pDb, SQLITE_MISUSE, 0); S3JniDb_mutex_leave; return 0; } @@ -3252,36 +3261,6 @@ error_cleanup: return (jint)rc; } -S3JniApi(sqlite3_db_filename(),jstring,1db_1filename)( - JniArgsEnvClass, jobject jDb, jstring jDbName -){ - S3JniDb * const ps = S3JniDb_from_java(jDb); - char *zDbName; - jstring jRv = 0; - int nStr = 0; - - if( !ps || !jDbName ){ - return 0; - } - zDbName = s3jni_jstring_to_utf8( jDbName, &nStr); - if( zDbName ){ - char const * zRv = sqlite3_db_filename(ps->pDb, zDbName); - sqlite3_free(zDbName); - if( zRv ){ - jRv = s3jni_utf8_to_jstring( zRv, -1); - } - } - return jRv; -} - -S3JniApi(sqlite3_db_handle(),jobject,1db_1handle)( - JniArgsEnvClass, jobject jpStmt -){ - sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt); - sqlite3 * const pDb = pStmt ? sqlite3_db_handle(pStmt) : 0; - S3JniDb * const ps = pDb ? S3JniDb_from_c(pDb) : 0; - return ps ? ps->jDb : 0; -} S3JniApi(sqlite3_db_config() /*for MAINDBNAME*/, jint,1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 @@ -3309,6 +3288,7 @@ S3JniApi(sqlite3_db_config() /*for MAINDBNAME*/, } S3JniDb_mutex_leave; break; + case 0: default: rc = SQLITE_MISUSE; } @@ -3352,6 +3332,7 @@ S3JniApi( } break; } + case 0: default: rc = SQLITE_MISUSE; } @@ -3372,6 +3353,48 @@ JniDecl(jint,1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPoint ); } +S3JniApi(sqlite3_db_filename(),jstring,1db_1filename)( + JniArgsEnvClass, jobject jDb, jstring jDbName +){ + S3JniDb * const ps = S3JniDb_from_java(jDb); + char *zDbName; + jstring jRv = 0; + int nStr = 0; + + if( !ps || !jDbName ){ + return 0; + } + zDbName = s3jni_jstring_to_utf8( jDbName, &nStr); + if( zDbName ){ + char const * zRv = sqlite3_db_filename(ps->pDb, zDbName); + sqlite3_free(zDbName); + if( zRv ){ + jRv = s3jni_utf8_to_jstring( zRv, -1); + } + } + return jRv; +} + +S3JniApi(sqlite3_db_handle(),jobject,1db_1handle)( + JniArgsEnvClass, jobject jpStmt +){ + sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt); + sqlite3 * const pDb = pStmt ? sqlite3_db_handle(pStmt) : 0; + S3JniDb * const ps = pDb ? S3JniDb_from_c(pDb) : 0; + return ps ? ps->jDb : 0; +} + +S3JniApi(sqlite3_db_readonly(),jint,1db_1readonly)( + JniArgsEnvClass, jobject jDb, jstring jDbName +){ + int rc = 0; + S3JniDb * const ps = S3JniDb_from_java(jDb); + char *zDbName = jDbName ? s3jni_jstring_to_utf8( jDbName, 0 ) : 0; + rc = sqlite3_db_readonly(ps ? ps->pDb : 0, zDbName); + sqlite3_free(zDbName); + return (jint)rc; +} + S3JniApi(sqlite3_db_release_memory(),int,1db_1release_1memory)( JniArgsEnvClass, jobject jDb ){ diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 6d38adf06e..4195ad6dba 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1307,6 +1307,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 (JNIEnv *, jclass, jobject, jint, jstring); +/* + * Class: org_sqlite_jni_CApi + * Method: sqlite3_db_name + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1name + (JNIEnv *, jclass, jlong, jint); + /* * Class: org_sqlite_jni_CApi * Method: sqlite3_db_filename @@ -1323,6 +1331,14 @@ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1filename JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1handle (JNIEnv *, jclass, jobject); +/* + * Class: org_sqlite_jni_CApi + * Method: sqlite3_db_readonly + * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1readonly + (JNIEnv *, jclass, jobject, jstring); + /* * Class: org_sqlite_jni_CApi * Method: sqlite3_db_release_memory diff --git a/ext/jni/src/org/sqlite/jni/CApi.java b/ext/jni/src/org/sqlite/jni/CApi.java index 8149d624ad..90e8339799 100644 --- a/ext/jni/src/org/sqlite/jni/CApi.java +++ b/ext/jni/src/org/sqlite/jni/CApi.java @@ -811,12 +811,21 @@ final class CApi { @NotNull sqlite3 db, int op, @NotNull String val ); + private static native String sqlite3_db_name(@NotNull long ptrToDb, int ndx); + + public static String sqlite3_db_name(@NotNull sqlite3 db, int ndx){ + return null==db ? null : sqlite3_db_name(db.getNativePointer(), ndx); + } + + public static native String sqlite3_db_filename( @NotNull sqlite3 db, @NotNull String dbName ); public static native sqlite3 sqlite3_db_handle(@NotNull sqlite3_stmt stmt); + public static native int sqlite3_db_readonly(@NotNull sqlite3 db, String dbName); + public static native int sqlite3_db_release_memory(sqlite3 db); public static native int sqlite3_db_status( diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 0ff1c98dbe..4d9061538b 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -255,6 +255,11 @@ public class Tester1 implements Runnable { and this call is here to ensure that the build fails if it cannot find both names. */; + affirm( 0==sqlite3_db_readonly(db,"main") ); + affirm( 0==sqlite3_db_readonly(db,null) ); + affirm( 0>sqlite3_db_readonly(db,"nope") ); + affirm( 0>sqlite3_db_readonly(null,null) ); + // These interrupt checks are only to make sure that the JNI binding // has the proper exported symbol names. They don't actually test // anything useful. @@ -1028,8 +1033,11 @@ public class Tester1 implements Runnable { affirm( 0 == rc ); affirm( outDb.get() != db1 ); final sqlite3 db2 = outDb.get(); + + affirm( "main".equals( sqlite3_db_name(db1, 0) ) ); rc = sqlite3_db_config(db1, SQLITE_DBCONFIG_MAINDBNAME, "foo"); affirm( sqlite3_db_filename(db1, "foo").endsWith(dbName) ); + affirm( "foo".equals( sqlite3_db_name(db1, 0) ) ); final ValueHolder xBusyCalled = new ValueHolder<>(0); BusyHandlerCallback handler = new BusyHandlerCallback(){ diff --git a/manifest b/manifest index f9baa60087..92c7ea1eed 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Round\sone\sof\san\saudit\sfor\sSQLITE_ENABLE_API_ARMOR\sfor\sfunctions\sexposed\sby\sJNI\sand\sthose\sfunctions\smissing\sarmor,\sas\s[forum:5e3fc453a69b49ca|reported\sin\sseveral\sforum\sposts]. -D 2023-10-13T12:48:35.298 +C Add\smissing\sJNI\sbindings\sfor\ssqlite3_db_readonly()\sand\ssqlite3_db_name().\sCode-adjacent\stweaks\sfor\sthe\sAPI_ARMOR\saudit. +D 2023-10-14T12:19:59.876 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,14 +238,14 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c eabd48ced29954fb4f6173c4f350f7f1fce218ce19f48a75367cb560cf2da77e -F ext/jni/src/c/sqlite3-jni.h be1fdff7ab3a2bb357197271c8ac5d2bf6ff59380c106dde3a13be88724bad22 +F ext/jni/src/c/sqlite3-jni.c 2a01d42df24718d69eafe836643de272b14fca57135ce0f1f6521fecf9002e29 +F ext/jni/src/c/sqlite3-jni.h 8bd34a6fe3b51059690be31ac5bd6e454a738dd1ff9916f490e05cf63c4f8e37 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 -F ext/jni/src/org/sqlite/jni/CApi.java c1dde485a3a3f43c46c8d9c527f9ba5bf303fe0409b2c0de253fb7b6e1055f7e +F ext/jni/src/org/sqlite/jni/CApi.java 6f878d291642568a06d9a36c15b420f5f867dcc44cee0cc56e8f02b542f67ec4 F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 @@ -265,7 +265,7 @@ F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233d F ext/jni/src/org/sqlite/jni/Sqlite.java 1617ea2bf3dfa493b7f031a3187cbfd6837c39bc1d406c4b3edcf9aab941639d F ext/jni/src/org/sqlite/jni/SqliteException.java e17500e8bca2c68c260d8d0163fe4b7dc8bd0b1b90211201325c4a5566ce75ca F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java f7b85fe24cf6c3e43bdf7e390617657e8137359f804d76921829c2a8c41b6df1 +F ext/jni/src/org/sqlite/jni/Tester1.java 92d4e9dcf9268e6e2588c1cbd808454926ee40287eb9126b0e5eb823918e538d F ext/jni/src/org/sqlite/jni/Tester2.java 70e005d41060e398ec0f69bd39a8e1c376fd51f81629cf25e877889ec9cb6ec6 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 @@ -2128,11 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2e968114fd0e60eebcc088dec02684e10b06ac1ec42d6bedb5287362f5cbf032 -R 64d7e862f198f312cf375ff0e1b4824a -T *branch * api-armor-audit -T *sym-api-armor-audit * -T -sym-trunk * Cancelled\sby\sbranch. +P 8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939 +R 540c998e288c6bc086b36558f89d784a U stephan -Z fb0f8b82a9c86be7bcd5823447ca13df +Z 6aa47de4921539f80453f46d0771c8db # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7b111488b3..8cb3c75d27 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939 \ No newline at end of file +e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d \ No newline at end of file From eaebd7fb6aca0762ff85eaf3faaa574fbf7249cb Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 12:20:55 +0000 Subject: [PATCH 062/242] Extend API_ARMOR checks on sqlite3_commit/rollback_hook() to include a check for the callback pointer. FossilOrigin-Name: f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/main.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 92c7ea1eed..23f9b55750 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\sJNI\sbindings\sfor\ssqlite3_db_readonly()\sand\ssqlite3_db_name().\sCode-adjacent\stweaks\sfor\sthe\sAPI_ARMOR\saudit. -D 2023-10-14T12:19:59.876 +C Extend\sAPI_ARMOR\schecks\son\ssqlite3_commit/rollback_hook()\sto\sinclude\sa\scheck\sfor\sthe\scallback\spointer. +D 2023-10-14T12:20:55.441 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -677,7 +677,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c 7a91b372dd1bada07c5b5e36082dc0d695161c3807efe2386f563a5b32446ae6 +F src/main.c be4dbe864b9ae973f5611aa6fb478541235ea3eef64f7d3d37bbe96334f556a3 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8c25c4b18ad07861bf0e47f99f3db04b569b9b859ad0690602f748ddf3576939 -R 540c998e288c6bc086b36558f89d784a +P e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d +R 30e2307f7d3debecac19515663c6942d U stephan -Z 6aa47de4921539f80453f46d0771c8db +Z 7173d279e961708051d9b4ee103a0383 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8cb3c75d27..8dd812c93b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d \ No newline at end of file +f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d \ No newline at end of file diff --git a/src/main.c b/src/main.c index 4ddf7e24d3..e764379126 100644 --- a/src/main.c +++ b/src/main.c @@ -2294,7 +2294,7 @@ void *sqlite3_commit_hook( void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !sqlite3SafetyCheckOk(db) || xCallback==0 ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -2344,7 +2344,7 @@ void *sqlite3_rollback_hook( void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) ){ + if( !sqlite3SafetyCheckOk(db) || xCallback==0 ){ (void)SQLITE_MISUSE_BKPT; return 0; } From 6d035d481f6dd137e30bf30c811d5379894ae34b Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 12:40:57 +0000 Subject: [PATCH 063/242] Bring JNI-side sqlite3_last_insert_rowid() and sqlite3_table_column_metadata() in line with the core's NULL handling. FossilOrigin-Name: c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa --- ext/jni/src/c/sqlite3-jni.c | 14 +++++--------- ext/jni/src/org/sqlite/jni/Tester1.java | 13 ++++++++++++- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 919f48bc13..8ff1da193a 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -3583,12 +3583,7 @@ S3JniApi(sqlite3_keyword_name(),jstring,1keyword_1name)( S3JniApi(sqlite3_last_insert_rowid(),jlong,1last_1insert_1rowid)( JniArgsEnvClass, jobject jpDb ){ - jlong rc = 0; - sqlite3 * const pDb = PtrGet_sqlite3(jpDb); - if( pDb ){ - rc = (jlong)sqlite3_last_insert_rowid(pDb); - } - return rc; + return (jlong)sqlite3_last_insert_rowid(PtrGet_sqlite3(jpDb)); } S3JniApi(sqlite3_limit(),jint,1limit)( @@ -4564,11 +4559,12 @@ S3JniApi(sqlite3_table_column_metadata(),int,1table_1column_1metadata)( int pNotNull = 0, pPrimaryKey = 0, pAutoinc = 0; int rc; - if( !db || !jDbName || !jTableName || !jColumnName ) return SQLITE_MISUSE; + if( !db || !jDbName || !jTableName ) return SQLITE_MISUSE; zDbName = s3jni_jstring_to_utf8(jDbName,0); zTableName = zDbName ? s3jni_jstring_to_utf8(jTableName,0) : 0; - zColumnName = zTableName ? s3jni_jstring_to_utf8(jColumnName,0) : 0; - rc = zColumnName + zColumnName = (zTableName && jColumnName) + ? s3jni_jstring_to_utf8(jColumnName,0) : 0; + rc = zTableName ? sqlite3_table_column_metadata(db, zDbName, zTableName, zColumnName, &pzDataType, &pzCollSeq, &pNotNull, &pPrimaryKey, &pAutoinc) diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 4d9061538b..d5dffc2d8a 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -259,6 +259,7 @@ public class Tester1 implements Runnable { affirm( 0==sqlite3_db_readonly(db,null) ); affirm( 0>sqlite3_db_readonly(db,"nope") ); affirm( 0>sqlite3_db_readonly(null,null) ); + affirm( 0==sqlite3_last_insert_rowid(null) ); // These interrupt checks are only to make sure that the JNI binding // has the proper exported symbol names. They don't actually test @@ -1464,7 +1465,7 @@ public class Tester1 implements Runnable { affirm( "noCase".equals(zCollSeq.value) ); affirm( "duck".equals(zDataType.value) ); - final TableColumnMetadata m = + TableColumnMetadata m = sqlite3_table_column_metadata(db, "main", "t", "a"); affirm( null != m ); affirm( bPrimaryKey.value == m.isPrimaryKey() ); @@ -1474,6 +1475,16 @@ public class Tester1 implements Runnable { affirm( zDataType.value.equals(m.getDataType()) ); affirm( null == sqlite3_table_column_metadata(db, "nope", "t", "a") ); + affirm( null == sqlite3_table_column_metadata(db, "main", "nope", "a") ); + + m = sqlite3_table_column_metadata(db, "main", "t", null) + /* Check only for existence of table */; + affirm( null != m ); + affirm( m.isPrimaryKey() ); + affirm( !m.isAutoincrement() ); + affirm( !m.isNotNull() ); + affirm( "BINARY".equalsIgnoreCase(m.getCollation()) ); + affirm( "INTEGER".equalsIgnoreCase(m.getDataType()) ); sqlite3_close_v2(db); } diff --git a/manifest b/manifest index 23f9b55750..9724e9f611 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extend\sAPI_ARMOR\schecks\son\ssqlite3_commit/rollback_hook()\sto\sinclude\sa\scheck\sfor\sthe\scallback\spointer. -D 2023-10-14T12:20:55.441 +C Bring\sJNI-side\ssqlite3_last_insert_rowid()\sand\ssqlite3_table_column_metadata()\sin\sline\swith\sthe\score's\sNULL\shandling. +D 2023-10-14T12:40:57.346 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 2a01d42df24718d69eafe836643de272b14fca57135ce0f1f6521fecf9002e29 +F ext/jni/src/c/sqlite3-jni.c 3d4640ae9c128326e0f65dade4732734771596371e398a7ae95c4d33ef24928a F ext/jni/src/c/sqlite3-jni.h 8bd34a6fe3b51059690be31ac5bd6e454a738dd1ff9916f490e05cf63c4f8e37 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -265,7 +265,7 @@ F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233d F ext/jni/src/org/sqlite/jni/Sqlite.java 1617ea2bf3dfa493b7f031a3187cbfd6837c39bc1d406c4b3edcf9aab941639d F ext/jni/src/org/sqlite/jni/SqliteException.java e17500e8bca2c68c260d8d0163fe4b7dc8bd0b1b90211201325c4a5566ce75ca F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 92d4e9dcf9268e6e2588c1cbd808454926ee40287eb9126b0e5eb823918e538d +F ext/jni/src/org/sqlite/jni/Tester1.java 7c17a33e044a24d590007e1b4581b8d1e07653ab3f76fc66571b78905d6391b1 F ext/jni/src/org/sqlite/jni/Tester2.java 70e005d41060e398ec0f69bd39a8e1c376fd51f81629cf25e877889ec9cb6ec6 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e5eace747ae656f1e05a346e53a2827242e57107567d2c3470e292cf0b40858d -R 30e2307f7d3debecac19515663c6942d +P f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d +R d3dd2ae5a14dfec019fa6886cd0b6713 U stephan -Z 7173d279e961708051d9b4ee103a0383 +Z a2340dd7e5a63c935f9d8e1e3bbbf4f4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8dd812c93b..6852d93cfa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d \ No newline at end of file +c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa \ No newline at end of file From 067a13c395494a8ee2f1624c3eb9b96d60ad6888 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 12:45:11 +0000 Subject: [PATCH 064/242] Revert [f6cd88e6b234] - the NULL callback case is perfectly legal. FossilOrigin-Name: 718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/main.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 9724e9f611..4e35daee46 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bring\sJNI-side\ssqlite3_last_insert_rowid()\sand\ssqlite3_table_column_metadata()\sin\sline\swith\sthe\score's\sNULL\shandling. -D 2023-10-14T12:40:57.346 +C Revert\s[f6cd88e6b234]\s-\sthe\sNULL\scallback\scase\sis\sperfectly\slegal. +D 2023-10-14T12:45:11.220 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -677,7 +677,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c be4dbe864b9ae973f5611aa6fb478541235ea3eef64f7d3d37bbe96334f556a3 +F src/main.c 7a91b372dd1bada07c5b5e36082dc0d695161c3807efe2386f563a5b32446ae6 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -2128,8 +2128,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d -R d3dd2ae5a14dfec019fa6886cd0b6713 +P c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa +Q -f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d +R e425a976b909e6e9442ecfbc934213d4 U stephan -Z a2340dd7e5a63c935f9d8e1e3bbbf4f4 +Z d7f2236cb14e3dff65c1d3d5c7a3103b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6852d93cfa..b0d12201ae 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa \ No newline at end of file +718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de \ No newline at end of file diff --git a/src/main.c b/src/main.c index e764379126..4ddf7e24d3 100644 --- a/src/main.c +++ b/src/main.c @@ -2294,7 +2294,7 @@ void *sqlite3_commit_hook( void *pOld; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || xCallback==0 ){ + if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } @@ -2344,7 +2344,7 @@ void *sqlite3_rollback_hook( void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || xCallback==0 ){ + if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; return 0; } From a17f63290cd2a13cef5b34cbb84a7ce87de27545 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 13:24:30 +0000 Subject: [PATCH 065/242] Add column name to API_ARMOR check in sqlite3_blob_open() to avoid a null-pointer deref. FossilOrigin-Name: 0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42 --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/vdbeblob.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 4e35daee46..152bb69a2f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revert\s[f6cd88e6b234]\s-\sthe\sNULL\scallback\scase\sis\sperfectly\slegal. -D 2023-10-14T12:45:11.220 +C Add\scolumn\sname\sto\sAPI_ARMOR\scheck\sin\ssqlite3_blob_open()\sto\savoid\sa\snull-pointer\sderef. +D 2023-10-14T13:24:30.111 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -789,7 +789,7 @@ F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c be7d88a05df51cb3940304f74e4b0534817b51213b3406143a67eecd6f82fe21 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 -F src/vdbeblob.c 4cf5aa130e96e3b52ba3fb54b7f9606c942ab988dbb32cb19cff4db24e06aeec +F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 @@ -2128,9 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c2afc1c2a2fc9bdf3d7b7701004e0fa40965cf8c6b7cf44b46f2ca37cfa1d2aa -Q -f6cd88e6b234560f729ff00da86144a0121ad96d5a07d227c9ffa3f43c22f72d -R e425a976b909e6e9442ecfbc934213d4 +P 718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de +R 6939314c5aa83ebb51a4869d1b741b9d U stephan -Z d7f2236cb14e3dff65c1d3d5c7a3103b +Z 1c92c68280e405080d393332e7ff98bd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b0d12201ae..ec21d78cdc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de \ No newline at end of file +0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42 \ No newline at end of file diff --git a/src/vdbeblob.c b/src/vdbeblob.c index ea6f016e3e..522447dbc1 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -142,7 +142,7 @@ int sqlite3_blob_open( #endif *ppBlob = 0; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zTable==0 ){ + if( !sqlite3SafetyCheckOk(db) || zTable==0 || zColumn==0 ){ return SQLITE_MISUSE_BKPT; } #endif From 7a54b1269569abfaac978c0f77d145a4acd5caa7 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 14:53:18 +0000 Subject: [PATCH 066/242] More API_ARMOR additions. FossilOrigin-Name: 78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeapi.c | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 152bb69a2f..6fb15f78f3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\scolumn\sname\sto\sAPI_ARMOR\scheck\sin\ssqlite3_blob_open()\sto\savoid\sa\snull-pointer\sderef. -D 2023-10-14T13:24:30.111 +C More\sAPI_ARMOR\sadditions. +D 2023-10-14T14:53:18.394 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -787,7 +787,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c cd112eb00d20fc5cc44f631d0e713838602637328b0f127c2f3c2aa8cea3cc91 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c be7d88a05df51cb3940304f74e4b0534817b51213b3406143a67eecd6f82fe21 +F src/vdbeapi.c dbada91cc9f2e0b76ad4c76aad7b92fbe80c4a439b5dd8d7fa990d4e34b9831c F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 718ab67607895176e529eb7469832d262a347d030e83e7ee66d3b4704bf933de -R 6939314c5aa83ebb51a4869d1b741b9d +P 0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42 +R 376130abd753bb410df401995b876336 U stephan -Z 1c92c68280e405080d393332e7ff98bd +Z fbd9ca46d7a725fcd4bdd4a5ef9f230a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ec21d78cdc..a9523053f7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42 \ No newline at end of file +78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index f8e66df87a..60798e9aa4 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -547,7 +547,16 @@ void sqlite3_result_text16le( } #endif /* SQLITE_OMIT_UTF16 */ void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ - Mem *pOut = pCtx->pOut; + Mem *pOut; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; + if( pValue==0 ){ + sqlite3_result_null(pCtx); + return; + } +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemCopy(pOut, pValue); sqlite3VdbeChangeEncoding(pOut, pCtx->enc); @@ -845,7 +854,11 @@ int sqlite3_step(sqlite3_stmt *pStmt){ ** pointer to it. */ void *sqlite3_user_data(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#else assert( p && p->pFunc ); +#endif return p->pFunc->pUserData; } @@ -860,7 +873,11 @@ void *sqlite3_user_data(sqlite3_context *p){ ** application defined function. */ sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#else assert( p && p->pOut ); +#endif return p->pOut->db; } @@ -879,7 +896,11 @@ sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ ** value, as a signal to the xUpdate routine that the column is unchanged. */ int sqlite3_vtab_nochange(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#else assert( p ); +#endif return sqlite3_value_nochange(p->pOut); } @@ -1038,6 +1059,9 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ AuxData *pAuxData; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return 0; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); #if SQLITE_ENABLE_STAT4 if( pCtx->pVdbe==0 ) return 0; @@ -1070,8 +1094,12 @@ void sqlite3_set_auxdata( void (*xDelete)(void*) ){ AuxData *pAuxData; - Vdbe *pVdbe = pCtx->pVdbe; + Vdbe *pVdbe; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif + pVdbe= pCtx->pVdbe; assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); #ifdef SQLITE_ENABLE_STAT4 if( pVdbe==0 ) goto failed; From c76e4509084e184cc6fa59edbff3cb28dbda8d99 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 16:29:36 +0000 Subject: [PATCH 067/242] Add API_ARMOR support to the sqlite3_result_...() family of functions and sqlite3_bind_zeroblob64(). FossilOrigin-Name: afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73 --- manifest | 12 ++++---- manifest.uuid | 2 +- src/vdbeapi.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 6fb15f78f3..f33c25c838 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sAPI_ARMOR\sadditions. -D 2023-10-14T14:53:18.394 +C Add\sAPI_ARMOR\ssupport\sto\sthe\ssqlite3_result_...()\sfamily\sof\sfunctions\sand\ssqlite3_bind_zeroblob64(). +D 2023-10-14T16:29:36.931 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -787,7 +787,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c cd112eb00d20fc5cc44f631d0e713838602637328b0f127c2f3c2aa8cea3cc91 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c dbada91cc9f2e0b76ad4c76aad7b92fbe80c4a439b5dd8d7fa990d4e34b9831c +F src/vdbeapi.c 0204e7247582975797a4b45606b39395c8a4f678d7c2b8dc15129044dcbb508f F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0114a6622afc4588c47e98d804340449417b603dc4831513eab4d8e4ccb15d42 -R 376130abd753bb410df401995b876336 +P 78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d +R 71ff5d4a376fdfcdde5b2514a89cbed8 U stephan -Z fbd9ca46d7a725fcd4bdd4a5ef9f230a +Z 2c334c3835eed2b31940cc452708383c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a9523053f7..a3560d7197 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d \ No newline at end of file +afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73 \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 60798e9aa4..f878f2a2a7 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -405,7 +405,7 @@ static void setResultStrOrError( static int invokeValueDestructor( const void *p, /* Value to destroy */ void (*xDel)(void*), /* The destructor */ - sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if no NULL */ + sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if not NULL */ ){ assert( xDel!=SQLITE_DYNAMIC ); if( xDel==0 ){ @@ -415,7 +415,9 @@ static int invokeValueDestructor( }else{ xDel((void*)p); } - sqlite3_result_error_toobig(pCtx); + if( pCtx!=0 ){ + sqlite3_result_error_toobig(pCtx); + } return SQLITE_TOOBIG; } void sqlite3_result_blob( @@ -424,6 +426,12 @@ void sqlite3_result_blob( int n, void (*xDel)(void *) ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 || n<0 ){ + invokeValueDestructor(z, xDel, pCtx); + return; + } +#endif assert( n>=0 ); assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, 0, xDel); @@ -434,8 +442,14 @@ void sqlite3_result_blob64( sqlite3_uint64 n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif + assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); if( n>0x7fffffff ){ (void)invokeValueDestructor(z, xDel, pCtx); }else{ @@ -443,30 +457,48 @@ void sqlite3_result_blob64( } } void sqlite3_result_double(sqlite3_context *pCtx, double rVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetDouble(pCtx->pOut, rVal); } void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT); } #ifndef SQLITE_OMIT_UTF16 void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT); } #endif void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal); } void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetInt64(pCtx->pOut, iVal); } void sqlite3_result_null(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetNull(pCtx->pOut); } @@ -476,14 +508,25 @@ void sqlite3_result_pointer( const char *zPType, void (*xDestructor)(void*) ){ - Mem *pOut = pCtx->pOut; + Mem *pOut; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(pPtr, xDestructor, 0); + return; + } +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); sqlite3VdbeMemRelease(pOut); pOut->flags = MEM_Null; sqlite3VdbeMemSetPointer(pOut, pPtr, zPType, xDestructor); } void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){ - Mem *pOut = pCtx->pOut; + Mem *pOut; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); pOut->eSubtype = eSubtype & 0xff; pOut->flags |= MEM_Subtype; @@ -494,6 +537,12 @@ void sqlite3_result_text( int n, void (*xDel)(void *) ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel); } @@ -504,6 +553,12 @@ void sqlite3_result_text64( void (*xDel)(void *), unsigned char enc ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); if( enc!=SQLITE_UTF8 ){ @@ -568,7 +623,12 @@ void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){ sqlite3_result_zeroblob64(pCtx, n>0 ? n : 0); } int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ - Mem *pOut = pCtx->pOut; + Mem *pOut; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return SQLITE_MISUSE_BKPT; +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(pCtx); @@ -582,6 +642,9 @@ int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ #endif } void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif pCtx->isError = errCode ? errCode : -1; #ifdef SQLITE_DEBUG if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode; @@ -594,6 +657,9 @@ void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ /* Force an SQLITE_TOOBIG error. */ void sqlite3_result_error_toobig(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_TOOBIG; sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1, @@ -602,6 +668,9 @@ void sqlite3_result_error_toobig(sqlite3_context *pCtx){ /* An SQLITE_NOMEM error. */ void sqlite3_result_error_nomem(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetNull(pCtx->pOut); pCtx->isError = SQLITE_NOMEM_BKPT; @@ -1765,6 +1834,9 @@ int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){ int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){ int rc; Vdbe *p = (Vdbe *)pStmt; +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(p->db->mutex); if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){ rc = SQLITE_TOOBIG; From a9000d424eae8438b95fd51b6e12ddcfa7e8b435 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 16:56:12 +0000 Subject: [PATCH 068/242] JNI: add missing sqlite3_bind_value() and minor memory-safety-related cleanups. FossilOrigin-Name: 3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af --- ext/jni/src/c/sqlite3-jni.c | 54 +++++++++++++++++++++------- ext/jni/src/c/sqlite3-jni.h | 8 +++++ ext/jni/src/org/sqlite/jni/CApi.java | 11 ++++++ manifest | 16 ++++----- manifest.uuid | 2 +- 5 files changed, 70 insertions(+), 21 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 8ff1da193a..f4615329e8 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2378,7 +2378,7 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)( int rc = SQLITE_MISUSE; if(pStmt){ - jobject const rv = val ? S3JniRefGlobal(val) : 0; + jobject const rv = S3JniRefGlobal(val); if( rv ){ rc = sqlite3_bind_pointer(pStmt, ndx, rv, ResultJavaValuePtrStr, S3Jni_jobject_finalizer); @@ -2445,6 +2445,24 @@ S3JniApi(sqlite3_bind_text16(),jint,1bind_1text16)( return (jint)rc; } +S3JniApi(sqlite3_bind_value(),jint,1bind_1value)( + JniArgsEnvClass, jlong jpStmt, jint ndx, jlong jpValue +){ + int rc = 0; + sqlite3_stmt * pStmt = S3JniLongPtr_sqlite3_stmt(jpStmt); + if( pStmt ){ + sqlite3_value *v = S3JniLongPtr_sqlite3_value(jpValue); + if( v ){ + rc = sqlite3_bind_value(pStmt, (int)ndx, v); + }else{ + sqlite3_bind_null(pStmt, (int)ndx); + } + }else{ + rc = SQLITE_MISUSE; + } + return (jint)rc; +} + S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob)( JniArgsEnvClass, jlong jpStmt, jint ndx, jint n ){ @@ -3731,10 +3749,15 @@ jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self, sqlite3_stmt * pStmt = 0; jobject jStmt = 0; const char * zTail = 0; - jbyte * const pBuf = s3jni_jbyteArray_bytes(baSql); + sqlite3 * const pDb = S3JniLongPtr_sqlite3(jpDb); + jbyte * const pBuf = pDb ? s3jni_jbyteArray_bytes(baSql) : 0; int rc = SQLITE_ERROR; + assert(prepVersion==1 || prepVersion==2 || prepVersion==3); - if( !pBuf ){ + if( !pDb || !jOutStmt ){ + rc = SQLITE_MISUSE; + goto end; + }else if( !pBuf ){ rc = baSql ? SQLITE_NOMEM : SQLITE_MISUSE; goto end; } @@ -3744,13 +3767,13 @@ jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self, goto end; } switch( prepVersion ){ - case 1: rc = sqlite3_prepare(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf, + case 1: rc = sqlite3_prepare(pDb, (const char *)pBuf, (int)nMax, &pStmt, &zTail); break; - case 2: rc = sqlite3_prepare_v2(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf, + case 2: rc = sqlite3_prepare_v2(pDb, (const char *)pBuf, (int)nMax, &pStmt, &zTail); break; - case 3: rc = sqlite3_prepare_v3(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf, + case 3: rc = sqlite3_prepare_v3(pDb, (const char *)pBuf, (int)nMax, (unsigned int)prepFlags, &pStmt, &zTail); break; @@ -3780,8 +3803,10 @@ end: S3JniUnrefLocal(jStmt); jStmt = 0; } - OutputPointer_set_obj(env, S3JniNph(OutputPointer_sqlite3_stmt), - jOutStmt, jStmt); + if( jOutStmt ){ + OutputPointer_set_obj(env, S3JniNph(OutputPointer_sqlite3_stmt), + jOutStmt, jStmt); + } return (jint)rc; } S3JniApi(sqlite3_prepare(),jint,1prepare)( @@ -4105,7 +4130,10 @@ static void result_blob_text(int as64 /* true for text64/blob64() mode */, JNIEnv * const env, sqlite3_context *pCx, jbyteArray jBa, jlong nMax){ int const asBlob = 0==eTextRep; - if( jBa ){ + if( !pCx ){ + /* We should arguably emit a warning here. But where to log it? */ + return; + }else if( jBa ){ jbyte * const pBuf = s3jni_jbyteArray_bytes(jBa); jsize nBa = (*env)->GetArrayLength(env, jBa); if( nMax>=0 && nBa>(jsize)nMax ){ @@ -4121,7 +4149,7 @@ static void result_blob_text(int as64 /* true for text64/blob64() mode */, Note that the text64() interfaces take an unsigned value for the length, which Java does not support. This binding takes the approach of passing on negative values to the C API, - which will, in turn fail with SQLITE_TOOBIG at some later + which will in turn fail with SQLITE_TOOBIG at some later point (recall that the sqlite3_result_xyz() family do not have result values). */ @@ -4255,10 +4283,12 @@ S3JniApi(sqlite3_result_int64(),void,1result_1int64)( S3JniApi(sqlite3_result_java_object(),void,1result_1java_1object)( JniArgsEnvClass, jobject jpCx, jobject v ){ - if( v ){ + sqlite3_context * pCx = PtrGet_sqlite3_context(jpCx); + if( !pCx ) return; + else if( v ){ jobject const rjv = S3JniRefGlobal(v); if( rjv ){ - sqlite3_result_pointer(PtrGet_sqlite3_context(jpCx), rjv, + sqlite3_result_pointer(pCx, rjv, ResultJavaValuePtrStr, S3Jni_jobject_finalizer); }else{ sqlite3_result_error_nomem(PtrGet_sqlite3_context(jpCx)); diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 4195ad6dba..3a78e0917a 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -939,6 +939,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text16 (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); +/* + * Class: org_sqlite_jni_CApi + * Method: sqlite3_bind_value + * Signature: (JIJ)I + */ +JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1value + (JNIEnv *, jclass, jlong, jint, jlong); + /* * Class: org_sqlite_jni_CApi * Method: sqlite3_bind_zeroblob diff --git a/ext/jni/src/org/sqlite/jni/CApi.java b/ext/jni/src/org/sqlite/jni/CApi.java index 90e8339799..b006fceef1 100644 --- a/ext/jni/src/org/sqlite/jni/CApi.java +++ b/ext/jni/src/org/sqlite/jni/CApi.java @@ -400,6 +400,17 @@ final class CApi { : sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, data.length); } + static native int sqlite3_bind_value(@NotNull long ptrToStmt, int ndx, long ptrToValue); + + /** + Functions like the C-level sqlite3_bind_value(), or + sqlite3_bind_null() if val is null. + */ + public static int sqlite3_bind_value(@NotNull sqlite3_stmt stmt, int ndx, sqlite3_value val){ + return sqlite3_bind_value(stmt.getNativePointer(), ndx, + null==val ? 0L : val.getNativePointer()); + } + static native int sqlite3_bind_zeroblob(@NotNull long ptrToStmt, int ndx, int n); public static int sqlite3_bind_zeroblob(@NotNull sqlite3_stmt stmt, int ndx, int n){ diff --git a/manifest b/manifest index f33c25c838..4a030a4c21 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sAPI_ARMOR\ssupport\sto\sthe\ssqlite3_result_...()\sfamily\sof\sfunctions\sand\ssqlite3_bind_zeroblob64(). -D 2023-10-14T16:29:36.931 +C JNI:\sadd\smissing\ssqlite3_bind_value()\sand\sminor\smemory-safety-related\scleanups. +D 2023-10-14T16:56:12.307 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,14 +238,14 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 3d4640ae9c128326e0f65dade4732734771596371e398a7ae95c4d33ef24928a -F ext/jni/src/c/sqlite3-jni.h 8bd34a6fe3b51059690be31ac5bd6e454a738dd1ff9916f490e05cf63c4f8e37 +F ext/jni/src/c/sqlite3-jni.c fdaad9490dad7b703dcfc98cda1c9a9e82b1bf8e6d9f6b64dd1639878f990f7c +F ext/jni/src/c/sqlite3-jni.h fefcf0a7116d0c0f097c7ac71ca9ab4d092bf661ac40dd9dafb415d929f9b26d F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 -F ext/jni/src/org/sqlite/jni/CApi.java 6f878d291642568a06d9a36c15b420f5f867dcc44cee0cc56e8f02b542f67ec4 +F ext/jni/src/org/sqlite/jni/CApi.java 32dcd13be87308fbd98f07cb6f6c25ece21ccb17b5fb9ff81e4c6e574758db0e F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 78ebf838f645742f87733665cd72af736df345683b27377a2c8310c893b1769d -R 71ff5d4a376fdfcdde5b2514a89cbed8 +P afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73 +R e2e3f6e590cd006da1a4ca6fd58b6f1a U stephan -Z 2c334c3835eed2b31940cc452708383c +Z e96ab04282e03aa20daa6385e63d9a19 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a3560d7197..b56201f927 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73 \ No newline at end of file +3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af \ No newline at end of file From 4213cc78cde2d9fa8b9ede1e133749f61e09330f Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 16:57:48 +0000 Subject: [PATCH 069/242] JNI: add a missing result code check to sqlite3_bind_value(stmt, null). FossilOrigin-Name: f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00 --- ext/jni/src/c/sqlite3-jni.c | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index f4615329e8..b34d2a6ff7 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2455,7 +2455,7 @@ S3JniApi(sqlite3_bind_value(),jint,1bind_1value)( if( v ){ rc = sqlite3_bind_value(pStmt, (int)ndx, v); }else{ - sqlite3_bind_null(pStmt, (int)ndx); + rc = sqlite3_bind_null(pStmt, (int)ndx); } }else{ rc = SQLITE_MISUSE; diff --git a/manifest b/manifest index 4a030a4c21..f85658bbd3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sadd\smissing\ssqlite3_bind_value()\sand\sminor\smemory-safety-related\scleanups. -D 2023-10-14T16:56:12.307 +C JNI:\sadd\sa\smissing\sresult\scode\scheck\sto\ssqlite3_bind_value(stmt,\snull). +D 2023-10-14T16:57:48.421 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c fdaad9490dad7b703dcfc98cda1c9a9e82b1bf8e6d9f6b64dd1639878f990f7c +F ext/jni/src/c/sqlite3-jni.c bc52599bdd0729d74921264d14bda6567235da775050af153feff36fe5a4bd17 F ext/jni/src/c/sqlite3-jni.h fefcf0a7116d0c0f097c7ac71ca9ab4d092bf661ac40dd9dafb415d929f9b26d F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P afabe3e35a66625527e2881749cdb6e13300888ab57bc0f05889d0e3ee203d73 -R e2e3f6e590cd006da1a4ca6fd58b6f1a +P 3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af +R 2d3aef25bfb9da0f56a2961d39d07eaf U stephan -Z e96ab04282e03aa20daa6385e63d9a19 +Z db14742ea8ffc7099a6f208879ce0c90 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b56201f927..0930db6514 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af \ No newline at end of file +f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00 \ No newline at end of file From 153790d9ae7f6e22abf64fe0ab352e4b8df2ae7d Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 14 Oct 2023 17:14:53 +0000 Subject: [PATCH 070/242] The rtreecheck() SQL function should not invoke BEGIN or COMMIT as this causes issues for statement transactions. FossilOrigin-Name: b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a --- ext/rtree/rtree.c | 14 -------------- ext/rtree/rtree1.test | 11 +++++++++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index b2667527bc..682c052c56 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -4132,7 +4132,6 @@ static int rtreeCheckTable( ){ RtreeCheck check; /* Common context for various routines */ sqlite3_stmt *pStmt = 0; /* Used to find column count of rtree table */ - int bEnd = 0; /* True if transaction should be closed */ int nAux = 0; /* Number of extra columns. */ /* Initialize the context object */ @@ -4141,14 +4140,6 @@ static int rtreeCheckTable( check.zDb = zDb; check.zTab = zTab; - /* If there is not already an open transaction, open one now. This is - ** to ensure that the queries run as part of this integrity-check operate - ** on a consistent snapshot. */ - if( sqlite3_get_autocommit(db) ){ - check.rc = sqlite3_exec(db, "BEGIN", 0, 0, 0); - bEnd = 1; - } - /* Find the number of auxiliary columns */ if( check.rc==SQLITE_OK ){ pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.'%q_rowid'", zDb, zTab); @@ -4189,11 +4180,6 @@ static int rtreeCheckTable( sqlite3_finalize(check.aCheckMapping[0]); sqlite3_finalize(check.aCheckMapping[1]); - /* If one was opened, close the transaction */ - if( bEnd ){ - int rc = sqlite3_exec(db, "END", 0, 0, 0); - if( check.rc==SQLITE_OK ) check.rc = rc; - } *pzReport = check.zReport; return check.rc; } diff --git a/ext/rtree/rtree1.test b/ext/rtree/rtree1.test index 633d0a5d5f..2d8458a538 100644 --- a/ext/rtree/rtree1.test +++ b/ext/rtree/rtree1.test @@ -784,4 +784,15 @@ do_execsql_test 22.1 { SELECT id, x0 > 9223372036854775807 AS 'a0' FROM t1; } {123 1} +# 2023-10-14 dbsqlfuzz --sql-fuzz find. rtreecheck() should not call +# BEGIN/COMMIT because that causes problems with statement transactions, +# and it is unnecessary. +# +reset_db +do_test 23.0 { + db eval {CREATE TABLE t1(a,b,c);} + catch {db eval {CREATE TABLE t2 AS SELECT rtreecheck('t1') AS y;}} + db eval {PRAGMA integrity_check;} +} {ok} + finish_test diff --git a/manifest b/manifest index 3f1b563ebc..89be45b112 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bug\sfix\sin\ssqlite3_analyzer:\sfor\sdatabases\slarger\sthan\s1GiB,\stake\sinto\naccount\sthe\slock-byte\spage\swhen\scalculating\sthe\snumber\sof\sfreelist\spages. -D 2023-10-14T10:54:37.378 +C The\srtreecheck()\sSQL\sfunction\sshould\snot\sinvoke\sBEGIN\sor\sCOMMIT\sas\sthis\ncauses\sissues\sfor\sstatement\stransactions. +D 2023-10-14T17:14:53.738 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -475,9 +475,9 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350 F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca -F ext/rtree/rtree.c 9fdb03b602ca128c4b5b786c10675cf97cd0990d18db3b8c7a312551c3cf2f59 +F ext/rtree/rtree.c da842644466b84391e9fa1b1d5a17f461b475b8e36f1217117d1d98ad5f437e3 F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 -F ext/rtree/rtree1.test 877d40b8b61b1f88cec9d4dc0ff8334f5b05299fac12a35141532e2881860e9d +F ext/rtree/rtree1.test ecc881fdd1bc10fc390faa988ad93343739af84384e4cf3619fed7afada66a30 F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d F ext/rtree/rtree3.test 272594f88c344e973864008bbe4c71fd3a41a264c097d568593ee7886d83d409 F ext/rtree/rtree4.test 304de65d484540111b896827e4261815e5dca4ce28eeecd58be648cd73452c4b @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 348fa7aaf7958b3fb689ed023d946064ae8d92718a497a346e95114a2410cbf5 -R 491b395fcb54d24388cea619b1896c53 +P 26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6 +R ad487958c6df4b6717bccb543e9d7836 U drh -Z 11377a3945484d066aca86a95198dde7 +Z de59a6958b8ef06ef4ebd517456df8ae # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5e9c11cf71..56d82816e7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6 \ No newline at end of file +b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a \ No newline at end of file From eb62ccdab5d88ab9962d07194c6a24363ad986d0 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 20:01:55 +0000 Subject: [PATCH 071/242] Add API_ARMOR support to the scanstatus family of functions. FossilOrigin-Name: 2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeapi.c | 14 +++++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f85658bbd3..f8868c0231 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sadd\sa\smissing\sresult\scode\scheck\sto\ssqlite3_bind_value(stmt,\snull). -D 2023-10-14T16:57:48.421 +C Add\sAPI_ARMOR\ssupport\sto\sthe\sscanstatus\sfamily\sof\sfunctions. +D 2023-10-14T20:01:55.789 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -787,7 +787,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c cd112eb00d20fc5cc44f631d0e713838602637328b0f127c2f3c2aa8cea3cc91 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c 0204e7247582975797a4b45606b39395c8a4f678d7c2b8dc15129044dcbb508f +F src/vdbeapi.c 56fb801c15af34ba4e7de6804b1a143f045ca9d4b466f32d220d930823e05885 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c 317b9f48708139db6239ade40c7980b4bc8233168383690d588dad6d8437f722 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3900031763abf4b2aab7b57e886cc407571d0d5928b74f24dcea8fb7371655af -R 2d3aef25bfb9da0f56a2961d39d07eaf +P f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00 +R 40cedb778c9752c9ea6047f75e2dc266 U stephan -Z db14742ea8ffc7099a6f208879ce0c90 +Z da97de50a030a40a20a80ce89a4f774f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0930db6514..b3254db94c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00 \ No newline at end of file +2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index f878f2a2a7..b0a40cf6db 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -1963,6 +1963,9 @@ int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){ int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode){ Vdbe *v = (Vdbe*)pStmt; int rc; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pStmt==0 ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(v->db->mutex); if( ((int)v->explain)==eMode ){ rc = SQLITE_OK; @@ -2342,11 +2345,16 @@ int sqlite3_stmt_scanstatus_v2( void *pOut /* OUT: Write the answer here */ ){ Vdbe *p = (Vdbe*)pStmt; - VdbeOp *aOp = p->aOp; - int nOp = p->nOp; + VdbeOp *aOp; + int nOp; ScanStatus *pScan = 0; int idx; +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 1; +#endif + aOp = p->aOp; + nOp = p->nOp; if( p->pFrame ){ VdbeFrame *pFrame; for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); @@ -2493,7 +2501,7 @@ int sqlite3_stmt_scanstatus( void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; int ii; - for(ii=0; iinOp; ii++){ + for(ii=0; p!=0 && iinOp; ii++){ Op *pOp = &p->aOp[ii]; pOp->nExec = 0; pOp->nCycle = 0; From d718bde6da3f15f8f9862e47e21cf883a9afedde Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 14 Oct 2023 20:24:52 +0000 Subject: [PATCH 072/242] Do not allow an ALTER TABLE ADD COLUMN on a STRICT table if the added column contains a DEFAULT clause that would violate the type of the added column. FossilOrigin-Name: 75b075863eaa56e36635a1d27740d37de8600ba92099b3fad9378a1e6ce12c0e --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/alter.c | 7 ++++++- test/alter.test | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 89be45b112..de4852e990 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\srtreecheck()\sSQL\sfunction\sshould\snot\sinvoke\sBEGIN\sor\sCOMMIT\sas\sthis\ncauses\sissues\sfor\sstatement\stransactions. -D 2023-10-14T17:14:53.738 +C Do\snot\sallow\san\sALTER\sTABLE\sADD\sCOLUMN\son\sa\sSTRICT\stable\sif\sthe\sadded\scolumn\ncontains\sa\sDEFAULT\sclause\sthat\swould\sviolate\sthe\stype\sof\sthe\sadded\scolumn. +D 2023-10-14T20:24:52.039 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -646,7 +646,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F sqlite_cfg.h.in baf2e409c63d4e7a765e17769b6ff17c5a82bbd9cbf1e284fd2e4cefaff3fcf2 -F src/alter.c 3ff8c2fca0c0636d43459154bb40d79c882df1b34df77f89c4ec47ab2e2389f5 +F src/alter.c 30c2333b8bb3af71e4eb9adeadee8aa20edb15917ed44b8422e5cd15f3dfcddc F src/analyze.c d4cc28738c29e009640ec20ebb6936ba6fcefff0d11aa93398d9bb9a5ead6c1f F src/attach.c cc9d00d30da916ff656038211410ccf04ed784b7564639b9b61d1839ed69fd39 F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 @@ -812,7 +812,7 @@ F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c F test/aggnested.test 7269d07ac879fce161cb26c8fabe65cba5715742fac8a1fccac570dcdaf28f00 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 -F test/alter.test 313073774ab5c3f2ef1d3f0d03757c9d3a81284ae7e1b4a6ca34db088f886896 +F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 F test/alter2.test a966ccfcddf9ce0a4e0e6ff1aca9e6e7948e0e242cd7e43fc091948521807687 F test/alter3.test ffc4ab29ce78a3517a66afd69b2730667e3471622509c283b2bd4c46f680fba3 F test/alter4.test 716caa071dd8a3c6d57225778d15d3c3cbf5e34b2e84ae44199aeb2bbf50a707 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 26a909cdd32afee0f15968ca6f611eb259373b2a2195d0b3d47cfba103f1e6d6 -R ad487958c6df4b6717bccb543e9d7836 +P b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a +R 44739401ad1354dd510207d981352cd8 U drh -Z de59a6958b8ef06ef4ebd517456df8ae +Z 26263ba5a1d7e41dc561c332fa263ba2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 56d82816e7..f8f6fa4c78 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b7b2e30b570efda338c62e88446dedb6667640f33855b2422ad20c7b569b025a \ No newline at end of file +75b075863eaa56e36635a1d27740d37de8600ba92099b3fad9378a1e6ce12c0e \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index d0b1f7f696..ec45e14331 100644 --- a/src/alter.c +++ b/src/alter.c @@ -446,14 +446,19 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ /* Verify that constraints are still satisfied */ if( pNew->pCheck!=0 || (pCol->notNull && (pCol->colFlags & COLFLAG_GENERATED)!=0) + || (pTab->tabFlags & TF_Strict)!=0 ){ sqlite3NestedParse(pParse, "SELECT CASE WHEN quick_check GLOB 'CHECK*'" " THEN raise(ABORT,'CHECK constraint failed')" + " WHEN quick_check GLOB 'non-* value in*'" + " THEN raise(ABORT,'type mismatch on DEFAULT')" " ELSE raise(ABORT,'NOT NULL constraint failed')" " END" " FROM pragma_quick_check(%Q,%Q)" - " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'", + " WHERE quick_check GLOB 'CHECK*'" + " OR quick_check GLOB 'NULL*'" + " OR quick_check GLOB 'non-* value in*'", zTab, zDb ); } diff --git a/test/alter.test b/test/alter.test index 0088858a15..ee8e6c0b90 100644 --- a/test/alter.test +++ b/test/alter.test @@ -934,5 +934,24 @@ do_execsql_test alter-19.3 { SELECT name FROM sqlite_schema WHERE sql LIKE '%t3%' ORDER BY name; } {r1 t3} +# 2023-10-14 +# On an ALTER TABLE ADD COLUMN with a DEFAULT clause on a STRICT table +# make sure that the DEFAULT has a compatible type. +# +reset_db +do_execsql_test alter-20.1 { + CREATE TABLE t1(a INT) STRICT; + INSERT INTO t1(a) VALUES(45); +} {} +do_catchsql_test alter-20.2 { + ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT x'313233'; +} {1 {type mismatch on DEFAULT}} +do_execsql_test alter-20.2 { + DELETE FROM t1; + ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT x'313233'; +} {} +do_catchsql_test alter-20.3 { + INSERT INTO t1(a) VALUES(45); +} {1 {cannot store BLOB value in TEXT column t1.b}} finish_test From 4b1e42ef9457347852d397a7f4953c4acdbca505 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 20:34:40 +0000 Subject: [PATCH 073/242] JNI: make the sqlite3_value_...() family of bindings resistent to NULL arguments. FossilOrigin-Name: baf220e78a46246c476cd429ac131698db5fa66f62fb5725d4f736fe5246283c --- ext/jni/src/c/sqlite3-jni.c | 64 ++++++++++++++++++++++++++----------- manifest | 12 +++---- manifest.uuid | 2 +- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index b34d2a6ff7..bfde0cd4b9 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2112,8 +2112,6 @@ WRAP_INT_DB(1system_1errno, sqlite3_system_errno) WRAP_INT_VOID(1threadsafe, sqlite3_threadsafe) WRAP_INT_DB(1total_1changes, sqlite3_total_changes) WRAP_INT64_DB(1total_1changes64, sqlite3_total_changes64) -WRAP_INT_SVALUE(1value_1bytes, sqlite3_value_bytes) -WRAP_INT_SVALUE(1value_1bytes16, sqlite3_value_bytes16) WRAP_INT_SVALUE(1value_1encoding, sqlite3_value_encoding) WRAP_BOOL_SVALUE(1value_1frombind, sqlite3_value_frombind) WRAP_INT_SVALUE(1value_1nochange, sqlite3_value_nochange) @@ -4754,8 +4752,8 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - const jbyte * pBytes = sqlite3_value_blob(sv); - int const nLen = sqlite3_value_bytes(sv); + const jbyte * pBytes = sv ? sqlite3_value_blob(sv) : 0; + int const nLen = pBytes ? sqlite3_value_bytes(sv) : 0; s3jni_oom_check( nLen ? !!pBytes : 1 ); return pBytes @@ -4763,52 +4761,80 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)( : NULL; } +S3JniApi(sqlite3_value_bytes(),int,1value_1bytes)( + JniArgsEnvClass, jlong jpSVal +){ + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return sv ? sqlite3_value_bytes(sv) : 0; +} + +S3JniApi(sqlite3_value_bytes16(),int,1value_1bytes16)( + JniArgsEnvClass, jlong jpSVal +){ + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return sv ? sqlite3_value_bytes16(sv) : 0; +} + S3JniApi(sqlite3_value_double(),jdouble,1value_1double)( JniArgsEnvClass, jlong jpSVal ){ - return (jdouble) sqlite3_value_double(S3JniLongPtr_sqlite3_value(jpSVal)); + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return (jdouble) (sv ? sqlite3_value_double(sv) : 0.0); } S3JniApi(sqlite3_value_dup(),jobject,1value_1dup)( JniArgsEnvClass, jlong jpSVal ){ - sqlite3_value * const sv = sqlite3_value_dup(S3JniLongPtr_sqlite3_value(jpSVal)); - return sv ? new_java_sqlite3_value(env, sv) : 0; + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + sqlite3_value * const sd = sv ? sqlite3_value_dup(sv) : 0; + jobject rv = sd ? new_java_sqlite3_value(env, sd) : 0; + if( sd && !rv ) { + /* OOM */ + sqlite3_value_free(sd); + } + return rv; } S3JniApi(sqlite3_value_free(),void,1value_1free)( JniArgsEnvClass, jlong jpSVal ){ - sqlite3_value_free(S3JniLongPtr_sqlite3_value(jpSVal)); + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + if( sv ){ + sqlite3_value_free(sv); + } } S3JniApi(sqlite3_value_int(),jint,1value_1int)( JniArgsEnvClass, jlong jpSVal ){ - return (jint) sqlite3_value_int(S3JniLongPtr_sqlite3_value(jpSVal)); + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return (jint) (sv ? sqlite3_value_int(sv) : 0); } S3JniApi(sqlite3_value_int64(),jlong,1value_1int64)( JniArgsEnvClass, jlong jpSVal ){ - return (jlong) sqlite3_value_int64(S3JniLongPtr_sqlite3_value(jpSVal)); + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return (jlong) (sv ? sqlite3_value_int64(sv) : 0LL); } S3JniApi(sqlite3_value_java_object(),jobject,1value_1java_1object)( JniArgsEnvClass, jlong jpSVal ){ - return sqlite3_value_pointer(S3JniLongPtr_sqlite3_value(jpSVal), - ResultJavaValuePtrStr); + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); + return sv + ? sqlite3_value_pointer(sv, ResultJavaValuePtrStr) + : 0; } S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - const unsigned char * const p = sqlite3_value_text(sv); - int const n = sqlite3_value_bytes(sv); + const unsigned char * const p = sv ? sqlite3_value_text(sv) : 0; + int const n = p ? sqlite3_value_bytes(sv) : 0; return p ? s3jni_new_jbyteArray(p, n) : 0; } @@ -4818,8 +4844,8 @@ S3JniApi(sqlite3_value_text(),jstring,1value_1text)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - const unsigned char * const p = sqlite3_value_text(sv); - int const n = sqlite3_value_bytes(sv); + const unsigned char * const p = sv ? sqlite3_value_text(sv) : 0; + int const n = p ? sqlite3_value_bytes(sv) : 0; return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0; } #endif @@ -4828,9 +4854,9 @@ S3JniApi(sqlite3_value_text16(),jstring,1value_1text16)( JniArgsEnvClass, jlong jpSVal ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); - const int n = sqlite3_value_bytes16(sv); - const void * const p = sqlite3_value_text16(sv); - return s3jni_text16_to_jstring(env, p, n); + const int n = sv ? sqlite3_value_bytes16(sv) : 0; + const void * const p = sv ? sqlite3_value_text16(sv) : 0; + return p ? s3jni_text16_to_jstring(env, p, n) : 0; } JniDecl(void,1jni_1internal_1details)(JniArgsEnvClass){ diff --git a/manifest b/manifest index f8868c0231..22d9f804d6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sAPI_ARMOR\ssupport\sto\sthe\sscanstatus\sfamily\sof\sfunctions. -D 2023-10-14T20:01:55.789 +C JNI:\smake\sthe\ssqlite3_value_...()\sfamily\sof\sbindings\sresistent\sto\sNULL\sarguments. +D 2023-10-14T20:34:40.465 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c bc52599bdd0729d74921264d14bda6567235da775050af153feff36fe5a4bd17 +F ext/jni/src/c/sqlite3-jni.c 2cd46892020bd9ff62fbd80e0205ab731e2a12c1427b5f2b616493fcd0f41ed7 F ext/jni/src/c/sqlite3-jni.h fefcf0a7116d0c0f097c7ac71ca9ab4d092bf661ac40dd9dafb415d929f9b26d F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f1a357f42de58927c33e7047dc4417e3b9549d7529625f30c583e66b7d603b00 -R 40cedb778c9752c9ea6047f75e2dc266 +P 2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d +R 9e7d93ca57652f3f6459c7a72e2073a8 U stephan -Z da97de50a030a40a20a80ce89a4f774f +Z 389ca2ce91b537dc36ab3381ff35287f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b3254db94c..07f28dd40c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d \ No newline at end of file +baf220e78a46246c476cd429ac131698db5fa66f62fb5725d4f736fe5246283c \ No newline at end of file From 8a273bb6e8dc12571e587256d07168d11b64f3c7 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 14 Oct 2023 20:44:13 +0000 Subject: [PATCH 074/242] JNI: extend [baf220e78a46246c47] to include macro-generated sqlite3_value_...() bindings. FossilOrigin-Name: ad34b2542e330c22fcf331810ab43e66346b1bad8de1a3989e6208cfa0fc2f92 --- ext/jni/src/c/sqlite3-jni.c | 22 ++++++++++++---------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index bfde0cd4b9..792f5d6f78 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2065,14 +2065,16 @@ static void udf_xInverse(sqlite3_context* cx, int argc, -1); \ } /** Create a trivial JNI wrapper for (int CName(sqlite3_value*)). */ -#define WRAP_INT_SVALUE(JniNameSuffix,CName) \ +#define WRAP_INT_SVALUE(JniNameSuffix,CName,DfltOnNull) \ JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \ - return (jint)CName(S3JniLongPtr_sqlite3_value(jpSValue)); \ + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSValue); \ + return (jint)(sv ? CName(sv): DfltOnNull); \ } /** Create a trivial JNI wrapper for (boolean CName(sqlite3_value*)). */ -#define WRAP_BOOL_SVALUE(JniNameSuffix,CName) \ +#define WRAP_BOOL_SVALUE(JniNameSuffix,CName,DfltOnNull) \ JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \ - return (jint)CName(S3JniLongPtr_sqlite3_value(jpSValue)) \ + sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSValue); \ + return (jint)(sv ? CName(sv) : DfltOnNull) \ ? JNI_TRUE : JNI_FALSE; \ } @@ -2112,12 +2114,12 @@ WRAP_INT_DB(1system_1errno, sqlite3_system_errno) WRAP_INT_VOID(1threadsafe, sqlite3_threadsafe) WRAP_INT_DB(1total_1changes, sqlite3_total_changes) WRAP_INT64_DB(1total_1changes64, sqlite3_total_changes64) -WRAP_INT_SVALUE(1value_1encoding, sqlite3_value_encoding) -WRAP_BOOL_SVALUE(1value_1frombind, sqlite3_value_frombind) -WRAP_INT_SVALUE(1value_1nochange, sqlite3_value_nochange) -WRAP_INT_SVALUE(1value_1numeric_1type, sqlite3_value_numeric_type) -WRAP_INT_SVALUE(1value_1subtype, sqlite3_value_subtype) -WRAP_INT_SVALUE(1value_1type, sqlite3_value_type) +WRAP_INT_SVALUE(1value_1encoding, sqlite3_value_encoding,SQLITE_UTF8) +WRAP_BOOL_SVALUE(1value_1frombind, sqlite3_value_frombind,0) +WRAP_INT_SVALUE(1value_1nochange, sqlite3_value_nochange,0) +WRAP_INT_SVALUE(1value_1numeric_1type, sqlite3_value_numeric_type,SQLITE_NULL) +WRAP_INT_SVALUE(1value_1subtype, sqlite3_value_subtype,0) +WRAP_INT_SVALUE(1value_1type, sqlite3_value_type,SQLITE_NULL) #undef WRAP_BOOL_DB #undef WRAP_BOOL_STMT diff --git a/manifest b/manifest index 22d9f804d6..6a4dc8973c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\smake\sthe\ssqlite3_value_...()\sfamily\sof\sbindings\sresistent\sto\sNULL\sarguments. -D 2023-10-14T20:34:40.465 +C JNI:\sextend\s[baf220e78a46246c47]\sto\sinclude\smacro-generated\ssqlite3_value_...()\sbindings. +D 2023-10-14T20:44:13.117 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 2cd46892020bd9ff62fbd80e0205ab731e2a12c1427b5f2b616493fcd0f41ed7 +F ext/jni/src/c/sqlite3-jni.c ff7720536758ab952ed025a0a32a0e9d467d0b9a6bc7801dbdef56d56e074ea2 F ext/jni/src/c/sqlite3-jni.h fefcf0a7116d0c0f097c7ac71ca9ab4d092bf661ac40dd9dafb415d929f9b26d F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2f3101f016d5f8d954a262befdf5e0f938a223e444bc534e1d3655b733f4663d -R 9e7d93ca57652f3f6459c7a72e2073a8 +P baf220e78a46246c476cd429ac131698db5fa66f62fb5725d4f736fe5246283c +R 0ed9579f1b44c31a901370da9158e25e U stephan -Z 389ca2ce91b537dc36ab3381ff35287f +Z 40c95daefe505f2af1f470e995f85f56 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 07f28dd40c..8b25f2ce76 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -baf220e78a46246c476cd429ac131698db5fa66f62fb5725d4f736fe5246283c \ No newline at end of file +ad34b2542e330c22fcf331810ab43e66346b1bad8de1a3989e6208cfa0fc2f92 \ No newline at end of file From 29aeb620e7c2fb78ecf7664fc410a0694b099ca2 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 15 Oct 2023 13:25:39 +0000 Subject: [PATCH 075/242] Correct non-void return from sqlite3_preupdate_hook() when API_ARMOR is enabled. Broken by [6cb77503484e]. FossilOrigin-Name: 40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/main.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1ad4481602..97464c8306 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\scoverage\sof\smore\sfunctions\sto\sSQLITE_ENABLE_API_ARMOR\sbuilds. -D 2023-10-15T12:11:10.410 +C Correct\snon-void\sreturn\sfrom\ssqlite3_preupdate_hook()\swhen\sAPI_ARMOR\sis\senabled.\sBroken\sby\s[6cb77503484e]. +D 2023-10-15T13:25:39.766 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -677,7 +677,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c 7a91b372dd1bada07c5b5e36082dc0d695161c3807efe2386f563a5b32446ae6 +F src/main.c b252cd436f6ae873ba115cff62462932d4c50ebbe4ab49767b0b500471789446 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -2128,9 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 75b075863eaa56e36635a1d27740d37de8600ba92099b3fad9378a1e6ce12c0e ad34b2542e330c22fcf331810ab43e66346b1bad8de1a3989e6208cfa0fc2f92 -R 4cbaef1f14d50e148b58c1f67f162d61 -T +closed ad34b2542e330c22fcf331810ab43e66346b1bad8de1a3989e6208cfa0fc2f92 Closed\sby\sintegrate-merge. +P 6cb77503484e104a51f08690974d6e19c336ab5467d327f84be1d042615f008c +R 6337a5530409955001babbd6d9763171 U stephan -Z 0e8710bba7e8eb05eba392ba89683365 +Z 3e5e208c26caec77ac5884580b0569f0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dc9b79c350..037028a774 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6cb77503484e104a51f08690974d6e19c336ab5467d327f84be1d042615f008c \ No newline at end of file +40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a \ No newline at end of file diff --git a/src/main.c b/src/main.c index 4ddf7e24d3..4ffef9b418 100644 --- a/src/main.c +++ b/src/main.c @@ -2372,7 +2372,7 @@ void *sqlite3_preupdate_hook( #ifdef SQLITE_ENABLE_API_ARMOR if( db==0 || xCallback==0 ){ - return; + return 0; } #endif sqlite3_mutex_enter(db->mutex); From 5698e62f9ed056659133d486ef6d12ba484c4e38 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 15 Oct 2023 13:32:38 +0000 Subject: [PATCH 076/242] JNI: enable all optional components in the default build and fix a test broken by an option toggle. FossilOrigin-Name: 5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae --- ext/jni/GNUmakefile | 2 +- ext/jni/src/org/sqlite/jni/Tester1.java | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index bea26745f5..ddc51f727e 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -206,7 +206,7 @@ SQLITE_OPT = \ -DSQLITE_JNI_FATAL_OOM=$(opt.fatal-oom) \ -DSQLITE_JNI_ENABLE_METRICS=$(opt.metrics) -opt.extras ?= 0 +opt.extras ?= 1 ifeq (1,$(opt.extras)) SQLITE_OPT += -DSQLITE_ENABLE_RTREE \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index d5dffc2d8a..66489407fb 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -569,7 +569,7 @@ public class Tester1 implements Runnable { final String expect = "SELECT 'hell😃'"; affirm( expect.equals(sqlite3_expanded_sql(stmt)) ); String n = sqlite3_normalized_sql(stmt); - affirm( null==n || expect.equals(n) ); + affirm( null==n || "SELECT?;".equals(n) ); sqlite3_finalize(stmt); sqlite3_close(db); } diff --git a/manifest b/manifest index 97464c8306..9959891670 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Correct\snon-void\sreturn\sfrom\ssqlite3_preupdate_hook()\swhen\sAPI_ARMOR\sis\senabled.\sBroken\sby\s[6cb77503484e]. -D 2023-10-15T13:25:39.766 +C JNI:\senable\sall\soptional\scomponents\sin\sthe\sdefault\sbuild\sand\sfix\sa\stest\sbroken\sby\san\soption\stoggle. +D 2023-10-15T13:32:38.959 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 6da240c9a11701f3ed569384cd15ef611e8b3c5e3897d265923b14bf0e1eb272 +F ext/jni/GNUmakefile efaf1db6e3c2bbae4067924b932ee1a0f0640e842002c0dd9f3be824c24084f5 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c ff7720536758ab952ed025a0a32a0e9d467d0b9a6bc7801dbdef56d56e074ea2 @@ -265,7 +265,7 @@ F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233d F ext/jni/src/org/sqlite/jni/Sqlite.java 1617ea2bf3dfa493b7f031a3187cbfd6837c39bc1d406c4b3edcf9aab941639d F ext/jni/src/org/sqlite/jni/SqliteException.java e17500e8bca2c68c260d8d0163fe4b7dc8bd0b1b90211201325c4a5566ce75ca F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 7c17a33e044a24d590007e1b4581b8d1e07653ab3f76fc66571b78905d6391b1 +F ext/jni/src/org/sqlite/jni/Tester1.java 034863c36b0cd98af8edadb252358213e7ed3140f2cf81e03ef0e228c45d6a3c F ext/jni/src/org/sqlite/jni/Tester2.java 70e005d41060e398ec0f69bd39a8e1c376fd51f81629cf25e877889ec9cb6ec6 F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6cb77503484e104a51f08690974d6e19c336ab5467d327f84be1d042615f008c -R 6337a5530409955001babbd6d9763171 +P 40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a +R f3587d7c5ef3f59e820876cab93a9847 U stephan -Z 3e5e208c26caec77ac5884580b0569f0 +Z da5fb0c5e59fff6d3dac9695a0f0123e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 037028a774..34bb378877 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a \ No newline at end of file +5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae \ No newline at end of file From 24f6baca164bde519de34be8a95bf018c2c6e445 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 15 Oct 2023 13:36:21 +0000 Subject: [PATCH 077/242] Change 3 instance of #if SQLITE_ENABLE_API_ARMOR to #ifdef for consistency with how it is normally used. FossilOrigin-Name: dd766eeb59fec71627dd8ad8f120875b96fda455c6401e5671e086b785e2b2bc --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/main.c | 2 +- src/mutex.c | 2 +- src/mutex_unix.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 9959891670..57fb170b3d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\senable\sall\soptional\scomponents\sin\sthe\sdefault\sbuild\sand\sfix\sa\stest\sbroken\sby\san\soption\stoggle. -D 2023-10-15T13:32:38.959 +C Change\s3\sinstance\sof\s#if\sSQLITE_ENABLE_API_ARMOR\sto\s#ifdef\sfor\sconsistency\swith\show\sit\sis\snormally\sused. +D 2023-10-15T13:36:21.836 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -677,7 +677,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c b252cd436f6ae873ba115cff62462932d4c50ebbe4ab49767b0b500471789446 +F src/main.c 73ae4cab166b0fd36352446de7f7d91f89bde86686ae18f0bb7b245173479831 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -687,10 +687,10 @@ F src/mem5.c b7da5c10a726aacacc9ad7cdcb0667deec643e117591cc69cf9b4b9e7f3e96ff F src/memdb.c 559c42e61eb70cd6d4bc692b042497133c6d96c09a3d514d92f3dac72268e223 F src/memjournal.c c283c6c95d940eb9dc70f1863eef3ee40382dbd35e5a1108026e7817c206e8a0 F src/msvc.h 80b35f95d93bf996ccb3e498535255f2ef1118c78764719a7cd15ab4106ccac9 -F src/mutex.c 5e3409715552348732e97b9194abe92fdfcd934cfb681df4ba0ab87ac6c18d25 +F src/mutex.c 1b4c7e5e3621b510e0c18397210be27cd54c8084141144fbbafd003fde948e88 F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 -F src/mutex_unix.c bd52ec50e44a41fe1e3deb5a6e3fe98edb6f2059da3e46d196363d0fa3192cda +F src/mutex_unix.c f7ee5a2061a4c11815a2bf4fc0e2bfa6fb8d9dc89390eb613ca0cec32fc9a3d1 F src/mutex_w32.c 38b56d0bc8d54c17c20cbaaad3719b0c36b92fd07a7e34360d0c6a18d5589912 F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878 F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 40f5906f48d3f1f44d54e5b271fe04e7082166e50e3ed250bb57a4760f112e8a -R f3587d7c5ef3f59e820876cab93a9847 +P 5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae +R b045a4bd60ecbc07c24e8195605c8e45 U stephan -Z da5fb0c5e59fff6d3dac9695a0f0123e +Z b22c2adb863c74eddbb30d84bd9e9ef0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 34bb378877..a5f927f361 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae \ No newline at end of file +dd766eeb59fec71627dd8ad8f120875b96fda455c6401e5671e086b785e2b2bc \ No newline at end of file diff --git a/src/main.c b/src/main.c index 4ffef9b418..893326c2b5 100644 --- a/src/main.c +++ b/src/main.c @@ -5012,7 +5012,7 @@ int sqlite3_compileoption_used(const char *zOptName){ int nOpt; const char **azCompileOpt; -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( zOptName==0 ){ (void)SQLITE_MISUSE_BKPT; return 0; diff --git a/src/mutex.c b/src/mutex.c index 13a9fca15b..381ffbdfd5 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -133,7 +133,7 @@ static void checkMutexFree(sqlite3_mutex *p){ assert( SQLITE_MUTEX_FAST<2 ); assert( SQLITE_MUTEX_WARNONCONTENTION<2 ); -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( ((CheckMutex*)p)->iType<2 ) #endif { diff --git a/src/mutex_unix.c b/src/mutex_unix.c index ac4331a67b..beae877f98 100644 --- a/src/mutex_unix.c +++ b/src/mutex_unix.c @@ -223,7 +223,7 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){ */ static void pthreadMutexFree(sqlite3_mutex *p){ assert( p->nRef==0 ); -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ) #endif { From f83a4d850ce288dc26d8acf44cbd7bfde971b7c7 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 08:05:51 +0000 Subject: [PATCH 078/242] JNI: do not expose SQLITE_OPEN_... flags which are specific to VFSes. FossilOrigin-Name: 2b4e53d8be42a3bc098317abd8bb58b8ddc25094d80787f784bbc896f4f7b976 --- ext/jni/src/c/sqlite3-jni.h | 24 ++----------- ext/jni/src/org/sqlite/jni/CApi.java | 50 +++++++++++++++------------- manifest | 14 ++++---- manifest.uuid | 2 +- 4 files changed, 36 insertions(+), 54 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 3a78e0917a..78559a3262 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -421,30 +421,10 @@ extern "C" { #define org_sqlite_jni_CApi_SQLITE_OPEN_SHAREDCACHE 131072L #undef org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE #define org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE 262144L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE -#define org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE 33554432L #undef org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW #define org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW 16777216L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_DB -#define org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_DB 256L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_JOURNAL -#define org_sqlite_jni_CApi_SQLITE_OPEN_MAIN_JOURNAL 2048L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_DB -#define org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_DB 512L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_JOURNAL -#define org_sqlite_jni_CApi_SQLITE_OPEN_TEMP_JOURNAL 4096L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_TRANSIENT_DB -#define org_sqlite_jni_CApi_SQLITE_OPEN_TRANSIENT_DB 1024L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_SUBJOURNAL -#define org_sqlite_jni_CApi_SQLITE_OPEN_SUBJOURNAL 8192L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_SUPER_JOURNAL -#define org_sqlite_jni_CApi_SQLITE_OPEN_SUPER_JOURNAL 16384L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_WAL -#define org_sqlite_jni_CApi_SQLITE_OPEN_WAL 524288L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_DELETEONCLOSE -#define org_sqlite_jni_CApi_SQLITE_OPEN_DELETEONCLOSE 8L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXCLUSIVE -#define org_sqlite_jni_CApi_SQLITE_OPEN_EXCLUSIVE 16L +#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE +#define org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE 33554432L #undef org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT #define org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT 1L #undef org_sqlite_jni_CApi_SQLITE_PREPARE_NORMALIZE diff --git a/ext/jni/src/org/sqlite/jni/CApi.java b/ext/jni/src/org/sqlite/jni/CApi.java index b006fceef1..aac9b4e071 100644 --- a/ext/jni/src/org/sqlite/jni/CApi.java +++ b/ext/jni/src/org/sqlite/jni/CApi.java @@ -2226,27 +2226,29 @@ final class CApi { public static final int SQLITE_LIMIT_WORKER_THREADS = 11; // open flags - public static final int SQLITE_OPEN_READONLY = 1; - public static final int SQLITE_OPEN_READWRITE = 2; - public static final int SQLITE_OPEN_CREATE = 4; - public static final int SQLITE_OPEN_URI = 64; - public static final int SQLITE_OPEN_MEMORY = 128; - public static final int SQLITE_OPEN_NOMUTEX = 32768; - public static final int SQLITE_OPEN_FULLMUTEX = 65536; - public static final int SQLITE_OPEN_SHAREDCACHE = 131072; - public static final int SQLITE_OPEN_PRIVATECACHE = 262144; - public static final int SQLITE_OPEN_EXRESCODE = 33554432; - public static final int SQLITE_OPEN_NOFOLLOW = 16777216; - public static final int SQLITE_OPEN_MAIN_DB = 256; - public static final int SQLITE_OPEN_MAIN_JOURNAL = 2048; - public static final int SQLITE_OPEN_TEMP_DB = 512; - public static final int SQLITE_OPEN_TEMP_JOURNAL = 4096; - public static final int SQLITE_OPEN_TRANSIENT_DB = 1024; - public static final int SQLITE_OPEN_SUBJOURNAL = 8192; - public static final int SQLITE_OPEN_SUPER_JOURNAL = 16384; - public static final int SQLITE_OPEN_WAL = 524288; - public static final int SQLITE_OPEN_DELETEONCLOSE = 8; - public static final int SQLITE_OPEN_EXCLUSIVE = 16; + + public static final int SQLITE_OPEN_READONLY = 0x00000001 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_READWRITE = 0x00000002 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_CREATE = 0x00000004 /* Ok for sqlite3_open_v2() */; + //public static final int SQLITE_OPEN_DELETEONCLOSE = 0x00000008 /* VFS only */; + //public static final int SQLITE_OPEN_EXCLUSIVE = 0x00000010 /* VFS only */; + //public static final int SQLITE_OPEN_AUTOPROXY = 0x00000020 /* VFS only */; + public static final int SQLITE_OPEN_URI = 0x00000040 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_MEMORY = 0x00000080 /* Ok for sqlite3_open_v2() */; + //public static final int SQLITE_OPEN_MAIN_DB = 0x00000100 /* VFS only */; + //public static final int SQLITE_OPEN_TEMP_DB = 0x00000200 /* VFS only */; + //public static final int SQLITE_OPEN_TRANSIENT_DB = 0x00000400 /* VFS only */; + //public static final int SQLITE_OPEN_MAIN_JOURNAL = 0x00000800 /* VFS only */; + //public static final int SQLITE_OPEN_TEMP_JOURNAL = 0x00001000 /* VFS only */; + //public static final int SQLITE_OPEN_SUBJOURNAL = 0x00002000 /* VFS only */; + //public static final int SQLITE_OPEN_SUPER_JOURNAL = 0x00004000 /* VFS only */; + public static final int SQLITE_OPEN_NOMUTEX = 0x00008000 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_FULLMUTEX = 0x00010000 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_SHAREDCACHE = 0x00020000 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_PRIVATECACHE = 0x00040000 /* Ok for sqlite3_open_v2() */; + //public static final int SQLITE_OPEN_WAL = 0x00080000 /* VFS only */; + public static final int SQLITE_OPEN_NOFOLLOW = 0x01000000 /* Ok for sqlite3_open_v2() */; + public static final int SQLITE_OPEN_EXRESCODE = 0x02000000 /* Extended result codes */; // prepare flags public static final int SQLITE_PREPARE_PERSISTENT = 1; @@ -2406,9 +2408,9 @@ final class CApi { public static final int SQLITE_TXN_WRITE = 2; // udf flags - public static final int SQLITE_DETERMINISTIC = 2048; - public static final int SQLITE_DIRECTONLY = 524288; - public static final int SQLITE_INNOCUOUS = 2097152; + public static final int SQLITE_DETERMINISTIC = 0x000000800; + public static final int SQLITE_DIRECTONLY = 0x000080000; + public static final int SQLITE_INNOCUOUS = 0x000200000; // virtual tables public static final int SQLITE_INDEX_SCAN_UNIQUE = 1; diff --git a/manifest b/manifest index 57fb170b3d..f5fef60313 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\s3\sinstance\sof\s#if\sSQLITE_ENABLE_API_ARMOR\sto\s#ifdef\sfor\sconsistency\swith\show\sit\sis\snormally\sused. -D 2023-10-15T13:36:21.836 +C JNI:\sdo\snot\sexpose\sSQLITE_OPEN_...\sflags\swhich\sare\sspecific\sto\sVFSes. +D 2023-10-16T08:05:51.755 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -239,13 +239,13 @@ F ext/jni/GNUmakefile efaf1db6e3c2bbae4067924b932ee1a0f0640e842002c0dd9f3be824c2 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c ff7720536758ab952ed025a0a32a0e9d467d0b9a6bc7801dbdef56d56e074ea2 -F ext/jni/src/c/sqlite3-jni.h fefcf0a7116d0c0f097c7ac71ca9ab4d092bf661ac40dd9dafb415d929f9b26d +F ext/jni/src/c/sqlite3-jni.h e7c19450b691aeb12a1506521432144b5d07031683e0fbaad7dfcb9a0c8d69d7 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 -F ext/jni/src/org/sqlite/jni/CApi.java 32dcd13be87308fbd98f07cb6f6c25ece21ccb17b5fb9ff81e4c6e574758db0e +F ext/jni/src/org/sqlite/jni/CApi.java ab05a2ad4237b95e96ac5acf9ce28f1432f0862546444fc2f6265b6998e14860 F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5586a9df58a400c20a6815e8b0fbc7a7c49e5ef89daf92c452f1990586ca78ae -R b045a4bd60ecbc07c24e8195605c8e45 +P dd766eeb59fec71627dd8ad8f120875b96fda455c6401e5671e086b785e2b2bc +R a3abea6aaad96691a9fd3e93b233f3d2 U stephan -Z b22c2adb863c74eddbb30d84bd9e9ef0 +Z 11a2a6974b07b2c488e6e36a5cdd602e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a5f927f361..0d84e69c19 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dd766eeb59fec71627dd8ad8f120875b96fda455c6401e5671e086b785e2b2bc \ No newline at end of file +2b4e53d8be42a3bc098317abd8bb58b8ddc25094d80787f784bbc896f4f7b976 \ No newline at end of file From 19179722d6bf7bff82bcf9a72b2d0346346e46ff Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 08:10:11 +0000 Subject: [PATCH 079/242] JNI: after calling a Java-side UDF, zero-out the pointer of the Java-side sqlite3_context and sqlite3_value array entries to avoid misbehavior if a client makes the mistake of holding a reference to one of those objects. FossilOrigin-Name: 9fc3104f76a83d600beb11d91feb97bcea8bc7f7cda8cd73e7a6b81fbba879df --- ext/jni/src/c/sqlite3-jni.c | 26 ++++++++++++++++++++++++- ext/jni/src/org/sqlite/jni/Tester1.java | 18 +++++++++++++++++ manifest | 14 ++++++------- manifest.uuid | 2 +- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 792f5d6f78..dd643c30bd 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -1835,7 +1835,7 @@ typedef struct { ** final 2 arguments. Returns 0 on success, SQLITE_NOMEM on allocation ** error. On error *jCx and *jArgv will be set to 0. The output ** objects are of type org.sqlite.jni.sqlite3_context and -** array-of-org.sqlite3.jni.sqlite3_value, respectively. +** array-of-org.sqlite.jni.sqlite3_value, respectively. */ static int udf_args(JNIEnv *env, sqlite3_context * const cx, @@ -1867,6 +1867,28 @@ error_oom: return SQLITE_NOMEM; } +/* +** Requires that jCx and jArgv are sqlite3_context +** resp. array-of-sqlite3_value values initialized by udf_args(). This +** function zeroes out the nativePointer member of jCx and each entry +** in jArgv. This is a safety-net precaution to avoid undefined +** behavior if a Java-side UDF holds a reference to one of its +** arguments. This MUST be called from any function which successfully +** calls udf_args(), after calling the corresponding UDF and checking +** its exception status. It MUST NOT be called in any other case. +*/ +static void udf_unargs(JNIEnv *env, jobject jCx, int argc, jobjectArray jArgv){ + int i = 0; + assert(jCx); + NativePointerHolder_set(S3JniNph(sqlite3_context), jCx, 0); + for( ; i < argc; ++i ){ + jobject jsv = (*env)->GetObjectArrayElement(env, jArgv, i); + assert(jsv); + NativePointerHolder_set(S3JniNph(sqlite3_value), jsv, 0); + } +} + + /* ** Must be called immediately after a Java-side UDF callback throws. ** If translateToErr is true then it sets the exception's message in @@ -1926,6 +1948,7 @@ static int udf_xFSI(sqlite3_context* const pCx, int argc, rc = udf_report_exception(env, 'F'==zFuncType[1]/*xFunc*/, pCx, s->zFuncName, zFuncType); } + udf_unargs(env, args.jcx, argc, args.jargv); } S3JniUnrefLocal(args.jcx); S3JniUnrefLocal(args.jargv); @@ -5168,6 +5191,7 @@ static void s3jni_fts5_extension_function(Fts5ExtensionApi const *pApi, S3JniIfThrew{ udf_report_exception(env, 1, pCx, pAux->zFuncName, "call"); } + udf_unargs(env, jpCx, argc, jArgv); S3JniUnrefLocal(jpFts); S3JniUnrefLocal(jpCx); S3JniUnrefLocal(jArgv); diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/Tester1.java index 66489407fb..43ba085fab 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/Tester1.java @@ -694,6 +694,8 @@ public class Tester1 implements Runnable { // These ValueHolders are just to confirm that the func did what we want... final ValueHolder xDestroyCalled = new ValueHolder<>(false); final ValueHolder xFuncAccum = new ValueHolder<>(0); + final ValueHolder neverEverDoThisInClientCode = new ValueHolder<>(null); + final ValueHolder neverEverDoThisInClientCode2 = new ValueHolder<>(null); // Create an SQLFunction instance using one of its 3 subclasses: // Scalar, Aggregate, or Window: @@ -704,6 +706,15 @@ public class Tester1 implements Runnable { new ScalarFunction(){ public void xFunc(sqlite3_context cx, sqlite3_value[] args){ affirm(db == sqlite3_context_db_handle(cx)); + if( null==neverEverDoThisInClientCode.value ){ + neverEverDoThisInClientCode2.value = cx; + neverEverDoThisInClientCode.value = args + /* !!!NEVER!!! hold a reference to an sqlite3_value + object like this in client code! They are ONLY legal + for the duration of their single call. We do it here + ONLY to test that the defenses against clients doing + this are working. */; + } int result = 0; for( sqlite3_value v : args ) result += sqlite3_value_int(v); xFuncAccum.value += result;// just for post-run testing @@ -729,6 +740,13 @@ public class Tester1 implements Runnable { affirm(1 == n); affirm(6 == xFuncAccum.value); affirm( !xDestroyCalled.value ); + affirm( null!=neverEverDoThisInClientCode.value ); + affirm( null!=neverEverDoThisInClientCode2.value ); + affirm( 0 Date: Mon, 16 Oct 2023 10:27:19 +0000 Subject: [PATCH 080/242] JNI: move the C-style API parts into the capi subpackage and the higher-level wrapper into (tentatively) wrapper1, so that CApi.java can support multiple independent higher-level wrappers without name collisions, and CApi can be made public but have the option to be elided from wrapper-level javadocs for wrappers which do not wish to expose it. FossilOrigin-Name: 9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b --- ext/jni/GNUmakefile | 46 +- ext/jni/src/c/sqlite3-jni.c | 87 +- ext/jni/src/c/sqlite3-jni.h | 2384 ++++++++--------- .../{ => capi}/AbstractCollationCallback.java | 2 +- .../jni/{ => capi}/AggregateFunction.java | 2 +- .../jni/{ => capi}/AuthorizerCallback.java | 2 +- .../jni/{ => capi}/AutoExtensionCallback.java | 2 +- .../jni/{ => capi}/BusyHandlerCallback.java | 2 +- .../src/org/sqlite/jni/{ => capi}/CApi.java | 6 +- .../sqlite/jni/{ => capi}/CallbackProxy.java | 2 +- .../jni/{ => capi}/CollationCallback.java | 2 +- .../{ => capi}/CollationNeededCallback.java | 2 +- .../jni/{ => capi}/CommitHookCallback.java | 2 +- .../jni/{ => capi}/ConfigLogCallback.java | 2 +- .../jni/{ => capi}/ConfigSqllogCallback.java | 2 +- .../jni/{ => capi}/NativePointerHolder.java | 2 +- .../sqlite/jni/{ => capi}/OutputPointer.java | 34 +- .../jni/{ => capi}/PrepareMultiCallback.java | 2 +- .../jni/{ => capi}/PreupdateHookCallback.java | 2 +- .../{ => capi}/ProgressHandlerCallback.java | 2 +- .../org/sqlite/jni/{ => capi}/ResultCode.java | 2 +- .../jni/{ => capi}/RollbackHookCallback.java | 2 +- .../sqlite/jni/{ => capi}/SQLFunction.java | 2 +- .../org/sqlite/jni/{ => capi}/SQLTester.java | 6 +- .../sqlite/jni/{ => capi}/ScalarFunction.java | 2 +- .../jni/{ => capi}/TableColumnMetadata.java | 2 +- .../org/sqlite/jni/{ => capi}/Tester1.java | 18 +- .../jni/{ => capi}/TraceV2Callback.java | 2 +- .../jni/{ => capi}/UpdateHookCallback.java | 2 +- .../sqlite/jni/{ => capi}/WindowFunction.java | 2 +- .../jni/{ => capi}/XDestroyCallback.java | 2 +- .../sqlite/jni/{ => capi}/package-info.java | 4 +- .../org/sqlite/jni/{ => capi}/sqlite3.java | 2 +- .../sqlite/jni/{ => capi}/sqlite3_backup.java | 2 +- .../sqlite/jni/{ => capi}/sqlite3_blob.java | 2 +- .../jni/{ => capi}/sqlite3_context.java | 2 +- .../sqlite/jni/{ => capi}/sqlite3_stmt.java | 2 +- .../sqlite/jni/{ => capi}/sqlite3_value.java | 2 +- .../src/org/sqlite/jni/fts5/Fts5Context.java | 2 +- .../org/sqlite/jni/fts5/Fts5ExtensionApi.java | 2 +- .../org/sqlite/jni/fts5/Fts5PhraseIter.java | 2 +- .../org/sqlite/jni/fts5/Fts5Tokenizer.java | 2 +- .../org/sqlite/jni/{ => fts5}/TesterFts5.java | 8 +- ext/jni/src/org/sqlite/jni/fts5/fts5_api.java | 2 +- .../jni/fts5/fts5_extension_function.java | 4 +- .../org/sqlite/jni/fts5/fts5_tokenizer.java | 2 +- .../org/sqlite/jni/{ => wrapper1}/Sqlite.java | 7 +- .../jni/{ => wrapper1}/SqliteException.java | 5 +- .../sqlite/jni/{ => wrapper1}/Tester2.java | 23 +- manifest | 108 +- manifest.uuid | 2 +- 51 files changed, 1421 insertions(+), 1393 deletions(-) rename ext/jni/src/org/sqlite/jni/{ => capi}/AbstractCollationCallback.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/AggregateFunction.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/AuthorizerCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/AutoExtensionCallback.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/BusyHandlerCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/CApi.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/CallbackProxy.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/CollationCallback.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/CollationNeededCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/CommitHookCallback.java (95%) rename ext/jni/src/org/sqlite/jni/{ => capi}/ConfigLogCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/ConfigSqllogCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/NativePointerHolder.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/OutputPointer.java (87%) rename ext/jni/src/org/sqlite/jni/{ => capi}/PrepareMultiCallback.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/PreupdateHookCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/ProgressHandlerCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/ResultCode.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/RollbackHookCallback.java (95%) rename ext/jni/src/org/sqlite/jni/{ => capi}/SQLFunction.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/SQLTester.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/ScalarFunction.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/TableColumnMetadata.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/Tester1.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/TraceV2Callback.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/UpdateHookCallback.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/WindowFunction.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/XDestroyCallback.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/package-info.java (98%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3.java (97%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3_backup.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3_blob.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3_context.java (99%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3_stmt.java (96%) rename ext/jni/src/org/sqlite/jni/{ => capi}/sqlite3_value.java (95%) rename ext/jni/src/org/sqlite/jni/{ => fts5}/TesterFts5.java (99%) rename ext/jni/src/org/sqlite/jni/{ => wrapper1}/Sqlite.java (96%) rename ext/jni/src/org/sqlite/jni/{ => wrapper1}/SqliteException.java (95%) rename ext/jni/src/org/sqlite/jni/{ => wrapper1}/Tester2.java (94%) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index ddc51f727e..6b09514e1c 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -26,6 +26,7 @@ dir.src.c := $(dir.src)/c dir.bld := $(dir.jni)/bld dir.bld.c := $(dir.bld) dir.src.jni := $(dir.src)/org/sqlite/jni +dir.src.capi := $(dir.src.jni)/capi dir.src.fts5 := $(dir.src.jni)/fts5 dir.tests := $(dir.src)/tests mkdir ?= mkdir -p @@ -45,8 +46,8 @@ DISTCLEAN_FILES := $(dir.jni)/*~ $(dir.src.c)/*~ $(dir.src.jni)/*~ sqlite3-jni.h := $(dir.src.c)/sqlite3-jni.h .NOTPARALLEL: $(sqlite3-jni.h) -CApi.java := src/org/sqlite/jni/CApi.java -SQLTester.java := src/org/sqlite/jni/SQLTester.java +CApi.java := $(dir.src.capi)/CApi.java +SQLTester.java := $(dir.src.capi)/SQLTester.java CApi.class := $(CApi.java:.java=.class) SQLTester.class := $(SQLTester.java:.java=.class) @@ -77,9 +78,10 @@ $(bin.version-info): $(dir.tool)/version-info.c $(sqlite3.h) $(dir.top)/Makefile # Be explicit about which Java files to compile so that we can work on # in-progress files without requiring them to be in a compilable statae. -JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ - annotation/NotNull.java \ - annotation/Nullable.java \ +JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\ + NotNull.java \ + Nullable.java \ +) $(patsubst %,$(dir.src.capi)/%,\ AbstractCollationCallback.java \ AggregateFunction.java \ AuthorizerCallback.java \ @@ -98,8 +100,6 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ ResultCode.java \ RollbackHookCallback.java \ ScalarFunction.java \ - Sqlite.java \ - SqliteException.java \ SQLFunction.java \ CallbackProxy.java \ CApi.java \ @@ -112,13 +112,17 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/%,\ sqlite3_context.java \ sqlite3_stmt.java \ sqlite3_value.java \ +) $(patsubst %,$(dir.src.jni)/wrapper1/%,\ + Sqlite.java \ + SqliteException.java \ ) + JAVA_FILES.unittest := $(patsubst %,$(dir.src.jni)/%,\ - Tester1.java \ - Tester2.java \ + capi/Tester1.java \ + wrapper1/Tester2.java \ ) ifeq (1,$(enable.fts5)) - JAVA_FILES.unittest += $(patsubst %,$(dir.src.jni)/%,\ + JAVA_FILES.unittest += $(patsubst %,$(dir.src.fts5)/%,\ TesterFts5.java \ ) JAVA_FILES.main += $(patsubst %,$(dir.src.fts5)/%,\ @@ -245,8 +249,8 @@ $$(dir.bld.c)/org_sqlite_jni$(3)_$(2).h: $(1)/$(2).java endef # Invoke ADD_JNI_H once for each Java file which includes JNI # declarations: -$(eval $(call ADD_JNI_H,$(dir.src.jni),CApi,)) -$(eval $(call ADD_JNI_H,$(dir.src.jni),SQLTester,)) +$(eval $(call ADD_JNI_H,$(dir.src.capi),CApi,_capi)) +$(eval $(call ADD_JNI_H,$(dir.src.capi),SQLTester,_capi)) ifeq (1,$(enable.fts5)) $(eval $(call ADD_JNI_H,$(dir.src.fts5),Fts5ExtensionApi,_fts5)) $(eval $(call ADD_JNI_H,$(dir.src.fts5),fts5_api,_fts5)) @@ -303,16 +307,16 @@ test.flags.jvm = -ea -Djava.library.path=$(dir.bld.c) \ $(java.flags) -cp $(classpath) test.deps := $(CLASS_FILES) $(package.dll) test-one: $(test.deps) - $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester1 $(Tester1.flags) - $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 $(Tester2.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.capi.Tester1 $(Tester1.flags) + $(bin.java) $(test.flags.jvm) org.sqlite.jni.wrapper1.Tester2 $(Tester2.flags) test-sqllog: $(test.deps) @echo "Testing with -sqllog..." $(bin.java) $(test.flags.jvm) -sqllog test-mt: $(test.deps) @echo "Testing in multi-threaded mode:"; - $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester1 \ + $(bin.java) $(test.flags.jvm) org.sqlite.jni.capi.Tester1 \ -t 7 -r 50 -shuffle $(Tester1.flags) - $(bin.java) $(test.flags.jvm) org.sqlite.jni.Tester2 \ + $(bin.java) $(test.flags.jvm) org.sqlite.jni.wrapper1.Tester2 \ -t 7 -r 50 -shuffle $(Tester2.flags) test: test-one test-mt @@ -325,7 +329,7 @@ ifeq (1,$(enable.tester)) tester-local: $(CLASS_FILES.tester) $(package.dll) $(bin.java) -ea -Djava.library.path=$(dir.bld.c) \ $(java.flags) -cp $(classpath) \ - org.sqlite.jni.SQLTester $(tester.flags) $(tester.scripts) + org.sqlite.jni.capi.SQLTester $(tester.flags) $(tester.scripts) tester: tester-local else tester: @@ -339,7 +343,7 @@ ifneq (,$(tester.extern-scripts)) tester-ext: $(bin.java) -ea -Djava.library.path=$(dir.bld.c) \ $(java.flags) -cp $(classpath) \ - org.sqlite.jni.SQLTester $(tester.flags) $(tester.extern-scripts) + org.sqlite.jni.capi.SQLTester $(tester.flags) $(tester.extern-scripts) else tester-ext: @echo "******************************************************"; \ @@ -385,7 +389,7 @@ $(package.jar.in): $(package.dll) $(MAKEFILE) $(package.jar): $(CLASS_FILES.jar) $(MAKEFILE) $(package.jar.in) @rm -f $(dir.src)/c/*~ $(dir.src.jni)/*~ - cd $(dir.src); $(bin.jar) -cfe ../$@ org.sqlite.jni.Tester1 @$(package.jar.in) + cd $(dir.src); $(bin.jar) -cfe ../$@ org.sqlite.jni.capi.Tester1 @$(package.jar.in) @ls -la $@ @echo "To use this jar you will need the -Djava.library.path=DIR/CONTAINING/libsqlite3-jni.so flag." @echo "e.g. java -Djava.library.path=bld -jar $@" @@ -402,6 +406,8 @@ javadoc.exclude := -exclude org.sqlite.jni.fts5 # ^^^^ 2023-09-13: elide the fts5 parts from the public docs for # the time being, as it's not clear where the Java bindings for # those bits are going. +# javadoc.exclude += -exclude org.sqlite.jni.capi +# ^^^^ exclude the capi API only for certain builds (TBD) $(doc.index): $(JAVA_FILES.main) $(MAKEFILE) @if [ -d $(dir.doc) ]; then rm -fr $(dir.doc)/*; fi $(bin.javadoc) -cp $(classpath) -d $(dir.doc) -quiet \ @@ -422,7 +428,7 @@ docserve: $(doc.index) # Clean up... CLEAN_FILES += $(dir.bld.c)/* \ $(dir.src.jni)/*.class \ - $(dir.src.jni.tester)/*.class \ + $(dir.src.jni)/*/*.class \ $(package.dll) \ hs_err_pid*.log diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index dd643c30bd..8009592b6b 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -10,7 +10,7 @@ ** ************************************************************************* ** This file implements the JNI bindings declared in -** org.sqlite.jni.CApi (from which sqlite3-jni.h is generated). +** org.sqlite.jni.capi.CApi (from which sqlite3-jni.h is generated). */ /* @@ -169,7 +169,7 @@ ** prefix seen in this macro. */ #define JniFuncName(Suffix) \ - Java_org_sqlite_jni_CApi_sqlite3_ ## Suffix + Java_org_sqlite_jni_capi_CApi_sqlite3_ ## Suffix /* Prologue for JNI function declarations and definitions. */ #define JniDecl(ReturnType,Suffix) \ @@ -386,26 +386,26 @@ static const struct { #define RefN(INDEX, KLAZZ) MkRef(INDEX, KLAZZ, "nativePointer", "J") /* OutputPointer.T ref */ #define RefO(INDEX, KLAZZ, SIG) MkRef(INDEX, KLAZZ, "value", SIG) - RefN(0, "sqlite3"), - RefN(1, "sqlite3_backup"), - RefN(2, "sqlite3_blob"), - RefN(3, "sqlite3_context"), - RefN(4, "sqlite3_stmt"), - RefN(5, "sqlite3_value"), - RefO(6, "OutputPointer$Bool", "Z"), - RefO(7, "OutputPointer$Int32", "I"), - RefO(8, "OutputPointer$Int64", "J"), - RefO(9, "OutputPointer$sqlite3", - "Lorg/sqlite/jni/sqlite3;"), - RefO(10, "OutputPointer$sqlite3_blob", - "Lorg/sqlite/jni/sqlite3_blob;"), - RefO(11, "OutputPointer$sqlite3_stmt", - "Lorg/sqlite/jni/sqlite3_stmt;"), - RefO(12, "OutputPointer$sqlite3_value", - "Lorg/sqlite/jni/sqlite3_value;"), - RefO(13, "OutputPointer$String", "Ljava/lang/String;"), + RefN(0, "capi/sqlite3"), + RefN(1, "capi/sqlite3_backup"), + RefN(2, "capi/sqlite3_blob"), + RefN(3, "capi/sqlite3_context"), + RefN(4, "capi/sqlite3_stmt"), + RefN(5, "capi/sqlite3_value"), + RefO(6, "capi/OutputPointer$Bool", "Z"), + RefO(7, "capi/OutputPointer$Int32", "I"), + RefO(8, "capi/OutputPointer$Int64", "J"), + RefO(9, "capi/OutputPointer$sqlite3", + "Lorg/sqlite/jni/capi/sqlite3;"), + RefO(10, "capi/OutputPointer$sqlite3_blob", + "Lorg/sqlite/jni/capi/sqlite3_blob;"), + RefO(11, "capi/OutputPointer$sqlite3_stmt", + "Lorg/sqlite/jni/capi/sqlite3_stmt;"), + RefO(12, "capi/OutputPointer$sqlite3_value", + "Lorg/sqlite/jni/capi/sqlite3_value;"), + RefO(13, "capi/OutputPointer$String", "Ljava/lang/String;"), #ifdef SQLITE_ENABLE_FTS5 - RefO(14, "OutputPointer$ByteArray", "[B"), + RefO(14, "capi/OutputPointer$ByteArray", "[B"), RefN(15, "fts5/Fts5Context"), RefN(16, "fts5/Fts5ExtensionApi"), RefN(17, "fts5/fts5_api"), @@ -660,7 +660,7 @@ struct S3JniGlobalType { } g; /* ** The list of Java-side auto-extensions - ** (org.sqlite.jni.AutoExtensionCallback objects). + ** (org.sqlite.jni.capi.AutoExtensionCallback objects). */ struct { S3JniAutoExtension *aExt /* The auto-extension list. It is @@ -1371,6 +1371,7 @@ static S3JniNphOp * s3jni__nphop(JNIEnv * const env, S3JniNphOp const* pRef){ S3JniNph_mutex_enter; if( !pNC->klazz ){ jclass const klazz = (*env)->FindClass(env, pRef->zName); + //printf("FindClass %s\n", pRef->zName); S3JniExceptionIsFatal("FindClass() unexpectedly threw"); pNC->klazz = S3JniRefGlobal(klazz); } @@ -1515,7 +1516,7 @@ static S3JniDb * S3JniDb_alloc(JNIEnv * const env, jobject jDb){ } /* -** Returns the S3JniDb object for the given org.sqlite.jni.sqlite3 +** Returns the S3JniDb object for the given org.sqlite.jni.capi.sqlite3 ** object, or NULL if jDb is NULL, no pointer can be extracted ** from it, or no matching entry can be found. */ @@ -1564,7 +1565,7 @@ static int S3JniAutoExtension_init(JNIEnv *const env, S3JniAutoExt_mutex_assertLocker; *ax = S3JniHook_empty; ax->midCallback = (*env)->GetMethodID(env, klazz, "call", - "(Lorg/sqlite/jni/sqlite3;)I"); + "(Lorg/sqlite/jni/capi/sqlite3;)I"); S3JniUnrefLocal(klazz); S3JniExceptionWarnIgnore; if( !ax->midCallback ){ @@ -1660,7 +1661,7 @@ static int encodingTypeIsValid(int eTextRep){ } /* For use with sqlite3_result/value_pointer() */ -static const char * const ResultJavaValuePtrStr = "org.sqlite.jni.ResultJavaVal"; +static const char * const ResultJavaValuePtrStr = "org.sqlite.jni.capi.ResultJavaVal"; /* ** If v is not NULL, it must be a jobject global reference. Its @@ -1758,9 +1759,9 @@ static S3JniUdf * S3JniUdf_alloc(JNIEnv * const env, jobject jObj){ } if( s ){ const char * zFSI = /* signature for xFunc, xStep, xInverse */ - "(Lorg/sqlite/jni/sqlite3_context;[Lorg/sqlite/jni/sqlite3_value;)V"; + "(Lorg/sqlite/jni/capi/sqlite3_context;[Lorg/sqlite/jni/capi/sqlite3_value;)V"; const char * zFV = /* signature for xFinal, xValue */ - "(Lorg/sqlite/jni/sqlite3_context;)V"; + "(Lorg/sqlite/jni/capi/sqlite3_context;)V"; jclass const klazz = (*env)->GetObjectClass(env, jObj); memset(s, 0, sizeof(*s)); @@ -1834,8 +1835,8 @@ typedef struct { ** UDF, writing the result (Java wrappers for cx and argv) in the ** final 2 arguments. Returns 0 on success, SQLITE_NOMEM on allocation ** error. On error *jCx and *jArgv will be set to 0. The output -** objects are of type org.sqlite.jni.sqlite3_context and -** array-of-org.sqlite.jni.sqlite3_value, respectively. +** objects are of type org.sqlite.jni.capi.sqlite3_context and +** array-of-org.sqlite.jni.capi.sqlite3_value, respectively. */ static int udf_args(JNIEnv *env, sqlite3_context * const cx, @@ -2781,7 +2782,7 @@ S3JniApi(sqlite3_collation_needed(),jint,1collation_1needed)( }else{ jclass const klazz = (*env)->GetObjectClass(env, jHook); jmethodID const xCallback = (*env)->GetMethodID( - env, klazz, "call", "(Lorg/sqlite/jni/sqlite3;ILjava/lang/String;)I" + env, klazz, "call", "(Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I" ); S3JniUnrefLocal(klazz); S3JniIfThrew { @@ -3131,7 +3132,7 @@ S3JniApi(sqlite3_config() /* for SQLITE_CONFIG_SQLLOG */, }else { jclass const klazz = (*env)->GetObjectClass(env, jLog); jmethodID const midCallback = (*env)->GetMethodID(env, klazz, "call", - "(Lorg/sqlite/jni/sqlite3;" + "(Lorg/sqlite/jni/capi/sqlite3;" "Ljava/lang/String;" "I)V"); S3JniUnrefLocal(klazz); @@ -3304,7 +3305,7 @@ error_cleanup: S3JniApi(sqlite3_db_config() /*for MAINDBNAME*/, - jint,1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 + jint,1db_1config__Lorg_sqlite_jni_capi_sqlite3_2ILjava_lang_String_2 )(JniArgsEnvClass, jobject jDb, jint op, jstring jStr){ S3JniDb * const ps = S3JniDb_from_java(jDb); int rc; @@ -3341,7 +3342,7 @@ S3JniApi( /* WARNING: openjdk v19 creates a different mangled name for this ** function than openjdk v8 does. We account for that by exporting ** both versions of the name. */ - jint,1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_Int32_2 + jint,1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2 )( JniArgsEnvClass, jobject jDb, jint op, jint onOff, jobject jOut ){ @@ -3386,10 +3387,10 @@ S3JniApi( ** install both names for this function then Java will not be able to ** find the function in both environments. */ -JniDecl(jint,1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_00024Int32_2)( +JniDecl(jint,1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_00024Int32_2)( JniArgsEnvClass, jobject jDb, jint op, jint onOff, jobject jOut ){ - return JniFuncName(1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_Int32_2)( + return JniFuncName(1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2)( env, jKlazz, jDb, op, onOff, jOut ); } @@ -3676,7 +3677,7 @@ end: /* ** Post-open() code common to both the sqlite3_open() and ** sqlite3_open_v2() bindings. ps->jDb must be the -** org.sqlite.jni.sqlite3 object which will hold the db's native +** org.sqlite.jni.capi.sqlite3 object which will hold the db's native ** pointer. theRc must be the result code of the open() op. If ** *ppDb is NULL then ps is set aside and its state cleared, ** else ps is associated with *ppDb. If *ppDb is not NULL then @@ -3979,7 +3980,7 @@ static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jlong jpDb, jobject klazz = (*env)->GetObjectClass(env, jHook); xCallback = isPre ? (*env)->GetMethodID(env, klazz, "call", - "(Lorg/sqlite/jni/sqlite3;" + "(Lorg/sqlite/jni/capi/sqlite3;" "I" "Ljava/lang/String;" "Ljava/lang/String;" @@ -5027,8 +5028,8 @@ static Fts5JniAux * Fts5JniAux_alloc(JNIEnv * const env, jobject jObj){ s->jmid = (*env)->GetMethodID(env, klazz, "call", "(Lorg/sqlite/jni/fts5/Fts5ExtensionApi;" "Lorg/sqlite/jni/fts5/Fts5Context;" - "Lorg/sqlite/jni/sqlite3_context;" - "[Lorg/sqlite/jni/sqlite3_value;)V"); + "Lorg/sqlite/jni/capi/sqlite3_context;" + "[Lorg/sqlite/jni/capi/sqlite3_value;)V"); S3JniUnrefLocal(klazz); S3JniIfThrew{ S3JniExceptionReport; @@ -5745,7 +5746,7 @@ static int SQLTester_strnotglob(const char *zGlob, const char *z){ } JNIEXPORT jint JNICALL -Java_org_sqlite_jni_SQLTester_strglob( +Java_org_sqlite_jni_capi_SQLTester_strglob( JniArgsEnvClass, jbyteArray baG, jbyteArray baT ){ int rc = 0; @@ -5772,7 +5773,7 @@ static int SQLTester_auto_extension(sqlite3 *pDb, const char **pzErr, } JNIEXPORT void JNICALL -Java_org_sqlite_jni_SQLTester_installCustomExtensions(JniArgsEnvClass){ +Java_org_sqlite_jni_capi_SQLTester_installCustomExtensions(JniArgsEnvClass){ sqlite3_auto_extension( (void(*)(void))SQLTester_auto_extension ); } @@ -5786,7 +5787,7 @@ Java_org_sqlite_jni_SQLTester_installCustomExtensions(JniArgsEnvClass){ ** state. */ JNIEXPORT void JNICALL -Java_org_sqlite_jni_CApi_init(JniArgsEnvClass){ +Java_org_sqlite_jni_capi_CApi_init(JniArgsEnvClass){ jclass klazz; memset(&S3JniGlobal, 0, sizeof(S3JniGlobal)); @@ -5828,7 +5829,7 @@ Java_org_sqlite_jni_CApi_init(JniArgsEnvClass){ #ifdef SQLITE_ENABLE_FTS5 klazz = (*env)->FindClass(env, "org/sqlite/jni/fts5/Fts5PhraseIter"); - S3JniExceptionIsFatal("Error getting reference to org.sqlite.jni.Fts5PhraseIter."); + S3JniExceptionIsFatal("Error getting reference to org.sqlite.jni.fts5.Fts5PhraseIter."); SJG.fts5.jPhraseIter.fidA = (*env)->GetFieldID(env, klazz, "a", "J"); S3JniExceptionIsFatal("Cannot get Fts5PhraseIter.a field."); SJG.fts5.jPhraseIter.fidB = (*env)->GetFieldID(env, klazz, "b", "J"); diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 78559a3262..bf6df7ac94 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1,2122 +1,2122 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ #include -/* Header for class org_sqlite_jni_CApi */ +/* Header for class org_sqlite_jni_capi_CApi */ -#ifndef _Included_org_sqlite_jni_CApi -#define _Included_org_sqlite_jni_CApi +#ifndef _Included_org_sqlite_jni_capi_CApi +#define _Included_org_sqlite_jni_capi_CApi #ifdef __cplusplus extern "C" { #endif -#undef org_sqlite_jni_CApi_SQLITE_ACCESS_EXISTS -#define org_sqlite_jni_CApi_SQLITE_ACCESS_EXISTS 0L -#undef org_sqlite_jni_CApi_SQLITE_ACCESS_READWRITE -#define org_sqlite_jni_CApi_SQLITE_ACCESS_READWRITE 1L -#undef org_sqlite_jni_CApi_SQLITE_ACCESS_READ -#define org_sqlite_jni_CApi_SQLITE_ACCESS_READ 2L -#undef org_sqlite_jni_CApi_SQLITE_DENY -#define org_sqlite_jni_CApi_SQLITE_DENY 1L -#undef org_sqlite_jni_CApi_SQLITE_IGNORE -#define org_sqlite_jni_CApi_SQLITE_IGNORE 2L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_INDEX -#define org_sqlite_jni_CApi_SQLITE_CREATE_INDEX 1L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TABLE -#define org_sqlite_jni_CApi_SQLITE_CREATE_TABLE 2L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_INDEX -#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_INDEX 3L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TABLE -#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TABLE 4L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_TRIGGER 5L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_VIEW -#define org_sqlite_jni_CApi_SQLITE_CREATE_TEMP_VIEW 6L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_CREATE_TRIGGER 7L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_VIEW -#define org_sqlite_jni_CApi_SQLITE_CREATE_VIEW 8L -#undef org_sqlite_jni_CApi_SQLITE_DELETE -#define org_sqlite_jni_CApi_SQLITE_DELETE 9L -#undef org_sqlite_jni_CApi_SQLITE_DROP_INDEX -#define org_sqlite_jni_CApi_SQLITE_DROP_INDEX 10L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TABLE -#define org_sqlite_jni_CApi_SQLITE_DROP_TABLE 11L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_INDEX -#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_INDEX 12L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TABLE -#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TABLE 13L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_TRIGGER 14L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TEMP_VIEW -#define org_sqlite_jni_CApi_SQLITE_DROP_TEMP_VIEW 15L -#undef org_sqlite_jni_CApi_SQLITE_DROP_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_DROP_TRIGGER 16L -#undef org_sqlite_jni_CApi_SQLITE_DROP_VIEW -#define org_sqlite_jni_CApi_SQLITE_DROP_VIEW 17L -#undef org_sqlite_jni_CApi_SQLITE_INSERT -#define org_sqlite_jni_CApi_SQLITE_INSERT 18L -#undef org_sqlite_jni_CApi_SQLITE_PRAGMA -#define org_sqlite_jni_CApi_SQLITE_PRAGMA 19L -#undef org_sqlite_jni_CApi_SQLITE_READ -#define org_sqlite_jni_CApi_SQLITE_READ 20L -#undef org_sqlite_jni_CApi_SQLITE_SELECT -#define org_sqlite_jni_CApi_SQLITE_SELECT 21L -#undef org_sqlite_jni_CApi_SQLITE_TRANSACTION -#define org_sqlite_jni_CApi_SQLITE_TRANSACTION 22L -#undef org_sqlite_jni_CApi_SQLITE_UPDATE -#define org_sqlite_jni_CApi_SQLITE_UPDATE 23L -#undef org_sqlite_jni_CApi_SQLITE_ATTACH -#define org_sqlite_jni_CApi_SQLITE_ATTACH 24L -#undef org_sqlite_jni_CApi_SQLITE_DETACH -#define org_sqlite_jni_CApi_SQLITE_DETACH 25L -#undef org_sqlite_jni_CApi_SQLITE_ALTER_TABLE -#define org_sqlite_jni_CApi_SQLITE_ALTER_TABLE 26L -#undef org_sqlite_jni_CApi_SQLITE_REINDEX -#define org_sqlite_jni_CApi_SQLITE_REINDEX 27L -#undef org_sqlite_jni_CApi_SQLITE_ANALYZE -#define org_sqlite_jni_CApi_SQLITE_ANALYZE 28L -#undef org_sqlite_jni_CApi_SQLITE_CREATE_VTABLE -#define org_sqlite_jni_CApi_SQLITE_CREATE_VTABLE 29L -#undef org_sqlite_jni_CApi_SQLITE_DROP_VTABLE -#define org_sqlite_jni_CApi_SQLITE_DROP_VTABLE 30L -#undef org_sqlite_jni_CApi_SQLITE_FUNCTION -#define org_sqlite_jni_CApi_SQLITE_FUNCTION 31L -#undef org_sqlite_jni_CApi_SQLITE_SAVEPOINT -#define org_sqlite_jni_CApi_SQLITE_SAVEPOINT 32L -#undef org_sqlite_jni_CApi_SQLITE_RECURSIVE -#define org_sqlite_jni_CApi_SQLITE_RECURSIVE 33L -#undef org_sqlite_jni_CApi_SQLITE_STATIC -#define org_sqlite_jni_CApi_SQLITE_STATIC 0LL -#undef org_sqlite_jni_CApi_SQLITE_TRANSIENT -#define org_sqlite_jni_CApi_SQLITE_TRANSIENT -1LL -#undef org_sqlite_jni_CApi_SQLITE_CHANGESETSTART_INVERT -#define org_sqlite_jni_CApi_SQLITE_CHANGESETSTART_INVERT 2L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT -#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT 1L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_INVERT -#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_INVERT 2L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP -#define org_sqlite_jni_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP 4L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_DATA -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_DATA 1L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_NOTFOUND -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_NOTFOUND 2L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_CONFLICT -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_CONFLICT 3L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_CONSTRAINT -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_CONSTRAINT 4L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_FOREIGN_KEY -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_FOREIGN_KEY 5L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_OMIT -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_OMIT 0L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_REPLACE -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_REPLACE 1L -#undef org_sqlite_jni_CApi_SQLITE_CHANGESET_ABORT -#define org_sqlite_jni_CApi_SQLITE_CHANGESET_ABORT 2L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SINGLETHREAD -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SINGLETHREAD 1L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MULTITHREAD -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MULTITHREAD 2L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SERIALIZED -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SERIALIZED 3L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MALLOC -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MALLOC 4L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETMALLOC -#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETMALLOC 5L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SCRATCH -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SCRATCH 6L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PAGECACHE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_PAGECACHE 7L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_HEAP -#define org_sqlite_jni_CApi_SQLITE_CONFIG_HEAP 8L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MEMSTATUS -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MEMSTATUS 9L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MUTEX -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MUTEX 10L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETMUTEX -#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETMUTEX 11L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_LOOKASIDE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_LOOKASIDE 13L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE 14L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE 15L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_LOG -#define org_sqlite_jni_CApi_SQLITE_CONFIG_LOG 16L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_URI -#define org_sqlite_jni_CApi_SQLITE_CONFIG_URI 17L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE2 -#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE2 18L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE2 -#define org_sqlite_jni_CApi_SQLITE_CONFIG_GETPCACHE2 19L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN -#define org_sqlite_jni_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN 20L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SQLLOG -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SQLLOG 21L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MMAP_SIZE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MMAP_SIZE 22L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE 23L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE_HDRSZ -#define org_sqlite_jni_CApi_SQLITE_CONFIG_PCACHE_HDRSZ 24L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_PMASZ -#define org_sqlite_jni_CApi_SQLITE_CONFIG_PMASZ 25L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_STMTJRNL_SPILL -#define org_sqlite_jni_CApi_SQLITE_CONFIG_STMTJRNL_SPILL 26L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SMALL_MALLOC -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SMALL_MALLOC 27L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_SORTERREF_SIZE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_SORTERREF_SIZE 28L -#undef org_sqlite_jni_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE -#define org_sqlite_jni_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE 29L -#undef org_sqlite_jni_CApi_SQLITE_INTEGER -#define org_sqlite_jni_CApi_SQLITE_INTEGER 1L -#undef org_sqlite_jni_CApi_SQLITE_FLOAT -#define org_sqlite_jni_CApi_SQLITE_FLOAT 2L -#undef org_sqlite_jni_CApi_SQLITE_TEXT -#define org_sqlite_jni_CApi_SQLITE_TEXT 3L -#undef org_sqlite_jni_CApi_SQLITE_BLOB -#define org_sqlite_jni_CApi_SQLITE_BLOB 4L -#undef org_sqlite_jni_CApi_SQLITE_NULL -#define org_sqlite_jni_CApi_SQLITE_NULL 5L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAINDBNAME -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAINDBNAME 1000L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LOOKASIDE -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LOOKASIDE 1001L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FKEY -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FKEY 1002L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER 1003L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_QPSG -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_QPSG 1007L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRIGGER_EQP -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRIGGER_EQP 1008L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_RESET_DATABASE -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_RESET_DATABASE 1009L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DEFENSIVE -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DEFENSIVE 1010L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DML -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DML 1013L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DDL -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_DQS_DDL 1014L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_VIEW -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_ENABLE_VIEW 1015L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS 1018L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER 1019L -#undef org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAX -#define org_sqlite_jni_CApi_SQLITE_DBCONFIG_MAX 1019L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED 0L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED 1L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_SCHEMA_USED -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_SCHEMA_USED 2L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_STMT_USED -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_STMT_USED 3L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT 4L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_HIT -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_HIT 7L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_MISS -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_MISS 8L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_WRITE -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_WRITE 9L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_DEFERRED_FKS -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_DEFERRED_FKS 10L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_SPILL -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_CACHE_SPILL 12L -#undef org_sqlite_jni_CApi_SQLITE_DBSTATUS_MAX -#define org_sqlite_jni_CApi_SQLITE_DBSTATUS_MAX 12L -#undef org_sqlite_jni_CApi_SQLITE_UTF8 -#define org_sqlite_jni_CApi_SQLITE_UTF8 1L -#undef org_sqlite_jni_CApi_SQLITE_UTF16LE -#define org_sqlite_jni_CApi_SQLITE_UTF16LE 2L -#undef org_sqlite_jni_CApi_SQLITE_UTF16BE -#define org_sqlite_jni_CApi_SQLITE_UTF16BE 3L -#undef org_sqlite_jni_CApi_SQLITE_UTF16 -#define org_sqlite_jni_CApi_SQLITE_UTF16 4L -#undef org_sqlite_jni_CApi_SQLITE_UTF16_ALIGNED -#define org_sqlite_jni_CApi_SQLITE_UTF16_ALIGNED 8L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LOCKSTATE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_LOCKSTATE 1L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE 2L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE 3L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LAST_ERRNO -#define org_sqlite_jni_CApi_SQLITE_FCNTL_LAST_ERRNO 4L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_HINT -#define org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_HINT 5L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CHUNK_SIZE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_CHUNK_SIZE 6L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_FILE_POINTER -#define org_sqlite_jni_CApi_SQLITE_FCNTL_FILE_POINTER 7L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC_OMITTED -#define org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC_OMITTED 8L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_AV_RETRY -#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_AV_RETRY 9L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PERSIST_WAL -#define org_sqlite_jni_CApi_SQLITE_FCNTL_PERSIST_WAL 10L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_OVERWRITE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_OVERWRITE 11L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_VFSNAME -#define org_sqlite_jni_CApi_SQLITE_FCNTL_VFSNAME 12L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE 13L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PRAGMA -#define org_sqlite_jni_CApi_SQLITE_FCNTL_PRAGMA 14L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_BUSYHANDLER -#define org_sqlite_jni_CApi_SQLITE_FCNTL_BUSYHANDLER 15L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_TEMPFILENAME -#define org_sqlite_jni_CApi_SQLITE_FCNTL_TEMPFILENAME 16L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_MMAP_SIZE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_MMAP_SIZE 18L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_TRACE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_TRACE 19L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_HAS_MOVED -#define org_sqlite_jni_CApi_SQLITE_FCNTL_HAS_MOVED 20L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC -#define org_sqlite_jni_CApi_SQLITE_FCNTL_SYNC 21L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_PHASETWO -#define org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_PHASETWO 22L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE 23L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WAL_BLOCK -#define org_sqlite_jni_CApi_SQLITE_FCNTL_WAL_BLOCK 24L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_ZIPVFS -#define org_sqlite_jni_CApi_SQLITE_FCNTL_ZIPVFS 25L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RBU -#define org_sqlite_jni_CApi_SQLITE_FCNTL_RBU 26L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_VFS_POINTER -#define org_sqlite_jni_CApi_SQLITE_FCNTL_VFS_POINTER 27L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_JOURNAL_POINTER -#define org_sqlite_jni_CApi_SQLITE_FCNTL_JOURNAL_POINTER 28L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE 29L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_PDB -#define org_sqlite_jni_CApi_SQLITE_FCNTL_PDB 30L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_LOCK_TIMEOUT -#define org_sqlite_jni_CApi_SQLITE_FCNTL_LOCK_TIMEOUT 34L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_DATA_VERSION -#define org_sqlite_jni_CApi_SQLITE_FCNTL_DATA_VERSION 35L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_LIMIT -#define org_sqlite_jni_CApi_SQLITE_FCNTL_SIZE_LIMIT 36L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_DONE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_DONE 37L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RESERVE_BYTES -#define org_sqlite_jni_CApi_SQLITE_FCNTL_RESERVE_BYTES 38L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_START -#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKPT_START 39L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_EXTERNAL_READER -#define org_sqlite_jni_CApi_SQLITE_FCNTL_EXTERNAL_READER 40L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_CKSM_FILE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_CKSM_FILE 41L -#undef org_sqlite_jni_CApi_SQLITE_FCNTL_RESET_CACHE -#define org_sqlite_jni_CApi_SQLITE_FCNTL_RESET_CACHE 42L -#undef org_sqlite_jni_CApi_SQLITE_LOCK_NONE -#define org_sqlite_jni_CApi_SQLITE_LOCK_NONE 0L -#undef org_sqlite_jni_CApi_SQLITE_LOCK_SHARED -#define org_sqlite_jni_CApi_SQLITE_LOCK_SHARED 1L -#undef org_sqlite_jni_CApi_SQLITE_LOCK_RESERVED -#define org_sqlite_jni_CApi_SQLITE_LOCK_RESERVED 2L -#undef org_sqlite_jni_CApi_SQLITE_LOCK_PENDING -#define org_sqlite_jni_CApi_SQLITE_LOCK_PENDING 3L -#undef org_sqlite_jni_CApi_SQLITE_LOCK_EXCLUSIVE -#define org_sqlite_jni_CApi_SQLITE_LOCK_EXCLUSIVE 4L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC 1L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC512 -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC512 2L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC1K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC1K 4L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC2K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC2K 8L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC4K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC4K 16L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC8K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC8K 32L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC16K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC16K 64L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC32K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC32K 128L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC64K -#define org_sqlite_jni_CApi_SQLITE_IOCAP_ATOMIC64K 256L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_SAFE_APPEND -#define org_sqlite_jni_CApi_SQLITE_IOCAP_SAFE_APPEND 512L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_SEQUENTIAL -#define org_sqlite_jni_CApi_SQLITE_IOCAP_SEQUENTIAL 1024L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN -#define org_sqlite_jni_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 2048L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE -#define org_sqlite_jni_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE 4096L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_IMMUTABLE -#define org_sqlite_jni_CApi_SQLITE_IOCAP_IMMUTABLE 8192L -#undef org_sqlite_jni_CApi_SQLITE_IOCAP_BATCH_ATOMIC -#define org_sqlite_jni_CApi_SQLITE_IOCAP_BATCH_ATOMIC 16384L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_LENGTH -#define org_sqlite_jni_CApi_SQLITE_LIMIT_LENGTH 0L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_SQL_LENGTH -#define org_sqlite_jni_CApi_SQLITE_LIMIT_SQL_LENGTH 1L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_COLUMN -#define org_sqlite_jni_CApi_SQLITE_LIMIT_COLUMN 2L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_EXPR_DEPTH -#define org_sqlite_jni_CApi_SQLITE_LIMIT_EXPR_DEPTH 3L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_COMPOUND_SELECT -#define org_sqlite_jni_CApi_SQLITE_LIMIT_COMPOUND_SELECT 4L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_VDBE_OP -#define org_sqlite_jni_CApi_SQLITE_LIMIT_VDBE_OP 5L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_FUNCTION_ARG -#define org_sqlite_jni_CApi_SQLITE_LIMIT_FUNCTION_ARG 6L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_ATTACHED -#define org_sqlite_jni_CApi_SQLITE_LIMIT_ATTACHED 7L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH -#define org_sqlite_jni_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_VARIABLE_NUMBER -#define org_sqlite_jni_CApi_SQLITE_LIMIT_VARIABLE_NUMBER 9L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_TRIGGER_DEPTH -#define org_sqlite_jni_CApi_SQLITE_LIMIT_TRIGGER_DEPTH 10L -#undef org_sqlite_jni_CApi_SQLITE_LIMIT_WORKER_THREADS -#define org_sqlite_jni_CApi_SQLITE_LIMIT_WORKER_THREADS 11L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_READONLY -#define org_sqlite_jni_CApi_SQLITE_OPEN_READONLY 1L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_READWRITE -#define org_sqlite_jni_CApi_SQLITE_OPEN_READWRITE 2L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_CREATE -#define org_sqlite_jni_CApi_SQLITE_OPEN_CREATE 4L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_URI -#define org_sqlite_jni_CApi_SQLITE_OPEN_URI 64L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_MEMORY -#define org_sqlite_jni_CApi_SQLITE_OPEN_MEMORY 128L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_NOMUTEX -#define org_sqlite_jni_CApi_SQLITE_OPEN_NOMUTEX 32768L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_FULLMUTEX -#define org_sqlite_jni_CApi_SQLITE_OPEN_FULLMUTEX 65536L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_SHAREDCACHE -#define org_sqlite_jni_CApi_SQLITE_OPEN_SHAREDCACHE 131072L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE -#define org_sqlite_jni_CApi_SQLITE_OPEN_PRIVATECACHE 262144L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW -#define org_sqlite_jni_CApi_SQLITE_OPEN_NOFOLLOW 16777216L -#undef org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE -#define org_sqlite_jni_CApi_SQLITE_OPEN_EXRESCODE 33554432L -#undef org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT -#define org_sqlite_jni_CApi_SQLITE_PREPARE_PERSISTENT 1L -#undef org_sqlite_jni_CApi_SQLITE_PREPARE_NORMALIZE -#define org_sqlite_jni_CApi_SQLITE_PREPARE_NORMALIZE 2L -#undef org_sqlite_jni_CApi_SQLITE_PREPARE_NO_VTAB -#define org_sqlite_jni_CApi_SQLITE_PREPARE_NO_VTAB 4L -#undef org_sqlite_jni_CApi_SQLITE_OK -#define org_sqlite_jni_CApi_SQLITE_OK 0L -#undef org_sqlite_jni_CApi_SQLITE_ERROR -#define org_sqlite_jni_CApi_SQLITE_ERROR 1L -#undef org_sqlite_jni_CApi_SQLITE_INTERNAL -#define org_sqlite_jni_CApi_SQLITE_INTERNAL 2L -#undef org_sqlite_jni_CApi_SQLITE_PERM -#define org_sqlite_jni_CApi_SQLITE_PERM 3L -#undef org_sqlite_jni_CApi_SQLITE_ABORT -#define org_sqlite_jni_CApi_SQLITE_ABORT 4L -#undef org_sqlite_jni_CApi_SQLITE_BUSY -#define org_sqlite_jni_CApi_SQLITE_BUSY 5L -#undef org_sqlite_jni_CApi_SQLITE_LOCKED -#define org_sqlite_jni_CApi_SQLITE_LOCKED 6L -#undef org_sqlite_jni_CApi_SQLITE_NOMEM -#define org_sqlite_jni_CApi_SQLITE_NOMEM 7L -#undef org_sqlite_jni_CApi_SQLITE_READONLY -#define org_sqlite_jni_CApi_SQLITE_READONLY 8L -#undef org_sqlite_jni_CApi_SQLITE_INTERRUPT -#define org_sqlite_jni_CApi_SQLITE_INTERRUPT 9L -#undef org_sqlite_jni_CApi_SQLITE_IOERR -#define org_sqlite_jni_CApi_SQLITE_IOERR 10L -#undef org_sqlite_jni_CApi_SQLITE_CORRUPT -#define org_sqlite_jni_CApi_SQLITE_CORRUPT 11L -#undef org_sqlite_jni_CApi_SQLITE_NOTFOUND -#define org_sqlite_jni_CApi_SQLITE_NOTFOUND 12L -#undef org_sqlite_jni_CApi_SQLITE_FULL -#define org_sqlite_jni_CApi_SQLITE_FULL 13L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN 14L -#undef org_sqlite_jni_CApi_SQLITE_PROTOCOL -#define org_sqlite_jni_CApi_SQLITE_PROTOCOL 15L -#undef org_sqlite_jni_CApi_SQLITE_EMPTY -#define org_sqlite_jni_CApi_SQLITE_EMPTY 16L -#undef org_sqlite_jni_CApi_SQLITE_SCHEMA -#define org_sqlite_jni_CApi_SQLITE_SCHEMA 17L -#undef org_sqlite_jni_CApi_SQLITE_TOOBIG -#define org_sqlite_jni_CApi_SQLITE_TOOBIG 18L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT 19L -#undef org_sqlite_jni_CApi_SQLITE_MISMATCH -#define org_sqlite_jni_CApi_SQLITE_MISMATCH 20L -#undef org_sqlite_jni_CApi_SQLITE_MISUSE -#define org_sqlite_jni_CApi_SQLITE_MISUSE 21L -#undef org_sqlite_jni_CApi_SQLITE_NOLFS -#define org_sqlite_jni_CApi_SQLITE_NOLFS 22L -#undef org_sqlite_jni_CApi_SQLITE_AUTH -#define org_sqlite_jni_CApi_SQLITE_AUTH 23L -#undef org_sqlite_jni_CApi_SQLITE_FORMAT -#define org_sqlite_jni_CApi_SQLITE_FORMAT 24L -#undef org_sqlite_jni_CApi_SQLITE_RANGE -#define org_sqlite_jni_CApi_SQLITE_RANGE 25L -#undef org_sqlite_jni_CApi_SQLITE_NOTADB -#define org_sqlite_jni_CApi_SQLITE_NOTADB 26L -#undef org_sqlite_jni_CApi_SQLITE_NOTICE -#define org_sqlite_jni_CApi_SQLITE_NOTICE 27L -#undef org_sqlite_jni_CApi_SQLITE_WARNING -#define org_sqlite_jni_CApi_SQLITE_WARNING 28L -#undef org_sqlite_jni_CApi_SQLITE_ROW -#define org_sqlite_jni_CApi_SQLITE_ROW 100L -#undef org_sqlite_jni_CApi_SQLITE_DONE -#define org_sqlite_jni_CApi_SQLITE_DONE 101L -#undef org_sqlite_jni_CApi_SQLITE_ERROR_MISSING_COLLSEQ -#define org_sqlite_jni_CApi_SQLITE_ERROR_MISSING_COLLSEQ 257L -#undef org_sqlite_jni_CApi_SQLITE_ERROR_RETRY -#define org_sqlite_jni_CApi_SQLITE_ERROR_RETRY 513L -#undef org_sqlite_jni_CApi_SQLITE_ERROR_SNAPSHOT -#define org_sqlite_jni_CApi_SQLITE_ERROR_SNAPSHOT 769L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_READ -#define org_sqlite_jni_CApi_SQLITE_IOERR_READ 266L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHORT_READ -#define org_sqlite_jni_CApi_SQLITE_IOERR_SHORT_READ 522L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_WRITE -#define org_sqlite_jni_CApi_SQLITE_IOERR_WRITE 778L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_FSYNC -#define org_sqlite_jni_CApi_SQLITE_IOERR_FSYNC 1034L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_DIR_FSYNC -#define org_sqlite_jni_CApi_SQLITE_IOERR_DIR_FSYNC 1290L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_TRUNCATE -#define org_sqlite_jni_CApi_SQLITE_IOERR_TRUNCATE 1546L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_FSTAT -#define org_sqlite_jni_CApi_SQLITE_IOERR_FSTAT 1802L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_UNLOCK -#define org_sqlite_jni_CApi_SQLITE_IOERR_UNLOCK 2058L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_RDLOCK -#define org_sqlite_jni_CApi_SQLITE_IOERR_RDLOCK 2314L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_DELETE -#define org_sqlite_jni_CApi_SQLITE_IOERR_DELETE 2570L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_BLOCKED -#define org_sqlite_jni_CApi_SQLITE_IOERR_BLOCKED 2826L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_NOMEM -#define org_sqlite_jni_CApi_SQLITE_IOERR_NOMEM 3082L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_ACCESS -#define org_sqlite_jni_CApi_SQLITE_IOERR_ACCESS 3338L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK -#define org_sqlite_jni_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK 3594L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_LOCK -#define org_sqlite_jni_CApi_SQLITE_IOERR_LOCK 3850L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_CLOSE -#define org_sqlite_jni_CApi_SQLITE_IOERR_CLOSE 4106L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_DIR_CLOSE -#define org_sqlite_jni_CApi_SQLITE_IOERR_DIR_CLOSE 4362L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMOPEN -#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMOPEN 4618L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMSIZE -#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMSIZE 4874L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMLOCK -#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMLOCK 5130L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SHMMAP -#define org_sqlite_jni_CApi_SQLITE_IOERR_SHMMAP 5386L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_SEEK -#define org_sqlite_jni_CApi_SQLITE_IOERR_SEEK 5642L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_DELETE_NOENT -#define org_sqlite_jni_CApi_SQLITE_IOERR_DELETE_NOENT 5898L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_MMAP -#define org_sqlite_jni_CApi_SQLITE_IOERR_MMAP 6154L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_GETTEMPPATH -#define org_sqlite_jni_CApi_SQLITE_IOERR_GETTEMPPATH 6410L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_CONVPATH -#define org_sqlite_jni_CApi_SQLITE_IOERR_CONVPATH 6666L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_VNODE -#define org_sqlite_jni_CApi_SQLITE_IOERR_VNODE 6922L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_AUTH -#define org_sqlite_jni_CApi_SQLITE_IOERR_AUTH 7178L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_BEGIN_ATOMIC -#define org_sqlite_jni_CApi_SQLITE_IOERR_BEGIN_ATOMIC 7434L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_COMMIT_ATOMIC -#define org_sqlite_jni_CApi_SQLITE_IOERR_COMMIT_ATOMIC 7690L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC -#define org_sqlite_jni_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC 7946L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_DATA -#define org_sqlite_jni_CApi_SQLITE_IOERR_DATA 8202L -#undef org_sqlite_jni_CApi_SQLITE_IOERR_CORRUPTFS -#define org_sqlite_jni_CApi_SQLITE_IOERR_CORRUPTFS 8458L -#undef org_sqlite_jni_CApi_SQLITE_LOCKED_SHAREDCACHE -#define org_sqlite_jni_CApi_SQLITE_LOCKED_SHAREDCACHE 262L -#undef org_sqlite_jni_CApi_SQLITE_LOCKED_VTAB -#define org_sqlite_jni_CApi_SQLITE_LOCKED_VTAB 518L -#undef org_sqlite_jni_CApi_SQLITE_BUSY_RECOVERY -#define org_sqlite_jni_CApi_SQLITE_BUSY_RECOVERY 261L -#undef org_sqlite_jni_CApi_SQLITE_BUSY_SNAPSHOT -#define org_sqlite_jni_CApi_SQLITE_BUSY_SNAPSHOT 517L -#undef org_sqlite_jni_CApi_SQLITE_BUSY_TIMEOUT -#define org_sqlite_jni_CApi_SQLITE_BUSY_TIMEOUT 773L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_NOTEMPDIR -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_NOTEMPDIR 270L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_ISDIR -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_ISDIR 526L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_FULLPATH -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_FULLPATH 782L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_CONVPATH -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_CONVPATH 1038L -#undef org_sqlite_jni_CApi_SQLITE_CANTOPEN_SYMLINK -#define org_sqlite_jni_CApi_SQLITE_CANTOPEN_SYMLINK 1550L -#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_VTAB -#define org_sqlite_jni_CApi_SQLITE_CORRUPT_VTAB 267L -#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_SEQUENCE -#define org_sqlite_jni_CApi_SQLITE_CORRUPT_SEQUENCE 523L -#undef org_sqlite_jni_CApi_SQLITE_CORRUPT_INDEX -#define org_sqlite_jni_CApi_SQLITE_CORRUPT_INDEX 779L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_RECOVERY -#define org_sqlite_jni_CApi_SQLITE_READONLY_RECOVERY 264L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_CANTLOCK -#define org_sqlite_jni_CApi_SQLITE_READONLY_CANTLOCK 520L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_ROLLBACK -#define org_sqlite_jni_CApi_SQLITE_READONLY_ROLLBACK 776L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_DBMOVED -#define org_sqlite_jni_CApi_SQLITE_READONLY_DBMOVED 1032L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_CANTINIT -#define org_sqlite_jni_CApi_SQLITE_READONLY_CANTINIT 1288L -#undef org_sqlite_jni_CApi_SQLITE_READONLY_DIRECTORY -#define org_sqlite_jni_CApi_SQLITE_READONLY_DIRECTORY 1544L -#undef org_sqlite_jni_CApi_SQLITE_ABORT_ROLLBACK -#define org_sqlite_jni_CApi_SQLITE_ABORT_ROLLBACK 516L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_CHECK -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_CHECK 275L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_COMMITHOOK -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_COMMITHOOK 531L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FOREIGNKEY -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FOREIGNKEY 787L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FUNCTION -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_FUNCTION 1043L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_NOTNULL -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_NOTNULL 1299L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PRIMARYKEY -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PRIMARYKEY 1555L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_TRIGGER -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_TRIGGER 1811L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_UNIQUE -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_UNIQUE 2067L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_VTAB -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_VTAB 2323L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_ROWID -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_ROWID 2579L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PINNED -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_PINNED 2835L -#undef org_sqlite_jni_CApi_SQLITE_CONSTRAINT_DATATYPE -#define org_sqlite_jni_CApi_SQLITE_CONSTRAINT_DATATYPE 3091L -#undef org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_WAL -#define org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_WAL 283L -#undef org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK -#define org_sqlite_jni_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK 539L -#undef org_sqlite_jni_CApi_SQLITE_WARNING_AUTOINDEX -#define org_sqlite_jni_CApi_SQLITE_WARNING_AUTOINDEX 284L -#undef org_sqlite_jni_CApi_SQLITE_AUTH_USER -#define org_sqlite_jni_CApi_SQLITE_AUTH_USER 279L -#undef org_sqlite_jni_CApi_SQLITE_OK_LOAD_PERMANENTLY -#define org_sqlite_jni_CApi_SQLITE_OK_LOAD_PERMANENTLY 256L -#undef org_sqlite_jni_CApi_SQLITE_SERIALIZE_NOCOPY -#define org_sqlite_jni_CApi_SQLITE_SERIALIZE_NOCOPY 1L -#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_FREEONCLOSE -#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_FREEONCLOSE 1L -#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_READONLY -#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_READONLY 4L -#undef org_sqlite_jni_CApi_SQLITE_DESERIALIZE_RESIZEABLE -#define org_sqlite_jni_CApi_SQLITE_DESERIALIZE_RESIZEABLE 2L -#undef org_sqlite_jni_CApi_SQLITE_SESSION_CONFIG_STRMSIZE -#define org_sqlite_jni_CApi_SQLITE_SESSION_CONFIG_STRMSIZE 1L -#undef org_sqlite_jni_CApi_SQLITE_SESSION_OBJCONFIG_SIZE -#define org_sqlite_jni_CApi_SQLITE_SESSION_OBJCONFIG_SIZE 1L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_MEMORY_USED -#define org_sqlite_jni_CApi_SQLITE_STATUS_MEMORY_USED 0L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_USED -#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_USED 1L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW -#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW 2L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_SIZE -#define org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_SIZE 5L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_PARSER_STACK -#define org_sqlite_jni_CApi_SQLITE_STATUS_PARSER_STACK 6L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_SIZE -#define org_sqlite_jni_CApi_SQLITE_STATUS_PAGECACHE_SIZE 7L -#undef org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_COUNT -#define org_sqlite_jni_CApi_SQLITE_STATUS_MALLOC_COUNT 9L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP 1L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_SORT -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_SORT 2L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_AUTOINDEX -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_AUTOINDEX 3L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_VM_STEP -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_VM_STEP 4L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_REPREPARE -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_REPREPARE 5L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_RUN -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_RUN 6L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_MISS -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_MISS 7L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_HIT -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_FILTER_HIT 8L -#undef org_sqlite_jni_CApi_SQLITE_STMTSTATUS_MEMUSED -#define org_sqlite_jni_CApi_SQLITE_STMTSTATUS_MEMUSED 99L -#undef org_sqlite_jni_CApi_SQLITE_SYNC_NORMAL -#define org_sqlite_jni_CApi_SQLITE_SYNC_NORMAL 2L -#undef org_sqlite_jni_CApi_SQLITE_SYNC_FULL -#define org_sqlite_jni_CApi_SQLITE_SYNC_FULL 3L -#undef org_sqlite_jni_CApi_SQLITE_SYNC_DATAONLY -#define org_sqlite_jni_CApi_SQLITE_SYNC_DATAONLY 16L -#undef org_sqlite_jni_CApi_SQLITE_TRACE_STMT -#define org_sqlite_jni_CApi_SQLITE_TRACE_STMT 1L -#undef org_sqlite_jni_CApi_SQLITE_TRACE_PROFILE -#define org_sqlite_jni_CApi_SQLITE_TRACE_PROFILE 2L -#undef org_sqlite_jni_CApi_SQLITE_TRACE_ROW -#define org_sqlite_jni_CApi_SQLITE_TRACE_ROW 4L -#undef org_sqlite_jni_CApi_SQLITE_TRACE_CLOSE -#define org_sqlite_jni_CApi_SQLITE_TRACE_CLOSE 8L -#undef org_sqlite_jni_CApi_SQLITE_TXN_NONE -#define org_sqlite_jni_CApi_SQLITE_TXN_NONE 0L -#undef org_sqlite_jni_CApi_SQLITE_TXN_READ -#define org_sqlite_jni_CApi_SQLITE_TXN_READ 1L -#undef org_sqlite_jni_CApi_SQLITE_TXN_WRITE -#define org_sqlite_jni_CApi_SQLITE_TXN_WRITE 2L -#undef org_sqlite_jni_CApi_SQLITE_DETERMINISTIC -#define org_sqlite_jni_CApi_SQLITE_DETERMINISTIC 2048L -#undef org_sqlite_jni_CApi_SQLITE_DIRECTONLY -#define org_sqlite_jni_CApi_SQLITE_DIRECTONLY 524288L -#undef org_sqlite_jni_CApi_SQLITE_INNOCUOUS -#define org_sqlite_jni_CApi_SQLITE_INNOCUOUS 2097152L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_SCAN_UNIQUE -#define org_sqlite_jni_CApi_SQLITE_INDEX_SCAN_UNIQUE 1L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_EQ -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_EQ 2L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GT -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GT 4L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LE -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LE 8L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LT -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LT 16L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GE -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GE 32L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_MATCH -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_MATCH 64L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIKE -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIKE 65L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GLOB -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_GLOB 66L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP 67L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_NE -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_NE 68L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT 69L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL 71L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_IS -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_IS 72L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT 73L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET 74L -#undef org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION -#define org_sqlite_jni_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION 150L -#undef org_sqlite_jni_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT -#define org_sqlite_jni_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT 1L -#undef org_sqlite_jni_CApi_SQLITE_VTAB_INNOCUOUS -#define org_sqlite_jni_CApi_SQLITE_VTAB_INNOCUOUS 2L -#undef org_sqlite_jni_CApi_SQLITE_VTAB_DIRECTONLY -#define org_sqlite_jni_CApi_SQLITE_VTAB_DIRECTONLY 3L -#undef org_sqlite_jni_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS -#define org_sqlite_jni_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS 4L -#undef org_sqlite_jni_CApi_SQLITE_ROLLBACK -#define org_sqlite_jni_CApi_SQLITE_ROLLBACK 1L -#undef org_sqlite_jni_CApi_SQLITE_FAIL -#define org_sqlite_jni_CApi_SQLITE_FAIL 3L -#undef org_sqlite_jni_CApi_SQLITE_REPLACE -#define org_sqlite_jni_CApi_SQLITE_REPLACE 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_EXISTS +#define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_EXISTS 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READWRITE +#define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READWRITE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READ +#define org_sqlite_jni_capi_CApi_SQLITE_ACCESS_READ 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_DENY +#define org_sqlite_jni_capi_CApi_SQLITE_DENY 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_IGNORE +#define org_sqlite_jni_capi_CApi_SQLITE_IGNORE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_INDEX +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_INDEX 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TABLE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_INDEX +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_INDEX 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TABLE 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_TRIGGER 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_VIEW +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TEMP_VIEW 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_TRIGGER 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_VIEW +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_VIEW 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_DELETE +#define org_sqlite_jni_capi_CApi_SQLITE_DELETE 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_INDEX +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_INDEX 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TABLE 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_INDEX +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_INDEX 12L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TABLE 13L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_TRIGGER 14L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_VIEW +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TEMP_VIEW 15L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_TRIGGER 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_VIEW +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_VIEW 17L +#undef org_sqlite_jni_capi_CApi_SQLITE_INSERT +#define org_sqlite_jni_capi_CApi_SQLITE_INSERT 18L +#undef org_sqlite_jni_capi_CApi_SQLITE_PRAGMA +#define org_sqlite_jni_capi_CApi_SQLITE_PRAGMA 19L +#undef org_sqlite_jni_capi_CApi_SQLITE_READ +#define org_sqlite_jni_capi_CApi_SQLITE_READ 20L +#undef org_sqlite_jni_capi_CApi_SQLITE_SELECT +#define org_sqlite_jni_capi_CApi_SQLITE_SELECT 21L +#undef org_sqlite_jni_capi_CApi_SQLITE_TRANSACTION +#define org_sqlite_jni_capi_CApi_SQLITE_TRANSACTION 22L +#undef org_sqlite_jni_capi_CApi_SQLITE_UPDATE +#define org_sqlite_jni_capi_CApi_SQLITE_UPDATE 23L +#undef org_sqlite_jni_capi_CApi_SQLITE_ATTACH +#define org_sqlite_jni_capi_CApi_SQLITE_ATTACH 24L +#undef org_sqlite_jni_capi_CApi_SQLITE_DETACH +#define org_sqlite_jni_capi_CApi_SQLITE_DETACH 25L +#undef org_sqlite_jni_capi_CApi_SQLITE_ALTER_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_ALTER_TABLE 26L +#undef org_sqlite_jni_capi_CApi_SQLITE_REINDEX +#define org_sqlite_jni_capi_CApi_SQLITE_REINDEX 27L +#undef org_sqlite_jni_capi_CApi_SQLITE_ANALYZE +#define org_sqlite_jni_capi_CApi_SQLITE_ANALYZE 28L +#undef org_sqlite_jni_capi_CApi_SQLITE_CREATE_VTABLE +#define org_sqlite_jni_capi_CApi_SQLITE_CREATE_VTABLE 29L +#undef org_sqlite_jni_capi_CApi_SQLITE_DROP_VTABLE +#define org_sqlite_jni_capi_CApi_SQLITE_DROP_VTABLE 30L +#undef org_sqlite_jni_capi_CApi_SQLITE_FUNCTION +#define org_sqlite_jni_capi_CApi_SQLITE_FUNCTION 31L +#undef org_sqlite_jni_capi_CApi_SQLITE_SAVEPOINT +#define org_sqlite_jni_capi_CApi_SQLITE_SAVEPOINT 32L +#undef org_sqlite_jni_capi_CApi_SQLITE_RECURSIVE +#define org_sqlite_jni_capi_CApi_SQLITE_RECURSIVE 33L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATIC +#define org_sqlite_jni_capi_CApi_SQLITE_STATIC 0LL +#undef org_sqlite_jni_capi_CApi_SQLITE_TRANSIENT +#define org_sqlite_jni_capi_CApi_SQLITE_TRANSIENT -1LL +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETSTART_INVERT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETSTART_INVERT 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_NOSAVEPOINT 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_INVERT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_INVERT 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESETAPPLY_IGNORENOOP 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_DATA +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_DATA 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_NOTFOUND +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_NOTFOUND 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONFLICT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONFLICT 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONSTRAINT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_CONSTRAINT 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_FOREIGN_KEY +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_FOREIGN_KEY 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_OMIT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_OMIT 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_REPLACE +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_REPLACE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_ABORT +#define org_sqlite_jni_capi_CApi_SQLITE_CHANGESET_ABORT 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SINGLETHREAD +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SINGLETHREAD 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MULTITHREAD +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MULTITHREAD 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SERIALIZED +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SERIALIZED 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MALLOC +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MALLOC 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMALLOC +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMALLOC 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SCRATCH +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SCRATCH 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PAGECACHE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PAGECACHE 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_HEAP +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_HEAP 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMSTATUS +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMSTATUS 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MUTEX +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MUTEX 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMUTEX +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETMUTEX 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOOKASIDE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOOKASIDE 13L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE 14L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE 15L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOG +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_LOG 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_URI +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_URI 17L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE2 +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE2 18L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE2 +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_GETPCACHE2 19L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_COVERING_INDEX_SCAN 20L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SQLLOG +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SQLLOG 21L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MMAP_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MMAP_SIZE 22L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_WIN32_HEAPSIZE 23L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE_HDRSZ +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PCACHE_HDRSZ 24L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PMASZ +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_PMASZ 25L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_STMTJRNL_SPILL +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_STMTJRNL_SPILL 26L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SMALL_MALLOC +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SMALL_MALLOC 27L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SORTERREF_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_SORTERREF_SIZE 28L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE +#define org_sqlite_jni_capi_CApi_SQLITE_CONFIG_MEMDB_MAXSIZE 29L +#undef org_sqlite_jni_capi_CApi_SQLITE_INTEGER +#define org_sqlite_jni_capi_CApi_SQLITE_INTEGER 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_FLOAT +#define org_sqlite_jni_capi_CApi_SQLITE_FLOAT 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_TEXT +#define org_sqlite_jni_capi_CApi_SQLITE_TEXT 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_BLOB +#define org_sqlite_jni_capi_CApi_SQLITE_BLOB 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_NULL +#define org_sqlite_jni_capi_CApi_SQLITE_NULL 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAINDBNAME +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAINDBNAME 1000L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LOOKASIDE +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LOOKASIDE 1001L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FKEY +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FKEY 1002L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_TRIGGER 1003L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_QPSG +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_QPSG 1007L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRIGGER_EQP +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRIGGER_EQP 1008L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_RESET_DATABASE +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_RESET_DATABASE 1009L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DEFENSIVE +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DEFENSIVE 1010L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DML +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DML 1013L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DDL +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_DQS_DDL 1014L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_VIEW +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_ENABLE_VIEW 1015L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_STMT_SCANSTATUS 1018L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_REVERSE_SCANORDER 1019L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAX +#define org_sqlite_jni_capi_CApi_SQLITE_DBCONFIG_MAX 1019L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_USED 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_SCHEMA_USED +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_SCHEMA_USED 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_STMT_USED +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_STMT_USED 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_HIT 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_HIT +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_HIT 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_MISS +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_MISS 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_WRITE 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_DEFERRED_FKS +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_DEFERRED_FKS 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL 12L +#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX +#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX 12L +#undef org_sqlite_jni_capi_CApi_SQLITE_UTF8 +#define org_sqlite_jni_capi_CApi_SQLITE_UTF8 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_UTF16LE +#define org_sqlite_jni_capi_CApi_SQLITE_UTF16LE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_UTF16BE +#define org_sqlite_jni_capi_CApi_SQLITE_UTF16BE 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_UTF16 +#define org_sqlite_jni_capi_CApi_SQLITE_UTF16 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_UTF16_ALIGNED +#define org_sqlite_jni_capi_CApi_SQLITE_UTF16_ALIGNED 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCKSTATE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCKSTATE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_GET_LOCKPROXYFILE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SET_LOCKPROXYFILE 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LAST_ERRNO +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LAST_ERRNO 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_HINT +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_HINT 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CHUNK_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CHUNK_SIZE 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_FILE_POINTER +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_FILE_POINTER 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC_OMITTED +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC_OMITTED 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_AV_RETRY +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_AV_RETRY 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PERSIST_WAL +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PERSIST_WAL 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_OVERWRITE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_OVERWRITE 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFSNAME +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFSNAME 12L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_POWERSAFE_OVERWRITE 13L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PRAGMA +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PRAGMA 14L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BUSYHANDLER +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BUSYHANDLER 15L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TEMPFILENAME +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TEMPFILENAME 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_MMAP_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_MMAP_SIZE 18L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TRACE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_TRACE 19L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_HAS_MOVED +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_HAS_MOVED 20L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SYNC 21L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_PHASETWO +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_PHASETWO 22L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_SET_HANDLE 23L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WAL_BLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WAL_BLOCK 24L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ZIPVFS +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ZIPVFS 25L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RBU +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RBU 26L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFS_POINTER +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_VFS_POINTER 27L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_JOURNAL_POINTER +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_JOURNAL_POINTER 28L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_WIN32_GET_HANDLE 29L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PDB +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_PDB 30L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCK_TIMEOUT +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_LOCK_TIMEOUT 34L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_DATA_VERSION +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_DATA_VERSION 35L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_LIMIT +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_SIZE_LIMIT 36L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_DONE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_DONE 37L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESERVE_BYTES +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESERVE_BYTES 38L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_START +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKPT_START 39L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_EXTERNAL_READER +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_EXTERNAL_READER 40L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKSM_FILE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_CKSM_FILE 41L +#undef org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESET_CACHE +#define org_sqlite_jni_capi_CApi_SQLITE_FCNTL_RESET_CACHE 42L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_NONE +#define org_sqlite_jni_capi_CApi_SQLITE_LOCK_NONE 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_SHARED +#define org_sqlite_jni_capi_CApi_SQLITE_LOCK_SHARED 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_RESERVED +#define org_sqlite_jni_capi_CApi_SQLITE_LOCK_RESERVED 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_PENDING +#define org_sqlite_jni_capi_CApi_SQLITE_LOCK_PENDING 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCK_EXCLUSIVE +#define org_sqlite_jni_capi_CApi_SQLITE_LOCK_EXCLUSIVE 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC512 +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC512 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC1K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC1K 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC2K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC2K 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC4K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC4K 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC8K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC8K 32L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC16K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC16K 64L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC32K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC32K 128L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC64K +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_ATOMIC64K 256L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SAFE_APPEND +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SAFE_APPEND 512L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SEQUENTIAL +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_SEQUENTIAL 1024L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 2048L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_POWERSAFE_OVERWRITE 4096L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_IMMUTABLE +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_IMMUTABLE 8192L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOCAP_BATCH_ATOMIC +#define org_sqlite_jni_capi_CApi_SQLITE_IOCAP_BATCH_ATOMIC 16384L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LENGTH +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LENGTH 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_SQL_LENGTH +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_SQL_LENGTH 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COLUMN +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COLUMN 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_EXPR_DEPTH +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_EXPR_DEPTH 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COMPOUND_SELECT +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_COMPOUND_SELECT 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VDBE_OP +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VDBE_OP 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_FUNCTION_ARG +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_FUNCTION_ARG 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_ATTACHED +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_ATTACHED 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VARIABLE_NUMBER +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_VARIABLE_NUMBER 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_TRIGGER_DEPTH +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_TRIGGER_DEPTH 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_LIMIT_WORKER_THREADS +#define org_sqlite_jni_capi_CApi_SQLITE_LIMIT_WORKER_THREADS 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_READONLY +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_READONLY 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_READWRITE +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_READWRITE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_CREATE +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_CREATE 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_URI +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_URI 64L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_MEMORY +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_MEMORY 128L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOMUTEX +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOMUTEX 32768L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_FULLMUTEX +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_FULLMUTEX 65536L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_SHAREDCACHE +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_SHAREDCACHE 131072L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_PRIVATECACHE +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_PRIVATECACHE 262144L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOFOLLOW +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_NOFOLLOW 16777216L +#undef org_sqlite_jni_capi_CApi_SQLITE_OPEN_EXRESCODE +#define org_sqlite_jni_capi_CApi_SQLITE_OPEN_EXRESCODE 33554432L +#undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT +#define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NORMALIZE +#define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NORMALIZE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB +#define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_OK +#define org_sqlite_jni_capi_CApi_SQLITE_OK 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_ERROR +#define org_sqlite_jni_capi_CApi_SQLITE_ERROR 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_INTERNAL +#define org_sqlite_jni_capi_CApi_SQLITE_INTERNAL 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_PERM +#define org_sqlite_jni_capi_CApi_SQLITE_PERM 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_ABORT +#define org_sqlite_jni_capi_CApi_SQLITE_ABORT 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_BUSY +#define org_sqlite_jni_capi_CApi_SQLITE_BUSY 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED +#define org_sqlite_jni_capi_CApi_SQLITE_LOCKED 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOMEM +#define org_sqlite_jni_capi_CApi_SQLITE_NOMEM 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_INTERRUPT +#define org_sqlite_jni_capi_CApi_SQLITE_INTERRUPT 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR 10L +#undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT +#define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT 11L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOTFOUND +#define org_sqlite_jni_capi_CApi_SQLITE_NOTFOUND 12L +#undef org_sqlite_jni_capi_CApi_SQLITE_FULL +#define org_sqlite_jni_capi_CApi_SQLITE_FULL 13L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN 14L +#undef org_sqlite_jni_capi_CApi_SQLITE_PROTOCOL +#define org_sqlite_jni_capi_CApi_SQLITE_PROTOCOL 15L +#undef org_sqlite_jni_capi_CApi_SQLITE_EMPTY +#define org_sqlite_jni_capi_CApi_SQLITE_EMPTY 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_SCHEMA +#define org_sqlite_jni_capi_CApi_SQLITE_SCHEMA 17L +#undef org_sqlite_jni_capi_CApi_SQLITE_TOOBIG +#define org_sqlite_jni_capi_CApi_SQLITE_TOOBIG 18L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT 19L +#undef org_sqlite_jni_capi_CApi_SQLITE_MISMATCH +#define org_sqlite_jni_capi_CApi_SQLITE_MISMATCH 20L +#undef org_sqlite_jni_capi_CApi_SQLITE_MISUSE +#define org_sqlite_jni_capi_CApi_SQLITE_MISUSE 21L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOLFS +#define org_sqlite_jni_capi_CApi_SQLITE_NOLFS 22L +#undef org_sqlite_jni_capi_CApi_SQLITE_AUTH +#define org_sqlite_jni_capi_CApi_SQLITE_AUTH 23L +#undef org_sqlite_jni_capi_CApi_SQLITE_FORMAT +#define org_sqlite_jni_capi_CApi_SQLITE_FORMAT 24L +#undef org_sqlite_jni_capi_CApi_SQLITE_RANGE +#define org_sqlite_jni_capi_CApi_SQLITE_RANGE 25L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOTADB +#define org_sqlite_jni_capi_CApi_SQLITE_NOTADB 26L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE +#define org_sqlite_jni_capi_CApi_SQLITE_NOTICE 27L +#undef org_sqlite_jni_capi_CApi_SQLITE_WARNING +#define org_sqlite_jni_capi_CApi_SQLITE_WARNING 28L +#undef org_sqlite_jni_capi_CApi_SQLITE_ROW +#define org_sqlite_jni_capi_CApi_SQLITE_ROW 100L +#undef org_sqlite_jni_capi_CApi_SQLITE_DONE +#define org_sqlite_jni_capi_CApi_SQLITE_DONE 101L +#undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_MISSING_COLLSEQ +#define org_sqlite_jni_capi_CApi_SQLITE_ERROR_MISSING_COLLSEQ 257L +#undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_RETRY +#define org_sqlite_jni_capi_CApi_SQLITE_ERROR_RETRY 513L +#undef org_sqlite_jni_capi_CApi_SQLITE_ERROR_SNAPSHOT +#define org_sqlite_jni_capi_CApi_SQLITE_ERROR_SNAPSHOT 769L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_READ +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_READ 266L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHORT_READ +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHORT_READ 522L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_WRITE 778L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSYNC +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSYNC 1034L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_FSYNC +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_FSYNC 1290L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_TRUNCATE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_TRUNCATE 1546L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSTAT +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_FSTAT 1802L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_UNLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_UNLOCK 2058L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_RDLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_RDLOCK 2314L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE 2570L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_BLOCKED +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_BLOCKED 2826L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_NOMEM +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_NOMEM 3082L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_ACCESS +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_ACCESS 3338L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CHECKRESERVEDLOCK 3594L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_LOCK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_LOCK 3850L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CLOSE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CLOSE 4106L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_CLOSE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DIR_CLOSE 4362L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMOPEN +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMOPEN 4618L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMSIZE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMSIZE 4874L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMLOCK 5130L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMMAP +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SHMMAP 5386L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_SEEK +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_SEEK 5642L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE_NOENT +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DELETE_NOENT 5898L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_MMAP +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_MMAP 6154L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_GETTEMPPATH +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_GETTEMPPATH 6410L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CONVPATH +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CONVPATH 6666L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_VNODE +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_VNODE 6922L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_AUTH +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_AUTH 7178L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_BEGIN_ATOMIC +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_BEGIN_ATOMIC 7434L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_COMMIT_ATOMIC +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_COMMIT_ATOMIC 7690L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_ROLLBACK_ATOMIC 7946L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_DATA +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_DATA 8202L +#undef org_sqlite_jni_capi_CApi_SQLITE_IOERR_CORRUPTFS +#define org_sqlite_jni_capi_CApi_SQLITE_IOERR_CORRUPTFS 8458L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED_SHAREDCACHE +#define org_sqlite_jni_capi_CApi_SQLITE_LOCKED_SHAREDCACHE 262L +#undef org_sqlite_jni_capi_CApi_SQLITE_LOCKED_VTAB +#define org_sqlite_jni_capi_CApi_SQLITE_LOCKED_VTAB 518L +#undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_RECOVERY +#define org_sqlite_jni_capi_CApi_SQLITE_BUSY_RECOVERY 261L +#undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_SNAPSHOT +#define org_sqlite_jni_capi_CApi_SQLITE_BUSY_SNAPSHOT 517L +#undef org_sqlite_jni_capi_CApi_SQLITE_BUSY_TIMEOUT +#define org_sqlite_jni_capi_CApi_SQLITE_BUSY_TIMEOUT 773L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_NOTEMPDIR +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_NOTEMPDIR 270L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_ISDIR +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_ISDIR 526L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_FULLPATH +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_FULLPATH 782L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_CONVPATH +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_CONVPATH 1038L +#undef org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_SYMLINK +#define org_sqlite_jni_capi_CApi_SQLITE_CANTOPEN_SYMLINK 1550L +#undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_VTAB +#define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_VTAB 267L +#undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_SEQUENCE +#define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_SEQUENCE 523L +#undef org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_INDEX +#define org_sqlite_jni_capi_CApi_SQLITE_CORRUPT_INDEX 779L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_RECOVERY +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_RECOVERY 264L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTLOCK +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTLOCK 520L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_ROLLBACK +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_ROLLBACK 776L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_DBMOVED +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_DBMOVED 1032L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTINIT +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_CANTINIT 1288L +#undef org_sqlite_jni_capi_CApi_SQLITE_READONLY_DIRECTORY +#define org_sqlite_jni_capi_CApi_SQLITE_READONLY_DIRECTORY 1544L +#undef org_sqlite_jni_capi_CApi_SQLITE_ABORT_ROLLBACK +#define org_sqlite_jni_capi_CApi_SQLITE_ABORT_ROLLBACK 516L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_CHECK +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_CHECK 275L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_COMMITHOOK +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_COMMITHOOK 531L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FOREIGNKEY +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FOREIGNKEY 787L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FUNCTION +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_FUNCTION 1043L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_NOTNULL +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_NOTNULL 1299L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PRIMARYKEY +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PRIMARYKEY 1555L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_TRIGGER +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_TRIGGER 1811L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_UNIQUE +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_UNIQUE 2067L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_VTAB +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_VTAB 2323L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_ROWID +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_ROWID 2579L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PINNED +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_PINNED 2835L +#undef org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_DATATYPE +#define org_sqlite_jni_capi_CApi_SQLITE_CONSTRAINT_DATATYPE 3091L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_WAL +#define org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_WAL 283L +#undef org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK +#define org_sqlite_jni_capi_CApi_SQLITE_NOTICE_RECOVER_ROLLBACK 539L +#undef org_sqlite_jni_capi_CApi_SQLITE_WARNING_AUTOINDEX +#define org_sqlite_jni_capi_CApi_SQLITE_WARNING_AUTOINDEX 284L +#undef org_sqlite_jni_capi_CApi_SQLITE_AUTH_USER +#define org_sqlite_jni_capi_CApi_SQLITE_AUTH_USER 279L +#undef org_sqlite_jni_capi_CApi_SQLITE_OK_LOAD_PERMANENTLY +#define org_sqlite_jni_capi_CApi_SQLITE_OK_LOAD_PERMANENTLY 256L +#undef org_sqlite_jni_capi_CApi_SQLITE_SERIALIZE_NOCOPY +#define org_sqlite_jni_capi_CApi_SQLITE_SERIALIZE_NOCOPY 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_FREEONCLOSE +#define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_FREEONCLOSE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_READONLY +#define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_READONLY 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_RESIZEABLE +#define org_sqlite_jni_capi_CApi_SQLITE_DESERIALIZE_RESIZEABLE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_SESSION_CONFIG_STRMSIZE +#define org_sqlite_jni_capi_CApi_SQLITE_SESSION_CONFIG_STRMSIZE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_SESSION_OBJCONFIG_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_SESSION_OBJCONFIG_SIZE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MEMORY_USED +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MEMORY_USED 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_USED +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_USED 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_OVERFLOW 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_SIZE 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PARSER_STACK +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PARSER_STACK 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_SIZE +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_PAGECACHE_SIZE 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_COUNT +#define org_sqlite_jni_capi_CApi_SQLITE_STATUS_MALLOC_COUNT 9L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FULLSCAN_STEP 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_SORT +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_SORT 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_AUTOINDEX +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_AUTOINDEX 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_VM_STEP +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_VM_STEP 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_REPREPARE +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_REPREPARE 5L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_RUN +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_RUN 6L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_MISS +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_MISS 7L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_HIT +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_FILTER_HIT 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_MEMUSED +#define org_sqlite_jni_capi_CApi_SQLITE_STMTSTATUS_MEMUSED 99L +#undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_NORMAL +#define org_sqlite_jni_capi_CApi_SQLITE_SYNC_NORMAL 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_FULL +#define org_sqlite_jni_capi_CApi_SQLITE_SYNC_FULL 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_SYNC_DATAONLY +#define org_sqlite_jni_capi_CApi_SQLITE_SYNC_DATAONLY 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_STMT +#define org_sqlite_jni_capi_CApi_SQLITE_TRACE_STMT 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_PROFILE +#define org_sqlite_jni_capi_CApi_SQLITE_TRACE_PROFILE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_ROW +#define org_sqlite_jni_capi_CApi_SQLITE_TRACE_ROW 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_TRACE_CLOSE +#define org_sqlite_jni_capi_CApi_SQLITE_TRACE_CLOSE 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_TXN_NONE +#define org_sqlite_jni_capi_CApi_SQLITE_TXN_NONE 0L +#undef org_sqlite_jni_capi_CApi_SQLITE_TXN_READ +#define org_sqlite_jni_capi_CApi_SQLITE_TXN_READ 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_TXN_WRITE +#define org_sqlite_jni_capi_CApi_SQLITE_TXN_WRITE 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_DETERMINISTIC +#define org_sqlite_jni_capi_CApi_SQLITE_DETERMINISTIC 2048L +#undef org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY +#define org_sqlite_jni_capi_CApi_SQLITE_DIRECTONLY 524288L +#undef org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS +#define org_sqlite_jni_capi_CApi_SQLITE_INNOCUOUS 2097152L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_SCAN_UNIQUE 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_EQ +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_EQ 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GT +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GT 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LE +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LE 8L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LT +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LT 16L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GE +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GE 32L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_MATCH +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_MATCH 64L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIKE +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIKE 65L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GLOB +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_GLOB 66L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_REGEXP 67L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_NE +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_NE 68L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOT 69L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_ISNULL 71L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_IS +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_IS 72L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_LIMIT 73L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_OFFSET 74L +#undef org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION +#define org_sqlite_jni_capi_CApi_SQLITE_INDEX_CONSTRAINT_FUNCTION 150L +#undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT +#define org_sqlite_jni_capi_CApi_SQLITE_VTAB_CONSTRAINT_SUPPORT 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_INNOCUOUS +#define org_sqlite_jni_capi_CApi_SQLITE_VTAB_INNOCUOUS 2L +#undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_DIRECTONLY +#define org_sqlite_jni_capi_CApi_SQLITE_VTAB_DIRECTONLY 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS +#define org_sqlite_jni_capi_CApi_SQLITE_VTAB_USES_ALL_SCHEMAS 4L +#undef org_sqlite_jni_capi_CApi_SQLITE_ROLLBACK +#define org_sqlite_jni_capi_CApi_SQLITE_ROLLBACK 1L +#undef org_sqlite_jni_capi_CApi_SQLITE_FAIL +#define org_sqlite_jni_capi_CApi_SQLITE_FAIL 3L +#undef org_sqlite_jni_capi_CApi_SQLITE_REPLACE +#define org_sqlite_jni_capi_CApi_SQLITE_REPLACE 5L /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: init * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_init +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_init (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_java_uncache_thread * Signature: ()Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1java_1uncache_1thread +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1java_1uncache_1thread (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_aggregate_context - * Signature: (Lorg/sqlite/jni/sqlite3_context;Z)J + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Z)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1aggregate_1context +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1aggregate_1context (JNIEnv *, jclass, jobject, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_auto_extension - * Signature: (Lorg/sqlite/jni/AutoExtensionCallback;)I + * Signature: (Lorg/sqlite/jni/capi/AutoExtensionCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1auto_1extension +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1auto_1extension (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_backup_finish * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1finish +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1finish (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_backup_init - * Signature: (JLjava/lang/String;JLjava/lang/String;)Lorg/sqlite/jni/sqlite3_backup; + * Signature: (JLjava/lang/String;JLjava/lang/String;)Lorg/sqlite/jni/capi/sqlite3_backup; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1init +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1init (JNIEnv *, jclass, jlong, jstring, jlong, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_backup_pagecount * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1pagecount +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1pagecount (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_backup_remaining * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1remaining +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1remaining (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_backup_step * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1backup_1step +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1backup_1step (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_blob * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1blob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1blob (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_double * Signature: (JID)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1double +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1double (JNIEnv *, jclass, jlong, jint, jdouble); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_int * Signature: (JII)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1int (JNIEnv *, jclass, jlong, jint, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_int64 * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1int64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1int64 (JNIEnv *, jclass, jlong, jint, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_java_object * Signature: (JILjava/lang/Object;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1java_1object +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1java_1object (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_null * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1null +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1null (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_parameter_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_parameter_index * Signature: (J[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1index +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1index (JNIEnv *, jclass, jlong, jbyteArray); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_parameter_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1parameter_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1parameter_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_text * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1text (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_text16 * Signature: (JI[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1text16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1text16 (JNIEnv *, jclass, jlong, jint, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_value * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1value +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1value (JNIEnv *, jclass, jlong, jint, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_zeroblob * Signature: (JII)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1zeroblob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1zeroblob (JNIEnv *, jclass, jlong, jint, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_bind_zeroblob64 * Signature: (JIJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1bind_1zeroblob64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1bind_1zeroblob64 (JNIEnv *, jclass, jlong, jint, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_bytes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1bytes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_close * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1close +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1close (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_open - * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/OutputPointer/sqlite3_blob;)I + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;JILorg/sqlite/jni/capi/OutputPointer/sqlite3_blob;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1open +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1open (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_read * Signature: (J[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1read +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1read (JNIEnv *, jclass, jlong, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_reopen * Signature: (JJ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1reopen +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1reopen (JNIEnv *, jclass, jlong, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_blob_write * Signature: (J[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1blob_1write +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1blob_1write (JNIEnv *, jclass, jlong, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_busy_handler - * Signature: (JLorg/sqlite/jni/BusyHandlerCallback;)I + * Signature: (JLorg/sqlite/jni/capi/BusyHandlerCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1busy_1handler +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1busy_1handler (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_busy_timeout * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1busy_1timeout +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1busy_1timeout (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_cancel_auto_extension - * Signature: (Lorg/sqlite/jni/AutoExtensionCallback;)Z + * Signature: (Lorg/sqlite/jni/capi/AutoExtensionCallback;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1cancel_1auto_1extension +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1cancel_1auto_1extension (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_changes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1changes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1changes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_changes64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1changes64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1changes64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_clear_bindings * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1clear_1bindings +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1clear_1bindings (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_close * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1close +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1close (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_close_v2 * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1close_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1close_1v2 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_blob - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)[B + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1blob +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1blob (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_bytes * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1bytes (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_bytes16 * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1bytes16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1bytes16 (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_decltype * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1decltype +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1decltype (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_double - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)D + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1double +JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1double (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_int - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_int64 - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)J + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1int64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int64 (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_database_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1database_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1database_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_origin_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1origin_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1origin_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_table_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1table_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1table_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_text - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)[B + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1text +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1text (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_text16 - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1text16 +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1text16 (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_type * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1type (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_value - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Lorg/sqlite/jni/sqlite3_value; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;I)Lorg/sqlite/jni/capi/sqlite3_value; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1column_1value +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1value (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_collation_needed - * Signature: (JLorg/sqlite/jni/CollationNeededCallback;)I + * Signature: (JLorg/sqlite/jni/capi/CollationNeededCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1collation_1needed +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1collation_1needed (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_commit_hook - * Signature: (JLorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback; + * Signature: (JLorg/sqlite/jni/capi/CommitHookCallback;)Lorg/sqlite/jni/capi/CommitHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1commit_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1commit_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_compileoption_get * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1compileoption_1get +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1compileoption_1get (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_compileoption_used * Signature: (Ljava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1compileoption_1used +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1compileoption_1used (JNIEnv *, jclass, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_complete * Signature: ([B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1complete +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1complete (JNIEnv *, jclass, jbyteArray); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_config * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__I +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config__I (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_config - * Signature: (Lorg/sqlite/jni/ConfigSqllogCallback;)I + * Signature: (Lorg/sqlite/jni/capi/ConfigSqllogCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__Lorg_sqlite_jni_ConfigSqllogCallback_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config__Lorg_sqlite_jni_capi_ConfigSqllogCallback_2 (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_config - * Signature: (Lorg/sqlite/jni/ConfigLogCallback;)I + * Signature: (Lorg/sqlite/jni/capi/ConfigLogCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1config__Lorg_sqlite_jni_ConfigLogCallback_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1config__Lorg_sqlite_jni_capi_ConfigLogCallback_2 (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_context_db_handle - * Signature: (Lorg/sqlite/jni/sqlite3_context;)Lorg/sqlite/jni/sqlite3; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)Lorg/sqlite/jni/capi/sqlite3; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1context_1db_1handle +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1context_1db_1handle (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_create_collation - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;ILorg/sqlite/jni/CollationCallback;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;ILorg/sqlite/jni/capi/CollationCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1create_1collation +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1create_1collation (JNIEnv *, jclass, jobject, jstring, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_create_function - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;IILorg/sqlite/jni/SQLFunction;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;IILorg/sqlite/jni/capi/SQLFunction;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1create_1function +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1create_1function (JNIEnv *, jclass, jobject, jstring, jint, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_data_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1data_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1data_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_config - * Signature: (Lorg/sqlite/jni/sqlite3;IILorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;IILorg/sqlite/jni/capi/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2IILorg_sqlite_jni_OutputPointer_Int32_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2IILorg_sqlite_jni_capi_OutputPointer_Int32_2 (JNIEnv *, jclass, jobject, jint, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_config - * Signature: (Lorg/sqlite/jni/sqlite3;ILjava/lang/String;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_sqlite3_2ILjava_lang_String_2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1config__Lorg_sqlite_jni_capi_sqlite3_2ILjava_lang_String_2 (JNIEnv *, jclass, jobject, jint, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_name * Signature: (JI)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1name (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_filename - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1filename +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1filename (JNIEnv *, jclass, jobject, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_handle - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Lorg/sqlite/jni/sqlite3; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Lorg/sqlite/jni/capi/sqlite3; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1handle +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1handle (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_readonly - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1readonly +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1readonly (JNIEnv *, jclass, jobject, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_release_memory - * Signature: (Lorg/sqlite/jni/sqlite3;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1release_1memory +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1release_1memory (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_db_status - * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Z)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1db_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1db_1status (JNIEnv *, jclass, jobject, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_errcode - * Signature: (Lorg/sqlite/jni/sqlite3;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errcode +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errcode (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_errmsg - * Signature: (Lorg/sqlite/jni/sqlite3;)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errmsg +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errmsg (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_error_offset * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1error_1offset +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1error_1offset (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_errstr * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1errstr +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errstr (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_expanded_sql - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1expanded_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1expanded_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_extended_errcode * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1extended_1errcode +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1errcode (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_extended_result_codes - * Signature: (Lorg/sqlite/jni/sqlite3;Z)Z + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Z)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1extended_1result_1codes +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1result_1codes (JNIEnv *, jclass, jobject, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_get_autocommit * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1get_1autocommit +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1get_1autocommit (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_get_auxdata - * Signature: (Lorg/sqlite/jni/sqlite3_context;I)Ljava/lang/Object; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1get_1auxdata +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1get_1auxdata (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_finalize * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1finalize +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1finalize (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_initialize * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1initialize +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1initialize (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_interrupt - * Signature: (Lorg/sqlite/jni/sqlite3;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1interrupt +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1interrupt (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_is_interrupted - * Signature: (Lorg/sqlite/jni/sqlite3;)Z + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1is_1interrupted +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1is_1interrupted (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_keyword_check * Signature: (Ljava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1check +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1check (JNIEnv *, jclass, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_keyword_count * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1count (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_keyword_name * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1keyword_1name +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1keyword_1name (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_last_insert_rowid - * Signature: (Lorg/sqlite/jni/sqlite3;)J + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1last_1insert_1rowid +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1last_1insert_1rowid (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_libversion * Signature: ()Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1libversion +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1libversion (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_libversion_number * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1libversion_1number +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1libversion_1number (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_limit - * Signature: (Lorg/sqlite/jni/sqlite3;II)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;II)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1limit +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1limit (JNIEnv *, jclass, jobject, jint, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_normalized_sql - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1normalized_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1normalized_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_open - * Signature: (Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/sqlite3;)I + * Signature: (Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/sqlite3;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1open +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1open (JNIEnv *, jclass, jstring, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_open_v2 - * Signature: (Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/sqlite3;ILjava/lang/String;)I + * Signature: (Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/sqlite3;ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1open_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1open_1v2 (JNIEnv *, jclass, jstring, jobject, jint, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_prepare - * Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (J[BILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_prepare_v2 - * Signature: (J[BILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (J[BILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare_1v2 (JNIEnv *, jclass, jlong, jbyteArray, jint, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_prepare_v3 - * Signature: (J[BIILorg/sqlite/jni/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (J[BIILorg/sqlite/jni/capi/OutputPointer/sqlite3_stmt;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1prepare_1v3 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1prepare_1v3 (JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_blobwrite * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1blobwrite +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1blobwrite (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_count * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1count +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1count (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_depth * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1depth +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1depth (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_hook - * Signature: (JLorg/sqlite/jni/PreupdateHookCallback;)Lorg/sqlite/jni/PreupdateHookCallback; + * Signature: (JLorg/sqlite/jni/capi/PreupdateHookCallback;)Lorg/sqlite/jni/capi/PreupdateHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_new - * Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I + * Signature: (JILorg/sqlite/jni/capi/OutputPointer/sqlite3_value;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1new +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1new (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_preupdate_old - * Signature: (JILorg/sqlite/jni/OutputPointer/sqlite3_value;)I + * Signature: (JILorg/sqlite/jni/capi/OutputPointer/sqlite3_value;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1preupdate_1old +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1preupdate_1old (JNIEnv *, jclass, jlong, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_progress_handler - * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/ProgressHandlerCallback;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/ProgressHandlerCallback;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1progress_1handler +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1progress_1handler (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_randomness * Signature: ([B)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1randomness +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1randomness (JNIEnv *, jclass, jbyteArray); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_release_memory * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1release_1memory +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1release_1memory (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_reset - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1reset +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1reset (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_reset_auto_extension * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1reset_1auto_1extension +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1reset_1auto_1extension (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_double - * Signature: (Lorg/sqlite/jni/sqlite3_context;D)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;D)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1double +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1double (JNIEnv *, jclass, jobject, jdouble); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_error - * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_error_toobig - * Signature: (Lorg/sqlite/jni/sqlite3_context;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1toobig +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1toobig (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_error_nomem - * Signature: (Lorg/sqlite/jni/sqlite3_context;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1nomem +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1nomem (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_error_code - * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1error_1code +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1code (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_null - * Signature: (Lorg/sqlite/jni/sqlite3_context;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1null +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1null (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_int - * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1int +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1int (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_int64 - * Signature: (Lorg/sqlite/jni/sqlite3_context;J)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1int64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1int64 (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_java_object - * Signature: (Lorg/sqlite/jni/sqlite3_context;Ljava/lang/Object;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Ljava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1java_1object +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1java_1object (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_value - * Signature: (Lorg/sqlite/jni/sqlite3_context;Lorg/sqlite/jni/sqlite3_value;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;Lorg/sqlite/jni/capi/sqlite3_value;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1value +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1value (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_zeroblob - * Signature: (Lorg/sqlite/jni/sqlite3_context;I)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1zeroblob +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1zeroblob (JNIEnv *, jclass, jobject, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_zeroblob64 - * Signature: (Lorg/sqlite/jni/sqlite3_context;J)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1zeroblob64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1zeroblob64 (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_blob - * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1blob +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1blob (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_blob64 - * Signature: (Lorg/sqlite/jni/sqlite3_context;[BJ)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BJ)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1blob64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1blob64 (JNIEnv *, jclass, jobject, jbyteArray, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_text - * Signature: (Lorg/sqlite/jni/sqlite3_context;[BI)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1text +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1text (JNIEnv *, jclass, jobject, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_text64 - * Signature: (Lorg/sqlite/jni/sqlite3_context;[BJI)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;[BJI)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1result_1text64 +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1text64 (JNIEnv *, jclass, jobject, jbyteArray, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_rollback_hook - * Signature: (JLorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback; + * Signature: (JLorg/sqlite/jni/capi/RollbackHookCallback;)Lorg/sqlite/jni/capi/RollbackHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1rollback_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1rollback_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_set_authorizer - * Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/AuthorizerCallback;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Lorg/sqlite/jni/capi/AuthorizerCallback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1authorizer +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1authorizer (JNIEnv *, jclass, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_set_auxdata - * Signature: (Lorg/sqlite/jni/sqlite3_context;ILjava/lang/Object;)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;ILjava/lang/Object;)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1auxdata +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1auxdata (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_set_last_insert_rowid - * Signature: (Lorg/sqlite/jni/sqlite3;J)V + * Signature: (Lorg/sqlite/jni/capi/sqlite3;J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1set_1last_1insert_1rowid +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1last_1insert_1rowid (JNIEnv *, jclass, jobject, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_shutdown * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1shutdown +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1shutdown (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_sleep * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sleep +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sleep (JNIEnv *, jclass, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_sourceid * Signature: ()Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sourceid +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sourceid (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_sql - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Ljava/lang/String; + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1sql +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1sql (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_status - * Signature: (ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Z)I + * Signature: (ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1status (JNIEnv *, jclass, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_status64 - * Signature: (ILorg/sqlite/jni/OutputPointer/Int64;Lorg/sqlite/jni/OutputPointer/Int64;Z)I + * Signature: (ILorg/sqlite/jni/capi/OutputPointer/Int64;Lorg/sqlite/jni/capi/OutputPointer/Int64;Z)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1status64 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1status64 (JNIEnv *, jclass, jint, jobject, jobject, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_step - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1step +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1step (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_stmt_busy - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Z + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1busy +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1busy (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_stmt_explain * Signature: (JI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1explain +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1explain (JNIEnv *, jclass, jlong, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_stmt_isexplain * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1isexplain +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1isexplain (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_stmt_readonly - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;)Z + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1readonly +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1readonly (JNIEnv *, jclass, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_stmt_status - * Signature: (Lorg/sqlite/jni/sqlite3_stmt;IZ)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3_stmt;IZ)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1stmt_1status +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1stmt_1status (JNIEnv *, jclass, jobject, jint, jboolean); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_strglob * Signature: ([B[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1strglob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1strglob (JNIEnv *, jclass, jbyteArray, jbyteArray); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_strlike * Signature: ([B[BI)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1strlike +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1strlike (JNIEnv *, jclass, jbyteArray, jbyteArray, jint); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_system_errno * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1system_1errno +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1system_1errno (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_table_column_metadata - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/sqlite/jni/OutputPointer/String;Lorg/sqlite/jni/OutputPointer/String;Lorg/sqlite/jni/OutputPointer/Bool;Lorg/sqlite/jni/OutputPointer/Bool;Lorg/sqlite/jni/OutputPointer/Bool;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/sqlite/jni/capi/OutputPointer/String;Lorg/sqlite/jni/capi/OutputPointer/String;Lorg/sqlite/jni/capi/OutputPointer/Bool;Lorg/sqlite/jni/capi/OutputPointer/Bool;Lorg/sqlite/jni/capi/OutputPointer/Bool;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1table_1column_1metadata +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1table_1column_1metadata (JNIEnv *, jclass, jobject, jstring, jstring, jstring, jobject, jobject, jobject, jobject, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_threadsafe * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1threadsafe +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1threadsafe (JNIEnv *, jclass); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_total_changes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1total_1changes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1total_1changes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_total_changes64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1total_1changes64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1total_1changes64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_trace_v2 - * Signature: (Lorg/sqlite/jni/sqlite3;ILorg/sqlite/jni/TraceV2Callback;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;ILorg/sqlite/jni/capi/TraceV2Callback;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1trace_1v2 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1trace_1v2 (JNIEnv *, jclass, jobject, jint, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_txn_state - * Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)I + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Ljava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1txn_1state +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1txn_1state (JNIEnv *, jclass, jobject, jstring); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_update_hook - * Signature: (JLorg/sqlite/jni/UpdateHookCallback;)Lorg/sqlite/jni/UpdateHookCallback; + * Signature: (JLorg/sqlite/jni/capi/UpdateHookCallback;)Lorg/sqlite/jni/capi/UpdateHookCallback; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1update_1hook +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1update_1hook (JNIEnv *, jclass, jlong, jobject); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_blob * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1blob +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1blob (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_bytes * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1bytes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1bytes (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_bytes16 * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1bytes16 +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1bytes16 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_double * Signature: (J)D */ -JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1double +JNIEXPORT jdouble JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1double (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_dup - * Signature: (J)Lorg/sqlite/jni/sqlite3_value; + * Signature: (J)Lorg/sqlite/jni/capi/sqlite3_value; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1dup +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1dup (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_encoding * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1encoding +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1encoding (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1free +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1free (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_frombind * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1frombind +JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1frombind (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_int * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1int +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1int (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_int64 * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1int64 +JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1int64 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_java_object * Signature: (J)Ljava/lang/Object; */ -JNIEXPORT jobject JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1java_1object +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1java_1object (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_nochange * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1nochange +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1nochange (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_numeric_type * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1numeric_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1numeric_1type (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_subtype * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1subtype +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1subtype (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_text * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1text +JNIEXPORT jbyteArray JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1text (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_text16 * Signature: (J)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1text16 +JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1text16 (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_value_type * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_CApi_sqlite3_1value_1type +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1value_1type (JNIEnv *, jclass, jlong); /* - * Class: org_sqlite_jni_CApi + * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_jni_internal_details * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1jni_1internal_1details +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1jni_1internal_1details (JNIEnv *, jclass); #ifdef __cplusplus @@ -2125,27 +2125,27 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_CApi_sqlite3_1jni_1internal_1details #endif /* DO NOT EDIT THIS FILE - it is machine generated */ #include -/* Header for class org_sqlite_jni_SQLTester */ +/* Header for class org_sqlite_jni_capi_SQLTester */ -#ifndef _Included_org_sqlite_jni_SQLTester -#define _Included_org_sqlite_jni_SQLTester +#ifndef _Included_org_sqlite_jni_capi_SQLTester +#define _Included_org_sqlite_jni_capi_SQLTester #ifdef __cplusplus extern "C" { #endif /* - * Class: org_sqlite_jni_SQLTester + * Class: org_sqlite_jni_capi_SQLTester * Method: strglob * Signature: ([B[B)I */ -JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLTester_strglob +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_SQLTester_strglob (JNIEnv *, jclass, jbyteArray, jbyteArray); /* - * Class: org_sqlite_jni_SQLTester + * Class: org_sqlite_jni_capi_SQLTester * Method: installCustomExtensions * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLTester_installCustomExtensions +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_SQLTester_installCustomExtensions (JNIEnv *, jclass); #ifdef __cplusplus @@ -2180,7 +2180,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnCount /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xColumnSize - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int32;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnSize (JNIEnv *, jobject, jobject, jint, jobject); @@ -2188,7 +2188,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnSize /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xColumnText - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/OutputPointer/String;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/String;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnText (JNIEnv *, jobject, jobject, jint, jobject); @@ -2196,7 +2196,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnText /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xColumnTotalSize - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/OutputPointer/Int64;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int64;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xColumnTotalSize (JNIEnv *, jobject, jobject, jint, jobject); @@ -2212,7 +2212,7 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xGetAuxdata /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xInst - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xInst (JNIEnv *, jobject, jobject, jint, jobject, jobject, jobject); @@ -2220,7 +2220,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xInst /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xInstCount - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xInstCount (JNIEnv *, jobject, jobject, jobject); @@ -2236,7 +2236,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseCount /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xPhraseFirst - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirst (JNIEnv *, jobject, jobject, jint, jobject, jobject, jobject); @@ -2244,7 +2244,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirst /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xPhraseFirstColumn - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/OutputPointer/Int32;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;ILorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirstColumn (JNIEnv *, jobject, jobject, jint, jobject, jobject); @@ -2252,7 +2252,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseFirstCol /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xPhraseNext - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;)V + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;Lorg/sqlite/jni/capi/OutputPointer/Int32;)V */ JNIEXPORT void JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseNext (JNIEnv *, jobject, jobject, jobject, jobject, jobject); @@ -2260,7 +2260,7 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseNext /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xPhraseNextColumn - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/OutputPointer/Int32;)V + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/fts5/Fts5PhraseIter;Lorg/sqlite/jni/capi/OutputPointer/Int32;)V */ JNIEXPORT void JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xPhraseNextColumn (JNIEnv *, jobject, jobject, jobject, jobject); @@ -2284,7 +2284,7 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xQueryPhrase /* * Class: org_sqlite_jni_fts5_Fts5ExtensionApi * Method: xRowCount - * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/OutputPointer/Int64;)I + * Signature: (Lorg/sqlite/jni/fts5/Fts5Context;Lorg/sqlite/jni/capi/OutputPointer/Int64;)I */ JNIEXPORT jint JNICALL Java_org_sqlite_jni_fts5_Fts5ExtensionApi_xRowCount (JNIEnv *, jobject, jobject, jobject); @@ -2339,7 +2339,7 @@ extern "C" { /* * Class: org_sqlite_jni_fts5_fts5_api * Method: getInstanceForDb - * Signature: (Lorg/sqlite/jni/sqlite3;)Lorg/sqlite/jni/fts5/fts5_api; + * Signature: (Lorg/sqlite/jni/capi/sqlite3;)Lorg/sqlite/jni/fts5/fts5_api; */ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_fts5_fts5_1api_getInstanceForDb (JNIEnv *, jclass, jobject); diff --git a/ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java b/ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java rename to ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java index 63cac66a52..925536636e 100644 --- a/ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import org.sqlite.jni.annotation.NotNull; /** diff --git a/ext/jni/src/org/sqlite/jni/AggregateFunction.java b/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/AggregateFunction.java rename to ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java index 502cde12f8..89c4f27421 100644 --- a/ext/jni/src/org/sqlite/jni/AggregateFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** diff --git a/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java b/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/AuthorizerCallback.java rename to ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java index cd3eb06c2a..ce7c6fca6d 100644 --- a/ext/jni/src/org/sqlite/jni/AuthorizerCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import org.sqlite.jni.annotation.*; /** diff --git a/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java b/ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java rename to ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java index 96a63cafb2..7a54132d29 100644 --- a/ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with the {@link CApi#sqlite3_auto_extension} diff --git a/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java b/ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java rename to ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java index 0f1670e17d..00223f0b66 100644 --- a/ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_busy_handler}. diff --git a/ext/jni/src/org/sqlite/jni/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/CApi.java rename to ext/jni/src/org/sqlite/jni/capi/CApi.java index aac9b4e071..051e28a899 100644 --- a/ext/jni/src/org/sqlite/jni/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file declares JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import java.nio.charset.StandardCharsets; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -27,7 +27,7 @@ import java.util.Arrays; use, a static import is recommended:
    {@code
    -  import static org.sqlite.jni.CApi.*;
    +  import static org.sqlite.jni.capi.CApi.*;
       }

    The C-side part can be found in sqlite3-jni.c. @@ -91,7 +91,7 @@ import java.util.Arrays;

    https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html#modified-utf-8 */ -final class CApi { +public final class CApi { static { System.loadLibrary("sqlite3-jni"); } diff --git a/ext/jni/src/org/sqlite/jni/CallbackProxy.java b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/CallbackProxy.java rename to ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java index 086c2f8e5d..0495702561 100644 --- a/ext/jni/src/org/sqlite/jni/CallbackProxy.java +++ b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** This marker interface exists soley for use as a documentation and class-grouping tool. It should be applied to interfaces or diff --git a/ext/jni/src/org/sqlite/jni/CollationCallback.java b/ext/jni/src/org/sqlite/jni/capi/CollationCallback.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/CollationCallback.java rename to ext/jni/src/org/sqlite/jni/capi/CollationCallback.java index 0e35296326..ed8bd09475 100644 --- a/ext/jni/src/org/sqlite/jni/CollationCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/CollationCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import org.sqlite.jni.annotation.NotNull; /** diff --git a/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java b/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/CollationNeededCallback.java rename to ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java index 21b014ba11..fe61fe5065 100644 --- a/ext/jni/src/org/sqlite/jni/CollationNeededCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_collation_needed}. diff --git a/ext/jni/src/org/sqlite/jni/CommitHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java similarity index 95% rename from ext/jni/src/org/sqlite/jni/CommitHookCallback.java rename to ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java index c6e4538bbd..24373bdf2b 100644 --- a/ext/jni/src/org/sqlite/jni/CommitHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_commit_hook}. diff --git a/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java b/ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/ConfigLogCallback.java rename to ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java index d5af70fa52..6513b0730d 100644 --- a/ext/jni/src/org/sqlite/jni/ConfigLogCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A callback for use with sqlite3_config(). diff --git a/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java b/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java rename to ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java index 9a5a201aac..df753e6513 100644 --- a/ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A callback for use with sqlite3_config(). diff --git a/ext/jni/src/org/sqlite/jni/NativePointerHolder.java b/ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/NativePointerHolder.java rename to ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java index 2b0e8cfbdd..e82909e424 100644 --- a/ext/jni/src/org/sqlite/jni/NativePointerHolder.java +++ b/ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A helper for passing pointers between JNI C code and Java, in diff --git a/ext/jni/src/org/sqlite/jni/OutputPointer.java b/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java similarity index 87% rename from ext/jni/src/org/sqlite/jni/OutputPointer.java rename to ext/jni/src/org/sqlite/jni/capi/OutputPointer.java index c6e48ed72f..60b9025386 100644 --- a/ext/jni/src/org/sqlite/jni/OutputPointer.java +++ b/ext/jni/src/org/sqlite/jni/capi/OutputPointer.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Helper classes for handling JNI output pointers. @@ -49,16 +49,16 @@ public final class OutputPointer { code. */ public static final class sqlite3 { - private org.sqlite.jni.sqlite3 value; + private org.sqlite.jni.capi.sqlite3 value; /** Initializes with a null value. */ public sqlite3(){value = null;} /** Sets the current value to null. */ public void clear(){value = null;} /** Returns the current value. */ - public final org.sqlite.jni.sqlite3 get(){return value;} + public final org.sqlite.jni.capi.sqlite3 get(){return value;} /** Equivalent to calling get() then clear(). */ - public final org.sqlite.jni.sqlite3 take(){ - final org.sqlite.jni.sqlite3 v = value; + public final org.sqlite.jni.capi.sqlite3 take(){ + final org.sqlite.jni.capi.sqlite3 v = value; value = null; return v; } @@ -70,16 +70,16 @@ public final class OutputPointer { code. */ public static final class sqlite3_blob { - private org.sqlite.jni.sqlite3_blob value; + private org.sqlite.jni.capi.sqlite3_blob value; /** Initializes with a null value. */ public sqlite3_blob(){value = null;} /** Sets the current value to null. */ public void clear(){value = null;} /** Returns the current value. */ - public final org.sqlite.jni.sqlite3_blob get(){return value;} + public final org.sqlite.jni.capi.sqlite3_blob get(){return value;} /** Equivalent to calling get() then clear(). */ - public final org.sqlite.jni.sqlite3_blob take(){ - final org.sqlite.jni.sqlite3_blob v = value; + public final org.sqlite.jni.capi.sqlite3_blob take(){ + final org.sqlite.jni.capi.sqlite3_blob v = value; value = null; return v; } @@ -92,16 +92,16 @@ public final class OutputPointer { code. */ public static final class sqlite3_stmt { - private org.sqlite.jni.sqlite3_stmt value; + private org.sqlite.jni.capi.sqlite3_stmt value; /** Initializes with a null value. */ public sqlite3_stmt(){value = null;} /** Sets the current value to null. */ public void clear(){value = null;} /** Returns the current value. */ - public final org.sqlite.jni.sqlite3_stmt get(){return value;} + public final org.sqlite.jni.capi.sqlite3_stmt get(){return value;} /** Equivalent to calling get() then clear(). */ - public final org.sqlite.jni.sqlite3_stmt take(){ - final org.sqlite.jni.sqlite3_stmt v = value; + public final org.sqlite.jni.capi.sqlite3_stmt take(){ + final org.sqlite.jni.capi.sqlite3_stmt v = value; value = null; return v; } @@ -114,16 +114,16 @@ public final class OutputPointer { code. */ public static final class sqlite3_value { - private org.sqlite.jni.sqlite3_value value; + private org.sqlite.jni.capi.sqlite3_value value; /** Initializes with a null value. */ public sqlite3_value(){value = null;} /** Sets the current value to null. */ public void clear(){value = null;} /** Returns the current value. */ - public final org.sqlite.jni.sqlite3_value get(){return value;} + public final org.sqlite.jni.capi.sqlite3_value get(){return value;} /** Equivalent to calling get() then clear(). */ - public final org.sqlite.jni.sqlite3_value take(){ - final org.sqlite.jni.sqlite3_value v = value; + public final org.sqlite.jni.capi.sqlite3_value take(){ + final org.sqlite.jni.capi.sqlite3_value v = value; value = null; return v; } diff --git a/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java b/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java rename to ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java index 2599c1cd7f..1c805a9b16 100644 --- a/ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_prepare_multi}. diff --git a/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java rename to ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java index 29088726f0..99d3fb0351 100644 --- a/ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_preupdate_hook}. diff --git a/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java b/ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java rename to ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java index 2bc56665cb..464baa2e3d 100644 --- a/ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_progress_handler}. diff --git a/ext/jni/src/org/sqlite/jni/ResultCode.java b/ext/jni/src/org/sqlite/jni/capi/ResultCode.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/ResultCode.java rename to ext/jni/src/org/sqlite/jni/capi/ResultCode.java index e6f0ad89dc..5a8b2e6a18 100644 --- a/ext/jni/src/org/sqlite/jni/ResultCode.java +++ b/ext/jni/src/org/sqlite/jni/capi/ResultCode.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** This enum contains all of the core and "extended" result codes used diff --git a/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java similarity index 95% rename from ext/jni/src/org/sqlite/jni/RollbackHookCallback.java rename to ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java index bd736e1b76..5ce17e718a 100644 --- a/ext/jni/src/org/sqlite/jni/RollbackHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_rollback_hook}. diff --git a/ext/jni/src/org/sqlite/jni/SQLFunction.java b/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/SQLFunction.java rename to ext/jni/src/org/sqlite/jni/capi/SQLFunction.java index 66119ebe55..4806e2fc0c 100644 --- a/ext/jni/src/org/sqlite/jni/SQLFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** SQLFunction is used in conjunction with the diff --git a/ext/jni/src/org/sqlite/jni/SQLTester.java b/ext/jni/src/org/sqlite/jni/capi/SQLTester.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/SQLTester.java rename to ext/jni/src/org/sqlite/jni/capi/SQLTester.java index 1170c86d92..81d6106be7 100644 --- a/ext/jni/src/org/sqlite/jni/SQLTester.java +++ b/ext/jni/src/org/sqlite/jni/capi/SQLTester.java @@ -12,13 +12,13 @@ ** This file contains the main application entry pointer for the ** SQLTester framework. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import java.util.List; import java.util.ArrayList; import java.util.Arrays; import java.nio.charset.StandardCharsets; import java.util.regex.*; -import static org.sqlite.jni.CApi.*; +import static org.sqlite.jni.capi.CApi.*; /** Modes for how to escape (or not) column values and names from @@ -457,7 +457,7 @@ public class SQLTester { } private void appendDbErr(sqlite3 db, StringBuilder sb, int rc){ - sb.append(org.sqlite.jni.ResultCode.getEntryForInt(rc)).append(' '); + sb.append(org.sqlite.jni.capi.ResultCode.getEntryForInt(rc)).append(' '); final String msg = escapeSqlValue(sqlite3_errmsg(db)); if( '{' == msg.charAt(0) ){ sb.append(msg); diff --git a/ext/jni/src/org/sqlite/jni/ScalarFunction.java b/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/ScalarFunction.java rename to ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java index 73fb58cda2..f517b3610c 100644 --- a/ext/jni/src/org/sqlite/jni/ScalarFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** diff --git a/ext/jni/src/org/sqlite/jni/TableColumnMetadata.java b/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/TableColumnMetadata.java rename to ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java index 70b7c90ec8..d8b6226ac9 100644 --- a/ext/jni/src/org/sqlite/jni/TableColumnMetadata.java +++ b/ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A wrapper object for use with sqlite3_table_column_metadata(). diff --git a/ext/jni/src/org/sqlite/jni/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/Tester1.java rename to ext/jni/src/org/sqlite/jni/capi/Tester1.java index 43ba085fab..5c982ea5ed 100644 --- a/ext/jni/src/org/sqlite/jni/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -11,8 +11,8 @@ ************************************************************************* ** This file contains a set of tests for the sqlite3 JNI bindings. */ -package org.sqlite.jni; -import static org.sqlite.jni.CApi.*; +package org.sqlite.jni.capi; +import static org.sqlite.jni.capi.CApi.*; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.ArrayList; @@ -707,13 +707,13 @@ public class Tester1 implements Runnable { public void xFunc(sqlite3_context cx, sqlite3_value[] args){ affirm(db == sqlite3_context_db_handle(cx)); if( null==neverEverDoThisInClientCode.value ){ + /* !!!NEVER!!! hold a reference to an sqlite3_value or + sqlite3_context object like this in client code! They + are ONLY legal for the duration of their single + call. We do it here ONLY to test that the defenses + against clients doing this are working. */ neverEverDoThisInClientCode2.value = cx; - neverEverDoThisInClientCode.value = args - /* !!!NEVER!!! hold a reference to an sqlite3_value - object like this in client code! They are ONLY legal - for the duration of their single call. We do it here - ONLY to test that the defenses against clients doing - this are working. */; + neverEverDoThisInClientCode.value = args; } int result = 0; for( sqlite3_value v : args ) result += sqlite3_value_int(v); @@ -1323,7 +1323,7 @@ public class Tester1 implements Runnable { } Exception err = null; try { - Class t = Class.forName("org.sqlite.jni.TesterFts5"); + Class t = Class.forName("org.sqlite.jni.fts5.TesterFts5"); java.lang.reflect.Constructor ctor = t.getConstructor(); ctor.setAccessible(true); final long timeStart = System.currentTimeMillis(); diff --git a/ext/jni/src/org/sqlite/jni/TraceV2Callback.java b/ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/TraceV2Callback.java rename to ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java index b16012b60e..56465a2c0a 100644 --- a/ext/jni/src/org/sqlite/jni/TraceV2Callback.java +++ b/ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; import org.sqlite.jni.annotation.Nullable; /** diff --git a/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/UpdateHookCallback.java rename to ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java index 32724be6d4..33d72a5dd2 100644 --- a/ext/jni/src/org/sqlite/jni/UpdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for use with {@link CApi#sqlite3_update_hook}. diff --git a/ext/jni/src/org/sqlite/jni/WindowFunction.java b/ext/jni/src/org/sqlite/jni/capi/WindowFunction.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/WindowFunction.java rename to ext/jni/src/org/sqlite/jni/capi/WindowFunction.java index 7f70177ac0..eaf1bb9a35 100644 --- a/ext/jni/src/org/sqlite/jni/WindowFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/WindowFunction.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** diff --git a/ext/jni/src/org/sqlite/jni/XDestroyCallback.java b/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/XDestroyCallback.java rename to ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java index 4b547e6bc9..372e4ec8d0 100644 --- a/ext/jni/src/org/sqlite/jni/XDestroyCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file declares JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** Callback for a hook called by SQLite when certain client-provided diff --git a/ext/jni/src/org/sqlite/jni/package-info.java b/ext/jni/src/org/sqlite/jni/capi/package-info.java similarity index 98% rename from ext/jni/src/org/sqlite/jni/package-info.java rename to ext/jni/src/org/sqlite/jni/capi/package-info.java index d669e680f7..127f380675 100644 --- a/ext/jni/src/org/sqlite/jni/package-info.java +++ b/ext/jni/src/org/sqlite/jni/capi/package-info.java @@ -2,7 +2,7 @@ This package houses a JNI binding to the SQLite3 C API.

    The primary interfaces are in {@link - org.sqlite.jni.CApi}.

    + org.sqlite.jni.capi.CApi}.

    API Goals and Requirements

    @@ -86,4 +86,4 @@ undefined behavior.

    */ -package org.sqlite.jni; +package org.sqlite.jni.capi; diff --git a/ext/jni/src/org/sqlite/jni/sqlite3.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3.java similarity index 97% rename from ext/jni/src/org/sqlite/jni/sqlite3.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3.java index c358e91c8f..901317f0ef 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A wrapper for communicating C-level (sqlite3*) instances with diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_backup.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/sqlite3_backup.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java index 232b001818..0ef75c17eb 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_backup.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A wrapper for passing C-level (sqlite3_backup*) instances around in diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_blob.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/sqlite3_blob.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java index f84b848a40..1b96c18b06 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_blob.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A wrapper for passing C-level (sqlite3_blob*) instances around in diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_context.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/sqlite3_context.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java index 22bc62ab46..82ec49af16 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_context.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** sqlite3_context instances are used in conjunction with user-defined diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/sqlite3_stmt.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java index e773b73631..3b8b71f8a5 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_stmt.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; /** A wrapper for communicating C-level (sqlite3_stmt*) instances with diff --git a/ext/jni/src/org/sqlite/jni/sqlite3_value.java b/ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java similarity index 95% rename from ext/jni/src/org/sqlite/jni/sqlite3_value.java rename to ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java index 2cfb32ff1a..a4772f0f63 100644 --- a/ext/jni/src/org/sqlite/jni/sqlite3_value.java +++ b/ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java @@ -11,7 +11,7 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.capi; public final class sqlite3_value extends NativePointerHolder { //! Invoked only from JNI. diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java index a5b937ceb8..439b477910 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java +++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java @@ -12,7 +12,7 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni.fts5; -import org.sqlite.jni.*; +import org.sqlite.jni.capi.*; /** A wrapper for communicating C-level (Fts5Context*) instances with diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java index 7829104cd9..594f3eaad6 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java +++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java @@ -13,7 +13,7 @@ */ package org.sqlite.jni.fts5; import java.nio.charset.StandardCharsets; -import org.sqlite.jni.*; +import org.sqlite.jni.capi.*; import org.sqlite.jni.annotation.*; /** diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java index 0f8f3e551b..5774eb5936 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java +++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java @@ -12,7 +12,7 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni.fts5; -import org.sqlite.jni.NativePointerHolder; +import org.sqlite.jni.capi.NativePointerHolder; /** A wrapper for C-level Fts5PhraseIter. They are only modified and diff --git a/ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java b/ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java index 1992438448..b72e5d0fc0 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java +++ b/ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java @@ -12,7 +12,7 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni.fts5; -import org.sqlite.jni.NativePointerHolder; +import org.sqlite.jni.capi.NativePointerHolder; /** INCOMPLETE AND COMPLETELY UNTESTED. diff --git a/ext/jni/src/org/sqlite/jni/TesterFts5.java b/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java similarity index 99% rename from ext/jni/src/org/sqlite/jni/TesterFts5.java rename to ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java index 04cc7dbcfb..c4264c5417 100644 --- a/ext/jni/src/org/sqlite/jni/TesterFts5.java +++ b/ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java @@ -11,10 +11,10 @@ ************************************************************************* ** This file contains a set of tests for the sqlite3 JNI bindings. */ -package org.sqlite.jni; -import static org.sqlite.jni.CApi.*; -import static org.sqlite.jni.Tester1.*; -import org.sqlite.jni.*; +package org.sqlite.jni.fts5; +import static org.sqlite.jni.capi.CApi.*; +import static org.sqlite.jni.capi.Tester1.*; +import org.sqlite.jni.capi.*; import org.sqlite.jni.fts5.*; import java.util.*; diff --git a/ext/jni/src/org/sqlite/jni/fts5/fts5_api.java b/ext/jni/src/org/sqlite/jni/fts5/fts5_api.java index 3172dc8306..d7d2da430d 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/fts5_api.java +++ b/ext/jni/src/org/sqlite/jni/fts5/fts5_api.java @@ -13,7 +13,7 @@ */ package org.sqlite.jni.fts5; import org.sqlite.jni.annotation.*; -import org.sqlite.jni.*; +import org.sqlite.jni.capi.*; /** A wrapper for communicating C-level (fts5_api*) instances with diff --git a/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java b/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java index 7ed353ac0b..5e47633baa 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java +++ b/ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java @@ -12,8 +12,8 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni.fts5; -import org.sqlite.jni.sqlite3_context; -import org.sqlite.jni.sqlite3_value; +import org.sqlite.jni.capi.sqlite3_context; +import org.sqlite.jni.capi.sqlite3_value; /** JNI-level wrapper for C's fts5_extension_function type. diff --git a/ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java b/ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java index d442fe9aaa..f4ada4dc30 100644 --- a/ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java +++ b/ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java @@ -12,7 +12,7 @@ ** This file is part of the JNI bindings for the sqlite3 C API. */ package org.sqlite.jni.fts5; -import org.sqlite.jni.NativePointerHolder; +import org.sqlite.jni.capi.NativePointerHolder; import org.sqlite.jni.annotation.NotNull; /** diff --git a/ext/jni/src/org/sqlite/jni/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java similarity index 96% rename from ext/jni/src/org/sqlite/jni/Sqlite.java rename to ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 5c2c456296..aaa1fe67fc 100644 --- a/ext/jni/src/org/sqlite/jni/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -11,9 +11,12 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; +package org.sqlite.jni.wrapper1; import java.nio.charset.StandardCharsets; -import static org.sqlite.jni.CApi.*; +import static org.sqlite.jni.capi.CApi.*; +import org.sqlite.jni.capi.sqlite3; +import org.sqlite.jni.capi.sqlite3_stmt; +import org.sqlite.jni.capi.OutputPointer; /** This class represents a database connection, analog to the C-side diff --git a/ext/jni/src/org/sqlite/jni/SqliteException.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java similarity index 95% rename from ext/jni/src/org/sqlite/jni/SqliteException.java rename to ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java index c15cb34919..87b0d3737f 100644 --- a/ext/jni/src/org/sqlite/jni/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java @@ -11,8 +11,9 @@ ************************************************************************* ** This file is part of the JNI bindings for the sqlite3 C API. */ -package org.sqlite.jni; -import static org.sqlite.jni.CApi.*; +package org.sqlite.jni.wrapper1; +import static org.sqlite.jni.capi.CApi.*; +import org.sqlite.jni.capi.sqlite3; /** A wrapper for communicating C-level (sqlite3*) instances with diff --git a/ext/jni/src/org/sqlite/jni/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java similarity index 94% rename from ext/jni/src/org/sqlite/jni/Tester2.java rename to ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index e75f56e064..435c37425d 100644 --- a/ext/jni/src/org/sqlite/jni/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -11,15 +11,32 @@ ************************************************************************* ** This file contains a set of tests for the sqlite3 JNI bindings. */ -package org.sqlite.jni; -import static org.sqlite.jni.CApi.*; +package org.sqlite.jni.wrapper1; +import static org.sqlite.jni.capi.CApi.*; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; +import org.sqlite.jni.capi.*; + +/** + An annotation for Tester1 tests which we do not want to run in + reflection-driven test mode because either they are not suitable + for multi-threaded threaded mode or we have to control their execution + order. +*/ +@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) +@interface ManualTest{} +/** + Annotation for Tester1 tests which mark those which must be skipped + in multi-threaded mode. +*/ +@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) +@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) +@interface SingleThreadOnly{} public class Tester2 implements Runnable { //! True when running in multi-threaded mode. diff --git a/manifest b/manifest index 482917dfef..2e440bcd40 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\safter\scalling\sa\sJava-side\sUDF,\szero-out\sthe\spointer\sof\sthe\sJava-side\ssqlite3_context\sand\ssqlite3_value\sarray\sentries\sto\savoid\smisbehavior\sif\sa\sclient\smakes\sthe\smistake\sof\sholding\sa\sreference\sto\sone\sof\sthose\sobjects. -D 2023-10-16T08:10:11.732 +C JNI:\smove\sthe\sC-style\sAPI\sparts\sinto\sthe\scapi\ssubpackage\sand\sthe\shigher-level\swrapper\sinto\s(tentatively)\swrapper1,\sso\sthat\sCApi.java\scan\ssupport\smultiple\sindependent\shigher-level\swrappers\swithout\sname\scollisions,\sand\sCApi\scan\sbe\smade\spublic\sbut\shave\sthe\soption\sto\sbe\selided\sfrom\swrapper-level\sjavadocs\sfor\swrappers\swhich\sdo\snot\swish\sto\sexpose\sit. +D 2023-10-16T10:27:19.982 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,63 +235,63 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile efaf1db6e3c2bbae4067924b932ee1a0f0640e842002c0dd9f3be824c24084f5 +F ext/jni/GNUmakefile 951ced121cce68b27086ab4dd5d9c6ba493507b2aa3ad396abe3ee352fc76170 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c fa78ee087d493dba500c55797a77d57591d36be45e983b66222b9de6dd498ab9 -F ext/jni/src/c/sqlite3-jni.h e7c19450b691aeb12a1506521432144b5d07031683e0fbaad7dfcb9a0c8d69d7 -F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436 -F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4 -F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java fde5f758ad170ca45ae00b12194c8ba8d8f3090bd64cc3e002dd9c5e7dff8568 -F ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java c0fbfd3779fc92982c7935325a7484dee43eeb80d716989ed31218f453addb94 -F ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java 4cb7fc70efd55583fed6033c34a8719da42975ca97ef4781dda0b9f6cc8ec2e8 -F ext/jni/src/org/sqlite/jni/CApi.java ab05a2ad4237b95e96ac5acf9ce28f1432f0862546444fc2f6265b6998e14860 -F ext/jni/src/org/sqlite/jni/CallbackProxy.java 064a8a00e4c63cc501c30504f93ca996d422c5f010067f969b2d0a10f0868153 -F ext/jni/src/org/sqlite/jni/CollationCallback.java 8cf57cb014a645ecc12609eed17308852a597bc5e83d82a4fdb90f7fadc25f9d -F ext/jni/src/org/sqlite/jni/CollationNeededCallback.java 0c62245e000d5db52576c728cac20f6a31f31f5cf40ca4cbcd64b22964e82ae5 -F ext/jni/src/org/sqlite/jni/CommitHookCallback.java d15bd87ca6159a48b281966cf7a6e67dd17e2fabf974a797c9e3a66a74f361e8 -F ext/jni/src/org/sqlite/jni/ConfigLogCallback.java 16bb391d8d4ae89cc43baa3cfa0c80c988003627b7ea872deb41156a76f7e867 -F ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java 6d6b64638123acb70ffefcd5d2345b1bea3d3b528727d1684cc20cc2357f03a0 -F ext/jni/src/org/sqlite/jni/NativePointerHolder.java 3eb36b5e81993a847f5ec03d23ab219a92671f817547b6a85d312667faeedd8b -F ext/jni/src/org/sqlite/jni/OutputPointer.java 2f57c05672ddc9b38e3f8eed11759896cf0bf01107ffd24d5182b99f6e7254b6 -F ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java 6f051951fecab41f2e842b1ac1d3c498706de9387c86f62564e2afbe03d026cb -F ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java 242dc2afea13c45b4809d41b6a919e0a4003508713ceffe5f6545270138c6a7b -F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 247a47f49a1dd54fda28201c27796d2600a5c904f47fa21697a5377d49febe56 -F ext/jni/src/org/sqlite/jni/ResultCode.java dc7400b8b18df10027525d8d0f04300b2c6afc617d4d980923f8b5bb14412f3a -F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java ec6cd96bff5d3bc5af079cbf1469ae7fb34c50583a23581a58d6b2f8b55bafd3 -F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c -F ext/jni/src/org/sqlite/jni/SQLTester.java d246c67f93e2fa2603bd106dbb3246ea725c987dffd6e5d42214ae262f750c68 -F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c -F ext/jni/src/org/sqlite/jni/Sqlite.java 1617ea2bf3dfa493b7f031a3187cbfd6837c39bc1d406c4b3edcf9aab941639d -F ext/jni/src/org/sqlite/jni/SqliteException.java e17500e8bca2c68c260d8d0163fe4b7dc8bd0b1b90211201325c4a5566ce75ca -F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab -F ext/jni/src/org/sqlite/jni/Tester1.java 865cc3a23f9aeec5c70b362633037d166697f97f88eccd4024085814c4c95dbd -F ext/jni/src/org/sqlite/jni/Tester2.java 70e005d41060e398ec0f69bd39a8e1c376fd51f81629cf25e877889ec9cb6ec6 -F ext/jni/src/org/sqlite/jni/TesterFts5.java d60fe9944a81156b3b5325dd1b0e8e92a1547468f39fd1266d06f7bb6a95fa70 -F ext/jni/src/org/sqlite/jni/TraceV2Callback.java f157edd9c72e7d2243c169061487cd7bb51a0d50f3ac976dbcbbacf748ab1fc2 -F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java 959d4677a857c9079c6e96ddd10918b946d68359af6252b6f284379069ea3d27 -F ext/jni/src/org/sqlite/jni/WindowFunction.java 488980f4dbb6bdd7067d6cb9c43e4075475e51c54d9b74a5834422654b126246 -F ext/jni/src/org/sqlite/jni/XDestroyCallback.java 50c5ca124ef6c6b735a7e136e7a23a557be367e61b56d4aab5777a614ab46cc2 +F ext/jni/src/c/sqlite3-jni.c 8d32ca0598a11370a9e92a6d111f38934c225056b42b13512175acf6e37eed4c +F ext/jni/src/c/sqlite3-jni.h b4c413a0d0c734683da1049cfcf89e35ae2719759d0656ec0f8c57188f18cab8 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca +F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c w ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java +F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f935f5b7264c1c1026864e50a4a735192864f75e37c0 w ext/jni/src/org/sqlite/jni/AggregateFunction.java +F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 w ext/jni/src/org/sqlite/jni/AuthorizerCallback.java +F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 w ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java +F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca w ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java +F ext/jni/src/org/sqlite/jni/capi/CApi.java 82993492793fd946e2b9b9a244fe5ac39647292b449cac7453ea49031c00f517 w ext/jni/src/org/sqlite/jni/CApi.java +F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d w ext/jni/src/org/sqlite/jni/CallbackProxy.java +F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a w ext/jni/src/org/sqlite/jni/CollationCallback.java +F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 w ext/jni/src/org/sqlite/jni/CollationNeededCallback.java +F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 w ext/jni/src/org/sqlite/jni/CommitHookCallback.java +F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4 w ext/jni/src/org/sqlite/jni/ConfigLogCallback.java +F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbeeb56315d15b13d8752b0fdbca705f31bd4366c58d8a33 w ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java +F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 w ext/jni/src/org/sqlite/jni/NativePointerHolder.java +F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 68f60aec7aeb5cd4e5fb83449037f668c63cb99f682ee1036cc226d0cbd909b9 w ext/jni/src/org/sqlite/jni/OutputPointer.java +F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java aca8f9fa72e3b6602bc9a7dd3ae9f5b2808103fbbee9b2749dc96c19cdc261a1 w ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java +F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17ca4b7ddde1d8cd6915b6ab7b708249a9787beca6bd6b6 w ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java +F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b w ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java +F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f w ext/jni/src/org/sqlite/jni/ResultCode.java +F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 w ext/jni/src/org/sqlite/jni/RollbackHookCallback.java +F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bdf97fa8a4f6b3b6577c9660dd7bd6a6d3c4a w ext/jni/src/org/sqlite/jni/SQLFunction.java +F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 w ext/jni/src/org/sqlite/jni/SQLTester.java +F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java dee85ef2650a9c95067f5d55bd6e290e0404e6643a5d115d1a1533df21f9b5c8 w ext/jni/src/org/sqlite/jni/ScalarFunction.java +F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f w ext/jni/src/org/sqlite/jni/TableColumnMetadata.java +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8aacea90b0eed6e4e801cfba2515a66b5d602e124f1ba68fe3d2f0aa98f0f443 w ext/jni/src/org/sqlite/jni/Tester1.java +F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 w ext/jni/src/org/sqlite/jni/TraceV2Callback.java +F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 w ext/jni/src/org/sqlite/jni/UpdateHookCallback.java +F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e w ext/jni/src/org/sqlite/jni/WindowFunction.java +F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d w ext/jni/src/org/sqlite/jni/XDestroyCallback.java +F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e w ext/jni/src/org/sqlite/jni/package-info.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3.java 4010bbebc5bf44e2044e610786088cdee7dc155da2b333c0551492ff1cedf33b w ext/jni/src/org/sqlite/jni/sqlite3.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227 w ext/jni/src/org/sqlite/jni/sqlite3_backup.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java f204ab6ab1263e119fe43730141a00662d80972129a5351dfb11aae5d282df36 w ext/jni/src/org/sqlite/jni/sqlite3_blob.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22 w ext/jni/src/org/sqlite/jni/sqlite3_context.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java ff579621e9bd5ffbc6b2ef9f996c12db4df6e0c8cc5697c91273e5fca279fcf8 w ext/jni/src/org/sqlite/jni/sqlite3_stmt.java +F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049 w ext/jni/src/org/sqlite/jni/sqlite3_value.java F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41 -F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 7058da97059b8e156c17561a47ecd7faa0fc3e2d8c2588b9a28dbff8d06202dd -F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java c8e06475a6172a7cd61b2bad9cfb18b6f059ffdd2935e62856f95785a14fe0e5 -F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 2a7f3d76a1206e6a43d4c4ed9609b294d5431cc7d8fb875d8419f76efa6e56dc -F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java cc9a53846a168a215238af224c31cef0e8379780e36e8a5e743b00c08145cf19 +F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 338637e6e5a2cc385d962b220f3c1f475cc371d12ae43d18ef27327b6e6225f7 +F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java 7da0fbb5728f7c056a43e6407f13dd0c7c9c445221267786a109b987f5fc8a9d +F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 28045042d593a1f1b9b80d54ec77cbf1d8a1bc95e442eceefa9a3a6f56600b0e +F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java 3c8f677ffb85b8782f865d6fcbc16200b3375d0e3c29ed541a494fde3011bf49 +F ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java eaee4d641229a098eb704b96a45c9a23c6514dc39009d3611e265bab33834deb w ext/jni/src/org/sqlite/jni/TesterFts5.java F ext/jni/src/org/sqlite/jni/fts5/XTokenizeCallback.java 1efd1220ea328a32f2d2a1b16c735864159e929480f71daad4de9d5944839167 -F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java 90f09477331c371a8abe0a6504cfe094bc075b29a800be9d72a2c92a7bb49db1 -F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 1fe0f5692c1d67475d12b067f0469949073446f18c56eba5ee5da6ddd06db9b9 -F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java ea993738b851038c16d98576abd0db3d6028a231f075a394fb8a78c7834d0f6c -F ext/jni/src/org/sqlite/jni/package-info.java 7d465cbdf9050761db0db6d0c542afaaad7dc67f61510860592159c48bfc40e8 -F ext/jni/src/org/sqlite/jni/sqlite3.java 4fa76f9c618264ed17ab613570076002c0b78717261b263350cd92d6d6b01242 -F ext/jni/src/org/sqlite/jni/sqlite3_backup.java 42db8b2f9cd8e9e16217273890e5d4afbb102603d7130a2cb1651f1c69c1cfa4 -F ext/jni/src/org/sqlite/jni/sqlite3_blob.java 7c341bca1856475fc3bf3697251e0cf1d737ddcb099c65d90afdc164aaddcc51 -F ext/jni/src/org/sqlite/jni/sqlite3_context.java ba8da75eaaeb557c986af3fb4dbc69501cf2b083ca33497f2c0c70dbc0a53f2c -F ext/jni/src/org/sqlite/jni/sqlite3_stmt.java fa0703004721c49d6d08a0c1e99439fadb8cebaebf42b81ee3f427d7f950d1eb -F ext/jni/src/org/sqlite/jni/sqlite3_value.java 3d1d4903e267bc0bc81d57d21f5e85978eff389a1a6ed46726dbe75f85e6914a +F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653fead88f8f4953376178d9c7385b197ea +F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 +F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java f05ee6c52b039bb5b65e49ac90710f58cbfc95e13e5a8d46a7fe5106d5819dad w ext/jni/src/org/sqlite/jni/Sqlite.java +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 039f6f858cd6a0f59a41f0823d638959d8f47e7098dd469c486988494d651896 w ext/jni/src/org/sqlite/jni/SqliteException.java +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 7f5aa5a74ad1b01339c7fefe2a3a89b2b3a7b45449d02aa77ca353fadb5045bf w ext/jni/src/org/sqlite/jni/Tester2.java F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2b4e53d8be42a3bc098317abd8bb58b8ddc25094d80787f784bbc896f4f7b976 -R e7086cafa37f4c64d76125756c139d05 +P 9fc3104f76a83d600beb11d91feb97bcea8bc7f7cda8cd73e7a6b81fbba879df +R 07d421243ac464d8cea8c99cca226bef U stephan -Z 15d3510e65023cee802402770fb1df4a +Z 86e6158301bdc6bca12dead7ccadc137 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 71558f81fb..82f34fe35b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9fc3104f76a83d600beb11d91feb97bcea8bc7f7cda8cd73e7a6b81fbba879df \ No newline at end of file +9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b \ No newline at end of file From 7e540e5a2cbbc70dffeaed1877c1a5aa6fdf4d39 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 10:38:34 +0000 Subject: [PATCH 081/242] JNI: cleanups in Tester2 and update the jar makefile target to account for [9fcdf96adca2]. FossilOrigin-Name: abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6 --- ext/jni/GNUmakefile | 3 +- .../src/org/sqlite/jni/wrapper1/Tester2.java | 68 +++++++------- manifest | 90 +++++++++---------- manifest.uuid | 2 +- 4 files changed, 81 insertions(+), 82 deletions(-) diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 6b09514e1c..cc53cf8d15 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -383,8 +383,7 @@ JAVA_FILES.jar := $(JAVA_FILES.main) $(JAVA_FILES.unittest) $(JAVA_FILES.package CLASS_FILES.jar := $(filter-out %/package-info.class,$(JAVA_FILES.jar:.java=.class)) $(package.jar.in): $(package.dll) $(MAKEFILE) ls -1 \ - $(dir.src.jni)/*.java $(dir.src.jni)/*.class \ - $(dir.src.jni)/annotation/*.java $(dir.src.jni)/annotation/*.class \ + $(dir.src.jni)/*/*.java $(dir.src.jni)/*/*.class \ | sed -e 's,^$(dir.src)/,,' | sort > $@ $(package.jar): $(CLASS_FILES.jar) $(MAKEFILE) $(package.jar.in) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 435c37425d..73f07b1561 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -12,7 +12,7 @@ ** This file contains a set of tests for the sqlite3 JNI bindings. */ package org.sqlite.jni.wrapper1; -import static org.sqlite.jni.capi.CApi.*; +//import static org.sqlite.jni.capi.CApi.*; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.ArrayList; @@ -22,7 +22,7 @@ import java.util.concurrent.Executors; import org.sqlite.jni.capi.*; /** - An annotation for Tester1 tests which we do not want to run in + An annotation for Tester2 tests which we do not want to run in reflection-driven test mode because either they are not suitable for multi-threaded threaded mode or we have to control their execution order. @@ -31,7 +31,7 @@ import org.sqlite.jni.capi.*; @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) @interface ManualTest{} /** - Annotation for Tester1 tests which mark those which must be skipped + Annotation for Tester2 tests which mark those which must be skipped in multi-threaded mode. */ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @@ -126,7 +126,7 @@ public class Tester2 implements Runnable { @SingleThreadOnly /* because it's thread-agnostic */ private void test1(){ - affirm(sqlite3_libversion_number() == SQLITE_VERSION_NUMBER); + affirm(CApi.sqlite3_libversion_number() == CApi.SQLITE_VERSION_NUMBER); } /* Copy/paste/rename this to add new tests. */ @@ -144,9 +144,9 @@ public class Tester2 implements Runnable { } Sqlite openDb(String name){ - return Sqlite.open(name, SQLITE_OPEN_READWRITE| - SQLITE_OPEN_CREATE| - SQLITE_OPEN_EXRESCODE); + return Sqlite.open(name, CApi.SQLITE_OPEN_READWRITE| + CApi.SQLITE_OPEN_CREATE| + CApi.SQLITE_OPEN_EXRESCODE); } Sqlite openDb(){ return openDb(":memory:"); } @@ -174,16 +174,16 @@ public class Tester2 implements Runnable { try (Sqlite db = openDb()) { Sqlite.Stmt stmt = db.prepare("SELECT 1"); affirm( null!=stmt.nativeHandle() ); - affirm( SQLITE_ROW == stmt.step() ); - affirm( SQLITE_DONE == stmt.step() ); + affirm( CApi.SQLITE_ROW == stmt.step() ); + affirm( CApi.SQLITE_DONE == stmt.step() ); stmt.reset(); - affirm( SQLITE_ROW == stmt.step() ); - affirm( SQLITE_DONE == stmt.step() ); + affirm( CApi.SQLITE_ROW == stmt.step() ); + affirm( CApi.SQLITE_DONE == stmt.step() ); affirm( 0 == stmt.finalizeStmt() ); affirm( null==stmt.nativeHandle() ); stmt = db.prepare("SELECT 1"); - affirm( SQLITE_ROW == stmt.step() ); + affirm( CApi.SQLITE_ROW == stmt.step() ); affirm( 0 == stmt.finalizeStmt() ) /* getting a non-0 out of sqlite3_finalize() is tricky */; affirm( null==stmt.nativeHandle() ); @@ -236,8 +236,8 @@ public class Tester2 implements Runnable { listErrors.add(e); } }finally{ - affirm( sqlite3_java_uncache_thread() ); - affirm( !sqlite3_java_uncache_thread() ); + affirm( CApi.sqlite3_java_uncache_thread() ); + affirm( !CApi.sqlite3_java_uncache_thread() ); } } @@ -307,7 +307,7 @@ public class Tester2 implements Runnable { } if( sqlLog ){ - if( sqlite3_compileoption_used("ENABLE_SQLLOG") ){ + if( CApi.sqlite3_compileoption_used("ENABLE_SQLLOG") ){ final ConfigSqllogCallback log = new ConfigSqllogCallback() { @Override public void call(sqlite3 db, String msg, int op){ switch(op){ @@ -317,11 +317,11 @@ public class Tester2 implements Runnable { } } }; - int rc = sqlite3_config( log ); + int rc = CApi.sqlite3_config( log ); affirm( 0==rc ); - rc = sqlite3_config( (ConfigSqllogCallback)null ); + rc = CApi.sqlite3_config( (ConfigSqllogCallback)null ); affirm( 0==rc ); - rc = sqlite3_config( log ); + rc = CApi.sqlite3_config( log ); affirm( 0==rc ); }else{ outln("WARNING: -sqllog is not active because library was built ", @@ -334,11 +334,11 @@ public class Tester2 implements Runnable { outln("ConfigLogCallback: ",ResultCode.getEntryForInt(code),": ", msg); }; }; - int rc = sqlite3_config( log ); + int rc = CApi.sqlite3_config( log ); affirm( 0==rc ); - rc = sqlite3_config( (ConfigLogCallback)null ); + rc = CApi.sqlite3_config( (ConfigLogCallback)null ); affirm( 0==rc ); - rc = sqlite3_config( log ); + rc = CApi.sqlite3_config( log ); affirm( 0==rc ); } @@ -373,33 +373,33 @@ public class Tester2 implements Runnable { final long timeStart = System.currentTimeMillis(); int nLoop = 0; - switch( sqlite3_threadsafe() ){ /* Sanity checking */ + switch( CApi.sqlite3_threadsafe() ){ /* Sanity checking */ case 0: - affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ), + affirm( CApi.SQLITE_ERROR==CApi.sqlite3_config( CApi.SQLITE_CONFIG_SINGLETHREAD ), "Could not switch to single-thread mode." ); - affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_MULTITHREAD ), + affirm( CApi.SQLITE_ERROR==CApi.sqlite3_config( CApi.SQLITE_CONFIG_MULTITHREAD ), "Could switch to multithread mode." ); - affirm( SQLITE_ERROR==sqlite3_config( SQLITE_CONFIG_SERIALIZED ), + affirm( CApi.SQLITE_ERROR==CApi.sqlite3_config( CApi.SQLITE_CONFIG_SERIALIZED ), "Could not switch to serialized threading mode." ); outln("This is a single-threaded build. Not using threads."); nThread = 1; break; case 1: case 2: - affirm( 0==sqlite3_config( SQLITE_CONFIG_SINGLETHREAD ), + affirm( 0==CApi.sqlite3_config( CApi.SQLITE_CONFIG_SINGLETHREAD ), "Could not switch to single-thread mode." ); - affirm( 0==sqlite3_config( SQLITE_CONFIG_MULTITHREAD ), + affirm( 0==CApi.sqlite3_config( CApi.SQLITE_CONFIG_MULTITHREAD ), "Could not switch to multithread mode." ); - affirm( 0==sqlite3_config( SQLITE_CONFIG_SERIALIZED ), + affirm( 0==CApi.sqlite3_config( CApi.SQLITE_CONFIG_SERIALIZED ), "Could not switch to serialized threading mode." ); break; default: affirm( false, "Unhandled SQLITE_THREADSAFE value." ); } outln("libversion_number: ", - sqlite3_libversion_number(),"\n", - sqlite3_libversion(),"\n",SQLITE_SOURCE_ID,"\n", - "SQLITE_THREADSAFE=",sqlite3_threadsafe()); + CApi.sqlite3_libversion_number(),"\n", + CApi.sqlite3_libversion(),"\n",CApi.SQLITE_SOURCE_ID,"\n", + "SQLITE_THREADSAFE=",CApi.sqlite3_threadsafe()); final boolean showLoopCount = (nRepeat>1 && nThread>1); if( showLoopCount ){ outln("Running ",nRepeat," loop(s) with ",nThread," thread(s) each."); @@ -444,10 +444,10 @@ public class Tester2 implements Runnable { outln("\tAssertions checked: ",affirmCount); outln("\tDatabases opened: ",metrics.dbOpen); if( doSomethingForDev ){ - sqlite3_jni_internal_details(); + CApi.sqlite3_jni_internal_details(); } - affirm( 0==sqlite3_release_memory(1) ); - sqlite3_shutdown(); + affirm( 0==CApi.sqlite3_release_memory(1) ); + CApi.sqlite3_shutdown(); int nMethods = 0; int nNatives = 0; int nCanonical = 0; diff --git a/manifest b/manifest index 2e440bcd40..891a5e2aef 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\smove\sthe\sC-style\sAPI\sparts\sinto\sthe\scapi\ssubpackage\sand\sthe\shigher-level\swrapper\sinto\s(tentatively)\swrapper1,\sso\sthat\sCApi.java\scan\ssupport\smultiple\sindependent\shigher-level\swrappers\swithout\sname\scollisions,\sand\sCApi\scan\sbe\smade\spublic\sbut\shave\sthe\soption\sto\sbe\selided\sfrom\swrapper-level\sjavadocs\sfor\swrappers\swhich\sdo\snot\swish\sto\sexpose\sit. -D 2023-10-16T10:27:19.982 +C JNI:\scleanups\sin\sTester2\sand\supdate\sthe\sjar\smakefile\starget\sto\saccount\sfor\s[9fcdf96adca2]. +D 2023-10-16T10:38:34.125 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 951ced121cce68b27086ab4dd5d9c6ba493507b2aa3ad396abe3ee352fc76170 +F ext/jni/GNUmakefile bf7dbc177903a180aaa45540483d49185abb5e032c08773a36eb7983281b7ab0 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c 8d32ca0598a11370a9e92a6d111f38934c225056b42b13512175acf6e37eed4c @@ -243,55 +243,55 @@ F ext/jni/src/c/sqlite3-jni.h b4c413a0d0c734683da1049cfcf89e35ae2719759d0656ec0f F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca -F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c w ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java -F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f935f5b7264c1c1026864e50a4a735192864f75e37c0 w ext/jni/src/org/sqlite/jni/AggregateFunction.java -F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 w ext/jni/src/org/sqlite/jni/AuthorizerCallback.java -F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 w ext/jni/src/org/sqlite/jni/AutoExtensionCallback.java -F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca w ext/jni/src/org/sqlite/jni/BusyHandlerCallback.java -F ext/jni/src/org/sqlite/jni/capi/CApi.java 82993492793fd946e2b9b9a244fe5ac39647292b449cac7453ea49031c00f517 w ext/jni/src/org/sqlite/jni/CApi.java -F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d w ext/jni/src/org/sqlite/jni/CallbackProxy.java -F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a w ext/jni/src/org/sqlite/jni/CollationCallback.java -F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 w ext/jni/src/org/sqlite/jni/CollationNeededCallback.java -F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 w ext/jni/src/org/sqlite/jni/CommitHookCallback.java -F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4 w ext/jni/src/org/sqlite/jni/ConfigLogCallback.java -F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbeeb56315d15b13d8752b0fdbca705f31bd4366c58d8a33 w ext/jni/src/org/sqlite/jni/ConfigSqllogCallback.java -F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 w ext/jni/src/org/sqlite/jni/NativePointerHolder.java -F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 68f60aec7aeb5cd4e5fb83449037f668c63cb99f682ee1036cc226d0cbd909b9 w ext/jni/src/org/sqlite/jni/OutputPointer.java -F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java aca8f9fa72e3b6602bc9a7dd3ae9f5b2808103fbbee9b2749dc96c19cdc261a1 w ext/jni/src/org/sqlite/jni/PrepareMultiCallback.java -F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17ca4b7ddde1d8cd6915b6ab7b708249a9787beca6bd6b6 w ext/jni/src/org/sqlite/jni/PreupdateHookCallback.java -F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b w ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java -F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f w ext/jni/src/org/sqlite/jni/ResultCode.java -F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 w ext/jni/src/org/sqlite/jni/RollbackHookCallback.java -F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bdf97fa8a4f6b3b6577c9660dd7bd6a6d3c4a w ext/jni/src/org/sqlite/jni/SQLFunction.java -F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 w ext/jni/src/org/sqlite/jni/SQLTester.java -F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java dee85ef2650a9c95067f5d55bd6e290e0404e6643a5d115d1a1533df21f9b5c8 w ext/jni/src/org/sqlite/jni/ScalarFunction.java -F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f w ext/jni/src/org/sqlite/jni/TableColumnMetadata.java -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8aacea90b0eed6e4e801cfba2515a66b5d602e124f1ba68fe3d2f0aa98f0f443 w ext/jni/src/org/sqlite/jni/Tester1.java -F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 w ext/jni/src/org/sqlite/jni/TraceV2Callback.java -F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 w ext/jni/src/org/sqlite/jni/UpdateHookCallback.java -F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e w ext/jni/src/org/sqlite/jni/WindowFunction.java -F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d w ext/jni/src/org/sqlite/jni/XDestroyCallback.java -F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e w ext/jni/src/org/sqlite/jni/package-info.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3.java 4010bbebc5bf44e2044e610786088cdee7dc155da2b333c0551492ff1cedf33b w ext/jni/src/org/sqlite/jni/sqlite3.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227 w ext/jni/src/org/sqlite/jni/sqlite3_backup.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java f204ab6ab1263e119fe43730141a00662d80972129a5351dfb11aae5d282df36 w ext/jni/src/org/sqlite/jni/sqlite3_blob.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22 w ext/jni/src/org/sqlite/jni/sqlite3_context.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java ff579621e9bd5ffbc6b2ef9f996c12db4df6e0c8cc5697c91273e5fca279fcf8 w ext/jni/src/org/sqlite/jni/sqlite3_stmt.java -F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049 w ext/jni/src/org/sqlite/jni/sqlite3_value.java +F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c +F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f935f5b7264c1c1026864e50a4a735192864f75e37c0 +F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 +F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 +F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca +F ext/jni/src/org/sqlite/jni/capi/CApi.java 82993492793fd946e2b9b9a244fe5ac39647292b449cac7453ea49031c00f517 +F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d +F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a +F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 +F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 +F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4 +F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbeeb56315d15b13d8752b0fdbca705f31bd4366c58d8a33 +F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 +F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 68f60aec7aeb5cd4e5fb83449037f668c63cb99f682ee1036cc226d0cbd909b9 +F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java aca8f9fa72e3b6602bc9a7dd3ae9f5b2808103fbbee9b2749dc96c19cdc261a1 +F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17ca4b7ddde1d8cd6915b6ab7b708249a9787beca6bd6b6 +F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b +F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f +F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 +F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bdf97fa8a4f6b3b6577c9660dd7bd6a6d3c4a +F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 +F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java dee85ef2650a9c95067f5d55bd6e290e0404e6643a5d115d1a1533df21f9b5c8 +F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8aacea90b0eed6e4e801cfba2515a66b5d602e124f1ba68fe3d2f0aa98f0f443 +F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 +F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 +F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e +F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d +F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e +F ext/jni/src/org/sqlite/jni/capi/sqlite3.java 4010bbebc5bf44e2044e610786088cdee7dc155da2b333c0551492ff1cedf33b +F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227 +F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java f204ab6ab1263e119fe43730141a00662d80972129a5351dfb11aae5d282df36 +F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22 +F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java ff579621e9bd5ffbc6b2ef9f996c12db4df6e0c8cc5697c91273e5fca279fcf8 +F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049 F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41 F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 338637e6e5a2cc385d962b220f3c1f475cc371d12ae43d18ef27327b6e6225f7 F ext/jni/src/org/sqlite/jni/fts5/Fts5ExtensionApi.java 7da0fbb5728f7c056a43e6407f13dd0c7c9c445221267786a109b987f5fc8a9d F ext/jni/src/org/sqlite/jni/fts5/Fts5PhraseIter.java 28045042d593a1f1b9b80d54ec77cbf1d8a1bc95e442eceefa9a3a6f56600b0e F ext/jni/src/org/sqlite/jni/fts5/Fts5Tokenizer.java 3c8f677ffb85b8782f865d6fcbc16200b3375d0e3c29ed541a494fde3011bf49 -F ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java eaee4d641229a098eb704b96a45c9a23c6514dc39009d3611e265bab33834deb w ext/jni/src/org/sqlite/jni/TesterFts5.java +F ext/jni/src/org/sqlite/jni/fts5/TesterFts5.java eaee4d641229a098eb704b96a45c9a23c6514dc39009d3611e265bab33834deb F ext/jni/src/org/sqlite/jni/fts5/XTokenizeCallback.java 1efd1220ea328a32f2d2a1b16c735864159e929480f71daad4de9d5944839167 F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653fead88f8f4953376178d9c7385b197ea F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java f05ee6c52b039bb5b65e49ac90710f58cbfc95e13e5a8d46a7fe5106d5819dad w ext/jni/src/org/sqlite/jni/Sqlite.java -F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 039f6f858cd6a0f59a41f0823d638959d8f47e7098dd469c486988494d651896 w ext/jni/src/org/sqlite/jni/SqliteException.java -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 7f5aa5a74ad1b01339c7fefe2a3a89b2b3a7b45449d02aa77ca353fadb5045bf w ext/jni/src/org/sqlite/jni/Tester2.java +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java f05ee6c52b039bb5b65e49ac90710f58cbfc95e13e5a8d46a7fe5106d5819dad +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 039f6f858cd6a0f59a41f0823d638959d8f47e7098dd469c486988494d651896 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java aee8301f92256ab8572043cf5de2a35afda057d2a6ff09970a2f84a90305471e F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2128,8 +2128,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9fc3104f76a83d600beb11d91feb97bcea8bc7f7cda8cd73e7a6b81fbba879df -R 07d421243ac464d8cea8c99cca226bef +P 9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b +R 376c33c5d6d18c40ea3627a195e8192d U stephan -Z 86e6158301bdc6bca12dead7ccadc137 +Z 0f3f56205e0babb2af321d2f9efdae5a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 82f34fe35b..11d064f42b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b \ No newline at end of file +abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6 \ No newline at end of file From f2d7e961d9f8f67e183328ca40262e1a7c115f8d Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 13:04:42 +0000 Subject: [PATCH 082/242] JNI: initial draft (untested - requires more infrastructure first) of a UDF argument/result-handling interface which completely hides the C-style API from the client. FossilOrigin-Name: 43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493 --- ext/jni/GNUmakefile | 1 + ext/jni/src/org/sqlite/jni/capi/CApi.java | 3 +- .../org/sqlite/jni/wrapper1/SqlFunction.java | 153 ++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Sqlite.java | 2 +- .../sqlite/jni/wrapper1/SqliteException.java | 8 +- manifest | 19 +-- manifest.uuid | 2 +- 7 files changed, 172 insertions(+), 16 deletions(-) create mode 100644 ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index cc53cf8d15..e7f083a756 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -113,6 +113,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\ sqlite3_stmt.java \ sqlite3_value.java \ ) $(patsubst %,$(dir.src.jni)/wrapper1/%,\ + SqlFunction.java \ Sqlite.java \ SqliteException.java \ ) diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index 051e28a899..a721844744 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -1635,7 +1635,8 @@ public final class CApi { public static void sqlite3_result_text16( @NotNull sqlite3_context cx, @Nullable byte[] utf16 ){ - sqlite3_result_text64(cx, utf16, utf16.length, SQLITE_UTF16); + if(null == utf16) sqlite3_result_null(cx); + else sqlite3_result_text64(cx, utf16, utf16.length, SQLITE_UTF16); } public static void sqlite3_result_text16( diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java new file mode 100644 index 0000000000..4be6dcbe23 --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -0,0 +1,153 @@ +/* +** 2023-10-16 +** +** 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 is part of the wrapper1 interface for sqlite3. +*/ +package org.sqlite.jni.wrapper1; +import org.sqlite.jni.capi.CApi; +import org.sqlite.jni.annotation.*; +import org.sqlite.jni.capi.sqlite3_context; +import org.sqlite.jni.capi.sqlite3_value; + +/** + EXPERIMENTAL/INCOMPLETE/UNTESTED +*/ +public interface SqlFunction { + + /** + EXPERIMENTAL/INCOMPLETE/UNTESTED. An attempt at hiding UDF-side + uses of the sqlite3_context and sqlite3_value classes from a + high-level wrapper. This level of indirection requires more than + twice as much Java code (in this API, not client-side) as using + the lower-level API. Client-side it's roughly the same amount of + code. + */ + public final static class Arguments implements Iterable{ + private final sqlite3_context cx; + private final sqlite3_value args[]; + + /** + Must be passed the context and arguments for the UDF call this + object is wrapping. + */ + Arguments(@NotNull sqlite3_context cx, @NotNull sqlite3_value args[]){ + this.cx = cx; + this.args = args; + } + + /** + Wrapper for a single SqlFunction argument. Primarily intended + for eventual use with the Arguments class's Iterable interface. + */ + public final static class Arg { + private final Arguments a; + private final int ndx; + /* Only for use by the Arguments class. */ + private Arg(@NotNull Arguments a, int ndx){ + this.a = a; + this.ndx = ndx; + } + /** Returns this argument's index in its parent argument list. */ + public int getIndex(){return ndx;} + + public int getInt(){return a.getInt(ndx);} + public long getInt64(){return a.getInt64(ndx);} + public double getDouble(){return a.getDouble(ndx);} + public byte[] getBlob(){return a.getBlob(ndx);} + public byte[] getText(){return a.getText(ndx);} + public String getText16(){return a.getText16(ndx);} + public int getBytes(){return a.getBytes(ndx);} + public int getBytes16(){return a.getBytes16(ndx);} + public Object getObject(){return a.getObject(ndx);} + public T getObjectCasted(Class type){ return a.getObjectCasted(ndx, type); } + public int getType(){return a.getType(ndx);} + public Object getAuxData(){return a.getAuxData(ndx);} + public void setAuxData(Object o){a.setAuxData(ndx, o);} + } + + //! Untested! + @Override + public java.util.Iterator iterator(){ + Arg[] proxies = new Arg[args.length]; + for( int i = 0; i < args.length; ++i ){ + proxies[i] = new Arg(this, i); + } + return java.util.Arrays.stream(proxies).iterator(); + } + + /** + Returns the sqlite3_value at the given argument index or throws + an IllegalArgumentException exception if ndx is out of range. + */ + private sqlite3_value valueAt(int ndx){ + if(ndx<0 || ndx>=args.length){ + throw new IllegalArgumentException( + "SQL function argument index "+ndx+" is out of range." + ); + } + return args[ndx]; + } + + public int getArgCount(){ return args.length; } + + public int getInt(int arg){return CApi.sqlite3_value_int(valueAt(arg));} + public long getInt64(int arg){return CApi.sqlite3_value_int64(valueAt(arg));} + public double getDouble(int arg){return CApi.sqlite3_value_double(valueAt(arg));} + public byte[] getBlob(int arg){return CApi.sqlite3_value_blob(valueAt(arg));} + public byte[] getText(int arg){return CApi.sqlite3_value_text(valueAt(arg));} + public String getText16(int arg){return CApi.sqlite3_value_text16(valueAt(arg));} + public int getBytes(int arg){return CApi.sqlite3_value_bytes(valueAt(arg));} + public int getBytes16(int arg){return CApi.sqlite3_value_bytes16(valueAt(arg));} + public Object getObject(int arg){return CApi.sqlite3_value_java_object(valueAt(arg));} + public T getObjectCasted(int arg, Class type){ + return CApi.sqlite3_value_java_casted(valueAt(arg), type); + } + + public int getType(int arg){return CApi.sqlite3_value_type(valueAt(arg));} + + public void resultInt(int v){ CApi.sqlite3_result_int(cx, v); } + public void resultInt64(long v){ CApi.sqlite3_result_int64(cx, v); } + public void resultDouble(double v){ CApi.sqlite3_result_double(cx, v); } + public void resultError(String msg){CApi.sqlite3_result_error(cx, msg);} + public void resultError(Exception e){CApi.sqlite3_result_error(cx, e);} + public void resultErrorTooBig(){CApi.sqlite3_result_error_toobig(cx);} + public void resultErrorCode(int rc){CApi.sqlite3_result_error_code(cx, rc);} + public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} + public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} + public void resultZeroBlob(long n){ + // Throw on error? If n is too big, + // sqlite3_result_error_toobig() is automatically called. + CApi.sqlite3_result_zeroblob64(cx, n); + } + + public void resultBlob(byte[] blob){CApi.sqlite3_result_blob(cx, blob);} + public void resultText(byte[] utf8){CApi.sqlite3_result_text(cx, utf8);} + public void resultText(String txt){CApi.sqlite3_result_text(cx, txt);} + public void resultText16(byte[] utf16){CApi.sqlite3_result_text16(cx, utf16);} + public void resultText16(String txt){CApi.sqlite3_result_text16(cx, txt);} + + public void setAuxData(int arg, Object o){ + /* From the API docs: https://www.sqlite.org/c3ref/get_auxdata.html + + The value of the N parameter to these interfaces should be + non-negative. Future enhancements may make use of negative N + values to define new kinds of function caching behavior. + */ + valueAt(arg); + CApi.sqlite3_set_auxdata(cx, arg, o); + } + + public Object getAuxData(int arg){ + valueAt(arg); + return CApi.sqlite3_get_auxdata(cx, arg); + } + } +} diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index aaa1fe67fc..b6a4bda108 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file is part of the JNI bindings for the sqlite3 C API. +** This file is part of the wrapper1 interface for sqlite3. */ package org.sqlite.jni.wrapper1; import java.nio.charset.StandardCharsets; diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java index 87b0d3737f..111f004db4 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file is part of the JNI bindings for the sqlite3 C API. +** This file is part of the wrapper1 interface for sqlite3. */ package org.sqlite.jni.wrapper1; import static org.sqlite.jni.capi.CApi.*; @@ -54,7 +54,7 @@ public final class SqliteException extends java.lang.RuntimeException { a failed db-open operation, and the place(s) where that can happen are inside this library, not client-level code. */ - public SqliteException(sqlite3 db){ + SqliteException(sqlite3 db){ super(sqlite3_errmsg(db)); errCode = sqlite3_errcode(db); xerrCode = sqlite3_extended_errcode(db); @@ -63,8 +63,8 @@ public final class SqliteException extends java.lang.RuntimeException { } /** - Records the current error state of db (which must not be null and must - refer to an open database) then closes it. + Records the current error state of db (which must not be null and + must refer to an open database). */ public SqliteException(Sqlite db){ this(db.nativeHandle()); diff --git a/manifest b/manifest index 891a5e2aef..978dd1cded 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\scleanups\sin\sTester2\sand\supdate\sthe\sjar\smakefile\starget\sto\saccount\sfor\s[9fcdf96adca2]. -D 2023-10-16T10:38:34.125 +C JNI:\sinitial\sdraft\s(untested\s-\srequires\smore\sinfrastructure\sfirst)\sof\sa\sUDF\sargument/result-handling\sinterface\swhich\scompletely\shides\sthe\sC-style\sAPI\sfrom\sthe\sclient. +D 2023-10-16T13:04:42.394 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile bf7dbc177903a180aaa45540483d49185abb5e032c08773a36eb7983281b7ab0 +F ext/jni/GNUmakefile 069399d471af948a4293e79135907a8d58daa09e59b4cc1b9cc1a5124c87f589 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c 8d32ca0598a11370a9e92a6d111f38934c225056b42b13512175acf6e37eed4c @@ -248,7 +248,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f93 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 82993492793fd946e2b9b9a244fe5ac39647292b449cac7453ea49031c00f517 +F ext/jni/src/org/sqlite/jni/capi/CApi.java 5d754b4bb57852d006ad046b2860eb23ba406f800846460b26beee5172df4fc3 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -289,8 +289,9 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java f05ee6c52b039bb5b65e49ac90710f58cbfc95e13e5a8d46a7fe5106d5819dad -F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 039f6f858cd6a0f59a41f0823d638959d8f47e7098dd469c486988494d651896 +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 40a9f4f8a7a72b90b12baa82d26ba16376a5758009739b069c1863201770e816 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 2bc90edc4c25225e018ed600b5eff43ba0485be85db08f8b6b35246372fdac20 +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java aee8301f92256ab8572043cf5de2a35afda057d2a6ff09970a2f84a90305471e F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 @@ -2128,8 +2129,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9fcdf96adca25cc2d2f4b75ec4eea94254fb9671c5ba63b88213d7f62dedff1b -R 376c33c5d6d18c40ea3627a195e8192d +P abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6 +R 287c21329f3772a974832101be3bffee U stephan -Z 0f3f56205e0babb2af321d2f9efdae5a +Z a4e77b564ffa0b3970c5e65a1253c53d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 11d064f42b..2eac8e0f45 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6 \ No newline at end of file +43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493 \ No newline at end of file From 626d0a9fda410efcf405ed8bb6f7b00acee80207 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 14:31:13 +0000 Subject: [PATCH 083/242] JNI: add scalar UDF support to the wrapper1 API. FossilOrigin-Name: a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a --- .../org/sqlite/jni/capi/ScalarFunction.java | 2 +- .../org/sqlite/jni/wrapper1/SqlFunction.java | 31 ++++++ .../src/org/sqlite/jni/wrapper1/Sqlite.java | 27 +++++- .../src/org/sqlite/jni/wrapper1/Tester2.java | 95 ++++++++++++++++++- manifest | 18 ++-- manifest.uuid | 2 +- 6 files changed, 156 insertions(+), 19 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java b/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java index f517b3610c..95541bdcba 100644 --- a/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java @@ -27,7 +27,7 @@ public abstract class ScalarFunction implements SQLFunction { /** Optionally override to be notified when the UDF is finalized by - SQLite. This implementation does nothing. + SQLite. This default implementation does nothing. */ public void xDestroy() {} } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 4be6dcbe23..6851bf8379 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -33,6 +33,7 @@ public interface SqlFunction { public final static class Arguments implements Iterable{ private final sqlite3_context cx; private final sqlite3_value args[]; + public final int length; /** Must be passed the context and arguments for the UDF call this @@ -41,6 +42,7 @@ public interface SqlFunction { Arguments(@NotNull sqlite3_context cx, @NotNull sqlite3_value args[]){ this.cx = cx; this.args = args; + this.length = args.length; } /** @@ -112,6 +114,11 @@ public interface SqlFunction { } public int getType(int arg){return CApi.sqlite3_value_type(valueAt(arg));} + public int getSubtype(int arg){return CApi.sqlite3_value_subtype(valueAt(arg));} + public int getNumericType(int arg){return CApi.sqlite3_value_numeric_type(valueAt(arg));} + public int getNoChange(int arg){return CApi.sqlite3_value_nochange(valueAt(arg));} + public boolean getFromBind(int arg){return CApi.sqlite3_value_frombind(valueAt(arg));} + public int getEncoding(int arg){return CApi.sqlite3_value_encoding(valueAt(arg));} public void resultInt(int v){ CApi.sqlite3_result_int(cx, v); } public void resultInt64(long v){ CApi.sqlite3_result_int64(cx, v); } @@ -121,6 +128,7 @@ public interface SqlFunction { public void resultErrorTooBig(){CApi.sqlite3_result_error_toobig(cx);} public void resultErrorCode(int rc){CApi.sqlite3_result_error_code(cx, rc);} public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} + public void resultNull(){CApi.sqlite3_result_null(cx);} public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} public void resultZeroBlob(long n){ // Throw on error? If n is too big, @@ -150,4 +158,27 @@ public interface SqlFunction { return CApi.sqlite3_get_auxdata(cx, arg); } } + + /** + Internal-use adapter for wrapping this package's ScalarFunction + for use with the org.sqlite.jni.capi.ScalarFunction interface. + */ + static final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction { + final ScalarFunction impl; + ScalarAdapter(ScalarFunction impl){ + this.impl = impl; + } + /** + Proxies this.f.xFunc(), adapting the call arguments to that + function's signature. + */ + public void xFunc(sqlite3_context cx, sqlite3_value[] args){ + impl.xFunc( new SqlFunction.Arguments(cx, args) ); + } + + public void xDestroy(){ + impl.xDestroy(); + } + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index b6a4bda108..7321d7bb36 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -14,6 +14,7 @@ package org.sqlite.jni.wrapper1; import java.nio.charset.StandardCharsets; import static org.sqlite.jni.capi.CApi.*; +import org.sqlite.jni.capi.CApi; import org.sqlite.jni.capi.sqlite3; import org.sqlite.jni.capi.sqlite3_stmt; import org.sqlite.jni.capi.OutputPointer; @@ -71,14 +72,16 @@ public final class Sqlite implements AutoCloseable { /** Returns this object's underlying native db handle, or null if - this instance has been closed. + this instance has been closed. This is very specifically not + public. */ sqlite3 nativeHandle(){ return this.db; } - private void affirmOpen(){ + private sqlite3 affirmOpen(){ if( null==db || 0==db.getNativePointer() ){ throw new IllegalArgumentException("This database instance is closed."); } + return this.db; } // private byte[] stringToUtf8(String s){ @@ -91,6 +94,10 @@ public final class Sqlite implements AutoCloseable { } } + /** + Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to + create new instances. + */ public final class Stmt implements AutoCloseable { private Sqlite _db = null; private sqlite3_stmt stmt = null; @@ -114,7 +121,7 @@ public final class Sqlite implements AutoCloseable { /** Corresponds to sqlite3_finalize(), but we cannot override the name finalize() here because this one requires a different - signature. We do not throw on error here because "destructors + signature. It does not throw on error here because "destructors do not throw." If it returns non-0, the object is still finalized. */ @@ -178,9 +185,8 @@ public final class Sqlite implements AutoCloseable { rather than the sqlite3_stmt class. */ public Stmt prepare(String sql, int prepFlags){ - affirmOpen(); final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); - final int rc = sqlite3_prepare_v3(this.db, sql, prepFlags, out); + final int rc = sqlite3_prepare_v3(affirmOpen(), sql, prepFlags, out); affirmRcOk(rc); return new Stmt(this, out.take()); } @@ -189,4 +195,15 @@ public final class Sqlite implements AutoCloseable { return prepare(sql, 0); } + + public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f ){ + int rc = CApi.sqlite3_create_function(affirmOpen(), name, nArg, eTextRep, + new SqlFunction.ScalarAdapter(f)); + if( 0!=rc ) throw new SqliteException(db); + } + + public void createFunction(String name, int nArg, ScalarFunction f){ + this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 73f07b1561..07a43b63dd 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -38,6 +38,17 @@ import org.sqlite.jni.capi.*; @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) @interface SingleThreadOnly{} +/** + A helper class which simply holds a single value. Its current use + is for communicating values out of anonymous classes, as doing so + requires a "final" reference. +*/ +class ValueHolder { + public T value; + public ValueHolder(){} + public ValueHolder(T v){value = v;} +} + public class Tester2 implements Runnable { //! True when running in multi-threaded mode. private static boolean mtMode = false; @@ -124,6 +135,56 @@ public class Tester2 implements Runnable { affirm(v, "Affirmation failed."); } + + public static void execSql(Sqlite db, String[] sql){ + execSql(db, String.join("", sql)); + } + + public static int execSql(Sqlite dbw, boolean throwOnError, String sql){ + final sqlite3 db = dbw.nativeHandle(); + OutputPointer.Int32 oTail = new OutputPointer.Int32(); + final byte[] sqlUtf8 = sql.getBytes(StandardCharsets.UTF_8); + int pos = 0, n = 1; + byte[] sqlChunk = sqlUtf8; + int rc = 0; + sqlite3_stmt stmt = null; + final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt(); + while(pos < sqlChunk.length){ + if(pos > 0){ + sqlChunk = Arrays.copyOfRange(sqlChunk, pos, + sqlChunk.length); + } + if( 0==sqlChunk.length ) break; + rc = CApi.sqlite3_prepare_v2(db, sqlChunk, outStmt, oTail); + if(throwOnError) affirm(0 == rc); + else if( 0!=rc ) break; + pos = oTail.value; + stmt = outStmt.take(); + if( null == stmt ){ + // empty statement was parsed. + continue; + } + affirm(0 != stmt.getNativePointer()); + while( CApi.SQLITE_ROW == (rc = CApi.sqlite3_step(stmt)) ){ + } + CApi.sqlite3_finalize(stmt); + affirm(0 == stmt.getNativePointer()); + if(0!=rc && CApi.SQLITE_ROW!=rc && CApi.SQLITE_DONE!=rc){ + break; + } + } + CApi.sqlite3_finalize(stmt); + if(CApi.SQLITE_ROW==rc || CApi.SQLITE_DONE==rc) rc = 0; + if( 0!=rc && throwOnError){ + throw new SqliteException(db); + } + return rc; + } + + static void execSql(Sqlite db, String sql){ + execSql(db, true, sql); + } + @SingleThreadOnly /* because it's thread-agnostic */ private void test1(){ affirm(CApi.sqlite3_libversion_number() == CApi.SQLITE_VERSION_NUMBER); @@ -144,9 +205,11 @@ public class Tester2 implements Runnable { } Sqlite openDb(String name){ - return Sqlite.open(name, CApi.SQLITE_OPEN_READWRITE| - CApi.SQLITE_OPEN_CREATE| - CApi.SQLITE_OPEN_EXRESCODE); + final Sqlite db = Sqlite.open(name, CApi.SQLITE_OPEN_READWRITE| + CApi.SQLITE_OPEN_CREATE| + CApi.SQLITE_OPEN_EXRESCODE); + ++metrics.dbOpen; + return db; } Sqlite openDb(){ return openDb(":memory:"); } @@ -190,6 +253,32 @@ public class Tester2 implements Runnable { } } + void testUdfScalar(){ + final ValueHolder xDestroyCalled = new ValueHolder<>(0); + try (Sqlite db = openDb()) { + execSql(db, "create table t(a); insert into t(a) values(1),(2),(3)"); + final ValueHolder vh = new ValueHolder<>(0); + final ScalarFunction f = new ScalarFunction(){ + public void xFunc(SqlFunction.Arguments args){ + for( SqlFunction.Arguments.Arg arg : args ){ + vh.value += arg.getInt(); + } + } + public void xDestroy(){ + ++xDestroyCalled.value; + } + }; + db.createFunction("myfunc", -1, f); + execSql(db, "select myfunc(1,2,3)"); + affirm( 6 == vh.value ); + vh.value = 0; + execSql(db, "select myfunc(-1,-2,-3)"); + affirm( -6 == vh.value ); + affirm( 0 == xDestroyCalled.value ); + } + affirm( 1 == xDestroyCalled.value ); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 978dd1cded..1fb9230659 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sinitial\sdraft\s(untested\s-\srequires\smore\sinfrastructure\sfirst)\sof\sa\sUDF\sargument/result-handling\sinterface\swhich\scompletely\shides\sthe\sC-style\sAPI\sfrom\sthe\sclient. -D 2023-10-16T13:04:42.394 +C JNI:\sadd\sscalar\sUDF\ssupport\sto\sthe\swrapper1\sAPI. +D 2023-10-16T14:31:13.824 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -264,7 +264,7 @@ F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bdf97fa8a4f6b3b6577c9660dd7bd6a6d3c4a F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 -F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java dee85ef2650a9c95067f5d55bd6e290e0404e6643a5d115d1a1533df21f9b5c8 +F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8aacea90b0eed6e4e801cfba2515a66b5d602e124f1ba68fe3d2f0aa98f0f443 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 @@ -289,10 +289,10 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 40a9f4f8a7a72b90b12baa82d26ba16376a5758009739b069c1863201770e816 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 2bc90edc4c25225e018ed600b5eff43ba0485be85db08f8b6b35246372fdac20 +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 8b422ec8a2e922c1c21db549e68e0eb93078d2c4d341354043975e111a43b10d +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 7826de9bea3102d8a2ecaef3cc84480d8d6f6bc617c531d2078b419913c866fd F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java aee8301f92256ab8572043cf5de2a35afda057d2a6ff09970a2f84a90305471e +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 3dccdb259bd1d737c6d104bdf488fb489063b40a113c03b311284e0287d0d5b7 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2129,8 +2129,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P abc82bf4b800dde1b6e6172c7be816edb391fdbed5dbd2749f54623fdf3bf8e6 -R 287c21329f3772a974832101be3bffee +P 43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493 +R b476ec63940a46ee7b1e2c0e07bbcf7b U stephan -Z a4e77b564ffa0b3970c5e65a1253c53d +Z a39099e216c3c59927f5c5a18a7e93ef # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2eac8e0f45..0ec7f3375d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493 \ No newline at end of file +a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a \ No newline at end of file From 08747d44a27c47735c050bca68193677ef39b5ec Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 16 Oct 2023 16:04:23 +0000 Subject: [PATCH 084/242] JNI: add aggregate function support to the wrapper1 API. FossilOrigin-Name: 15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e --- ext/jni/GNUmakefile | 4 + ext/jni/src/org/sqlite/jni/capi/Tester1.java | 11 -- .../src/org/sqlite/jni/capi/ValueHolder.java | 25 +++ .../jni/wrapper1/AggregateFunction.java | 82 +++++++++ .../org/sqlite/jni/wrapper1/SqlFunction.java | 157 +++++++++++++++--- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 11 +- .../src/org/sqlite/jni/wrapper1/Tester2.java | 41 +++-- .../org/sqlite/jni/wrapper1/ValueHolder.java | 25 +++ manifest | 23 +-- manifest.uuid | 2 +- 10 files changed, 327 insertions(+), 54 deletions(-) create mode 100644 ext/jni/src/org/sqlite/jni/capi/ValueHolder.java create mode 100644 ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java create mode 100644 ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index e7f083a756..19a5080471 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -106,6 +106,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\ TableColumnMetadata.java \ TraceV2Callback.java \ UpdateHookCallback.java \ + ValueHolder.java \ WindowFunction.java \ XDestroyCallback.java \ sqlite3.java \ @@ -113,9 +114,12 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\ sqlite3_stmt.java \ sqlite3_value.java \ ) $(patsubst %,$(dir.src.jni)/wrapper1/%,\ + AggregateFunction.java \ + ScalarFunction.java \ SqlFunction.java \ Sqlite.java \ SqliteException.java \ + ValueHolder.java \ ) JAVA_FILES.unittest := $(patsubst %,$(dir.src.jni)/%,\ diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 5c982ea5ed..6fb28e65b9 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -38,17 +38,6 @@ import java.util.concurrent.Future; @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) @interface SingleThreadOnly{} -/** - A helper class which simply holds a single value. Its current use - is for communicating values out of anonymous classes, as doing so - requires a "final" reference. -*/ -class ValueHolder { - public T value; - public ValueHolder(){} - public ValueHolder(T v){value = v;} -} - public class Tester1 implements Runnable { //! True when running in multi-threaded mode. private static boolean mtMode = false; diff --git a/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java b/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java new file mode 100644 index 0000000000..b3f03ac867 --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java @@ -0,0 +1,25 @@ +/* +** 2023-10-16 +** +** 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 contains a set of tests for the sqlite3 JNI bindings. +*/ +package org.sqlite.jni.capi; + +/** + A helper class which simply holds a single value. Its primary use + is for communicating values out of anonymous classes, as doing so + requires a "final" reference. +*/ +public class ValueHolder { + public T value; + public ValueHolder(){} + public ValueHolder(T v){value = v;} +} diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java new file mode 100644 index 0000000000..173d775e62 --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java @@ -0,0 +1,82 @@ +/* +** 2023-10-16 +** +** 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 is part of the wrapper1 interface for sqlite3. +*/ +package org.sqlite.jni.wrapper1; +import org.sqlite.jni.capi.CApi; +import org.sqlite.jni.annotation.*; +import org.sqlite.jni.capi.sqlite3_context; +import org.sqlite.jni.capi.sqlite3_value; + +/** + EXPERIMENTAL/INCOMPLETE/UNTESTED + + A SqlFunction implementation for aggregate functions. The T type + represents the type of data accumulated by this aggregate while it + works. e.g. a SUM()-like UDF might use Integer or Long and a + CONCAT()-like UDF might use a StringBuilder or a List. +*/ +public abstract class AggregateFunction implements SqlFunction { + + /** + As for the xStep() argument of the C API's + sqlite3_create_function(). If this function throws, the + exception is reported via sqlite3_result_error(). + */ + public abstract void xStep(SqlFunction.Arguments args); + + /** + As for the xFinal() argument of the C API's + sqlite3_create_function(). If this function throws, it is + translated into sqlite3_result_error(). + + Note that the passed-in object will not actually contain any + arguments for xFinal() but will contain the context object needed + for setting the call's result or error state. + */ + public abstract void xFinal(SqlFunction.Arguments args); + + /** + Optionally override to be notified when the UDF is finalized by + SQLite. + */ + public void xDestroy() {} + + /** Per-invocation state for the UDF. */ + private final SqlFunction.PerContextState map = + new SqlFunction.PerContextState<>(); + + /** + To be called from the implementation's xStep() method, as well + as the xValue() and xInverse() methods of the {@link WindowFunction} + subclass, to fetch the current per-call UDF state. On the + first call to this method for any given sqlite3_context + argument, the context is set to the given initial value. On all other + calls, the 2nd argument is ignored. + + @see SQLFunction.PerContextState#getAggregateState + */ + protected final ValueHolder getAggregateState(SqlFunction.Arguments args, T initialValue){ + return map.getAggregateState(args, initialValue); + } + + /** + To be called from the implementation's xFinal() method to fetch + the final state of the UDF and remove its mapping. + + see SQLFunction.PerContextState#takeAggregateState + */ + protected final T takeAggregateState(SqlFunction.Arguments args){ + return map.takeAggregateState(args); + } + +} diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 6851bf8379..d6acda5aa5 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -13,22 +13,20 @@ */ package org.sqlite.jni.wrapper1; import org.sqlite.jni.capi.CApi; -import org.sqlite.jni.annotation.*; import org.sqlite.jni.capi.sqlite3_context; import org.sqlite.jni.capi.sqlite3_value; /** - EXPERIMENTAL/INCOMPLETE/UNTESTED + Base marker interface for SQLite's three types of User-Defined SQL + Functions (UDFs): Scalar, Aggregate, and Window functions. */ public interface SqlFunction { /** - EXPERIMENTAL/INCOMPLETE/UNTESTED. An attempt at hiding UDF-side - uses of the sqlite3_context and sqlite3_value classes from a - high-level wrapper. This level of indirection requires more than - twice as much Java code (in this API, not client-side) as using - the lower-level API. Client-side it's roughly the same amount of - code. + The Arguments type is an abstraction on top of the lower-level + UDF function argument types. It provides _most_ of the functionality + of the lower-level interface, insofar as possible without "leaking" + those types into this API. */ public final static class Arguments implements Iterable{ private final sqlite3_context cx; @@ -37,29 +35,34 @@ public interface SqlFunction { /** Must be passed the context and arguments for the UDF call this - object is wrapping. + object is wrapping. Intended to be used by internal proxy + classes which "convert" the lower-level interface into this + package's higher-level interface, e.g. ScalarAdapter and + AggregateAdapter. + + Passing null for the args is equivalent to passing a length-0 + array. */ - Arguments(@NotNull sqlite3_context cx, @NotNull sqlite3_value args[]){ + Arguments(sqlite3_context cx, sqlite3_value args[]){ this.cx = cx; - this.args = args; - this.length = args.length; + this.args = args==null ? new sqlite3_value[0] : args;; + this.length = this.args.length; } /** Wrapper for a single SqlFunction argument. Primarily intended - for eventual use with the Arguments class's Iterable interface. + for use with the Arguments class's Iterable interface. */ public final static class Arg { private final Arguments a; private final int ndx; /* Only for use by the Arguments class. */ - private Arg(@NotNull Arguments a, int ndx){ + private Arg(Arguments a, int ndx){ this.a = a; this.ndx = ndx; } /** Returns this argument's index in its parent argument list. */ public int getIndex(){return ndx;} - public int getInt(){return a.getInt(ndx);} public long getInt64(){return a.getInt64(ndx);} public double getDouble(){return a.getDouble(ndx);} @@ -75,10 +78,9 @@ public interface SqlFunction { public void setAuxData(Object o){a.setAuxData(ndx, o);} } - //! Untested! @Override public java.util.Iterator iterator(){ - Arg[] proxies = new Arg[args.length]; + final Arg[] proxies = new Arg[args.length]; for( int i = 0; i < args.length; ++i ){ proxies[i] = new Arg(this, i); } @@ -98,6 +100,8 @@ public interface SqlFunction { return args[ndx]; } + sqlite3_context getContext(){return cx;} + public int getArgCount(){ return args.length; } public int getInt(int arg){return CApi.sqlite3_value_int(valueAt(arg));} @@ -159,6 +163,73 @@ public interface SqlFunction { } } + /** + PerContextState assists aggregate and window functions in + managing their accumulator state across calls to the UDF's + callbacks. + +

    T must be of a type which can be legally stored as a value in + java.util.HashMap. + +

    If a given aggregate or window function is called multiple times + in a single SQL statement, e.g. SELECT MYFUNC(A), MYFUNC(B)..., + then the clients need some way of knowing which call is which so + that they can map their state between their various UDF callbacks + and reset it via xFinal(). This class takes care of such + mappings. + +

    This class works by mapping + sqlite3_context.getAggregateContext() to a single piece of + state, of a client-defined type (the T part of this class), which + persists across a "matching set" of the UDF's callbacks. + +

    This class is a helper providing commonly-needed functionality + - it is not required for use with aggregate or window functions. + Client UDFs are free to perform such mappings using custom + approaches. The provided {@link AggregateFunction} and {@link + WindowFunction} classes use this. + */ + public static final class PerContextState { + private final java.util.Map> map + = new java.util.HashMap<>(); + + /** + Should be called from a UDF's xStep(), xValue(), and xInverse() + methods, passing it that method's first argument and an initial + value for the persistent state. If there is currently no + mapping for the given context within the map, one is created + using the given initial value, else the existing one is used + and the 2nd argument is ignored. It returns a ValueHolder + which can be used to modify that state directly without + requiring that the client update the underlying map's entry. + +

    The caller is obligated to eventually call + takeAggregateState() to clear the mapping. + */ + public ValueHolder getAggregateState(SqlFunction.Arguments args, T initialValue){ + final Long key = args.getContext().getAggregateContext(true); + ValueHolder rc = null==key ? null : map.get(key); + if( null==rc ){ + map.put(key, rc = new ValueHolder<>(initialValue)); + } + return rc; + } + + /** + Should be called from a UDF's xFinal() method and passed that + method's first argument. This function removes the value + associated with with the arguments' aggregate context from the + map and returns it, returning null if no other UDF method has + been called to set up such a mapping. The latter condition will + be the case if a UDF is used in a statement which has no result + rows. + */ + public T takeAggregateState(SqlFunction.Arguments args){ + final ValueHolder h = map.remove(args.getContext().getAggregateContext(false)); + return null==h ? null : h.value; + } + } + /** Internal-use adapter for wrapping this package's ScalarFunction for use with the org.sqlite.jni.capi.ScalarFunction interface. @@ -169,11 +240,57 @@ public interface SqlFunction { this.impl = impl; } /** - Proxies this.f.xFunc(), adapting the call arguments to that - function's signature. + Proxies this.impl.xFunc(), adapting the call arguments to that + function's signature. If the proxy throws, it's translated to + sqlite_result_error() with the exception's message. */ public void xFunc(sqlite3_context cx, sqlite3_value[] args){ - impl.xFunc( new SqlFunction.Arguments(cx, args) ); + try{ + impl.xFunc( new SqlFunction.Arguments(cx, args) ); + }catch(Exception e){ + CApi.sqlite3_result_error(cx, e); + } + } + + public void xDestroy(){ + impl.xDestroy(); + } + } + + /** + Internal-use adapter for wrapping this package's AggregateFunction + for use with the org.sqlite.jni.capi.AggregateFunction interface. + */ + static final class AggregateAdapter extends org.sqlite.jni.capi.AggregateFunction { + final AggregateFunction impl; + AggregateAdapter(AggregateFunction impl){ + this.impl = impl; + } + + /** + Proxies this.impl.xStep(), adapting the call arguments to that + function's signature. If the proxied function throws, it is + translated to sqlite_result_error() with the exception's + message. + */ + public void xStep(sqlite3_context cx, sqlite3_value[] args){ + try{ + impl.xStep( new SqlFunction.Arguments(cx, args) ); + }catch(Exception e){ + CApi.sqlite3_result_error(cx, e); + } + } + + /** + As for the xFinal() argument of the C API's sqlite3_create_function(). + If the proxied function throws, it is translated into a sqlite3_result_error(). + */ + public void xFinal(sqlite3_context cx){ + try{ + impl.xFinal( new SqlFunction.Arguments(cx, null) ); + }catch(Exception e){ + CApi.sqlite3_result_error(cx, e); + } } public void xDestroy(){ diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 7321d7bb36..bcf97b2394 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -195,7 +195,6 @@ public final class Sqlite implements AutoCloseable { return prepare(sql, 0); } - public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f ){ int rc = CApi.sqlite3_create_function(affirmOpen(), name, nArg, eTextRep, new SqlFunction.ScalarAdapter(f)); @@ -206,4 +205,14 @@ public final class Sqlite implements AutoCloseable { this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); } + public void createFunction(String name, int nArg, int eTextRep, AggregateFunction f ){ + int rc = CApi.sqlite3_create_function(affirmOpen(), name, nArg, eTextRep, + new SqlFunction.AggregateAdapter(f)); + if( 0!=rc ) throw new SqliteException(db); + } + + public void createFunction(String name, int nArg, AggregateFunction f){ + this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 07a43b63dd..f5fd5f84e6 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -38,17 +38,6 @@ import org.sqlite.jni.capi.*; @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) @interface SingleThreadOnly{} -/** - A helper class which simply holds a single value. Its current use - is for communicating values out of anonymous classes, as doing so - requires a "final" reference. -*/ -class ValueHolder { - public T value; - public ValueHolder(){} - public ValueHolder(T v){value = v;} -} - public class Tester2 implements Runnable { //! True when running in multi-threaded mode. private static boolean mtMode = false; @@ -279,6 +268,36 @@ public class Tester2 implements Runnable { affirm( 1 == xDestroyCalled.value ); } + void testUdfAggregate(){ + final ValueHolder xDestroyCalled = new ValueHolder<>(0); + final ValueHolder vh = new ValueHolder<>(0); + try (Sqlite db = openDb()) { + execSql(db, "create table t(a); insert into t(a) values(1),(2),(3)"); + final AggregateFunction f = new AggregateFunction(){ + public void xStep(SqlFunction.Arguments args){ + final ValueHolder agg = this.getAggregateState(args, 0); + for( SqlFunction.Arguments.Arg arg : args ){ + agg.value += arg.getInt(); + } + } + public void xFinal(SqlFunction.Arguments args){ + final Integer v = this.takeAggregateState(args); + if( null==v ) args.resultNull(); + else args.resultInt(v); + vh.value = v; + } + public void xDestroy(){ + ++xDestroyCalled.value; + } + }; + db.createFunction("myagg", -1, f); + execSql(db, "select myagg(a) from t"); + affirm( 6 == vh.value ); + affirm( 0 == xDestroyCalled.value ); + } + affirm( 1 == xDestroyCalled.value ); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java b/ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java new file mode 100644 index 0000000000..009936a43e --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java @@ -0,0 +1,25 @@ +/* +** 2023-10-16 +** +** 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 contains a set of tests for the sqlite3 JNI bindings. +*/ +package org.sqlite.jni.wrapper1; + +/** + A helper class which simply holds a single value. Its primary use + is for communicating values out of anonymous classes, as doing so + requires a "final" reference. +*/ +public class ValueHolder { + public T value; + public ValueHolder(){} + public ValueHolder(T v){value = v;} +} diff --git a/manifest b/manifest index 1fb9230659..ed6c5f7f8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sadd\sscalar\sUDF\ssupport\sto\sthe\swrapper1\sAPI. -D 2023-10-16T14:31:13.824 +C JNI:\sadd\saggregate\sfunction\ssupport\sto\sthe\swrapper1\sAPI. +D 2023-10-16T16:04:23.203 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -235,7 +235,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 069399d471af948a4293e79135907a8d58daa09e59b4cc1b9cc1a5124c87f589 +F ext/jni/GNUmakefile 5c3ac326bf3853486ebe0d70819abc790cc65c412182ce4ebd5012b008d9b059 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c 8d32ca0598a11370a9e92a6d111f38934c225056b42b13512175acf6e37eed4c @@ -266,9 +266,10 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bd F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8aacea90b0eed6e4e801cfba2515a66b5d602e124f1ba68fe3d2f0aa98f0f443 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java ca195521b6bda3e0cd00e76bb71ec8060d1fab76a2f13b1af9feea40789f44bb F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 +F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 9f9e151f1da017b706c0ee5f40f4c86b54e773d6ae4339723e0cc85a456251ab F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e @@ -289,10 +290,12 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 8b422ec8a2e922c1c21db549e68e0eb93078d2c4d341354043975e111a43b10d -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 7826de9bea3102d8a2ecaef3cc84480d8d6f6bc617c531d2078b419913c866fd +F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 004394eeb944baa56e36cd7ae69ba6d4a52b52db3c49439db16e98270b861421 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java a9ddc6a9e8c113168cc67592ae24c0e56d30dd06226eeab012f2761a0889d7bb F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 3dccdb259bd1d737c6d104bdf488fb489063b40a113c03b311284e0287d0d5b7 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java c24b510ebe801c30533cc62efdf69a4a5e2da9ec4b49f8d403f2060693f060a0 +F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2129,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 43b10a5cf9cb8be53d62914f340d533e60a70bf4caa8b9b91c0f867fa0f70493 -R b476ec63940a46ee7b1e2c0e07bbcf7b +P a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a +R 41c1c0a2430694da022548afb899150c U stephan -Z a39099e216c3c59927f5c5a18a7e93ef +Z b40ce65d6c09198a38c3804feb9178c7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ec7f3375d..0973dce9e0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a \ No newline at end of file +15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e \ No newline at end of file From b866f983464a3b58aaef6e9dcf87182a51428562 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 17 Oct 2023 02:15:49 +0000 Subject: [PATCH 085/242] Harden API_ARMOR checks for sqlite3_stmt_scanstatus_v2(). FossilOrigin-Name: d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeapi.c | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index ed6c5f7f8a..95bba15b39 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sadd\saggregate\sfunction\ssupport\sto\sthe\swrapper1\sAPI. -D 2023-10-16T16:04:23.203 +C Harden\sAPI_ARMOR\schecks\sfor\ssqlite3_stmt_scanstatus_v2(). +D 2023-10-17T02:15:49.601 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -791,7 +791,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c ae873b02ade06478b217ea38d90229dff68180d7a1fe526910b0d62a0fe0595a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c 56fb801c15af34ba4e7de6804b1a143f045ca9d4b466f32d220d930823e05885 +F src/vdbeapi.c 9c1509ea78dbfb528fbca49601a5a39617eeca3315b141e3b28e2ee1ec45dc12 F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c ba9e21c579b58979a63d85e79088c9a9860b0ff4359f59a0db37427fb7807f66 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a850535766d2243d9475e1523c753615875a2da9c9d82a41a9fb61b141c6334a -R 41c1c0a2430694da022548afb899150c +P 15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e +R 6b89fd1d08788235ad034998751967c3 U stephan -Z b40ce65d6c09198a38c3804feb9178c7 +Z f2c535ed4796a207a0fd6c4ff4bf7413 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0973dce9e0..e3467df406 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e \ No newline at end of file +d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index b0a40cf6db..b7b3b94cdc 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -2351,7 +2351,11 @@ int sqlite3_stmt_scanstatus_v2( int idx; #ifdef SQLITE_ENABLE_API_ARMOR - if( p==0 ) return 1; + if( p==0 || pOut==0 + || iScanStatusOpSQLITE_SCANSTAT_NCYCLE ){ + return 1; + } #endif aOp = p->aOp; nOp = p->nOp; From 11095bcb89a2386698743b948387bf46611b0d8f Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 10:47:42 +0000 Subject: [PATCH 086/242] When an I/O or similar error occurs during a transaction with journal_mode=MEMORY, attempt to rollback before closing the journal, as all rollback information is forgotten when a memory rollback journal is closed. FossilOrigin-Name: 1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 95bba15b39..0bb8ce077d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Harden\sAPI_ARMOR\schecks\sfor\ssqlite3_stmt_scanstatus_v2(). -D 2023-10-17T02:15:49.601 +C When\san\sI/O\sor\ssimilar\serror\soccurs\sduring\sa\stransaction\swith\njournal_mode=MEMORY,\sattempt\sto\srollback\sbefore\sclosing\sthe\sjournal,\sas\nall\srollback\sinformation\sis\sforgotten\swhen\sa\smemory\srollback\sjournal\sis\nclosed. +D 2023-10-17T10:47:42.224 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -705,7 +705,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c 2e8b12107f75d1bd16412f312b4c5d5103191807a37836d3b81beb26436ad81b F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 4aa388e47138551c83ae265e2efd4e01f0aa5afb6a958f45579658847b3430ff +F src/pager.c 2188897e1102a776dcb1bbe8b2eb70ac7de8863c9cb95ef09d35e9bad406cf45 F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 15b28b340a5c5efdbfe3fbed16ee0b699561edaeebb77446addf2374bdf9357e -R 6b89fd1d08788235ad034998751967c3 -U stephan -Z f2c535ed4796a207a0fd6c4ff4bf7413 +P d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda +R b56a9057afb3315b9dbeaacc1714889d +U drh +Z 10639baf7980722d71051df0aed0a0d8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e3467df406..4d645149e5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda \ No newline at end of file +1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 1423b66541..5c2d556b3e 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2161,6 +2161,9 @@ static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){ return (rc==SQLITE_OK?rc2:rc); } +/* Forward reference */ +static int pager_playback(Pager *pPager, int isHot); + /* ** Execute a rollback if a transaction is active and unlock the ** database file. @@ -2189,6 +2192,21 @@ static void pagerUnlockAndRollback(Pager *pPager){ assert( pPager->eState==PAGER_READER ); pager_end_transaction(pPager, 0, 0); } + }else if( pPager->eState==PAGER_ERROR + && pPager->journalMode==PAGER_JOURNALMODE_MEMORY + && isOpen(pPager->jfd) + ){ + /* Special case for a ROLLBACK due to I/O error with an in-memory + ** journal: We have to rollback immediately, before the journal is + ** closed, because once it is closed, all content is forgotten. */ + int errCode = pPager->errCode; + u8 eLock = pPager->eLock; + pPager->eState = PAGER_OPEN; + pPager->errCode = SQLITE_OK; + pPager->eLock = EXCLUSIVE_LOCK; + pager_playback(pPager, 1); + pPager->errCode = errCode; + pPager->eLock = eLock; } pager_unlock(pPager); } @@ -5681,8 +5699,20 @@ int sqlite3PagerGet( DbPage **ppPage, /* Write a pointer to the page here */ int flags /* PAGER_GET_XXX flags */ ){ - /* printf("PAGE %u\n", pgno); fflush(stdout); */ +#if 0 /* Trace page fetch by setting to 1 */ + int rc; + printf("PAGE %u\n", pgno); + fflush(stdout); + rc = pPager->xGet(pPager, pgno, ppPage, flags); + if( rc ){ + printf("PAGE %u failed with 0x%02x\n", pgno, rc); + fflush(stdout); + } + return rc; +#else + /* Normal, high-speed version of sqlite3PagerGet() */ return pPager->xGet(pPager, pgno, ppPage, flags); +#endif } /* From 5e0b11bda77dc6d48932601ffded969faec75aad Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 11:57:36 +0000 Subject: [PATCH 087/242] Enhance the documentation of sqlite3_deserialize() to make it clear that the input database may not be in WAL mode. [forum:/forumpost/a7e272cee9ac469f|Forum post a7e272cee9ac469f] FossilOrigin-Name: e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 0bb8ce077d..d5866a77be 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\san\sI/O\sor\ssimilar\serror\soccurs\sduring\sa\stransaction\swith\njournal_mode=MEMORY,\sattempt\sto\srollback\sbefore\sclosing\sthe\sjournal,\sas\nall\srollback\sinformation\sis\sforgotten\swhen\sa\smemory\srollback\sjournal\sis\nclosed. -D 2023-10-17T10:47:42.224 +C Enhance\sthe\sdocumentation\sof\ssqlite3_deserialize()\sto\smake\sit\sclear\sthat\nthe\sinput\sdatabase\smay\snot\sbe\sin\sWAL\smode.\n[forum:/forumpost/a7e272cee9ac469f|Forum\spost\sa7e272cee9ac469f] +D 2023-10-17T11:57:36.538 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -720,7 +720,7 @@ F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa -F src/sqlite.h.in 4f39f61c35348f0c56dd2c7a2294d1f0564389a0086dab80ce0960bfd772dc1b +F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h 3c8a3f1bf889a632dbbaecbd3334e9e8d7fdb63b26ee09d6d384af0cc757d64c @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d3f38e813ba3b887e973af034713cd58fdfbe07da375b154accc7b5790cfaeda -R b56a9057afb3315b9dbeaacc1714889d +P 1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c +R 6102819ec8d73f007027205c9baa6482 U drh -Z 10639baf7980722d71051df0aed0a0d8 +Z fed638031c498e74c10adafc1fcef571 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4d645149e5..9cde1130e7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c \ No newline at end of file +e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 54192422d6..af648829d6 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -10676,6 +10676,13 @@ unsigned char *sqlite3_serialize( ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the ** function returns SQLITE_ERROR. ** +** The deserialized database should not be in [WAL mode]. If the database +** is in WAL mode, then any attempt to use the database file will result +** in an [SQLITE_CANTOPEN] error. The application can set the +** [file format version numbers] (bytes 18 and 19) of the input database P +** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the +** database file into rollback mode and work around this limitation. +** ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** [sqlite3_free()] is invoked on argument P prior to returning. From 52d934e3164f5a0666b2f5f00b9ab4aee9ef9618 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 13:41:41 +0000 Subject: [PATCH 088/242] Fix a JSON bug introduced by the optimization of [df099ad713011b67] and first appearing in 3.43.0. The problem occurs when doing a JSON_EXTRACT() on an array element that was added by JSON_SET() without first reparsing. Reported by [forum:/forumpost/fc0e3f1e2a|forum post fc0e3f1e2a]. FossilOrigin-Name: e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/json.c | 1 + test/json101.test | 13 +++++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index d5866a77be..12f27004eb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sdocumentation\sof\ssqlite3_deserialize()\sto\smake\sit\sclear\sthat\nthe\sinput\sdatabase\smay\snot\sbe\sin\sWAL\smode.\n[forum:/forumpost/a7e272cee9ac469f|Forum\spost\sa7e272cee9ac469f] -D 2023-10-17T11:57:36.538 +C Fix\sa\sJSON\sbug\sintroduced\sby\sthe\soptimization\sof\s[df099ad713011b67]\sand\nfirst\sappearing\sin\s3.43.0.\s\sThe\sproblem\soccurs\swhen\sdoing\sa\sJSON_EXTRACT()\non\san\sarray\selement\sthat\swas\sadded\sby\sJSON_SET()\swithout\sfirst\sreparsing.\nReported\sby\s[forum:/forumpost/fc0e3f1e2a|forum\spost\sfc0e3f1e2a]. +D 2023-10-17T13:41:41.074 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -678,7 +678,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c 799430345d16fed21713416318e6ca616f1264224f708555f387bfa2ab2496c7 +F src/json.c a803f6eb684a8e24e99761138ee233e6d3140f8691146e4667a8fe700c0c16a5 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a F src/main.c 73ae4cab166b0fd36352446de7f7d91f89bde86686ae18f0bb7b245173479831 @@ -1310,7 +1310,7 @@ F test/json/README.md 63e3e589e1df8fd3cc1588ba1faaff659214003f8b77a15af5c6452b35 F test/json/json-generator.tcl dc0dd0f393800c98658fc4c47eaa6af29d4e17527380cd28656fb261bddc8a3f F test/json/json-q1.txt 65f9d1cdcc4cffa9823fb73ed936aae5658700cd001fde448f68bfb91c807307 F test/json/json-speed-check.sh 8b7babf530faa58bd59d6d362cec8e9036a68c5457ff46f3b1f1511d21af6737 x -F test/json101.test 1ad070e5616dee76bffbe9724e6add16ab7ad506d5af9e606627b163baf1a7b4 +F test/json101.test bc05d2476fd6f7ead31ec05b43d1b24b2b193ae112fd8f0d2ed56d9a904f9fa5 F test/json102.test 4c69694773a470f1fda34e5f4ba24920b35184fb66050b450fc2ef9ab5ad310b F test/json103.test 53df87f83a4e5fa0c0a56eb29ff6c94055c6eb919f33316d62161a8880112dbe F test/json104.test 1b844a70cddcfa2e4cd81a5db0657b2e61e7f00868310f24f56a9ba0114348c1 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1d67f75de259e5a26b751a50432822a268ebe367cda6510891ab81a15e5daa1c -R 6102819ec8d73f007027205c9baa6482 +P e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5 +R 3f9b22b9a01bc799e241ff3ddd4c2083 U drh -Z fed638031c498e74c10adafc1fcef571 +Z 0e3dd3d1b219ba9ab7384c8b1f01954c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9cde1130e7..aec3af3110 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5 \ No newline at end of file +e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58 \ No newline at end of file diff --git a/src/json.c b/src/json.c index e334b22140..bb1834dd89 100644 --- a/src/json.c +++ b/src/json.c @@ -2156,6 +2156,7 @@ static JsonNode *jsonLookupStep( if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ) i--; j += jsonNodeSize(&pRoot[j]); } + if( i==0 && j<=pRoot->n ) break; if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; if( pParse->useMod==0 ) break; assert( pRoot->eU==2 ); diff --git a/test/json101.test b/test/json101.test index d734dbb0e1..c62991bbbf 100644 --- a/test/json101.test +++ b/test/json101.test @@ -1042,5 +1042,18 @@ do_execsql_test json101-22.2 { ); } {{{"a":2,"b":4,"c":6}}} +# 2023-10-17 https://sqlite.org/forum/forumpost/fc0e3f1e2a +# Incorrect accesss to '$[0]' in parsed + edited JSON. +# +do_execsql_test json101-23.1 { + SELECT j, j->>0, j->>1 + FROM (SELECT json_set(json_set('[]','$[#]',0), '$[#]',1) AS j); +} {{[0,1]} 0 1} +do_execsql_test json101-23.2 { + SELECT j, j->>0, j->>1 + FROM (SELECT json_set('[]','$[#]',0,'$[#]',1) AS j); +} {{[0,1]} 0 1} + + finish_test From 4c827feba18d91ecee7680d3026ccd909957b127 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 17:53:46 +0000 Subject: [PATCH 089/242] Changes to sqlite3IntFloatCompare() in an attempt to better measure branch coverage in the face of aggressive compiler optimization. FossilOrigin-Name: 5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 22 +++++++++++++++------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 12f27004eb..e0207305ff 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sJSON\sbug\sintroduced\sby\sthe\soptimization\sof\s[df099ad713011b67]\sand\nfirst\sappearing\sin\s3.43.0.\s\sThe\sproblem\soccurs\swhen\sdoing\sa\sJSON_EXTRACT()\non\san\sarray\selement\sthat\swas\sadded\sby\sJSON_SET()\swithout\sfirst\sreparsing.\nReported\sby\s[forum:/forumpost/fc0e3f1e2a|forum\spost\sfc0e3f1e2a]. -D 2023-10-17T13:41:41.074 +C Changes\sto\ssqlite3IntFloatCompare()\sin\san\sattempt\sto\sbetter\smeasure\nbranch\scoverage\sin\sthe\sface\sof\saggressive\scompiler\soptimization. +D 2023-10-17T17:53:46.671 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -792,7 +792,7 @@ F src/vdbe.c ae873b02ade06478b217ea38d90229dff68180d7a1fe526910b0d62a0fe0595a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c 9c1509ea78dbfb528fbca49601a5a39617eeca3315b141e3b28e2ee1ec45dc12 -F src/vdbeaux.c 5b415e09b5b9d5be6c0f4fcbf18ea9d7d16f6a29ced2f14a3b2041020f63e9c1 +F src/vdbeaux.c 1a11270d4b7cd1fad29a7c3f1d175a816fca2fb6ecaa3e5ecbe1eb4baf575f75 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c ba9e21c579b58979a63d85e79088c9a9860b0ff4359f59a0db37427fb7807f66 F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e754789971e019647e7068f76dc6f9778675e4849fe51d8b25b39d3edf2379e5 -R 3f9b22b9a01bc799e241ff3ddd4c2083 +P e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58 +R 75216e177755e8e74b67bf7e07c7ed2b U drh -Z 0e3dd3d1b219ba9ab7384c8b1f01954c +Z a40626b169d3eb0845d6fccf462c01da # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index aec3af3110..915eb30ed5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58 \ No newline at end of file +5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index eafc038562..1ed7a6dca3 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -4461,6 +4461,16 @@ SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ return n1 - n2; } +/* The following two functions are used only within testcase() to prove +** test coverage. These functions do no exist for production builds. +** We must use separate SQLITE_NOINLINE functions here, since otherwise +** optimizer code movement causes gcov to become very confused. +*/ +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) +static int SQLITE_NOINLINE doubleLt(double a, double b){ return ar ); testcase( x==r ); - if( xr; /*NO_TEST*/ /* work around bug in gcov */ + return (xr); }else{ i64 y; double s; @@ -4482,12 +4491,11 @@ int sqlite3IntFloatCompare(i64 i, double r){ y = (i64)r; if( iy ) return +1; - testcase( r<(double)i ); - testcase( r>(double)i ); - testcase( r==(double)i ); s = (double)i; - if( sr; /*NO_TEST*/ /* work around bug in gcov */ + testcase( doubleLt(s,r) ); + testcase( doubleLt(r,s) ); + testcase( doubleEq(r,s) ); + return (sr); } } From 42b49a3138aa7009c8f36744aa309d932edcd4af Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 18:28:27 +0000 Subject: [PATCH 090/242] Omit an unreachable branch when SQLITE_ENABLE_API_ARMOR is not defined. FossilOrigin-Name: 5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeapi.c | 7 ++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index e0207305ff..889a0c5c2b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Changes\sto\ssqlite3IntFloatCompare()\sin\san\sattempt\sto\sbetter\smeasure\nbranch\scoverage\sin\sthe\sface\sof\saggressive\scompiler\soptimization. -D 2023-10-17T17:53:46.671 +C Omit\san\sunreachable\sbranch\swhen\sSQLITE_ENABLE_API_ARMOR\sis\snot\sdefined. +D 2023-10-17T18:28:27.757 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -791,7 +791,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c ae873b02ade06478b217ea38d90229dff68180d7a1fe526910b0d62a0fe0595a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c 9c1509ea78dbfb528fbca49601a5a39617eeca3315b141e3b28e2ee1ec45dc12 +F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 F src/vdbeaux.c 1a11270d4b7cd1fad29a7c3f1d175a816fca2fb6ecaa3e5ecbe1eb4baf575f75 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c ba9e21c579b58979a63d85e79088c9a9860b0ff4359f59a0db37427fb7807f66 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e5099c549a1d8959d4015516f090b8e6438e517a64b20651175bf5413d94fb58 -R 75216e177755e8e74b67bf7e07c7ed2b +P 5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d +R 513dac248a540d96596079e13af2bfae U drh -Z a40626b169d3eb0845d6fccf462c01da +Z 1e907b0b1d9f5c01eabd8840863bba73 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 915eb30ed5..a162b38132 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d \ No newline at end of file +5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index b7b3b94cdc..31ebbc6976 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -375,7 +375,7 @@ void sqlite3_value_free(sqlite3_value *pOld){ ** is too big or if an OOM occurs. ** ** The invokeValueDestructor(P,X) routine invokes destructor function X() -** on value P is not going to be used and need to be destroyed. +** on value P if P is not going to be used and need to be destroyed. */ static void setResultStrOrError( sqlite3_context *pCtx, /* Function context */ @@ -415,9 +415,14 @@ static int invokeValueDestructor( }else{ xDel((void*)p); } +#ifdef SQLITE_ENABLE_API_ARMOR if( pCtx!=0 ){ sqlite3_result_error_toobig(pCtx); } +#else + assert( pCtx!=0 ); + sqlite3_result_error_toobig(pCtx); +#endif return SQLITE_TOOBIG; } void sqlite3_result_blob( From 6db4e5ed4cc2247381bb2b93bdb66979d081cf94 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 18:59:13 +0000 Subject: [PATCH 091/242] Make a new branch in the SqlExec opcode reachable by tests. FossilOrigin-Name: 023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbe.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 889a0c5c2b..ccb1b3b8c3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\san\sunreachable\sbranch\swhen\sSQLITE_ENABLE_API_ARMOR\sis\snot\sdefined. -D 2023-10-17T18:28:27.757 +C Make\sa\snew\sbranch\sin\sthe\sSqlExec\sopcode\sreachable\sby\stests. +D 2023-10-17T18:59:13.292 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -788,7 +788,7 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c e87f66258c37f87724f46e849572c3ece4c74ef5614ba41eb221e98f0dbc95de F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c ae873b02ade06478b217ea38d90229dff68180d7a1fe526910b0d62a0fe0595a +F src/vdbe.c fb7697e9292e74d6b63e37349edbae5fb2116a7753f71744d41a699bd28e2d3a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5781d043ffeccda03357ee530564987443dc1deb6111a4028701b4a98fdfe16d -R 513dac248a540d96596079e13af2bfae +P 5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee +R 9f71db9b261c5cdc2f29e944e28307f6 U drh -Z 1e907b0b1d9f5c01eabd8840863bba73 +Z 35b981188468f296d580751db3ae3f1e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a162b38132..ca1349f344 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee \ No newline at end of file +023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index ce094f9970..8077d2185a 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -6927,7 +6927,7 @@ case OP_SqlExec: { db->nSqlExec--; db->xAuth = xAuth; db->mTrace = mTrace; - if( rc || zErr ){ + if( zErr || rc ){ sqlite3VdbeError(p, "%s", zErr); sqlite3_free(zErr); if( rc==SQLITE_NOMEM ) goto no_mem; From 43dc31cf1feff10d37e7a5dc3ce141698054768a Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 17 Oct 2023 19:33:52 +0000 Subject: [PATCH 092/242] Fix a harmless compiler warning about variant types for a pointer function. FossilOrigin-Name: 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/json.c | 10 +++++----- src/printf.c | 2 +- src/sqliteInt.h | 2 +- src/vdbe.c | 4 ++-- src/vdbemem.c | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index ccb1b3b8c3..d7fd51770a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sa\snew\sbranch\sin\sthe\sSqlExec\sopcode\sreachable\sby\stests. -D 2023-10-17T18:59:13.292 +C Fix\sa\sharmless\scompiler\swarning\sabout\svariant\stypes\sfor\sa\spointer\sfunction. +D 2023-10-17T19:33:52.248 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -678,7 +678,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c a803f6eb684a8e24e99761138ee233e6d3140f8691146e4667a8fe700c0c16a5 +F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a F src/main.c 73ae4cab166b0fd36352446de7f7d91f89bde86686ae18f0bb7b245173479831 @@ -714,7 +714,7 @@ F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 F src/pragma.c 9f9b8828624ee98de22a2a9793a651daa39bc06cd9e701b6eda23c6d75260f1d F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 -F src/printf.c e3ba080e2f409f9bfcc8d34724e6fc160e9c718dc92d0548f6b71b8b6f860ce2 +F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 @@ -723,7 +723,7 @@ F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728a F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 3c8a3f1bf889a632dbbaecbd3334e9e8d7fdb63b26ee09d6d384af0cc757d64c +F src/sqliteInt.h 2784a4c7cd99c21290a3c6608827ab18af82f2774bd3d3d74b510f792912317d F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -788,13 +788,13 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c e87f66258c37f87724f46e849572c3ece4c74ef5614ba41eb221e98f0dbc95de F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c fb7697e9292e74d6b63e37349edbae5fb2116a7753f71744d41a699bd28e2d3a +F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 F src/vdbeaux.c 1a11270d4b7cd1fad29a7c3f1d175a816fca2fb6ecaa3e5ecbe1eb4baf575f75 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 -F src/vdbemem.c ba9e21c579b58979a63d85e79088c9a9860b0ff4359f59a0db37427fb7807f66 +F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5f8b807b568f4f9ec65f1c924e0e1ac2f996f405e045204145ad7116be7580ee -R 9f71db9b261c5cdc2f29e944e28307f6 +P 023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c +R 2891ade350d5b9b23e69233a322b4f0b U drh -Z 35b981188468f296d580751db3ae3f1e +Z 8ab84523dcdf2fbda2ee418136868215 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ca1349f344..33a330abb9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c \ No newline at end of file +37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 \ No newline at end of file diff --git a/src/json.c b/src/json.c index bb1834dd89..c2129a026e 100644 --- a/src/json.c +++ b/src/json.c @@ -602,7 +602,7 @@ static void jsonResult(JsonString *p){ }else if( jsonForceRCStr(p) ){ sqlite3RCStrRef(p->zBuf); sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed, - (void(*)(void*))sqlite3RCStrUnref, + sqlite3RCStrUnref, SQLITE_UTF8); } } @@ -1942,7 +1942,7 @@ static JsonParse *jsonParseCached( /* The input JSON was not found anywhere in the cache. We will need ** to parse it ourselves and generate a new JsonParse object. */ - bJsonRCStr = sqlite3ValueIsOfClass(pJson,(void(*)(void*))sqlite3RCStrUnref); + bJsonRCStr = sqlite3ValueIsOfClass(pJson,sqlite3RCStrUnref); p = sqlite3_malloc64( sizeof(*p) + (bJsonRCStr ? 0 : nJson+1) ); if( p==0 ){ sqlite3_result_error_nomem(pCtx); @@ -3127,7 +3127,7 @@ static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){ }else if( isFinal ){ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, pStr->bStatic ? SQLITE_TRANSIENT : - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pStr->bStatic = 1; }else{ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); @@ -3236,7 +3236,7 @@ static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){ }else if( isFinal ){ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, pStr->bStatic ? SQLITE_TRANSIENT : - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pStr->bStatic = 1; }else{ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); @@ -3668,7 +3668,7 @@ static int jsonEachFilter( if( z==0 ) return SQLITE_OK; memset(&p->sParse, 0, sizeof(p->sParse)); p->sParse.nJPRef = 1; - if( sqlite3ValueIsOfClass(argv[0], (void(*)(void*))sqlite3RCStrUnref) ){ + if( sqlite3ValueIsOfClass(argv[0], sqlite3RCStrUnref) ){ p->sParse.zJson = sqlite3RCStrRef((char*)z); }else{ n = sqlite3_value_bytes(argv[0]); diff --git a/src/printf.c b/src/printf.c index 87ad91f795..3c0b182d39 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1389,7 +1389,7 @@ char *sqlite3RCStrRef(char *z){ ** Decrease the reference count by one. Free the string when the ** reference count reaches zero. */ -void sqlite3RCStrUnref(char *z){ +void sqlite3RCStrUnref(void *z){ RCStr *p = (RCStr*)z; assert( p!=0 ); p--; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 54f8db50a5..bee53b6c78 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -5352,7 +5352,7 @@ int sqlite3ApiExit(sqlite3 *db, int); int sqlite3OpenTempDatabase(Parse *); char *sqlite3RCStrRef(char*); -void sqlite3RCStrUnref(char*); +void sqlite3RCStrUnref(void*); char *sqlite3RCStrNew(u64); char *sqlite3RCStrResize(char*,u64); diff --git a/src/vdbe.c b/src/vdbe.c index 8077d2185a..b7bf8c0ec7 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -762,11 +762,11 @@ static SQLITE_NOINLINE int vdbeColumnFromOverflow( sqlite3RCStrRef(pBuf); if( t&1 ){ rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, encoding, - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pDest->flags |= MEM_Term; }else{ rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, 0, - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); } }else{ rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest); diff --git a/src/vdbemem.c b/src/vdbemem.c index 27dfc73fd0..eee828143a 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -336,7 +336,7 @@ void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){ pMem->flags |= MEM_Term; return; } - if( pMem->xDel==(void(*)(void*))sqlite3RCStrUnref ){ + if( pMem->xDel==sqlite3RCStrUnref ){ /* Blindly assume that all RCStr objects are zero-terminated */ pMem->flags |= MEM_Term; return; From 0b4de1acac7da83cfaf72cbd00d1d1f2fd456b1a Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 17 Oct 2023 23:35:47 +0000 Subject: [PATCH 093/242] JS: replace one errant reference to 'self' with 'globalThis' and remove a separate dead-code 'self' reference. FossilOrigin-Name: da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 --- ext/wasm/api/sqlite3-api-worker1.js | 3 +-- ext/wasm/api/sqlite3-worker1.c-pp.js | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-worker1.js b/ext/wasm/api/sqlite3-api-worker1.js index 9a386c13e7..29f7d2be63 100644 --- a/ext/wasm/api/sqlite3-api-worker1.js +++ b/ext/wasm/api/sqlite3-api-worker1.js @@ -333,7 +333,6 @@ sqlite3.initWorker1API = function(){ if(!(globalThis.WorkerGlobalScope instanceof Function)){ toss("initWorker1API() must be run from a Worker thread."); } - const self = this.self; const sqlite3 = this.sqlite3 || toss("Missing this.sqlite3 object."); const DB = sqlite3.oo1.DB; @@ -657,5 +656,5 @@ sqlite3.initWorker1API = function(){ }, wState.xfer); }; globalThis.postMessage({type:'sqlite3-api',result:'worker1-ready'}); -}.bind({self, sqlite3}); +}.bind({sqlite3}); }); diff --git a/ext/wasm/api/sqlite3-worker1.c-pp.js b/ext/wasm/api/sqlite3-worker1.c-pp.js index f260422309..220722ffe1 100644 --- a/ext/wasm/api/sqlite3-worker1.c-pp.js +++ b/ext/wasm/api/sqlite3-worker1.c-pp.js @@ -37,7 +37,7 @@ import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs'; "use strict"; { const urlParams = globalThis.location - ? new URL(self.location.href).searchParams + ? new URL(globalThis.location.href).searchParams : new URLSearchParams(); let theJs = 'sqlite3.js'; if(urlParams.has('sqlite3.dir')){ diff --git a/manifest b/manifest index d7fd51770a..ec337ca6ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sabout\svariant\stypes\sfor\sa\spointer\sfunction. -D 2023-10-17T19:33:52.248 +C JS:\sreplace\sone\serrant\sreference\sto\s'self'\swith\s'globalThis'\sand\sremove\sa\sseparate\sdead-code\s'self'\sreference. +D 2023-10-17T23:35:47.218 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -579,7 +579,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js d235ad237df6954145404305040991c72ef8b18817 F ext/wasm/api/sqlite3-api-glue.js 26aedfb27915f4f316f6eac84078443e4f0d2dfe5f012310014923ed4b77b2b6 F ext/wasm/api/sqlite3-api-oo1.js 9678dc4d9a5d39632b6ffe6ea94a023119260815bf32f265bf5f6c36c9516db8 F ext/wasm/api/sqlite3-api-prologue.js 9aeba7b45cf41b3a26d34d7fb2525633cd1adfc544888c1ea8dbb077496f4ce9 -F ext/wasm/api/sqlite3-api-worker1.js 9f32af64df1a031071912eea7a201557fe39b1738645c0134562bb84e88e2fec +F ext/wasm/api/sqlite3-api-worker1.js f941382f21006b4a817754184e2661b0a63ce650201f3419cd60f4758b6fd60e F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 @@ -587,7 +587,7 @@ F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js f7c965cf9ac0b66a538cd8f6c156f3f2 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e F ext/wasm/api/sqlite3-wasm.c c8c5b81b838cef2053b1eb6e7a79c44a2caedcf0c9e6b0d12a45d73ce0617be0 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f -F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75 +F ext/wasm/api/sqlite3-worker1.c-pp.js a541112aa51e16705f13a99bb943c64efe178aa28c86704a955f8fd9afe4ba37 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 023ad470b68b7c09e159244493a6d0285d706efdecd8719a71e6885509d4750c -R 2891ade350d5b9b23e69233a322b4f0b -U drh -Z 8ab84523dcdf2fbda2ee418136868215 +P 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 +R 02d0e707fb1cf1d9efb28ab84c90dee6 +U stephan +Z 455d6debd64ad95ee72e444517f71e6f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 33a330abb9..7700963681 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 \ No newline at end of file +da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 \ No newline at end of file From f8202f1ff3ff84908ff1038886f6c6c01eba8dc2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 13:18:52 +0000 Subject: [PATCH 094/242] Enhance the parser so that it can accept an ORDER BY clause on a function invocation. For this incremental check-in, the ORDER BY clause is currently ignored. FossilOrigin-Name: 3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132 --- manifest | 23 +++++++++++++---------- manifest.uuid | 2 +- src/expr.c | 38 ++++++++++++++++++++++++++++++++++++++ src/parse.y | 9 +++++++++ src/sqliteInt.h | 1 + src/treeview.c | 6 ++++++ 6 files changed, 68 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index ec337ca6ad..c119b5f7d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JS:\sreplace\sone\serrant\sreference\sto\s'self'\swith\s'globalThis'\sand\sremove\sa\sseparate\sdead-code\s'self'\sreference. -D 2023-10-17T23:35:47.218 +C Enhance\sthe\sparser\sso\sthat\sit\scan\saccept\san\sORDER\sBY\sclause\son\sa\sfunction\ninvocation.\s\sFor\sthis\sincremental\scheck-in,\sthe\sORDER\sBY\sclause\sis\scurrently\nignored. +D 2023-10-18T13:18:52.383 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d +F src/expr.c c1a2aa866a146a5329d562ad1cf7bc53a6e08aeb6d350a5766269a3f22f08ace F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -707,7 +707,7 @@ F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 2188897e1102a776dcb1bbe8b2eb70ac7de8863c9cb95ef09d35e9bad406cf45 F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 -F src/parse.y aeb7760d41cfa86465e3adba506500c021597049fd55f82a30e5b7045862c28c +F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 @@ -723,7 +723,7 @@ F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728a F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 2784a4c7cd99c21290a3c6608827ab18af82f2774bd3d3d74b510f792912317d +F src/sqliteInt.h bc1da6f5605dd0f8433904c2b4e6f9960f6cf327b42f00d1885dc11a290e0641 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -781,7 +781,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 -F src/treeview.c 1d52fbc4e97161e65858d36e3424ea6e3fc045dd8a679c82b4b9593dc30de3bd +F src/treeview.c 6c441500139d46c147216dac667510987ecd0e91a27735cd6d9dd77f81e465a7 F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 @@ -2132,8 +2132,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 -R 02d0e707fb1cf1d9efb28ab84c90dee6 -U stephan -Z 455d6debd64ad95ee72e444517f71e6f +P da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 +R 4d323de4f6e44235324bfe080b4895e2 +T *branch * agg-orderby +T *sym-agg-orderby * +T -sym-trunk * +U drh +Z 1ba4c9d9b0d3f5c9086b8a02e3617a21 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7700963681..639cc87ac6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 \ No newline at end of file +3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index f7290262e5..07b6dfcef6 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1181,6 +1181,44 @@ Expr *sqlite3ExprFunction( return pNew; } +/* +** Attach an ORDER BY clause to a function call. +** +** functionname( arguments ORDER BY sortlist ) +** \_____________________/ \______/ +** pExpr pOrderBy +** +** The ORDER BY clause is inserted into a new Expr node of type TK_ORDER +** and added to the Expr.pLeft field of the parent TK_FUNCTION node. +*/ +void sqlite3ExprAddFunctionOrderBy( + Parse *pParse, /* Parsing context */ + Expr *pExpr, /* The function call to which ORDER BY is to be added */ + ExprList *pOrderBy /* The ORDER BY clause to add */ +){ + Expr *pOB; + sqlite3 *db = pParse->db; + if( pOrderBy==0 ){ + assert( db->mallocFailed ); + return; + } + if( pExpr==0 ){ + assert( db->mallocFailed ); + sqlite3ExprListDelete(db, pOrderBy); + return; + } + assert( pExpr->op==TK_FUNCTION ); + assert( pExpr->pLeft==0 ); + pOB = sqlite3ExprAlloc(db, TK_ORDER, 0, 0); + if( pOB==0 ){ + sqlite3ExprListDelete(db, pOrderBy); + return; + } + pOB->x.pList = pOrderBy; + assert( ExprUseXList(pOB) ); + pExpr->pLeft = pOB; +} + /* ** Check to see if a function is usable according to current access ** rules: diff --git a/src/parse.y b/src/parse.y index 867b62aa7a..19491192e3 100644 --- a/src/parse.y +++ b/src/parse.y @@ -1144,6 +1144,10 @@ expr(A) ::= CAST LP expr(E) AS typetoken(T) RP. { expr(A) ::= idj(X) LP distinct(D) exprlist(Y) RP. { A = sqlite3ExprFunction(pParse, Y, &X, D); } +expr(A) ::= idj(X) LP distinct(D) exprlist(Y) ORDER BY sortlist(O) RP. { + A = sqlite3ExprFunction(pParse, Y, &X, D); + sqlite3ExprAddFunctionOrderBy(pParse, A, O); +} expr(A) ::= idj(X) LP STAR RP. { A = sqlite3ExprFunction(pParse, 0, &X, 0); } @@ -1153,6 +1157,11 @@ expr(A) ::= idj(X) LP distinct(D) exprlist(Y) RP filter_over(Z). { A = sqlite3ExprFunction(pParse, Y, &X, D); sqlite3WindowAttach(pParse, A, Z); } +expr(A) ::= idj(X) LP distinct(D) exprlist(Y) ORDER BY sortlist(O) RP filter_over(Z). { + A = sqlite3ExprFunction(pParse, Y, &X, D); + sqlite3WindowAttach(pParse, A, Z); + sqlite3ExprAddFunctionOrderBy(pParse, A, O); +} expr(A) ::= idj(X) LP STAR RP filter_over(Z). { A = sqlite3ExprFunction(pParse, 0, &X, 0); sqlite3WindowAttach(pParse, A, Z); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index bee53b6c78..16da1db4c2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4786,6 +4786,7 @@ void sqlite3PExprAddSelect(Parse*, Expr*, Select*); Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); Expr *sqlite3ExprSimplifiedAndOr(Expr*); Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int); +void sqlite3ExprAddFunctionOrderBy(Parse*,Expr*,ExprList*); void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*); void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); void sqlite3ExprDelete(sqlite3*, Expr*); diff --git a/src/treeview.c b/src/treeview.c index d55adab384..6852a61ddd 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -709,6 +709,12 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ } if( pFarg ){ sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); + if( pExpr->pLeft ){ + Expr *pOB = pExpr->pLeft; + assert( pOB->op==TK_ORDER ); + assert( ExprUseXList(pOB) ); + sqlite3TreeViewExprList(pView, pOB->x.pList, pWin!=0, "ORDERBY"); + } } #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ From db19f48b698bc1327ff4a83309a26d4ebead503e Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 13:58:31 +0000 Subject: [PATCH 095/242] Basic error checking. Resolve symbols in the aggregate ORDER BY expressions. FossilOrigin-Name: c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4 --- manifest | 18 ++++++++---------- manifest.uuid | 2 +- src/expr.c | 1 + src/resolve.c | 13 +++++++++++++ test/aggorderby.test | 31 +++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 test/aggorderby.test diff --git a/manifest b/manifest index c119b5f7d2..45e7a5f7a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sparser\sso\sthat\sit\scan\saccept\san\sORDER\sBY\sclause\son\sa\sfunction\ninvocation.\s\sFor\sthis\sincremental\scheck-in,\sthe\sORDER\sBY\sclause\sis\scurrently\nignored. -D 2023-10-18T13:18:52.383 +C Basic\serror\schecking.\s\sResolve\ssymbols\sin\sthe\saggregate\sORDER\sBY\sexpressions. +D 2023-10-18T13:58:31.861 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c c1a2aa866a146a5329d562ad1cf7bc53a6e08aeb6d350a5766269a3f22f08ace +F src/expr.c dbe1be4833e5d1737bc3b685fcc4b8849023b93ebd82538fcd3a5029ea685106 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -716,7 +716,7 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c 0c3046b88901336709cd09f474303a16fc54bce13a2befcab66d0fa6b44ca869 +F src/resolve.c ee4011c8ed177de113e617e514f66ec5c38772cf2f00efa33f9576cbf076361c F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa @@ -814,6 +814,7 @@ F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 F test/aggnested.test 7269d07ac879fce161cb26c8fabe65cba5715742fac8a1fccac570dcdaf28f00 +F test/aggorderby.test 155f0ed2e44f91b13413a84743f829efa23105866c33b66da03d5c6c62308232 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -2132,11 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 -R 4d323de4f6e44235324bfe080b4895e2 -T *branch * agg-orderby -T *sym-agg-orderby * -T -sym-trunk * +P 3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132 +R 151cfa4119235187f9a8c82d8ecde04d U drh -Z 1ba4c9d9b0d3f5c9086b8a02e3617a21 +Z 7081aae7959eb43f46824edbdfe856c6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 639cc87ac6..2c8835c078 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132 \ No newline at end of file +c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 07b6dfcef6..6ae6dc331e 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4361,6 +4361,7 @@ expr_code_doover: assert( !ExprHasVVAProperty(pExpr,EP_Immutable) ); op = pExpr->op; } + assert( op!=TK_ORDER ); switch( op ){ case TK_AGG_COLUMN: { AggInfo *pAggInfo = pExpr->pAggInfo; diff --git a/src/resolve.c b/src/resolve.c index bd890c9f8d..532306e9c0 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1052,6 +1052,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0); #endif assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); + assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER ); zId = pExpr->u.zToken; pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); if( pDef==0 ){ @@ -1193,6 +1194,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ pNC->nNcErr++; } #endif + else if( is_agg==0 && pExpr->pLeft ){ + sqlite3ErrorMsg(pParse, + "ORDER BY may not be used with non-aggregate %#T()", + pExpr + ); + pNC->nNcErr++; + } if( is_agg ){ /* Window functions may not be arguments of aggregate functions. ** Or arguments of other window functions. But aggregate functions @@ -1211,6 +1219,11 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif sqlite3WalkExprList(pWalker, pList); if( is_agg ){ + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + sqlite3WalkExprList(pWalker, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ Select *pSel = pNC->pWinSelect; diff --git a/test/aggorderby.test b/test/aggorderby.test new file mode 100644 index 0000000000..aa868d2faf --- /dev/null +++ b/test/aggorderby.test @@ -0,0 +1,31 @@ +# 2023-10-18 +# +# 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 tests for ORDER BY on aggregate functions. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_execsql_test aggorderby-1.1 { + CREATE TABLE t1(a,b,c,d); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20) + INSERT INTO t1(a,b,c,d) SELECT printf('x%d',x),1,x,200-x FROM c; + INSERT INTO t1(a,b,c,d) SELECT a, 2, c-3, -d FROM t1; + CREATE INDEX t1b ON t1(b); +} +do_catchsql_test aggorderby-1.2 { + SELECT b, group_concat(a ORDER BY max(d)) FROM t1 GROUP BY b; +} {1 {misuse of aggregate function max()}} +do_catchsql_test aggorderby-1.3 { + SELECT abs(a ORDER BY max(d)) FROM t1; +} {1 {ORDER BY may not be used with non-aggregate abs()}} + +finish_test From 59a0d0bbf9a40e678e99f71920bd1cc7ec06d24d Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 18:11:11 +0000 Subject: [PATCH 096/242] ORDER BY on aggregates seem to work, at least for simple smoke tests. Lots more testing is needed though. Surely there are many bugs. FossilOrigin-Name: 64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d --- manifest | 16 +++--- manifest.uuid | 2 +- src/expr.c | 41 +++++++++++--- src/select.c | 146 ++++++++++++++++++++++++++++++++++++++++++------ src/sqliteInt.h | 3 + 5 files changed, 173 insertions(+), 35 deletions(-) diff --git a/manifest b/manifest index 45e7a5f7a6..24129053b0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Basic\serror\schecking.\s\sResolve\ssymbols\sin\sthe\saggregate\sORDER\sBY\sexpressions. -D 2023-10-18T13:58:31.861 +C ORDER\sBY\son\saggregates\sseem\sto\swork,\sat\sleast\sfor\ssimple\ssmoke\stests.\s\sLots\nmore\stesting\sis\sneeded\sthough.\s\sSurely\sthere\sare\smany\sbugs. +D 2023-10-18T18:11:11.181 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c dbe1be4833e5d1737bc3b685fcc4b8849023b93ebd82538fcd3a5029ea685106 +F src/expr.c 7210855080a90215508cada806ee2aba2138907ca5fca19ba047955a3f094e04 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -718,12 +718,12 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c ee4011c8ed177de113e617e514f66ec5c38772cf2f00efa33f9576cbf076361c F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 7f9155185be78902818b21c2cd3e33f01b4306279a15d6719eb1bbb9779034aa +F src/select.c dd0f0ed89668f298e12226127ac4d977a696475a4b6572218c14511022001d42 F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h bc1da6f5605dd0f8433904c2b4e6f9960f6cf327b42f00d1885dc11a290e0641 +F src/sqliteInt.h 8eac2e94e597add7bbef6bab315dc8e761410a599be7a344aba8b7af615ff2a6 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3a98ff24bf468ed42d410a9a12d9f9b2ca154c7babe99fd6bc6f7b0565e0d132 -R 151cfa4119235187f9a8c82d8ecde04d +P c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4 +R c20d0fa6dc56e340bbaa31e8a36615e8 U drh -Z 7081aae7959eb43f46824edbdfe856c6 +Z 66c7548e2f839878f6f4ddcf4735c183 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2c8835c078..312ea1e8ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4 \ No newline at end of file +64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 6ae6dc331e..dd543a98d8 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1209,6 +1209,12 @@ void sqlite3ExprAddFunctionOrderBy( } assert( pExpr->op==TK_FUNCTION ); assert( pExpr->pLeft==0 ); + assert( ExprUseXList(pExpr) ); + if( pExpr->x.pList==0 || NEVER(pExpr->x.pList->nExpr==0) ){ + /* Ignore ORDER BY on zero-argument aggregates */ + sqlite3ExprListDelete(db, pOrderBy); + return; + } pOB = sqlite3ExprAlloc(db, TK_ORDER, 0, 0); if( pOB==0 ){ sqlite3ExprListDelete(db, pOrderBy); @@ -1902,11 +1908,7 @@ Select *sqlite3SelectDup(sqlite3 *db, const Select *p, int flags){ ** initially NULL, then create a new expression list. ** ** The pList argument must be either NULL or a pointer to an ExprList -** obtained from a prior call to sqlite3ExprListAppend(). This routine -** may not be used with an ExprList obtained from sqlite3ExprListDup(). -** Reason: This routine assumes that the number of slots in pList->a[] -** is a power of two. That is true for sqlite3ExprListAppend() returns -** but is not necessarily true from the return value of sqlite3ExprListDup(). +** obtained from a prior call to sqlite3ExprListAppend(). ** ** If a memory allocation error occurs, the entire list is freed and ** NULL is returned. If non-NULL is returned, then it is guaranteed @@ -6712,14 +6714,37 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ u8 enc = ENC(pParse->db); i = addAggInfoFunc(pParse->db, pAggInfo); if( i>=0 ){ + int nArg; assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); pItem = &pAggInfo->aFunc[i]; pItem->pFExpr = pExpr; assert( ExprUseUToken(pExpr) ); + nArg = pExpr->x.pList ? pExpr->x.pList->nExpr : 0; pItem->pFunc = sqlite3FindFunction(pParse->db, - pExpr->u.zToken, - pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0); - if( pExpr->flags & EP_Distinct ){ + pExpr->u.zToken, nArg, enc, 0); + assert( pItem->bOBUnique==0 ); + if( pExpr->pLeft ){ + ExprList *pOBList; + assert( nArg>0 ); + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + pItem->iOBTab = pParse->nTab++; + pOBList = pExpr->pLeft->x.pList; + assert( pOBList->nExpr>0 ); + if( pOBList->nExpr==1 + && nArg==1 + && sqlite3ExprCompare(0,pOBList->a[0].pExpr, + pExpr->x.pList->a[0].pExpr,0)==0 + ){ + pItem->bOBPayload = 0; + pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); + }else{ + pItem->bOBPayload = 1; + } + }else{ + pItem->iOBTab = -1; + } + if( ExprHasProperty(pExpr, EP_Distinct) && !pItem->bOBUnique ){ pItem->iDistinct = pParse->nTab++; }else{ pItem->iDistinct = -1; diff --git a/src/select.c b/src/select.c index a55545d513..36b6e0dd7b 100644 --- a/src/select.c +++ b/src/select.c @@ -6646,6 +6646,32 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ pFunc->pFunc->zName)); } } + if( pFunc->iOBTab>=0 ){ + ExprList *pOBList; + KeyInfo *pKeyInfo; + int nExtra = 0; + assert( pFunc->pFExpr->pLeft!=0 ); + assert( pFunc->pFExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pFunc->pFExpr->pLeft) ); + pOBList = pFunc->pFExpr->pLeft->x.pList; + if( !pFunc->bOBUnique ){ + nExtra++; /* One extra column for the OP_Sequence */ + } + if( pFunc->bOBPayload ){ + /* extra columns for the function arguments */ + assert( ExprUseXList(pFunc->pFExpr) ); + nExtra += pFunc->pFExpr->x.pList->nExpr; + } + pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOBList, 0, nExtra); + if( !pFunc->bOBUnique ){ + pKeyInfo->nKeyField++; + } + sqlite3VdbeAddOp4(v, OP_OpenEphemeral, + pFunc->iOBTab, pOBList->nExpr+nExtra, 0, + (char*)pKeyInfo, P4_KEYINFO); + ExplainQueryPlan((pParse, 0, "USE TEMP B-TREE FOR %s(ORDER BY)", + pFunc->pFunc->zName)); + } } } @@ -6661,13 +6687,46 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); pList = pF->pFExpr->x.pList; + if( pF->iOBTab ){ + /* For an ORDER BY aggregate, calls to OP_AggStep where deferred and + ** all content was stored in emphermal table pF->iOBTab. Extract that + ** content now (in ORDER BY order) and make all calls to OP_AggStep + ** before doing the OP_AggFinal call. */ + int iTop; /* Start of loop for extracting columns */ + int nArg; /* Number of columns to extract */ + int nKey; /* Key columns to be skipped */ + int regAgg; /* Extract into this array */ + int j; /* Loop counter */ + + nArg = pList->nExpr; + regAgg = sqlite3GetTempRange(pParse, nArg); + + if( pF->bOBPayload==0 ){ + nKey = 0; + }else{ + assert( pF->pFExpr->pLeft!=0 ); + assert( ExprUseXList(pF->pFExpr->pLeft) ); + assert( pF->pFExpr->pLeft->x.pList!=0 ); + nKey = pF->pFExpr->pLeft->x.pList->nExpr; + if( !pF->bOBUnique ) nKey++; + } + iTop = sqlite3VdbeAddOp1(v, OP_Rewind, pF->iOBTab); + for(j=nArg-1; j>=0; j--){ + sqlite3VdbeAddOp3(v, OP_Column, pF->iOBTab, nKey+j, regAgg+j); + } + sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); + sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + sqlite3VdbeChangeP5(v, (u8)nArg); + sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); + sqlite3VdbeJumpHere(v, iTop); + sqlite3ReleaseTempRange(pParse, regAgg, nArg); + } sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), pList ? pList->nExpr : 0); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); } } - /* ** Generate code that will update the accumulator memory cells for an ** aggregate based on the current cursor position. @@ -6676,6 +6735,13 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator ** registers if register regAcc contains 0. The caller will take care ** of setting and clearing regAcc. +** +** For an ORDER BY aggregate, the actually accumulator memory cell update +** is deferred until after all input rows have been received, so that they +** can be run in the requested order. In that case, instead of invoking +** OP_AggStep to update accumulator, just add the arguments that would +** have been passed into OP_AggStep into the sorting ephemeral table +** (along with the appropriate sort key). */ static void updateAccumulator( Parse *pParse, @@ -6697,6 +6763,7 @@ static void updateAccumulator( int nArg; int addrNext = 0; int regAgg; + int regAggSz = 0; ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); assert( !IsWindowFunc(pF->pFExpr) ); @@ -6723,7 +6790,39 @@ static void updateAccumulator( addrNext = sqlite3VdbeMakeLabel(pParse); sqlite3ExprIfFalse(pParse, pFilter, addrNext, SQLITE_JUMPIFNULL); } - if( pList ){ + if( pF->iOBTab>=0 ){ + /* Instead of invoking AggStep, we must push the arguments that would + ** have been passed to AggStep onto the sorting table. */ + int jj; /* Registered used so far in building the record */ + ExprList *pOBList; /* The ORDER BY clause */ + assert( pList!=0 ); + nArg = pList->nExpr; + assert( nArg>0 ); + assert( pF->pFExpr->pLeft!=0 ); + assert( pF->pFExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pF->pFExpr->pLeft) ); + pOBList = pF->pFExpr->pLeft->x.pList; + assert( pOBList!=0 ); + assert( pOBList->nExpr>0 ); + regAggSz = pOBList->nExpr; + if( !pF->bOBUnique ){ + regAggSz++; /* One register for OP_Sequence */ + } + if( pF->bOBPayload ){ + regAggSz += nArg; + } + regAggSz++; /* One extra register to hold result of MakeRecord */ + regAgg = sqlite3GetTempRange(pParse, regAggSz); + sqlite3ExprCodeExprList(pParse, pOBList, regAgg, 0, SQLITE_ECEL_DUP); + jj = pOBList->nExpr; + if( !pF->bOBUnique ){ + sqlite3VdbeAddOp2(v, OP_Sequence, pF->iOBTab, regAgg+jj); + jj++; + } + if( pF->bOBPayload ){ + sqlite3ExprCodeExprList(pParse, pList, regAgg+jj, 0, SQLITE_ECEL_DUP); + } + }else if( pList ){ nArg = pList->nExpr; regAgg = sqlite3GetTempRange(pParse, nArg); sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP); @@ -6738,24 +6837,35 @@ static void updateAccumulator( pF->iDistinct = codeDistinct(pParse, eDistinctType, pF->iDistinct, addrNext, pList, regAgg); } - if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - CollSeq *pColl = 0; - struct ExprList_item *pItem; - int j; - assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ - for(j=0, pItem=pList->a; !pColl && jpExpr); + if( pF->iOBTab>=0 ){ + /* Insert a new record into the ORDER BY table */ + sqlite3VdbeAddOp3(v, OP_MakeRecord, regAgg, regAggSz-1, + regAgg+regAggSz-1); + sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pF->iOBTab, regAgg+regAggSz-1, + regAgg, regAggSz-1); + sqlite3ReleaseTempRange(pParse, regAgg, regAggSz); + }else{ + /* Invoke the AggStep function */ + if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ + CollSeq *pColl = 0; + struct ExprList_item *pItem; + int j; + assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ + for(j=0, pItem=pList->a; !pColl && jpExpr); + } + if( !pColl ){ + pColl = pParse->db->pDfltColl; + } + if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; + sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, + (char *)pColl, P4_COLLSEQ); } - if( !pColl ){ - pColl = pParse->db->pDfltColl; - } - if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); + sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); + sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + sqlite3VdbeChangeP5(v, (u8)nArg); + sqlite3ReleaseTempRange(pParse, regAgg, nArg); } - sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); - sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nArg); - sqlite3ReleaseTempRange(pParse, regAgg, nArg); if( addrNext ){ sqlite3VdbeResolveLabel(v, addrNext); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 16da1db4c2..cb90fba4a7 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2860,6 +2860,9 @@ struct AggInfo { FuncDef *pFunc; /* The aggregate function implementation */ int iDistinct; /* Ephemeral table used to enforce DISTINCT */ int iDistAddr; /* Address of OP_OpenEphemeral */ + int iOBTab; /* Ephemeral table to implement ORDER BY */ + u8 bOBPayload; /* iOBTab has payload columns separate from key */ + u8 bOBUnique; /* Enforce uniqueness on iOBTab keys */ } *aFunc; int nFunc; /* Number of entries in aFunc[] */ u32 selId; /* Select to which this AggInfo belongs */ From 0021079ceb4f0583ae66d66bac510cb1644ff149 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 19:07:45 +0000 Subject: [PATCH 097/242] Fix one minor error in order to get all legacy tests to pass. FossilOrigin-Name: 5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 24129053b0..7bfe811a5d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C ORDER\sBY\son\saggregates\sseem\sto\swork,\sat\sleast\sfor\ssimple\ssmoke\stests.\s\sLots\nmore\stesting\sis\sneeded\sthough.\s\sSurely\sthere\sare\smany\sbugs. -D 2023-10-18T18:11:11.181 +C Fix\sone\sminor\serror\sin\sorder\sto\sget\sall\slegacy\stests\sto\spass. +D 2023-10-18T19:07:45.183 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -718,7 +718,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c ee4011c8ed177de113e617e514f66ec5c38772cf2f00efa33f9576cbf076361c F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c dd0f0ed89668f298e12226127ac4d977a696475a4b6572218c14511022001d42 +F src/select.c 80c5c95fcd5d9354884d825ca3f00cc20655484679cb9c995a2bb4f5d5b84a7b F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4 -R c20d0fa6dc56e340bbaa31e8a36615e8 +P 64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d +R d6ccbf7622f816d9126033156316cd20 U drh -Z 66c7548e2f839878f6f4ddcf4735c183 +Z d5004cc6bd28c98dd137858c93e3d27b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 312ea1e8ab..ce4e3fb168 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d \ No newline at end of file +5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc \ No newline at end of file diff --git a/src/select.c b/src/select.c index 36b6e0dd7b..60583b20a3 100644 --- a/src/select.c +++ b/src/select.c @@ -6687,7 +6687,7 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); pList = pF->pFExpr->x.pList; - if( pF->iOBTab ){ + if( pF->iOBTab>=0 ){ /* For an ORDER BY aggregate, calls to OP_AggStep where deferred and ** all content was stored in emphermal table pF->iOBTab. Extract that ** content now (in ORDER BY order) and make all calls to OP_AggStep From 49dc1be96f76ce01325cdb2d8b475f25a51f3605 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 19:44:59 +0000 Subject: [PATCH 098/242] Basic test cases. FossilOrigin-Name: 6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 6 +++++- test/aggorderby.test | 41 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 50 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 7bfe811a5d..bb22cd96f2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sone\sminor\serror\sin\sorder\sto\sget\sall\slegacy\stests\sto\spass. -D 2023-10-18T19:07:45.183 +C Basic\stest\scases. +D 2023-10-18T19:44:59.620 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 7210855080a90215508cada806ee2aba2138907ca5fca19ba047955a3f094e04 +F src/expr.c ae9224fba771a8471775c25bdf77dbbd395d9448625d9b57c0803c72a14eee27 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -814,7 +814,7 @@ F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 F test/aggnested.test 7269d07ac879fce161cb26c8fabe65cba5715742fac8a1fccac570dcdaf28f00 -F test/aggorderby.test 155f0ed2e44f91b13413a84743f829efa23105866c33b66da03d5c6c62308232 +F test/aggorderby.test a77c92a0eb05239ccecc36b6593f6fe965b20d3516d8c9dcc31786405d5f4d8a F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 64c12a835b6f1df8f2f5f4a41de083f6b3fc7f8030042c6aac0082382cd9cc4d -R d6ccbf7622f816d9126033156316cd20 +P 5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc +R 0d6047c558f607c2eae8d487564b4699 U drh -Z d5004cc6bd28c98dd137858c93e3d27b +Z a5d3b645b078b22a6e4c48aa8f04c82d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ce4e3fb168..5df3a0921a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc \ No newline at end of file +6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index dd543a98d8..26f0b4c5c0 100644 --- a/src/expr.c +++ b/src/expr.c @@ -6723,7 +6723,11 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ pItem->pFunc = sqlite3FindFunction(pParse->db, pExpr->u.zToken, nArg, enc, 0); assert( pItem->bOBUnique==0 ); - if( pExpr->pLeft ){ + if( pExpr->pLeft + && (pItem->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)==0 + ){ + /* The NEEDCOLL test above causes any ORDER BY clause on + ** aggregate min() or max() to be ignored. */ ExprList *pOBList; assert( nArg>0 ); assert( pExpr->pLeft->op==TK_ORDER ); diff --git a/test/aggorderby.test b/test/aggorderby.test index aa868d2faf..e90ea0a57c 100644 --- a/test/aggorderby.test +++ b/test/aggorderby.test @@ -15,10 +15,10 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl do_execsql_test aggorderby-1.1 { - CREATE TABLE t1(a,b,c,d); - WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20) - INSERT INTO t1(a,b,c,d) SELECT printf('x%d',x),1,x,200-x FROM c; - INSERT INTO t1(a,b,c,d) SELECT a, 2, c-3, -d FROM t1; + CREATE TABLE t1(a TEXT,b INT,c INT,d INT); + WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<9) + INSERT INTO t1(a,b,c,d) SELECT printf('%d',(x*7)%10),1,x,10-x FROM c; + INSERT INTO t1(a,b,c,d) SELECT a, 2, c, 10-d FROM t1; CREATE INDEX t1b ON t1(b); } do_catchsql_test aggorderby-1.2 { @@ -28,4 +28,37 @@ do_catchsql_test aggorderby-1.3 { SELECT abs(a ORDER BY max(d)) FROM t1; } {1 {ORDER BY may not be used with non-aggregate abs()}} +do_execsql_test aggorderby-2.0 { + SELECT group_concat(a ORDER BY a) FROM t1 WHERE b=1; +} {0,1,2,3,4,5,6,7,8,9} +do_execsql_test aggorderby-2.1 { + SELECT group_concat(a ORDER BY c) FROM t1 WHERE b=1; +} {0,7,4,1,8,5,2,9,6,3} +do_execsql_test aggorderby-2.2 { + SELECT group_concat(a ORDER BY b, d) FROM t1; +} {3,6,9,2,5,8,1,4,7,0,0,7,4,1,8,5,2,9,6,3} +do_execsql_test aggorderby-2.3 { + SELECT group_concat(a ORDER BY b DESC, d) FROM t1; +} {0,7,4,1,8,5,2,9,6,3,3,6,9,2,5,8,1,4,7,0} +do_execsql_test aggorderby-2.4 { + SELECT b, group_concat(a ORDER BY d) FROM t1 GROUP BY b ORDER BY b; +} {1 3,6,9,2,5,8,1,4,7,0 2 0,7,4,1,8,5,2,9,6,3} + +do_execsql_test aggorderby-3.0 { + SELECT group_concat(DISTINCT a ORDER BY a) FROM t1; +} {0,1,2,3,4,5,6,7,8,9} +do_execsql_test aggorderby-3.1 { + SELECT group_concat(DISTINCT a ORDER BY c) FROM t1; +} {0,7,4,1,8,5,2,9,6,3} + +do_execsql_test aggorderby-4.0 { + SELECT count(ORDER BY a) FROM t1; +} 20 +do_execsql_test aggorderby-4.1 { + SELECT c, max(a ORDER BY a) FROM t1; +} {7 9} + + + + finish_test From 20b95f8d3fc34d6fe8a049a3b2abebefce12eea1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 22:03:48 +0000 Subject: [PATCH 099/242] Make sure all terms of the ORDER BY within an aggregate go through aggregate analysis. Do not attach an aggregate ORDER BY to a window function. FossilOrigin-Name: 16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/expr.c | 16 ++++++++++++++++ src/resolve.c | 5 +---- src/select.c | 6 ++++++ src/sqliteInt.h | 1 + 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index bb22cd96f2..0fae9862b8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Basic\stest\scases. -D 2023-10-18T19:44:59.620 +C Make\ssure\sall\sterms\sof\sthe\sORDER\sBY\swithin\san\saggregate\sgo\sthrough\saggregate\nanalysis.\s\sDo\snot\sattach\san\saggregate\sORDER\sBY\sto\sa\swindow\sfunction. +D 2023-10-18T22:03:48.889 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c ae9224fba771a8471775c25bdf77dbbd395d9448625d9b57c0803c72a14eee27 +F src/expr.c 3c147581955ec30fc4732eb05d9fd6ebd6ee713284642e42bd5b9cfe22527abf F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -716,14 +716,14 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c ee4011c8ed177de113e617e514f66ec5c38772cf2f00efa33f9576cbf076361c +F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 80c5c95fcd5d9354884d825ca3f00cc20655484679cb9c995a2bb4f5d5b84a7b +F src/select.c 12733c8abdfffa7d383830a258885eeccc32b10eedbe068edd3137b1b05b3b1a F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 8eac2e94e597add7bbef6bab315dc8e761410a599be7a344aba8b7af615ff2a6 +F src/sqliteInt.h 834656265db68d42cf615e01b107b16d43c2bcad4837f197c88928448fc1de71 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5a885139c433a143302ab43dc5aaac1fed9db61548b4ff7d4b19b3a6a46c8fcc -R 0d6047c558f607c2eae8d487564b4699 +P 6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2 +R 67ae4f4c3cb6848472e4d3dd82fce25b U drh -Z a5d3b645b078b22a6e4c48aa8f04c82d +Z dc2e81b0f2992d3e49cb5d6bc5c317b5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5df3a0921a..03d4b453fd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2 \ No newline at end of file +16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 26f0b4c5c0..72a5fae7d2 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1181,6 +1181,16 @@ Expr *sqlite3ExprFunction( return pNew; } +/* +** Report an error when attempting to use an ORDER BY clause within +** the arguments of a non-aggregate function. +*/ +void sqlite3ExprOrderByAggregateError(Parse *pParse, Expr *p){ + sqlite3ErrorMsg(pParse, + "ORDER BY may not be used with non-aggregate %#T()", p + ); +} + /* ** Attach an ORDER BY clause to a function call. ** @@ -1215,6 +1225,12 @@ void sqlite3ExprAddFunctionOrderBy( sqlite3ExprListDelete(db, pOrderBy); return; } + if( IsWindowFunc(pExpr) ){ + sqlite3ExprOrderByAggregateError(pParse, pExpr); + sqlite3ExprListDelete(db, pOrderBy); + return; + } + pOB = sqlite3ExprAlloc(db, TK_ORDER, 0, 0); if( pOB==0 ){ sqlite3ExprListDelete(db, pOrderBy); diff --git a/src/resolve.c b/src/resolve.c index 532306e9c0..7eba26938a 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1195,10 +1195,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } #endif else if( is_agg==0 && pExpr->pLeft ){ - sqlite3ErrorMsg(pParse, - "ORDER BY may not be used with non-aggregate %#T()", - pExpr - ); + sqlite3ExprOrderByAggregateError(pParse, pExpr); pNC->nNcErr++; } if( is_agg ){ diff --git a/src/select.c b/src/select.c index 60583b20a3..05aeb42e05 100644 --- a/src/select.c +++ b/src/select.c @@ -6490,8 +6490,14 @@ static void analyzeAggFuncArgs( pNC->ncFlags |= NC_InAggFunc; for(i=0; inFunc; i++){ Expr *pExpr = pAggInfo->aFunc[i].pFExpr; + assert( pExpr->op==TK_FUNCTION || pExpr->op==TK_AGG_FUNCTION ); assert( ExprUseXList(pExpr) ); sqlite3ExprAnalyzeAggList(pNC, pExpr->x.pList); + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + sqlite3ExprAnalyzeAggList(pNC, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC assert( !IsWindowFunc(pExpr) ); if( ExprHasProperty(pExpr, EP_WinFunc) ){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index cb90fba4a7..4becf92227 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4790,6 +4790,7 @@ Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); Expr *sqlite3ExprSimplifiedAndOr(Expr*); Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int); void sqlite3ExprAddFunctionOrderBy(Parse*,Expr*,ExprList*); +void sqlite3ExprOrderByAggregateError(Parse*,Expr*); void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*); void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); void sqlite3ExprDelete(sqlite3*, Expr*); From ce51b313670889aea8c92ce0517d136203a27729 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 22:27:59 +0000 Subject: [PATCH 100/242] Deal with an OOM condition while processing aggregate ORDER BYs. FossilOrigin-Name: b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 0fae9862b8..b7c394baed 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sall\sterms\sof\sthe\sORDER\sBY\swithin\san\saggregate\sgo\sthrough\saggregate\nanalysis.\s\sDo\snot\sattach\san\saggregate\sORDER\sBY\sto\sa\swindow\sfunction. -D 2023-10-18T22:03:48.889 +C Deal\swith\san\sOOM\scondition\swhile\sprocessing\saggregate\sORDER\sBYs. +D 2023-10-18T22:27:59.265 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -718,7 +718,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 12733c8abdfffa7d383830a258885eeccc32b10eedbe068edd3137b1b05b3b1a +F src/select.c 9b6fd8e12eb607013d32c41448521495e0f6ee65be13076eca56418f36606241 F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6cccf86c362631ada0c6cbaf661520648f8bbf7ae2b137b3d7d959647387e5c2 -R 67ae4f4c3cb6848472e4d3dd82fce25b +P 16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b +R 6802737776ac151bb19cf65ccd4a04fb U drh -Z dc2e81b0f2992d3e49cb5d6bc5c317b5 +Z 63e8f8ba6a775006c8b7c4fe41a1d182 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 03d4b453fd..dde82f9eb8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b \ No newline at end of file +b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 05aeb42e05..69e22ba3ef 100644 --- a/src/select.c +++ b/src/select.c @@ -6669,7 +6669,7 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ nExtra += pFunc->pFExpr->x.pList->nExpr; } pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOBList, 0, nExtra); - if( !pFunc->bOBUnique ){ + if( !pFunc->bOBUnique && pParse->nErr==0 ){ pKeyInfo->nKeyField++; } sqlite3VdbeAddOp4(v, OP_OpenEphemeral, From 42f5ea354e8ec698e52837c44f094d6f55d61aca Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 22:53:22 +0000 Subject: [PATCH 101/242] Test case for alter column that is used in the ORDER BY of an aggregate. FossilOrigin-Name: 648ddb3a8eb358fc6c95aaa561ae68476c77996abda23890054ac07166278cef --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/altercol.test | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index b7c394baed..a200c332b0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Deal\swith\san\sOOM\scondition\swhile\sprocessing\saggregate\sORDER\sBYs. -D 2023-10-18T22:27:59.265 +C Test\scase\sfor\salter\scolumn\sthat\sis\sused\sin\sthe\sORDER\sBY\sof\san\saggregate. +D 2023-10-18T22:53:22.341 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -823,7 +823,7 @@ F test/alter3.test ffc4ab29ce78a3517a66afd69b2730667e3471622509c283b2bd4c46f680f F test/alter4.test 716caa071dd8a3c6d57225778d15d3c3cbf5e34b2e84ae44199aeb2bbf50a707 F test/alterauth.test 63442ba61ceb0c1eeb63aac1f4f5cebfa509d352276059d27106ae256bafc959 F test/alterauth2.test 48967abae0494d9a300d1c92473d99fcb66edfcc23579c89322f033f49410adc -F test/altercol.test 8465ca659c2c55a359cf16cc261df4fcb5c45a5f104a50827c337ae66c09dc15 +F test/altercol.test 29fed774747777fbbaacdd865b4413ed2d0844a4c824f8af531b5c7d4a832087 F test/altercorrupt.test 2e1d705342cf9d7de884518ddbb053fd52d7e60d2b8869b7b63b2fda68435c12 F test/alterdropcol.test a653a3945f964d26845ec0cd0a8e74189f46de3119a984c5bc45457da392612e F test/alterdropcol2.test 527fce683b200d620f560f666c44ae33e22728e990a10a48a543280dfd4b4d41 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b -R 6802737776ac151bb19cf65ccd4a04fb +P b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225 +R bfd41b51d8c40e8811533ae7ac911f64 U drh -Z 63e8f8ba6a775006c8b7c4fe41a1d182 +Z bf6fd600101e04b72e58dadb7f157c54 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dde82f9eb8..49d6cfc305 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225 \ No newline at end of file +648ddb3a8eb358fc6c95aaa561ae68476c77996abda23890054ac07166278cef \ No newline at end of file diff --git a/test/altercol.test b/test/altercol.test index e39793aa9f..f44aa2e065 100644 --- a/test/altercol.test +++ b/test/altercol.test @@ -343,6 +343,21 @@ do_catchsql_test 8.4.5 { ALTER TABLE b1 RENAME a TO aaa; } {1 {error in view zzz: no such column: george}} +do_execsql_test 8.5 { + DROP VIEW zzz; + CREATE TABLE t5(a TEXT, b INT); + INSERT INTO t5(a,b) VALUES('aaa',7),('bbb',3),('ccc',4); + CREATE VIEW vt5(x) AS SELECT group_concat(a ORDER BY b) FROM t5; + SELECT x FROM vt5; +} {bbb,ccc,aaa} +do_execsql_test 8.5.1 { + ALTER TABLE t5 RENAME COLUMN b TO bbb; + SELECT sql FROM sqlite_schema WHERE name='vt5'; +} {{CREATE VIEW vt5(x) AS SELECT group_concat(a ORDER BY bbb) FROM t5}} +do_execsql_test 8.5.2 { + SELECT x FROM vt5; +} {bbb,ccc,aaa} + #------------------------------------------------------------------------- # More triggers. # From d05e54efffa9f212af45f741fe651fb5766ad947 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 18 Oct 2023 23:48:24 +0000 Subject: [PATCH 102/242] Changes for test coverage. FossilOrigin-Name: ddfa09c6031afd4391a9888381bf09214cd542a826b431eeb1537a070f65c5f9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 4 ++-- src/select.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index a200c332b0..f402a01bd6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\scase\sfor\salter\scolumn\sthat\sis\sused\sin\sthe\sORDER\sBY\sof\san\saggregate. -D 2023-10-18T22:53:22.341 +C Changes\sfor\stest\scoverage. +D 2023-10-18T23:48:24.293 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 3c147581955ec30fc4732eb05d9fd6ebd6ee713284642e42bd5b9cfe22527abf +F src/expr.c 167dcf2ecc7ea7c6c2ce0c56eeec6a7d3c805c8d2721cb76a1790fe917a6f86d F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -718,7 +718,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 9b6fd8e12eb607013d32c41448521495e0f6ee65be13076eca56418f36606241 +F src/select.c 21bee7bc4ac897070b7f570354e9c6d38c6bf9499aeb92f585e675337d45dce0 F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b6d44427ec0184880ad14919667e2f526777c5085ffa636f6734cb5951a31225 -R bfd41b51d8c40e8811533ae7ac911f64 +P 648ddb3a8eb358fc6c95aaa561ae68476c77996abda23890054ac07166278cef +R 8ee0996b86b0afe5585fa6ea088a2916 U drh -Z bf6fd600101e04b72e58dadb7f157c54 +Z c40adbb172f79debd1a61052cc23946c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 49d6cfc305..994c21ecb4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -648ddb3a8eb358fc6c95aaa561ae68476c77996abda23890054ac07166278cef \ No newline at end of file +ddfa09c6031afd4391a9888381bf09214cd542a826b431eeb1537a070f65c5f9 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 72a5fae7d2..549888ec69 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1208,7 +1208,7 @@ void sqlite3ExprAddFunctionOrderBy( ){ Expr *pOB; sqlite3 *db = pParse->db; - if( pOrderBy==0 ){ + if( NEVER(pOrderBy==0) ){ assert( db->mallocFailed ); return; } @@ -6757,10 +6757,10 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ pExpr->x.pList->a[0].pExpr,0)==0 ){ pItem->bOBPayload = 0; - pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); }else{ pItem->bOBPayload = 1; } + pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); }else{ pItem->iOBTab = -1; } diff --git a/src/select.c b/src/select.c index 69e22ba3ef..30a44d0458 100644 --- a/src/select.c +++ b/src/select.c @@ -6716,14 +6716,14 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ nKey = pF->pFExpr->pLeft->x.pList->nExpr; if( !pF->bOBUnique ) nKey++; } - iTop = sqlite3VdbeAddOp1(v, OP_Rewind, pF->iOBTab); + iTop = sqlite3VdbeAddOp1(v, OP_Rewind, pF->iOBTab); VdbeCoverage(v); for(j=nArg-1; j>=0; j--){ sqlite3VdbeAddOp3(v, OP_Column, pF->iOBTab, nKey+j, regAgg+j); } sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); sqlite3VdbeChangeP5(v, (u8)nArg); - sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); + sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); sqlite3VdbeJumpHere(v, iTop); sqlite3ReleaseTempRange(pParse, regAgg, nArg); } From 69ff726d4d82eb070f798f854472b21518627c59 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 00:25:35 +0000 Subject: [PATCH 103/242] Fix a false-positive in run-time error checking. FossilOrigin-Name: cd63eec0758960d9ee63d7b964ec62e2bd622f8c94a58bd9556046381ffa18d0 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/expr.c | 2 +- src/vdbeaux.c | 4 ++++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index ec337ca6ad..28a5a3f0e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JS:\sreplace\sone\serrant\sreference\sto\s'self'\swith\s'globalThis'\sand\sremove\sa\sseparate\sdead-code\s'self'\sreference. -D 2023-10-17T23:35:47.218 +C Fix\sa\sfalse-positive\sin\srun-time\serror\schecking. +D 2023-10-19T00:25:35.141 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 8a5045ac7aae5ecebe7236ec05841693b5a0012af70a4d73933333172546c50d +F src/expr.c 243ef7e11095afe09cccd157ce5f42e637ae34f064ebb6ad12297e7af02f9e5a F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -792,7 +792,7 @@ F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 -F src/vdbeaux.c 1a11270d4b7cd1fad29a7c3f1d175a816fca2fb6ecaa3e5ecbe1eb4baf575f75 +F src/vdbeaux.c 2ebd996a266851d82b93346136fc074c8f9f31a5b139bd76a484b1a6e8b52f1d F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 @@ -2132,8 +2132,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 37ff0d8e7f91c32e8c53bb015280be47c66bf599281b640a8d3fd41335b55289 -R 02d0e707fb1cf1d9efb28ab84c90dee6 -U stephan -Z 455d6debd64ad95ee72e444517f71e6f +P da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 +R 2dc67760b798e4f6a6331f176070e794 +U drh +Z a96532a01a60297c343bac9ca71674a1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7700963681..d2f4420581 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -da1a47932ea96755b1e11fc2547ce11780b87846af6885857318ff18f1e62c31 \ No newline at end of file +cd63eec0758960d9ee63d7b964ec62e2bd622f8c94a58bd9556046381ffa18d0 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index f7290262e5..67863395dc 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4336,7 +4336,7 @@ expr_code_doover: #ifdef SQLITE_VDBE_COVERAGE /* Verify that the OP_Null above is exercised by tests ** tag-20230325-2 */ - sqlite3VdbeAddOp2(v, OP_NotNull, target, 1); + sqlite3VdbeAddOp3(v, OP_NotNull, target, 1, 20230325); VdbeCoverageNeverTaken(v); #endif break; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 1ed7a6dca3..c8dbe1e6d1 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1002,6 +1002,10 @@ void sqlite3VdbeNoJumpsOutsideSubrtn( int iDest = pOp->p2; /* Jump destination */ if( iDest==0 ) continue; if( pOp->opcode==OP_Gosub ) continue; + if( pOp->p3==20230325 && pOp->opcode==OP_NotNull ){ + /* This is a deliberately taken illegal branch. tag-20230325-2 */ + continue; + } if( iDest<0 ){ int j = ADDR(iDest); assert( j>=0 ); From 519017f25ae6d8189bc04dd815a987ec4967a8ea Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 12:12:49 +0000 Subject: [PATCH 104/242] Fix the sqlite3ReferencesSrcList() routine so that it recognizes columns in the ORDER BY clause of an aggregate. Fixes a problem with [634286828dad873d] discoverd by dbsqlfuzz. FossilOrigin-Name: 3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011 --- manifest | 15 +++++++-------- manifest.uuid | 2 +- src/expr.c | 6 ++++++ test/aggorderby.test | 17 ++++++++++++++++- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 36d4e32a39..65ace52b28 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\ssupport\sfor\sORDER\sBY\son\sthe\sargument\slist\sof\saggregate\sfunctions. -D 2023-10-19T01:26:34.354 +C Fix\sthe\ssqlite3ReferencesSrcList()\sroutine\sso\sthat\sit\srecognizes\scolumns\nin\sthe\sORDER\sBY\sclause\sof\san\saggregate.\s\sFixes\sa\sproblem\swith\n[634286828dad873d]\sdiscoverd\sby\sdbsqlfuzz. +D 2023-10-19T12:12:49.878 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 6090c2d44a8b705618dff2e9e5c26742125c95cd937a21467dd792546318e6ee +F src/expr.c 77191fed30bf1df1a70718cca9c8c1d17d5f9df15ec0f66ce7f122d11a97fe40 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -814,7 +814,7 @@ F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 F test/aggnested.test 7269d07ac879fce161cb26c8fabe65cba5715742fac8a1fccac570dcdaf28f00 -F test/aggorderby.test a77c92a0eb05239ccecc36b6593f6fe965b20d3516d8c9dcc31786405d5f4d8a +F test/aggorderby.test d0011beb1dec691ee18978d2d43e0f4af7043a1726f33e06c9f60e83112a917b F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -2133,9 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cd63eec0758960d9ee63d7b964ec62e2bd622f8c94a58bd9556046381ffa18d0 d18bc400146812c8c5048af7eaf4a5371ddd80fc9ce895d253b6114b9eae7fc3 -R 560408bb648a1c13d94a9c653c0e9458 -T +closed d18bc400146812c8c5048af7eaf4a5371ddd80fc9ce895d253b6114b9eae7fc3 +P 634286828dad873dba244751441aa729cd37b6ed5899fa5875643d4af03c006c +R 9bc375407ac96c58fb0984b4c1dff2e5 U drh -Z 8e33b937afab31ce742f2f1e881ff028 +Z c78ae0510d52a6a34f15df4050bb8417 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 603b79adaa..885dddf00f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -634286828dad873dba244751441aa729cd37b6ed5899fa5875643d4af03c006c \ No newline at end of file +3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 08d5ae36ea..38da1ab690 100644 --- a/src/expr.c +++ b/src/expr.c @@ -6466,6 +6466,12 @@ int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){ assert( pExpr->op==TK_AGG_FUNCTION ); assert( ExprUseXList(pExpr) ); sqlite3WalkExprList(&w, pExpr->x.pList); + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + assert( pExpr->pLeft->x.pList!=0 ); + sqlite3WalkExprList(&w, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter); diff --git a/test/aggorderby.test b/test/aggorderby.test index e90ea0a57c..7d7d86a09f 100644 --- a/test/aggorderby.test +++ b/test/aggorderby.test @@ -59,6 +59,21 @@ do_execsql_test aggorderby-4.1 { } {7 9} - +do_execsql_test aggorderby-5.0 { + DROP TABLE IF EXISTS t1; + DROP TABLE IF EXISTS t3; + CREATE TABLE t1(a TEXT); INSERT INTO t1 VALUES('aaa'),('bbb'); + CREATE TABLE t3(d TEXT); INSERT INTO t3 VALUES('/'),('-'); + SELECT (SELECT group_concat(a,d) FROM t3) FROM t1; +} {aaa-aaa bbb-bbb} +do_execsql_test aggorderby-5.1 { + SELECT (SELECT group_concat(a,d ORDER BY d) FROM t3) FROM t1; +} {aaa/aaa bbb/bbb} +do_execsql_test aggorderby-5.2 { + SELECT (SELECT group_concat(a,d ORDER BY d DESC) FROM t3) FROM t1; +} {aaa-aaa bbb-bbb} +do_execsql_test aggorderby-5.3 { + SELECT (SELECT group_concat(a,'#' ORDER BY d) FROM t3) FROM t1; +} {aaa#aaa bbb#bbb} finish_test From 266178f3695ac08f6240e1612309b5d17d1f6630 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 12:36:59 +0000 Subject: [PATCH 105/242] New assert() statements to help verify correctness of the ORDER BY aggregate code. FossilOrigin-Name: 8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 65ace52b28..95084c8ac1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\ssqlite3ReferencesSrcList()\sroutine\sso\sthat\sit\srecognizes\scolumns\nin\sthe\sORDER\sBY\sclause\sof\san\saggregate.\s\sFixes\sa\sproblem\swith\n[634286828dad873d]\sdiscoverd\sby\sdbsqlfuzz. -D 2023-10-19T12:12:49.878 +C New\sassert()\sstatements\sto\shelp\sverify\scorrectness\sof\sthe\sORDER\sBY\saggregate\ncode. +D 2023-10-19T12:36:59.371 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -718,7 +718,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 21bee7bc4ac897070b7f570354e9c6d38c6bf9499aeb92f585e675337d45dce0 +F src/select.c 28f136d35ca8b7b2ac87493e8be6685b0f364c8aec814893e47b8e3d5e00a90e F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 634286828dad873dba244751441aa729cd37b6ed5899fa5875643d4af03c006c -R 9bc375407ac96c58fb0984b4c1dff2e5 +P 3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011 +R e4538bd0a85cafb308a7c103d072a211 U drh -Z c78ae0510d52a6a34f15df4050bb8417 +Z 139757f6f7292db6c0b58e22a2f14879 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 885dddf00f..7fce4dcce7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011 \ No newline at end of file +8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 30a44d0458..128b33ee00 100644 --- a/src/select.c +++ b/src/select.c @@ -417,6 +417,7 @@ void sqlite3SetJoinExpr(Expr *p, int iTable, u32 joinFlag){ p->w.iJoin = iTable; if( p->op==TK_FUNCTION ){ assert( ExprUseXList(p) ); + assert( p->pLeft==0 ); if( p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ @@ -454,6 +455,7 @@ static void unsetJoinExpr(Expr *p, int iTable, int nullable){ } if( p->op==TK_FUNCTION ){ assert( ExprUseXList(p) ); + assert( p->pLeft==0 ); if( p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ From 11877c6ba4a4a80cb08366017a881287538321f1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 13:00:41 +0000 Subject: [PATCH 106/242] Fix an error in a debugging routine used inside of testcase(). Does not appear in production. Problem discovered by scan-build. FossilOrigin-Name: c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 95084c8ac1..722e3176eb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\sassert()\sstatements\sto\shelp\sverify\scorrectness\sof\sthe\sORDER\sBY\saggregate\ncode. -D 2023-10-19T12:36:59.371 +C Fix\san\serror\sin\sa\sdebugging\sroutine\sused\sinside\sof\stestcase().\s\sDoes\snot\nappear\sin\sproduction.\s\sProblem\sdiscovered\sby\sscan-build. +D 2023-10-19T13:00:41.210 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -792,7 +792,7 @@ F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 -F src/vdbeaux.c 2ebd996a266851d82b93346136fc074c8f9f31a5b139bd76a484b1a6e8b52f1d +F src/vdbeaux.c 929a4edecf9845fb063b47b23b9d187473a648470d915521cf72419f5219c4b7 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3d26f1aaa4876f21f2c3abf13bbc37933c8f32471153e29019880cc9530cb011 -R e4538bd0a85cafb308a7c103d072a211 +P 8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277 +R 4aca618a679e8419cd172eea36c7911d U drh -Z 139757f6f7292db6c0b58e22a2f14879 +Z 1bb915481df03cc399372db91bbfa483 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7fce4dcce7..0e3a256c2b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277 \ No newline at end of file +c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index c8dbe1e6d1..27be95a6b5 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -4472,7 +4472,7 @@ SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){ */ #if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) static int SQLITE_NOINLINE doubleLt(double a, double b){ return a Date: Thu, 19 Oct 2023 13:35:22 +0000 Subject: [PATCH 107/242] Simplification to sqlite3GetVarint32() to avoid confusing gcov. FossilOrigin-Name: 89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2 --- manifest | 12 ++--- manifest.uuid | 2 +- src/util.c | 125 ++++++++------------------------------------------ 3 files changed, 25 insertions(+), 114 deletions(-) diff --git a/manifest b/manifest index 722e3176eb..0d2df1c196 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\serror\sin\sa\sdebugging\sroutine\sused\sinside\sof\stestcase().\s\sDoes\snot\nappear\sin\sproduction.\s\sProblem\sdiscovered\sby\sscan-build. -D 2023-10-19T13:00:41.210 +C Simplification\sto\ssqlite3GetVarint32()\sto\savoid\sconfusing\sgcov. +D 2023-10-19T13:35:22.869 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -786,7 +786,7 @@ F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 -F src/util.c e87f66258c37f87724f46e849572c3ece4c74ef5614ba41eb221e98f0dbc95de +F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677 F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8b6fffb552c30f9cbf7102c2e26a7b486c4c9edd9f494d803de7004db3018277 -R 4aca618a679e8419cd172eea36c7911d +P c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6 +R 2d6d822f4f032385b3965cf0ea67965f U drh -Z 1bb915481df03cc399372db91bbfa483 +Z 984079d068cf9e399e4e739b1e691268 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0e3a256c2b..8b7d689343 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6 \ No newline at end of file +89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2 \ No newline at end of file diff --git a/src/util.c b/src/util.c index 58591590dc..e9c7cccb03 100644 --- a/src/util.c +++ b/src/util.c @@ -1367,121 +1367,32 @@ u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ ** this function assumes the single-byte case has already been handled. */ u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ - u32 a,b; + u64 v64; + u8 n; - /* The 1-byte case. Overwhelmingly the most common. Handled inline - ** by the getVarin32() macro */ - a = *p; - /* a: p0 (unmasked) */ -#ifndef getVarint32 - if (!(a&0x80)) - { - /* Values between 0 and 127 */ - *v = a; - return 1; - } -#endif + /* Assume that the single-byte case has already been handled by + ** the getVarint32() macro */ + assert( (p[0] & 0x80)!=0 ); - /* The 2-byte case */ - p++; - b = *p; - /* b: p1 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 128 and 16383 */ - a &= 0x7f; - a = a<<7; - *v = a | b; + if( (p[1] & 0x80)==0 ){ + /* This is the two-byte case */ + *v = ((p[0]&0x7f)<<7) | p[1]; return 2; } - - /* The 3-byte case */ - p++; - a = a<<14; - a |= *p; - /* a: p0<<14 | p2 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 16384 and 2097151 */ - a &= (0x7f<<14)|(0x7f); - b &= 0x7f; - b = b<<7; - *v = a | b; + if( (p[2] & 0x80)==0 ){ + /* This is the three-byte case */ + *v = ((p[0]&0x7f)<<14) | ((p[1]&0x7f)<<7) | p[2]; return 3; } - - /* A 32-bit varint is used to store size information in btrees. - ** Objects are rarely larger than 2MiB limit of a 3-byte varint. - ** A 3-byte varint is sufficient, for example, to record the size - ** of a 1048569-byte BLOB or string. - ** - ** We only unroll the first 1-, 2-, and 3- byte cases. The very - ** rare larger cases can be handled by the slower 64-bit varint - ** routine. - */ -#if 1 - { - u64 v64; - u8 n; - - n = sqlite3GetVarint(p-2, &v64); - assert( n>3 && n<=9 ); - if( (v64 & SQLITE_MAX_U32)!=v64 ){ - *v = 0xffffffff; - }else{ - *v = (u32)v64; - } - return n; - } - -#else - /* For following code (kept for historical record only) shows an - ** unrolling for the 3- and 4-byte varint cases. This code is - ** slightly faster, but it is also larger and much harder to test. - */ - p++; - b = b<<14; - b |= *p; - /* b: p1<<14 | p3 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 2097152 and 268435455 */ - b &= (0x7f<<14)|(0x7f); - a &= (0x7f<<14)|(0x7f); - a = a<<7; - *v = a | b; - return 4; - } - - p++; - a = a<<14; - a |= *p; - /* a: p0<<28 | p2<<14 | p4 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 268435456 and 34359738367 */ - a &= SLOT_4_2_0; - b &= SLOT_4_2_0; - b = b<<7; - *v = a | b; - return 5; - } - - /* We can only reach this point when reading a corrupt database - ** file. In that case we are not in any hurry. Use the (relatively - ** slow) general-purpose sqlite3GetVarint() routine to extract the - ** value. */ - { - u64 v64; - u8 n; - - p -= 4; - n = sqlite3GetVarint(p, &v64); - assert( n>5 && n<=9 ); + /* four or more bytes */ + n = sqlite3GetVarint(p, &v64); + assert( n>3 && n<=9 ); + if( (v64 & SQLITE_MAX_U32)!=v64 ){ + *v = 0xffffffff; + }else{ *v = (u32)v64; - return n; } -#endif + return n; } /* From 4e254641ff2a5aefbce3398346dcb250aef7bbda Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 18:07:58 +0000 Subject: [PATCH 108/242] Simplify the Expr compression logic slightly by adding the new EP_FullSize property to expressions that are exceptions to the rule and should not be compressed. FossilOrigin-Name: d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/expr.c | 7 ++----- src/sqliteInt.h | 3 ++- src/window.c | 3 ++- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 0d2df1c196..51ee3db8e2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplification\sto\ssqlite3GetVarint32()\sto\savoid\sconfusing\sgcov. -D 2023-10-19T13:35:22.869 +C Simplify\sthe\sExpr\scompression\slogic\sslightly\sby\sadding\sthe\snew\sEP_FullSize\nproperty\sto\sexpressions\sthat\sare\sexceptions\sto\sthe\srule\sand\sshould\snot\sbe\ncompressed. +D 2023-10-19T18:07:58.432 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 77191fed30bf1df1a70718cca9c8c1d17d5f9df15ec0f66ce7f122d11a97fe40 +F src/expr.c 7650672b74f1a5e944f93a47b2d21bef23cc2331103ffbf4bcdaa13624354f38 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -723,7 +723,7 @@ F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728a F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 834656265db68d42cf615e01b107b16d43c2bcad4837f197c88928448fc1de71 +F src/sqliteInt.h 849004dd6f4315e05a8ec892999b0972484eb5438d122adc9444ed854bd905ce F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -807,7 +807,7 @@ F src/where.c 313ce81270d2a414672370e1ee74e65949ad620519193d4cac2986d073cbc8a0 F src/whereInt.h 4b38c5889514e3aead3f27d0ee9a26e47c3f150efc59e2a8b4e3bc8835e4d7a1 F src/wherecode.c 5d77db30a2a3dd532492ae882de114edba2fae672622056b1c7fd61f5917a8f1 F src/whereexpr.c dc5096eca5ed503999be3bdee8a90c51361289a678d396a220912e9cb73b3c00 -F src/window.c b7ad9cff3ce8ae6f8cc25e18e1a258426cb6bd2999aace6f5248d781b2a74098 +F src/window.c ad21e2b73ec75acc79dde2576c573f54a338b0c49e9de847ce984f9b9595b5e2 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627 F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c6c9d7ed6dbc71b998aeaaa1bdeb36b1bb9b902f9d6088ad36db29f8ea8b7ef6 -R 2d6d822f4f032385b3965cf0ea67965f +P 89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2 +R cafbded15ce259abcd81ee283e9b7816 U drh -Z 984079d068cf9e399e4e739b1e691268 +Z f727cd73dc6d9e2bf2cf8af2294d32ea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8b7d689343..f2b5f60a4b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2 \ No newline at end of file +d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 38da1ab690..cc0b0dacc0 100644 --- a/src/expr.c +++ b/src/expr.c @@ -591,6 +591,7 @@ Expr *sqlite3ExprForVectorField( */ pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); if( pRet ){ + ExprSetProperty(pRet, EP_FullSize); pRet->iTable = nField; pRet->iColumn = iField; pRet->pLeft = pVector; @@ -1494,11 +1495,7 @@ static int dupedExprStructSize(const Expr *p, int flags){ assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */ assert( EXPR_FULLSIZE<=0xfff ); assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 ); - if( 0==flags || p->op==TK_SELECT_COLUMN -#ifndef SQLITE_OMIT_WINDOWFUNC - || ExprHasProperty(p, EP_WinFunc) -#endif - ){ + if( 0==flags || ExprHasProperty(p, EP_FullSize) ){ nSize = EXPR_FULLSIZE; }else{ assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 4becf92227..85492fbec6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3047,7 +3047,7 @@ struct Expr { #define EP_Reduced 0x004000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ #define EP_Win 0x008000 /* Contains window functions */ #define EP_TokenOnly 0x010000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ - /* 0x020000 // Available for reuse */ +#define EP_FullSize 0x020000 /* Expr structure must remain full sized */ #define EP_IfNullRow 0x040000 /* The TK_IF_NULL_ROW opcode */ #define EP_Unlikely 0x080000 /* unlikely() or likelihood() function */ #define EP_ConstFunc 0x100000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ @@ -3077,6 +3077,7 @@ struct Expr { #define ExprClearProperty(E,P) (E)->flags&=~(P) #define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue) #define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse) +#define ExprIsFullSize(E) (((E)->flags&(EP_Reduced|EP_TokenOnly))==0) /* Macros used to ensure that the correct members of unions are accessed ** in Expr. diff --git a/src/window.c b/src/window.c index d46eabc3b4..2c449592d7 100644 --- a/src/window.c +++ b/src/window.c @@ -1312,8 +1312,9 @@ void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ if( p ){ assert( p->op==TK_FUNCTION ); assert( pWin ); + assert( ExprIsFullSize(p) ); p->y.pWin = pWin; - ExprSetProperty(p, EP_WinFunc); + ExprSetProperty(p, EP_WinFunc|EP_FullSize); pWin->pOwner = p; if( (p->flags & EP_Distinct) && pWin->eFrmType!=TK_FILTER ){ sqlite3ErrorMsg(pParse, From ee3c55471ca02af8090f893b4deb461fab53dd35 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 19 Oct 2023 18:23:17 +0000 Subject: [PATCH 109/242] Fix an fts3 problem caused by reducing the page size using the undocumented "nodesize" option, then running an incremental-merge. FossilOrigin-Name: 2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea --- ext/fts3/fts3_write.c | 12 ++++++++---- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/fts3fuzz001.test | 27 +++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index de07c52c13..9bacd4235c 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -4034,9 +4034,13 @@ static int fts3IncrmergeAppend( nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; /* If the current block is not empty, and if adding this term/doclist - ** to the current block would make it larger than Fts3Table.nNodeSize - ** bytes, write this block out to the database. */ - if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){ + ** to the current block would make it larger than Fts3Table.nNodeSize bytes, + ** and if there is still room for another leaf page, write this block out to + ** the database. */ + if( pLeaf->block.n>0 + && (pLeaf->block.n + nSpace)>p->nNodeSize + && pLeaf->iBlock < (pWriter->iStart + pWriter->nLeafEst) + ){ rc = fts3WriteSegment(p, pLeaf->iBlock, pLeaf->block.a, pLeaf->block.n); pWriter->nWork++; @@ -4368,7 +4372,7 @@ static int fts3IncrmergeLoad( rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0); blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc - ); + ); if( rc==SQLITE_OK ){ memcpy(pNode->block.a, aBlock, nBlock); pNode->block.n = nBlock; diff --git a/manifest b/manifest index 51ee3db8e2..759ee440f6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\sExpr\scompression\slogic\sslightly\sby\sadding\sthe\snew\sEP_FullSize\nproperty\sto\sexpressions\sthat\sare\sexceptions\sto\sthe\srule\sand\sshould\snot\sbe\ncompressed. -D 2023-10-19T18:07:58.432 +C Fix\san\sfts3\sproblem\scaused\sby\sreducing\sthe\spage\ssize\susing\sthe\sundocumented\s"nodesize"\soption,\sthen\srunning\san\sincremental-merge. +D 2023-10-19T18:23:17.869 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -78,7 +78,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154 F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226 F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f -F ext/fts3/fts3_write.c b28f4cde90ed560245ecb76a882b45aa62da16ff6f61e9884eae5c7c5eff16ea +F ext/fts3/fts3_write.c 3a0043bb527c5d11e90493fd9fead30836e161a5330ba2ba739b372b03ea0459 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73 F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674 @@ -1148,7 +1148,7 @@ F test/fts3f.test 8c438d5e1cab526b0021988fb1dc70cf3597b006a33ffd6c955ee89929077f F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45c5df45 F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 -F test/fts3fuzz001.test e3c7b0ce9b04cc02281dcc96812a277f02df03cd7dc082055d87e11eb18aaf56 +F test/fts3fuzz001.test c78afcd8ad712ea0b8d2ed50851a8aab3bc9dc52c64a536291e07112f519357c F test/fts3join.test 1a4d786539b2b79a41c28ef2ac22cacd92a8ee830249b68a7dee4a020848e3bb F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6 F test/fts3matchinfo.test aa66cc50615578b30f6df9984819ae5b702511cf8a94251ec7c594096a703a4a @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 89862c51ad9715bedf5b029db484602e740f0db7404970d482ce503c1b9a0ed2 -R cafbded15ce259abcd81ee283e9b7816 -U drh -Z f727cd73dc6d9e2bf2cf8af2294d32ea +P d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a +R 02c4f3ff3085bada857f44e872f54862 +U dan +Z ffd740135c1cbc63e13e90b6f1ec66d6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f2b5f60a4b..33933915c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a \ No newline at end of file +2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea \ No newline at end of file diff --git a/test/fts3fuzz001.test b/test/fts3fuzz001.test index 41b22d33da..6b1ae90ee4 100644 --- a/test/fts3fuzz001.test +++ b/test/fts3fuzz001.test @@ -13,6 +13,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +set testprefix fts3fuzz001 ifcapable !deserialize||!fts3 { finish_test @@ -110,5 +111,31 @@ do_test fts3fuzz001-121 { } } {1 {database disk image is malformed}} +#------------------------------------------------------------------------- +reset_db +do_execsql_test 200 { + CREATE VIRTUAL TABLE x1 USING fts3(x); + + INSERT INTO x1 VALUES('braes brag bragged bragger bragging'); + INSERT INTO x1 VALUES('brags braid braided braiding braids'); + INSERT INTO x1 VALUES('brain brainchild brained braining brains'); + INSERT INTO x1 VALUES('brainstem brainstems brainstorm brainstorms'); + INSERT INTO x1(x1) VALUES('nodesize=24'); +} + +do_execsql_test 210 { + PRAGMA integrity_check; +} {ok} + +do_execsql_test 220 { + INSERT INTO x1(x1) VALUES('merge=10,2') +} + +do_execsql_test 220 { + PRAGMA integrity_check; +} {ok} + + + finish_test From d8b840a4f4bdcadfe755c966f1ee583f506cad0f Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 19:08:33 +0000 Subject: [PATCH 110/242] In the TreeView logic (used for debugging only) do not show unnecessary fields of the Window object when a function has a FILTER. FossilOrigin-Name: d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/treeview.c | 9 +++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 759ee440f6..2ec42087c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sfts3\sproblem\scaused\sby\sreducing\sthe\spage\ssize\susing\sthe\sundocumented\s"nodesize"\soption,\sthen\srunning\san\sincremental-merge. -D 2023-10-19T18:23:17.869 +C In\sthe\sTreeView\slogic\s(used\sfor\sdebugging\sonly)\sdo\snot\sshow\sunnecessary\sfields\nof\sthe\sWindow\sobject\swhen\sa\sfunction\shas\sa\sFILTER. +D 2023-10-19T19:08:33.080 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -781,7 +781,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 -F src/treeview.c 6c441500139d46c147216dac667510987ecd0e91a27735cd6d9dd77f81e465a7 +F src/treeview.c bd8ec60f37e3c5d133e00dbff6ba44bb7e3a102728bab83ec420b3feb7d04440 F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d5ae82ec52eafed5e3dc8c9d99685f6523fce7d973ef7e8d9d75ed9b8912426a -R 02c4f3ff3085bada857f44e872f54862 -U dan -Z ffd740135c1cbc63e13e90b6f1ec66d6 +P 2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea +R 45852c93d35e0d900ce3d50d808ec604 +U drh +Z 4a6691c4f5ab92ae34d088813bdd99dd # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 33933915c4..95865b7d32 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea \ No newline at end of file +d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a \ No newline at end of file diff --git a/src/treeview.c b/src/treeview.c index 6852a61ddd..a3f128cab2 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -412,6 +412,7 @@ void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ sqlite3TreeViewItem(pView, "FILTER", 1); sqlite3TreeViewExpr(pView, pWin->pFilter, 0); sqlite3TreeViewPop(&pView); + if( pWin->eFrmType==TK_FILTER ) return; } sqlite3TreeViewPush(&pView, more); if( pWin->zName ){ @@ -421,7 +422,7 @@ void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ } if( pWin->zBase ) nElement++; if( pWin->pOrderBy ) nElement++; - if( pWin->eFrmType ) nElement++; + if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ) nElement++; if( pWin->eExclude ) nElement++; if( pWin->zBase ){ sqlite3TreeViewPush(&pView, (--nElement)>0); @@ -434,7 +435,7 @@ void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ if( pWin->pOrderBy ){ sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); } - if( pWin->eFrmType ){ + if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ){ char zBuf[30]; const char *zFrmType = "ROWS"; if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE"; @@ -682,7 +683,7 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ assert( ExprUseXList(pExpr) ); pFarg = pExpr->x.pList; #ifndef SQLITE_OMIT_WINDOWFUNC - pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0; + pWin = IsWindowFunc(pExpr) ? pExpr->y.pWin : 0; #else pWin = 0; #endif @@ -708,7 +709,7 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); } if( pFarg ){ - sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); + sqlite3TreeViewExprList(pView, pFarg, pWin!=0 || pExpr->pLeft, 0); if( pExpr->pLeft ){ Expr *pOB = pExpr->pLeft; assert( pOB->op==TK_ORDER ); From 5080397e67e16a5b72f0139274661ddd8f661bb4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 19:19:59 +0000 Subject: [PATCH 111/242] Fix an adverse interaction between the new aggregate ORDER BY logic and the expression compressor. FossilOrigin-Name: f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 2ec42087c4..ee9b2d6e44 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sTreeView\slogic\s(used\sfor\sdebugging\sonly)\sdo\snot\sshow\sunnecessary\sfields\nof\sthe\sWindow\sobject\swhen\sa\sfunction\shas\sa\sFILTER. -D 2023-10-19T19:08:33.080 +C Fix\san\sadverse\sinteraction\sbetween\sthe\snew\saggregate\sORDER\sBY\slogic\sand\sthe\nexpression\scompressor. +D 2023-10-19T19:19:59.307 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 7650672b74f1a5e944f93a47b2d21bef23cc2331103ffbf4bcdaa13624354f38 +F src/expr.c 18a23aeeb4f0f1999163c273a823e7812a179de110025d07f6db58cfd9d3ddf0 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2875dcb1ac86db2704ad377d719f308c8837e196b49c98b20ceda1324f2d27ea -R 45852c93d35e0d900ce3d50d808ec604 +P d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a +R 9da72bfce06dbb3400677ef0c3b1a035 U drh -Z 4a6691c4f5ab92ae34d088813bdd99dd +Z c6070fdc6625bfd39e8b2f9924ac4aea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 95865b7d32..002a508a44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a \ No newline at end of file +f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index cc0b0dacc0..2dcba6e524 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1572,7 +1572,7 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ staticFlag = EP_Static; assert( zAlloc!=0 ); }else{ - zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)); + zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)*5); staticFlag = 0; } pNew = (Expr *)zAlloc; @@ -1622,7 +1622,8 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ if( ExprUseXSelect(p) ){ pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags); }else{ - pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags); + pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, + p->op!=TK_ORDER ? dupFlags : 0); } } From 5f53f85e22df1c5e1e36106b5e4d1db5089519aa Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 19:57:57 +0000 Subject: [PATCH 112/242] For TK_ORDER expression nodes to always be full-size. FossilOrigin-Name: a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index ee9b2d6e44..0abfc0faf1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sadverse\sinteraction\sbetween\sthe\snew\saggregate\sORDER\sBY\slogic\sand\sthe\nexpression\scompressor. -D 2023-10-19T19:19:59.307 +C For\sTK_ORDER\sexpression\snodes\sto\salways\sbe\sfull-size. +D 2023-10-19T19:57:57.476 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 18a23aeeb4f0f1999163c273a823e7812a179de110025d07f6db58cfd9d3ddf0 +F src/expr.c 0756a4116a60666e31e77297444e628262cac913eebdac955a17c8cc8177429b F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2c6b82c346dbf39e07f09d187e4a8216a56caa7df3dcfafc82e32f676a1db8a -R 9da72bfce06dbb3400677ef0c3b1a035 +P f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934 +R 6e8e24ae6b4cb9a95bb70c9f80125f71 U drh -Z c6070fdc6625bfd39e8b2f9924ac4aea +Z 5b3ced1de2a96a932e2087f4a6248f87 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 002a508a44..bcdd04358b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934 \ No newline at end of file +a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 2dcba6e524..86b5f5f1e7 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1240,6 +1240,7 @@ void sqlite3ExprAddFunctionOrderBy( pOB->x.pList = pOrderBy; assert( ExprUseXList(pOB) ); pExpr->pLeft = pOB; + ExprSetProperty(pOB, EP_FullSize); } /* From dcf76a8bbda9028c391945834d67471fc8e2821f Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 19 Oct 2023 20:06:20 +0000 Subject: [PATCH 113/242] Remove a faulty assert() that was added just a few check-ins ago by [8b6fffb552c30f9c]. FossilOrigin-Name: 18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 0abfc0faf1..e7ee8b1264 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C For\sTK_ORDER\sexpression\snodes\sto\salways\sbe\sfull-size. -D 2023-10-19T19:57:57.476 +C Remove\sa\sfaulty\sassert()\sthat\swas\sadded\sjust\sa\sfew\scheck-ins\sago\sby\n[8b6fffb552c30f9c]. +D 2023-10-19T20:06:20.075 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -718,7 +718,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 28f136d35ca8b7b2ac87493e8be6685b0f364c8aec814893e47b8e3d5e00a90e +F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f371e4c0f8ea73aee9ea0645f396e3da20f1eb97be34c83de9d94c9cbb959934 -R 6e8e24ae6b4cb9a95bb70c9f80125f71 +P a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d +R 028a712d10c14e79ed79d3b08f83b31c U drh -Z 5b3ced1de2a96a932e2087f4a6248f87 +Z 37bf27ee369c257065f7353841ae889a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bcdd04358b..d04bbb41aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d \ No newline at end of file +18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 128b33ee00..29df3325f3 100644 --- a/src/select.c +++ b/src/select.c @@ -417,7 +417,6 @@ void sqlite3SetJoinExpr(Expr *p, int iTable, u32 joinFlag){ p->w.iJoin = iTable; if( p->op==TK_FUNCTION ){ assert( ExprUseXList(p) ); - assert( p->pLeft==0 ); if( p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ From d707e012f06a82e293cba7ea97a5713db362fd08 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 10:18:03 +0000 Subject: [PATCH 114/242] Use sqlite3ParserAddCleanup() instead of calling sqlite3ExprListDelete() directly when disposing of an unused ORDER BY in an aggregate function, to avoid disrupting ALTER TABLE data structures. FossilOrigin-Name: d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index e7ee8b1264..fd7e4865c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sfaulty\sassert()\sthat\swas\sadded\sjust\sa\sfew\scheck-ins\sago\sby\n[8b6fffb552c30f9c]. -D 2023-10-19T20:06:20.075 +C Use\ssqlite3ParserAddCleanup()\sinstead\sof\scalling\ssqlite3ExprListDelete()\ndirectly\swhen\sdisposing\sof\san\sunused\sORDER\sBY\sin\san\saggregate\sfunction,\nto\savoid\sdisrupting\sALTER\sTABLE\sdata\sstructures. +D 2023-10-20T10:18:03.872 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 0756a4116a60666e31e77297444e628262cac913eebdac955a17c8cc8177429b +F src/expr.c eb0d4b2078d05284e209677183b4bcc20d4545260897215a5ef3fced03b67083 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a5c73b46f4772f214ffbfa31cb87dce82ebd690addabef539bd09def26b7744d -R 028a712d10c14e79ed79d3b08f83b31c +P 18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030 +R 116bd1e6425f8040f4b7884265787040 U drh -Z 37bf27ee369c257065f7353841ae889a +Z 3ed7aa53fa4bab3e10246f808572c725 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d04bbb41aa..51c9b3d467 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030 \ No newline at end of file +d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 86b5f5f1e7..35c797ac8f 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1223,7 +1223,9 @@ void sqlite3ExprAddFunctionOrderBy( assert( ExprUseXList(pExpr) ); if( pExpr->x.pList==0 || NEVER(pExpr->x.pList->nExpr==0) ){ /* Ignore ORDER BY on zero-argument aggregates */ - sqlite3ExprListDelete(db, pOrderBy); + sqlite3ParserAddCleanup(pParse, + (void(*)(sqlite3*,void*))sqlite3ExprListDelete, + pOrderBy); return; } if( IsWindowFunc(pExpr) ){ From 11223e0cff820fc81ebe6cf00192aec4bd7be521 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 20 Oct 2023 12:23:49 +0000 Subject: [PATCH 115/242] Correct the opfs-sahpool VFS's xGetLastError() method to return the previous error code, not 0, on success. FossilOrigin-Name: 95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c --- ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 39 ++++++++++--------- manifest | 14 +++---- manifest.uuid | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index e76fbf028a..870073cc09 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -155,8 +155,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ pool.deletePath(file.path); } }catch(e){ - pool.storeErr(e); - return capi.SQLITE_IOERR; + return pool.storeErr(e, capi.SQLITE_IOERR); } } return 0; @@ -200,8 +199,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } return 0; }catch(e){ - pool.storeErr(e); - return capi.SQLITE_IOERR; + return pool.storeErr(e, capi.SQLITE_IOERR); } }, xSectorSize: function(pFile){ @@ -217,8 +215,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ file.sah.flush(); return 0; }catch(e){ - pool.storeErr(e); - return capi.SQLITE_IOERR; + return pool.storeErr(e, capi.SQLITE_IOERR); } }, xTruncate: function(pFile,sz64){ @@ -231,8 +228,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ file.sah.truncate(HEADER_OFFSET_DATA + Number(sz64)); return 0; }catch(e){ - pool.storeErr(e); - return capi.SQLITE_IOERR; + return pool.storeErr(e, capi.SQLITE_IOERR); } }, xUnlock: function(pFile,lockType){ @@ -252,10 +248,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ wasm.heap8u().subarray(pSrc, pSrc+n), { at: HEADER_OFFSET_DATA + Number(offset64) } ); - return nBytes === n ? 0 : capi.SQLITE_IOERR; + return n===nBytes ? 0 : toss("Unknown write() failure."); }catch(e){ - pool.storeErr(e); - return capi.SQLITE_IOERR; + return pool.storeErr(e, capi.SQLITE_IOERR); } } }/*ioMethods*/; @@ -314,8 +309,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ }, xGetLastError: function(pVfs,nOut,pOut){ const pool = getPoolForVfs(pVfs); - pool.log(`xGetLastError ${nOut}`); const e = pool.popErr(); + pool.log(`xGetLastError ${nOut} e =`,e); if(e){ const scope = wasm.scopedAllocPush(); try{ @@ -328,7 +323,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ wasm.scopedAllocPop(scope); } } - return 0; + return e ? (e.sqlite3Rc || capi.SQLITE_IOERR) : 0; }, //xSleep is optionally defined below xOpen: function f(pVfs, zName, pFile, flags, pOutFlags){ @@ -762,12 +757,20 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ } /** - Sets e as this object's current error. Pass a falsy - (or no) value to clear it. + Sets e (an Error object) as this object's current error. Pass a + falsy (or no) value to clear it. If code is truthy it is + assumed to be an SQLITE_xxx result code, defaulting to + SQLITE_IOERR if code is falsy. + + Returns the 2nd argument. */ - storeErr(e){ - if(e) this.error(e); - return this.$error = e; + storeErr(e,code){ + if(e){ + e.sqlite3Rc = code || capi.SQLITE_IOERR; + this.error(e); + } + this.$error = e; + return code; } /** Pops this object's Error object and returns diff --git a/manifest b/manifest index fd7e4865c4..084765f3e7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\ssqlite3ParserAddCleanup()\sinstead\sof\scalling\ssqlite3ExprListDelete()\ndirectly\swhen\sdisposing\sof\san\sunused\sORDER\sBY\sin\san\saggregate\sfunction,\nto\savoid\sdisrupting\sALTER\sTABLE\sdata\sstructures. -D 2023-10-20T10:18:03.872 +C Correct\sthe\sopfs-sahpool\sVFS's\sxGetLastError()\smethod\sto\sreturn\sthe\sprevious\serror\scode,\snot\s0,\son\ssuccess. +D 2023-10-20T12:23:49.687 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -583,7 +583,7 @@ F ext/wasm/api/sqlite3-api-worker1.js f941382f21006b4a817754184e2661b0a63ce65020 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 -F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js f7c965cf9ac0b66a538cd8f6c156f3f2a235e089821ca78cabd7bce41ce16bf7 +F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 595953994aa3ae2287c889c4da39ab3d6f17b6461ecf4bec334b7a3faafddb02 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e F ext/wasm/api/sqlite3-wasm.c c8c5b81b838cef2053b1eb6e7a79c44a2caedcf0c9e6b0d12a45d73ce0617be0 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 18e7c826f08bce51719ef045daa60200b33790f2fe312c6853f9ef6c7e9d5030 -R 116bd1e6425f8040f4b7884265787040 -U drh -Z 3ed7aa53fa4bab3e10246f808572c725 +P d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a +R 6e8befaf01cb46d1b6ec065810ecbd1e +U stephan +Z d67ca77d259ff533bed4295ddbc6d176 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 51c9b3d467..825f6d5df0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a \ No newline at end of file +95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c \ No newline at end of file From 0a261eb4bbee272038551bde16633092c491880b Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 14:05:26 +0000 Subject: [PATCH 116/242] Omit an unused constant from sessionfuzz.c to prevent a compiler warning. FossilOrigin-Name: a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/sessionfuzz.c | 8 -------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 084765f3e7..982422d0f5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Correct\sthe\sopfs-sahpool\sVFS's\sxGetLastError()\smethod\sto\sreturn\sthe\sprevious\serror\scode,\snot\s0,\son\ssuccess. -D 2023-10-20T12:23:49.687 +C Omit\san\sunused\sconstant\sfrom\ssessionfuzz.c\sto\sprevent\sa\scompiler\swarning. +D 2023-10-20T14:05:26.334 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1542,7 +1542,7 @@ F test/selectG.test 089f7d3d7e6db91566f00b036cb353107a2cca6220eb1cb264085a836dae F test/selectH.test 0b54599f1917d99568c9b929df22ec6261ed7b6d2f02a46b5945ef81b7871aac F test/session.test 78fa2365e93d3663a6e933f86e7afc395adf18be F test/sessionfuzz-data1.db 1f8d5def831f19b1c74571037f0d53a588ea49a6c4ca2a028fc0c27ef896dbcb -F test/sessionfuzz.c 5eef09af01eeff6f20250ae4c0112c2e576e4d2f2026cc9a49dc5be6886fa6ee +F test/sessionfuzz.c 666b47e177c7b25f01ba645d41fb9131d2d54ae673f0d81c08f5af2b3e6ecbda F test/shared.test f022874d9d299fe913529dc10f52ad5a386e4e7ff709270b9b1111b3a0f3420a F test/shared2.test 03eb4a8d372e290107d34b6ce1809919a698e879 F test/shared3.test f8cd07c1a2b7cdb315c01671a0b2f8e3830b11ef31da6baa9a9cd8da88965403 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d083e42086733ecd79aba8c268e020b01782bfe1cfa9684ce1c277af9c8bf92a -R 6e8befaf01cb46d1b6ec065810ecbd1e -U stephan -Z d67ca77d259ff533bed4295ddbc6d176 +P 95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c +R 6ad478f91385b35d37da9909f3b6864d +U drh +Z 3d1888cda1fff3d60caf044573bbf655 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 825f6d5df0..653320efca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c \ No newline at end of file +a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d \ No newline at end of file diff --git a/test/sessionfuzz.c b/test/sessionfuzz.c index f2e4cd5a68..093c2b043d 100644 --- a/test/sessionfuzz.c +++ b/test/sessionfuzz.c @@ -66,14 +66,6 @@ #define SQLITE_ENABLE_DESERIALIZE 1 #include "sqlite3.c" -/* Create a test database. This will be an in-memory database */ -static const char zInitSql[] = - "CREATE TABLE t1(a INTEGER PRIMARY KEY,b,c,d);\n" - "CREATE TABLE t2(e TEXT PRIMARY KEY NOT NULL,f,g);\n" - "CREATE TABLE t3(w REAL PRIMARY KEY NOT NULL,x,y);\n" - "CREATE TABLE t4(z PRIMARY KEY) WITHOUT ROWID;\n" -; - /* Code to populate the database */ static const char zFillSql[] = "INSERT INTO t1(a,b,c,d) VALUES\n" From 90e4a3b7fcdf63035d6f35eb44d11ff58ff4b068 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 15:47:30 +0000 Subject: [PATCH 117/242] Simplifications and optimizations to the Expr object duplication logic. The 5x multiplier crutch from [f371e4c0f8ea73ae] is still present. More fixes are still needed. FossilOrigin-Name: 56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 45 ++++++++++++++++++++++++++++----------------- src/treeview.c | 4 ++++ 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/manifest b/manifest index 982422d0f5..84601b5828 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\san\sunused\sconstant\sfrom\ssessionfuzz.c\sto\sprevent\sa\scompiler\swarning. -D 2023-10-20T14:05:26.334 +C Simplifications\sand\soptimizations\sto\sthe\sExpr\sobject\sduplication\slogic.\nThe\s5x\smultiplier\scrutch\sfrom\s[f371e4c0f8ea73ae]\sis\sstill\spresent.\s\sMore\nfixes\sare\sstill\sneeded. +D 2023-10-20T15:47:30.360 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -668,7 +668,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c eb0d4b2078d05284e209677183b4bcc20d4545260897215a5ef3fced03b67083 +F src/expr.c 1755a8386bd8bb49b5c21cb33682608be33c07ce5df686eb2aa76983bc3a9520 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -781,7 +781,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 -F src/treeview.c bd8ec60f37e3c5d133e00dbff6ba44bb7e3a102728bab83ec420b3feb7d04440 +F src/treeview.c 62fafcd31eea60b718f8daf448116b7b19f90134ebc6c20777ddbb07f56a3d28 F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 @@ -2133,8 +2133,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 95a1dde63117d696323c775580b9c04f044a5b8d609e9174b739ac03ecc1336c -R 6ad478f91385b35d37da9909f3b6864d +P a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d +R 984c0c092b0039888c79b896b5903542 U drh -Z 3d1888cda1fff3d60caf044573bbf655 +Z 2bc926f7992297727e315207ed48e625 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 653320efca..06c3c8c646 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d \ No newline at end of file +56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 35c797ac8f..aa43c9be7b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1529,25 +1529,21 @@ static int dupedExprNodeSize(const Expr *p, int flags){ /* ** Return the number of bytes required to create a duplicate of the -** expression passed as the first argument. The second argument is a -** mask containing EXPRDUP_XXX flags. +** expression passed as the first argument. ** ** The value returned includes space to create a copy of the Expr struct ** itself and the buffer referred to by Expr.u.zToken, if any. ** -** If the EXPRDUP_REDUCE flag is set, then the return value includes -** space to duplicate all Expr nodes in the tree formed by Expr.pLeft -** and Expr.pRight variables (but not for any structures pointed to or -** descended from the Expr.x.pList or Expr.x.pSelect variables). +** The return value includes space to duplicate all Expr nodes in the +** tree formed by Expr.pLeft and Expr.pRight, but not any other +** substructure such as Expr.x.pList, Expr.x.pSelect, and Expr.y.pWin. */ -static int dupedExprSize(const Expr *p, int flags){ - int nByte = 0; - if( p ){ - nByte = dupedExprNodeSize(p, flags); - if( flags&EXPRDUP_REDUCE ){ - nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags); - } - } +static int dupedExprSize(const Expr *p){ + int nByte; + assert( p!=0 ); + nByte = dupedExprNodeSize(p, EXPRDUP_REDUCE); + if( p->pLeft ) nByte += dupedExprSize(p->pLeft); + if( p->pRight ) nByte += dupedExprSize(p->pRight); return nByte; } @@ -1564,6 +1560,13 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ u8 *zAlloc; /* Memory space from which to build Expr object */ u32 staticFlag; /* EP_Static if space not obtained from malloc */ +#ifdef SQLITE_DEBUG + /* If zEnd is not NULL, then it is the first byte past the end of the + ** zAlloc buffer allocated by this routine. Used inside assert() + ** to ensure that sufficient space was allocated for zAlloc */ + u8 *zEnd = 0; +#endif + assert( db!=0 ); assert( p ); assert( dupFlags==0 || dupFlags==EXPRDUP_REDUCE ); @@ -1574,8 +1577,13 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ zAlloc = *pzBuffer; staticFlag = EP_Static; assert( zAlloc!=0 ); + assert( dupFlags==EXPRDUP_REDUCE ); }else{ - zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)*5); + int nAlloc = dupFlags ? dupedExprSize(p) : dupedExprNodeSize(p, 0); + zAlloc = sqlite3DbMallocRawNN(db, nAlloc*5); +#ifdef SQLITE_DEBUG + zEnd = zAlloc ? zAlloc+nAlloc : 0; +#endif staticFlag = 0; } pNew = (Expr *)zAlloc; @@ -1597,12 +1605,14 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ if( dupFlags ){ assert( ExprHasProperty(p, EP_Reduced)==0 ); memcpy(zAlloc, p, nNewSize); + zAlloc += nNewSize; }else{ u32 nSize = (u32)exprStructSize(p); memcpy(zAlloc, p, nSize); if( nSizeu.zToken string, if any. */ if( nToken ){ - char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize]; + char *zToken = pNew->u.zToken = (char*)zAlloc; memcpy(zToken, p->u.zToken, nToken); + zAlloc += nToken; } if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){ @@ -1632,7 +1643,6 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ /* Fill in pNew->pLeft and pNew->pRight. */ if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly|EP_WinFunc) ){ - zAlloc += dupedExprNodeSize(p, dupFlags); if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){ pNew->pLeft = p->pLeft ? exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0; @@ -1661,6 +1671,7 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ } } } + assert( zEnd==0 || zAlloc<=zEnd ); return pNew; } diff --git a/src/treeview.c b/src/treeview.c index a3f128cab2..1fad8673dd 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -724,6 +724,10 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ #endif break; } + case TK_ORDER: { + sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, "ORDERBY"); + break; + } #ifndef SQLITE_OMIT_SUBQUERY case TK_EXISTS: { assert( ExprUseXSelect(pExpr) ); From 17c3408e0eb1fd8cac354af525a24edda47ffe2c Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 20 Oct 2023 17:06:39 +0000 Subject: [PATCH 118/242] Add the SQLITE_CHANGESETAPPLY_FKNOACTION flag to sqlite3session.h, for passing to sqlite3changeset_apply_v2() to cause all foreign key constraints to behave as if they were declared NO ACTION. FossilOrigin-Name: fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28 --- ext/session/sessionnoact.test | 88 +++++++++++++++++++++++++++++++++++ ext/session/sqlite3session.c | 11 +++++ ext/session/sqlite3session.h | 7 +++ ext/session/test_session.c | 5 +- manifest | 23 ++++----- manifest.uuid | 2 +- src/fkey.c | 11 ++++- src/sqliteInt.h | 1 + 8 files changed, 133 insertions(+), 15 deletions(-) create mode 100644 ext/session/sessionnoact.test diff --git a/ext/session/sessionnoact.test b/ext/session/sessionnoact.test new file mode 100644 index 0000000000..9750d5f3d7 --- /dev/null +++ b/ext/session/sessionnoact.test @@ -0,0 +1,88 @@ +# 2023 October 20 +# +# 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. +# + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source [file join [file dirname [info script]] session_common.tcl] +source $testdir/tester.tcl +ifcapable !session {finish_test; return} + +set testprefix sessionnoact + +do_execsql_test 1.0 { + CREATE TABLE p1(a INTEGER PRIMARY KEY, b, c UNIQUE); + INSERT INTO p1 VALUES(1, 1, 'one'); + INSERT INTO p1 VALUES(2, 2, 'two'); + INSERT INTO p1 VALUES(3, 3, 'three'); + INSERT INTO p1 VALUES(4, 4, 'four'); +} + +db_save + +set C [changeset_from_sql { + DELETE FROM p1 WHERE a=2; + UPDATE p1 SET c='six' WHERE a=3; + INSERT INTO p1 VALUES(5, 5, 'two'); + INSERT INTO p1 VALUES(6, 6, 'three'); +}] + +db_restore_and_reopen + +do_execsql_test 1.1 { + CREATE TABLE c1(x INTEGER PRIMARY KEY, y, + FOREIGN KEY(y) REFERENCES p1(c) ON DELETE CASCADE ON UPDATE SET NULL + ); + + INSERT INTO c1 VALUES(10, 'one'); + INSERT INTO c1 VALUES(20, 'two'); + INSERT INTO c1 VALUES(30, 'three'); + INSERT INTO c1 VALUES(40, 'four'); +} + +db_save + +do_execsql_test 1.2 { + PRAGMA foreign_keys = 1; +} + +set ::nConflict 0 +proc conflict {args} { + incr ::nConflict + return "OMIT" +} + +sqlite3changeset_apply_v2 db $C conflict + +do_execsql_test 1.3 { + SELECT * FROM c1 +} { + 10 one + 30 {} + 40 four +} + +db_restore_and_reopen +sqlite3changeset_apply_v2 -noaction db $C conflict + +do_execsql_test 1.4 { + SELECT * FROM c1 +} { + 10 one + 20 two + 30 three + 40 four +} + + +finish_test diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 7ae407154c..bf3f1390d6 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -5322,11 +5322,22 @@ int sqlite3changeset_apply_v2( sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */ int bInv = !!(flags & SQLITE_CHANGESETAPPLY_INVERT); int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset, bInv, 1); + u64 savedFlag = db->flags & SQLITE_FkNoAction; + + if( flags & SQLITE_CHANGESETAPPLY_FKNOACTION ){ + db->flags |= ((u64)SQLITE_FkNoAction); + } + if( rc==SQLITE_OK ){ rc = sessionChangesetApply( db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags ); } + + if( (flags & SQLITE_CHANGESETAPPLY_FKNOACTION) && savedFlag==0 ){ + assert( db->flags & SQLITE_FkNoAction ); + db->flags &= ((u64)SQLITE_FkNoAction); + } return rc; } diff --git a/ext/session/sqlite3session.h b/ext/session/sqlite3session.h index 0c9e786072..160ea8786b 100644 --- a/ext/session/sqlite3session.h +++ b/ext/session/sqlite3session.h @@ -1318,10 +1318,17 @@ int sqlite3changeset_apply_v2( **

  • an insert change if all fields of the conflicting row match ** the row being inserted. ** +** +**
    SQLITE_CHANGESETAPPLY_FKNOACTION
    +** If this flag it set, then all foreign key constraints in the target +** database behave as if they were declared with "ON UPDATE NO ACTION ON +** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL +** or SET DEFAULT. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 +#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 /* ** CAPI3REF: Constants Passed To The Conflict Handler diff --git a/ext/session/test_session.c b/ext/session/test_session.c index 2e8870db61..7931f08526 100644 --- a/ext/session/test_session.c +++ b/ext/session/test_session.c @@ -812,9 +812,12 @@ static int SQLITE_TCLAPI testSqlite3changesetApply( while( objc>1 ){ const char *z1 = Tcl_GetString(objv[1]); int n = strlen(z1); - if( n>1 && n<=12 && 0==sqlite3_strnicmp("-nosavepoint", z1, n) ){ + if( n>3 && n<=12 && 0==sqlite3_strnicmp("-nosavepoint", z1, n) ){ flags |= SQLITE_CHANGESETAPPLY_NOSAVEPOINT; } + else if( n>3 && n<=9 && 0==sqlite3_strnicmp("-noaction", z1, n) ){ + flags |= SQLITE_CHANGESETAPPLY_FKNOACTION; + } else if( n>2 && n<=7 && 0==sqlite3_strnicmp("-invert", z1, n) ){ flags |= SQLITE_CHANGESETAPPLY_INVERT; } diff --git a/manifest b/manifest index 84601b5828..9bd609d1f7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplifications\sand\soptimizations\sto\sthe\sExpr\sobject\sduplication\slogic.\nThe\s5x\smultiplier\scrutch\sfrom\s[f371e4c0f8ea73ae]\sis\sstill\spresent.\s\sMore\nfixes\sare\sstill\sneeded. -D 2023-10-20T15:47:30.360 +C Add\sthe\sSQLITE_CHANGESETAPPLY_FKNOACTION\sflag\sto\ssqlite3session.h,\sfor\spassing\sto\ssqlite3changeset_apply_v2()\sto\scause\sall\sforeign\skey\sconstraints\sto\sbehave\sas\sif\sthey\swere\sdeclared\sNO\sACTION. +D 2023-10-20T17:06:39.472 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -544,6 +544,7 @@ F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576d F ext/session/sessionfault3.test 7c7547202775de268f3fe6f074c4d0d165151829710b4e64f90d4a01645ba9e7 F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25 F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09 +F ext/session/sessionnoact.test 61d9ec369e5851fd7326c79ebb76df0b3dd7b21c0e2cb6d554eea3351b0a57de F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7 F ext/session/sessionnoop2.test de4672dce88464396ec9f30ed08c6c01643a69c53ae540fadbbf6d30642d64e8 F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2 @@ -551,9 +552,9 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c ea28d07a280dc82efd4e98417a10b582058dc11a0f2a6ac3b194aa20d233d758 -F ext/session/sqlite3session.h 4d1f69f1d8bfd4798e8f6431de301d17bb2e4097de2f77ca4dad494bb6c60dc0 -F ext/session/test_session.c be0610a8ab717c3f9c898576d8b4c43e5eb75384a47fed0a0b22768067552778 +F ext/session/sqlite3session.c 6da2db8b2d525a6fe0b6f451743dcb098f609fcc3733aa044406f2d28068aeb2 +F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e +F ext/session/test_session.c 73e9921205633a08c1497770beecf3dcbc9b826dd4358f7f8152f706eaac5d71 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb @@ -670,7 +671,7 @@ F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c 1755a8386bd8bb49b5c21cb33682608be33c07ce5df686eb2aa76983bc3a9520 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 -F src/fkey.c a7fcbf7e66d14dbb73cf49f31489ebf66d0e6006c62b95246924a3bae9f37b36 +F src/fkey.c 360a9b644efc9e05746e0b5b6ccb4760fd039d287ebdf090723b9c97f6d163d9 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 @@ -723,7 +724,7 @@ F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728a F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h 849004dd6f4315e05a8ec892999b0972484eb5438d122adc9444ed854bd905ce +F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2133,8 +2134,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a0cf7e24f928183866ac54f0d6cd83c859d487a19dc87572ab0188d90d2ff87d -R 984c0c092b0039888c79b896b5903542 -U drh -Z 2bc926f7992297727e315207ed48e625 +P 56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d +R 570cd03c70d6d0573d22a0c9506a275a +U dan +Z 570f4c231d8132d7b5260691ca2afd34 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 06c3c8c646..8de3ec5dee 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d \ No newline at end of file +fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index 3142e0ca68..6b1d747c88 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -853,7 +853,7 @@ static int fkParentIsModified( */ static int isSetNullAction(Parse *pParse, FKey *pFKey){ Parse *pTop = sqlite3ParseToplevel(pParse); - if( pTop->pTriggerPrg ){ + if( pTop->pTriggerPrg && 0==(pTop->db->flags & SQLITE_FkNoAction) ){ Trigger *p = pTop->pTriggerPrg->pTrigger; if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull) || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull) @@ -1052,6 +1052,8 @@ void sqlite3FkCheck( } if( regOld!=0 ){ int eAction = pFKey->aAction[aChange!=0]; + if( (db->flags & SQLITE_FkNoAction) ) eAction = OE_None; + fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); /* If this is a deferred FK constraint, or a CASCADE or SET NULL ** action applies, then any foreign key violations caused by @@ -1167,7 +1169,11 @@ int sqlite3FkRequired( /* Check if any parent key columns are being modified. */ for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ if( fkParentIsModified(pTab, p, aChange, chngRowid) ){ - if( p->aAction[1]!=OE_None ) return 2; + if( (pParse->db->flags & SQLITE_FkNoAction)==0 + && p->aAction[1]!=OE_None + ){ + return 2; + } bHaveFK = 1; } } @@ -1217,6 +1223,7 @@ static Trigger *fkActionTrigger( int iAction = (pChanges!=0); /* 1 for UPDATE, 0 for DELETE */ action = pFKey->aAction[iAction]; + if( (db->flags & SQLITE_FkNoAction) ) action = OE_None; if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){ return 0; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 85492fbec6..b6cc81fba1 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1845,6 +1845,7 @@ struct sqlite3 { /* the count using a callback. */ #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */ #define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */ +#define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */ /* Flags used only if debugging */ #ifdef SQLITE_DEBUG From ab3eb5b770841fe31428d74ceaf6d20ace405f7e Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 17:15:15 +0000 Subject: [PATCH 119/242] Improvements to the sqlite3ExprDup() logic for faster performance and better run-time error detection. This check-in fixes the 5x oversize memory allocation bug from [f371e4c0f8ea73ae] as well as all other known issues that result from handing the ORDER BY clause of an aggregate function off of the pLeft pointer of the Expr object. FossilOrigin-Name: f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5 --- manifest | 14 +++--- manifest.uuid | 2 +- src/expr.c | 118 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 78 insertions(+), 56 deletions(-) diff --git a/manifest b/manifest index 9bd609d1f7..a8d211717d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_CHANGESETAPPLY_FKNOACTION\sflag\sto\ssqlite3session.h,\sfor\spassing\sto\ssqlite3changeset_apply_v2()\sto\scause\sall\sforeign\skey\sconstraints\sto\sbehave\sas\sif\sthey\swere\sdeclared\sNO\sACTION. -D 2023-10-20T17:06:39.472 +C Improvements\sto\sthe\ssqlite3ExprDup()\slogic\sfor\sfaster\sperformance\sand\sbetter\nrun-time\serror\sdetection.\s\sThis\scheck-in\sfixes\sthe\s5x\soversize\smemory\sallocation\nbug\sfrom\s[f371e4c0f8ea73ae]\sas\swell\sas\sall\sother\sknown\sissues\sthat\sresult\sfrom\nhanding\sthe\sORDER\sBY\sclause\sof\san\saggregate\sfunction\soff\sof\sthe\spLeft\spointer\nof\sthe\sExpr\sobject. +D 2023-10-20T17:15:15.399 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -669,7 +669,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 1755a8386bd8bb49b5c21cb33682608be33c07ce5df686eb2aa76983bc3a9520 +F src/expr.c 2cf43de9cb6eaed600d689ca0276a8dbb5a56c0fea7e94b2120d9de95d8df309 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 360a9b644efc9e05746e0b5b6ccb4760fd039d287ebdf090723b9c97f6d163d9 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -2134,8 +2134,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 56142a78163b755f16afc05201f623a7a19d9a4b0620a67f7fa20d2a965a288d -R 570cd03c70d6d0573d22a0c9506a275a -U dan -Z 570f4c231d8132d7b5260691ca2afd34 +P fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28 +R 24ff7529cedac4d1c2b0acdaefc5dd9f +U drh +Z 6942ed424b94726ba0e7696f899b042d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8de3ec5dee..e5f3980a50 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28 \ No newline at end of file +f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index aa43c9be7b..c47f7964ae 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1548,45 +1548,61 @@ static int dupedExprSize(const Expr *p){ } /* -** This function is similar to sqlite3ExprDup(), except that if pzBuffer -** is not NULL then *pzBuffer is assumed to point to a buffer large enough -** to store the copy of expression p, the copies of p->u.zToken -** (if applicable), and the copies of the p->pLeft and p->pRight expressions, -** if any. Before returning, *pzBuffer is set to the first byte past the -** portion of the buffer copied into by this function. +** An EdupBuf is a memory allocation used to stored multiple Expr objects +** together with their Expr.zToken content. This is used to help implement +** compression while doing sqlite3ExprDup(). The top-level Expr does the +** allocation for itself and many of its decendents, then passes an instance +** of the structure down into exprDup() so that they decendents can have +** access to that memory. */ -static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ - Expr *pNew; /* Value to return */ - u8 *zAlloc; /* Memory space from which to build Expr object */ - u32 staticFlag; /* EP_Static if space not obtained from malloc */ - +typedef struct EdupBuf EdupBuf; +struct EdupBuf { + u8 *zAlloc; /* Memory space available for storage */ #ifdef SQLITE_DEBUG - /* If zEnd is not NULL, then it is the first byte past the end of the - ** zAlloc buffer allocated by this routine. Used inside assert() - ** to ensure that sufficient space was allocated for zAlloc */ - u8 *zEnd = 0; + u8 *zEnd; /* First byte past the end of memory */ #endif +}; + +/* +** This function is similar to sqlite3ExprDup(), except that if pEdupBuf +** is not NULL then it points to memory that can be used to store a copy +** of the input Expr p together with its p->u.zToken (if any). pEdupBuf +** is updated with the new buffer tail prior to returning. +*/ +static Expr *exprDup( + sqlite3 *db, /* Database connection (for memory allocation) */ + const Expr *p, /* Expr tree to be duplicated */ + int dupFlags, /* EXPRDUP_REDUCE for compression. 0 if not */ + EdupBuf *pEdupBuf /* Preallocated storage space, or NULL */ +){ + Expr *pNew; /* Value to return */ + EdupBuf sEdupBuf; /* Memory space from which to build Expr object */ + u32 staticFlag; /* EP_Static if space not obtained from malloc */ assert( db!=0 ); assert( p ); assert( dupFlags==0 || dupFlags==EXPRDUP_REDUCE ); - assert( pzBuffer==0 || dupFlags==EXPRDUP_REDUCE ); + assert( pEdupBuf==0 || dupFlags==EXPRDUP_REDUCE ); /* Figure out where to write the new Expr structure. */ - if( pzBuffer ){ - zAlloc = *pzBuffer; + if( pEdupBuf ){ + sEdupBuf.zAlloc = pEdupBuf->zAlloc; +#ifdef SQLITE_DEBUG + sEdupBuf.zEnd = pEdupBuf->zEnd; +#endif staticFlag = EP_Static; - assert( zAlloc!=0 ); + assert( sEdupBuf.zAlloc!=0 ); assert( dupFlags==EXPRDUP_REDUCE ); }else{ int nAlloc = dupFlags ? dupedExprSize(p) : dupedExprNodeSize(p, 0); - zAlloc = sqlite3DbMallocRawNN(db, nAlloc*5); + sEdupBuf.zAlloc = sqlite3DbMallocRawNN(db, nAlloc); #ifdef SQLITE_DEBUG - zEnd = zAlloc ? zAlloc+nAlloc : 0; + sEdupBuf.zEnd = sEdupBuf.zAlloc ? sEdupBuf.zAlloc+nAlloc : 0; #endif + staticFlag = 0; } - pNew = (Expr *)zAlloc; + pNew = (Expr *)sEdupBuf.zAlloc; if( pNew ){ /* Set nNewSize to the size allocated for the structure pointed to @@ -1603,16 +1619,18 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ nToken = 0; } if( dupFlags ){ + assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken ); assert( ExprHasProperty(p, EP_Reduced)==0 ); - memcpy(zAlloc, p, nNewSize); - zAlloc += nNewSize; + memcpy(sEdupBuf.zAlloc, p, nNewSize); + sEdupBuf.zAlloc += nNewSize; }else{ u32 nSize = (u32)exprStructSize(p); - memcpy(zAlloc, p, nSize); + assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= EXPR_FULLSIZE+nToken ); + memcpy(sEdupBuf.zAlloc, p, nSize); if( nSizeu.zToken string, if any. */ if( nToken ){ - char *zToken = pNew->u.zToken = (char*)zAlloc; + char *zToken = pNew->u.zToken = (char*)sEdupBuf.zAlloc; memcpy(zToken, p->u.zToken, nToken); - zAlloc += nToken; + sEdupBuf.zAlloc += nToken; } - if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){ + if( ((p->flags|pNew->flags)&(EP_TokenOnly|EP_Leaf))==0 ){ + /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ if( ExprUseXSelect(p) ){ pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags); @@ -1639,31 +1658,33 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, p->op!=TK_ORDER ? dupFlags : 0); } - } - /* Fill in pNew->pLeft and pNew->pRight. */ - if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly|EP_WinFunc) ){ - if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){ - pNew->pLeft = p->pLeft ? - exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0; - pNew->pRight = p->pRight ? - exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0; - } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ pNew->y.pWin = sqlite3WindowDup(db, pNew, p->y.pWin); assert( ExprHasProperty(pNew, EP_WinFunc) ); } #endif /* SQLITE_OMIT_WINDOWFUNC */ - if( pzBuffer ){ - *pzBuffer = zAlloc; - } - }else{ - if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ - if( pNew->op==TK_SELECT_COLUMN ){ + + /* Fill in pNew->pLeft and pNew->pRight. */ + if( dupFlags ){ + if( p->op==TK_SELECT_COLUMN ){ pNew->pLeft = p->pLeft; - assert( p->pRight==0 || p->pRight==p->pLeft - || ExprHasProperty(p->pLeft, EP_Subquery) ); + assert( p->pRight==0 + || p->pRight==p->pLeft + || ExprHasProperty(p->pLeft, EP_Subquery) ); + }else{ + pNew->pLeft = p->pLeft ? + exprDup(db, p->pLeft, EXPRDUP_REDUCE, &sEdupBuf) : 0; + } + pNew->pRight = p->pRight ? + exprDup(db, p->pRight, EXPRDUP_REDUCE, &sEdupBuf) : 0; + }else{ + if( p->op==TK_SELECT_COLUMN ){ + pNew->pLeft = p->pLeft; + assert( p->pRight==0 + || p->pRight==p->pLeft + || ExprHasProperty(p->pLeft, EP_Subquery) ); }else{ pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); } @@ -1671,7 +1692,8 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ } } } - assert( zEnd==0 || zAlloc<=zEnd ); + if( pEdupBuf ) memcpy(pEdupBuf, &sEdupBuf, sizeof(sEdupBuf)); + assert( sEdupBuf.zAlloc <= sEdupBuf.zEnd ); return pNew; } From e98f62fb3f23bc3e92796fe175c383177f0ef4ac Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 18:09:08 +0000 Subject: [PATCH 120/242] Omit some redundant calls to strlen() used to find the size of Expr.u.zToken in sqliteExprDup(). This inefficiency was seen while working on the previous check-in, and I thought it best to fix it while it was fresh in mind. FossilOrigin-Name: b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 26 +++++++++++++++++++------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index a8d211717d..04be4c0838 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\ssqlite3ExprDup()\slogic\sfor\sfaster\sperformance\sand\sbetter\nrun-time\serror\sdetection.\s\sThis\scheck-in\sfixes\sthe\s5x\soversize\smemory\sallocation\nbug\sfrom\s[f371e4c0f8ea73ae]\sas\swell\sas\sall\sother\sknown\sissues\sthat\sresult\sfrom\nhanding\sthe\sORDER\sBY\sclause\sof\san\saggregate\sfunction\soff\sof\sthe\spLeft\spointer\nof\sthe\sExpr\sobject. -D 2023-10-20T17:15:15.399 +C Omit\ssome\sredundant\scalls\sto\sstrlen()\sused\sto\sfind\sthe\ssize\sof\nExpr.u.zToken\sin\ssqliteExprDup().\s\sThis\sinefficiency\swas\sseen\swhile\sworking\non\sthe\sprevious\scheck-in,\sand\sI\sthought\sit\sbest\sto\sfix\sit\swhile\sit\swas\nfresh\sin\smind. +D 2023-10-20T18:09:08.595 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -669,7 +669,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 2cf43de9cb6eaed600d689ca0276a8dbb5a56c0fea7e94b2120d9de95d8df309 +F src/expr.c ddb8e310561c761b29f993490eaa64b8a3496032140db74b5ebaeca4a7c96cb3 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 360a9b644efc9e05746e0b5b6ccb4760fd039d287ebdf090723b9c97f6d163d9 F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 @@ -2134,8 +2134,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fc9f82ea084159eaf3dd1757b96d17d1201b00c4e06455a7dcd8067172b25f28 -R 24ff7529cedac4d1c2b0acdaefc5dd9f +P f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5 +R d3b5a604b96f76db93b01c4a13c3d7ea U drh -Z 6942ed424b94726ba0e7696f899b042d +Z 496ee78f77a1d59f8f48d2e1597d6cd9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e5f3980a50..9e114bfc58 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5 \ No newline at end of file +b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index c47f7964ae..73ff553730 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1578,6 +1578,7 @@ static Expr *exprDup( Expr *pNew; /* Value to return */ EdupBuf sEdupBuf; /* Memory space from which to build Expr object */ u32 staticFlag; /* EP_Static if space not obtained from malloc */ + int nToken = -1; /* Space needed for p->u.zToken. -1 means unknown */ assert( db!=0 ); assert( p ); @@ -1594,7 +1595,16 @@ static Expr *exprDup( assert( sEdupBuf.zAlloc!=0 ); assert( dupFlags==EXPRDUP_REDUCE ); }else{ - int nAlloc = dupFlags ? dupedExprSize(p) : dupedExprNodeSize(p, 0); + int nAlloc; + if( dupFlags ){ + nAlloc = dupedExprSize(p); + }else if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ + nToken = sqlite3Strlen30NN(p->u.zToken)+1; + nAlloc = EXPR_FULLSIZE + nToken; + }else{ + nToken = 0; + nAlloc = EXPR_FULLSIZE; + } sEdupBuf.zAlloc = sqlite3DbMallocRawNN(db, nAlloc); #ifdef SQLITE_DEBUG sEdupBuf.zEnd = sEdupBuf.zAlloc ? sEdupBuf.zAlloc+nAlloc : 0; @@ -1612,11 +1622,12 @@ static Expr *exprDup( */ const unsigned nStructSize = dupedExprStructSize(p, dupFlags); const int nNewSize = nStructSize & 0xfff; - int nToken; - if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nToken = sqlite3Strlen30(p->u.zToken) + 1; - }else{ - nToken = 0; + if( nToken<0 ){ + if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ + nToken = sqlite3Strlen30(p->u.zToken) + 1; + }else{ + nToken = 0; + } } if( dupFlags ){ assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken ); @@ -1643,7 +1654,8 @@ static Expr *exprDup( } /* Copy the p->u.zToken string, if any. */ - if( nToken ){ + assert( nToken>=0 ); + if( nToken>0 ){ char *zToken = pNew->u.zToken = (char*)sEdupBuf.zAlloc; memcpy(zToken, p->u.zToken, nToken); sEdupBuf.zAlloc += nToken; From 81656b15c95706b1336051e08ff15f022e70f525 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 19:06:04 +0000 Subject: [PATCH 121/242] Fix PRAGMA integrity_check so that it does not raise an error if the schema contains a CREATE VIRTUAL TABLE that does not have its module loaded. FossilOrigin-Name: 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pragma.c | 5 ++++- src/resolve.c | 2 -- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 04be4c0838..21113c6348 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\ssome\sredundant\scalls\sto\sstrlen()\sused\sto\sfind\sthe\ssize\sof\nExpr.u.zToken\sin\ssqliteExprDup().\s\sThis\sinefficiency\swas\sseen\swhile\sworking\non\sthe\sprevious\scheck-in,\sand\sI\sthought\sit\sbest\sto\sfix\sit\swhile\sit\swas\nfresh\sin\smind. -D 2023-10-20T18:09:08.595 +C Fix\sPRAGMA\sintegrity_check\sso\sthat\sit\sdoes\snot\sraise\san\serror\sif\sthe\nschema\scontains\sa\sCREATE\sVIRTUAL\sTABLE\sthat\sdoes\snot\shave\sits\smodule\nloaded. +D 2023-10-20T19:06:04.049 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -712,12 +712,12 @@ F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c 9f9b8828624ee98de22a2a9793a651daa39bc06cd9e701b6eda23c6d75260f1d +F src/pragma.c 63b3af7288c91cbfa24797e3eee74913437623683d8080d1db3ea422353aa77a F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c 77d07bcec1b3101ce36ebf4aa04dd0340e77cbfc4f31bd1a6e43fcd2db904626 +F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa @@ -2134,8 +2134,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f5c01676fd281e938181b846dd2024d050f597dc6a7a91928beab9d8553dfdb5 -R d3b5a604b96f76db93b01c4a13c3d7ea +P b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7 +R d49a86076e3848998904865202dcd417 U drh -Z 496ee78f77a1d59f8f48d2e1597d6cd9 +Z 9b5fdaea1a9423bb5f088658371340a2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9e114bfc58..72ef461529 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7 \ No newline at end of file +5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 576080e10a..0ec745d57d 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1765,8 +1765,11 @@ void sqlite3Pragma( if( !IsOrdinaryTable(pTab) ){ sqlite3_vtab *pVTab; int a1; + int savedErr = db->suppressErr; if( !IsVirtual(pTab) ) continue; - sqlite3ViewGetColumnNames(pParse, pTab); + db->suppressErr = 1; + rc = sqlite3ViewGetColumnNames(pParse, pTab); + db->suppressErr = savedErr; if( pTab->u.vtab.p==0 ) continue; pVTab = pTab->u.vtab.p->pVtab; if( NEVER(pVTab==0) ) continue; diff --git a/src/resolve.c b/src/resolve.c index 7eba26938a..0072f6b6aa 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1784,10 +1784,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ while( p ){ assert( (p->selFlags & SF_Expanded)!=0 ); assert( (p->selFlags & SF_Resolved)==0 ); - assert( db->suppressErr==0 ); /* SF_Resolved not set if errors suppressed */ p->selFlags |= SF_Resolved; - /* Resolve the expressions in the LIMIT and OFFSET clauses. These ** are not allowed to refer to any names, so pass an empty NameContext. */ From 71bae9f19f8c73841c0b4062af7c56bd83271e77 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 20 Oct 2023 19:59:12 +0000 Subject: [PATCH 122/242] Fix a problem allowing a COMMIT following an OOM to cause fts5 corruption. FossilOrigin-Name: fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e --- ext/fts5/fts5_index.c | 10 ++++--- ext/fts5/fts5_main.c | 53 +++++++++++++++++++++++++++++++---- ext/fts5/fts5_storage.c | 4 ++- ext/fts5/test/fts5faultG.test | 50 +++++++++++++++++++++++++++++++++ manifest | 19 +++++++------ manifest.uuid | 2 +- 6 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 ext/fts5/test/fts5faultG.test diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 0500d54a9e..4e6afb2815 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -5531,7 +5531,6 @@ static void fts5FlushOneHash(Fts5Index *p){ assert( pBuf->n<=pBuf->nSpace ); if( p->rc==SQLITE_OK ) sqlite3Fts5HashScanNext(pHash); } - sqlite3Fts5HashClear(pHash); fts5WriteFinish(p, &writer, &pgnoLast); assert( p->rc!=SQLITE_OK || bSecureDelete || pgnoLast>0 ); @@ -5564,7 +5563,6 @@ static void fts5FlushOneHash(Fts5Index *p){ fts5IndexCrisismerge(p, &pStruct); fts5StructureWrite(p, pStruct); fts5StructureRelease(pStruct); - p->nContentlessDelete = 0; } /* @@ -5575,8 +5573,12 @@ static void fts5IndexFlush(Fts5Index *p){ if( p->nPendingData || p->nContentlessDelete ){ assert( p->pHash ); fts5FlushOneHash(p); - p->nPendingData = 0; - p->nPendingRow = 0; + if( p->rc==SQLITE_OK ){ + sqlite3Fts5HashClear(p->pHash); + p->nPendingData = 0; + p->nPendingRow = 0; + p->nContentlessDelete = 0; + } } } diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 1c21367df1..6e60a4cc2a 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -117,6 +117,8 @@ struct Fts5FullTable { Fts5Storage *pStorage; /* Document store */ Fts5Global *pGlobal; /* Global (connection wide) data */ Fts5Cursor *pSortCsr; /* Sort data from this cursor */ + int iSavepoint; /* Successful xSavepoint()+1 */ + int bInSavepoint; #ifdef SQLITE_DEBUG struct Fts5TransactionState ts; #endif @@ -1568,6 +1570,8 @@ static int fts5SpecialInsert( }else if( 0==sqlite3_stricmp("prefix-index", zCmd) ){ pConfig->bPrefixIndex = sqlite3_value_int(pVal); #endif + }else if( 0==sqlite3_stricmp("flush", zCmd) ){ + rc = sqlite3Fts5FlushToDisk(&pTab->p); }else{ rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); if( rc==SQLITE_OK ){ @@ -2609,8 +2613,12 @@ static int fts5RenameMethod( sqlite3_vtab *pVtab, /* Virtual table handle */ const char *zName /* New name of table */ ){ + int rc; Fts5FullTable *pTab = (Fts5FullTable*)pVtab; - return sqlite3Fts5StorageRename(pTab->pStorage, zName); + pTab->bInSavepoint = 1; + rc = sqlite3Fts5StorageRename(pTab->pStorage, zName); + pTab->bInSavepoint = 0; + return rc; } int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ @@ -2624,9 +2632,30 @@ int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ ** Flush the contents of the pending-terms table to disk. */ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ + Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc = SQLITE_OK; + char *zSql = 0; UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ - fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_SAVEPOINT, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint); + + if( pTab->bInSavepoint==0 ){ + zSql = sqlite3_mprintf("INSERT INTO %Q.%Q(%Q) VALUES('flush')", + pTab->p.pConfig->zDb, pTab->p.pConfig->zName, pTab->p.pConfig->zName + ); + if( zSql ){ + pTab->bInSavepoint = 1; + rc = sqlite3_exec(pTab->p.pConfig->db, zSql, 0, 0, 0); + pTab->bInSavepoint = 0; + sqlite3_free(zSql); + }else{ + rc = SQLITE_NOMEM; + } + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint+1; + } + } + + return rc; } /* @@ -2635,9 +2664,17 @@ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** This is a no-op. */ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ + Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc = SQLITE_OK; UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ - fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_RELEASE, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint); + if( (iSavepoint+1)iSavepoint ){ + rc = sqlite3Fts5FlushToDisk(&pTab->p); + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint; + } + } + return rc; } /* @@ -2647,11 +2684,15 @@ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ */ static int fts5RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc = SQLITE_OK; UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint); fts5TripCursors(pTab); pTab->p.pConfig->pgsz = 0; - return sqlite3Fts5StorageRollback(pTab->pStorage); + if( (iSavepoint+1)<=pTab->iSavepoint ){ + rc = sqlite3Fts5StorageRollback(pTab->pStorage); + } + return rc; } /* diff --git a/ext/fts5/fts5_storage.c b/ext/fts5/fts5_storage.c index 0a0af9d4b5..9480da7c52 100644 --- a/ext/fts5/fts5_storage.c +++ b/ext/fts5/fts5_storage.c @@ -1184,7 +1184,9 @@ int sqlite3Fts5StorageSync(Fts5Storage *p){ i64 iLastRowid = sqlite3_last_insert_rowid(p->pConfig->db); if( p->bTotalsValid ){ rc = fts5StorageSaveTotals(p); - p->bTotalsValid = 0; + if( rc==SQLITE_OK ){ + p->bTotalsValid = 0; + } } if( rc==SQLITE_OK ){ rc = sqlite3Fts5IndexSync(p->pIndex); diff --git a/ext/fts5/test/fts5faultG.test b/ext/fts5/test/fts5faultG.test new file mode 100644 index 0000000000..f6ec781c8b --- /dev/null +++ b/ext/fts5/test/fts5faultG.test @@ -0,0 +1,50 @@ +# 2010 June 15 +# +# 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. +# +#*********************************************************************** +# + +source [file join [file dirname [info script]] fts5_common.tcl] +source $testdir/malloc_common.tcl +set testprefix fts5faultG + +# If SQLITE_ENABLE_FTS5 is defined, omit this file. +ifcapable !fts5 { + finish_test + return +} + +set ::testprefix fts5faultG + + +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE t1 USING fts5(a); + INSERT INTO t1 VALUES('test renaming the table'); + INSERT INTO t1 VALUES(' after it has been written'); + INSERT INTO t1 VALUES(' actually other stuff instead'); +} +faultsim_save_and_close +do_faultsim_test 1 -faults oom-t* -prep { + faultsim_restore_and_reopen + execsql { + BEGIN; + DELETE FROM t1 WHERE rowid=2; + } +} -body { + execsql { + DELETE FROM t1; + } +} -test { + catchsql { COMMIT } + faultsim_integrity_check + faultsim_test_result {0 {}} +} + + +finish_test diff --git a/manifest b/manifest index 21113c6348..cc92f43812 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sPRAGMA\sintegrity_check\sso\sthat\sit\sdoes\snot\sraise\san\serror\sif\sthe\nschema\scontains\sa\sCREATE\sVIRTUAL\sTABLE\sthat\sdoes\snot\shave\sits\smodule\nloaded. -D 2023-10-20T19:06:04.049 +C Fix\sa\sproblem\sallowing\sa\sCOMMIT\sfollowing\san\sOOM\sto\scause\sfts5\scorruption. +D 2023-10-20T19:59:12.660 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -94,9 +94,9 @@ F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b7292 F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081 F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d -F ext/fts5/fts5_index.c a0f8e58e1c101d0b7959264f76b8c0c3c44914a999b29ec4264a6f55f1bccfe1 -F ext/fts5/fts5_main.c 95b479e4cc1ae5d22084caa9d85295ed759044d24a0c1679115aea4910792a1f -F ext/fts5/fts5_storage.c 3c9b41fce41b6410f2e8f82eb035c6a29b2560483f773e6dc98cf3cb2e4ddbb5 +F ext/fts5/fts5_index.c 730c9c32ada18ce1eb7ff847b36507f4b005d88d47af7b47db521e695a8ea4c7 +F ext/fts5/fts5_main.c e345282be41c646702bbb91d488b78c35d9fa6e5a375d2809d9eb7dfbaed3314 +F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca56d6601426d F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b @@ -167,6 +167,7 @@ F ext/fts5/test/fts5faultB.test d606bdb8e81aaeb6f41de3fc9fc7ae315733f0903fbff05c F ext/fts5/test/fts5faultD.test e7ed7895abfe6bc98a5e853826f6b74956e7ba7f594f1860bbf9e504b9647996 F ext/fts5/test/fts5faultE.test 844586ce71dab4be85bb86880e87b624d089f851654cd22e4710c77eb8ce7075 F ext/fts5/test/fts5faultF.test 4abef99f86e99d9f0c6460dd68c586a766b6b9f1f660ada55bf2e8266bd1bbc1 +F ext/fts5/test/fts5faultG.test 7528654556b047ac515fc2790c03f71475141d5522a28edd3a6a630af269d9b1 F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079 F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717 F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e @@ -2134,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b7a84eff5dcdf5b2ff81331097cdc64d0c5d16a4ae224320f39b64541ec72dc7 -R d49a86076e3848998904865202dcd417 -U drh -Z 9b5fdaea1a9423bb5f088658371340a2 +P 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 +R 04eef64adc8baa80e96c39c8b85b43af +U dan +Z c4161b04175a3850db328dc9504c42b8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 72ef461529..a564dcfd24 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 \ No newline at end of file +fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e \ No newline at end of file From d5e040b6f087f0e3ec5ab604cf9eaf7d917087ed Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 20 Oct 2023 20:19:30 +0000 Subject: [PATCH 123/242] Add string_agg(X,Y) as an alias for group_concat(X,Y), for compatibility with SQLServer and PG. FossilOrigin-Name: b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1 --- manifest | 86 ++++++++++++++++++++-------------------- manifest.uuid | 2 +- src/func.c | 3 ++ test/aggnested.test | 8 ++-- test/aggorderby.test | 8 ++-- test/alterqf.test | 2 +- test/altertrig.test | 1 - test/bestindex9.test | 4 -- test/bestindexA.test | 3 -- test/changes.test | 2 - test/changes2.test | 1 - test/dbpagefault.test | 2 - test/distinctagg.test | 3 +- test/e_expr.test | 2 +- test/e_select.test | 2 +- test/filter2.test | 2 +- test/fts4merge.test | 14 +++---- test/func.test | 14 +++---- test/gcfault.test | 4 +- test/indexA.test | 1 - test/joinH.test | 1 - test/memdb2.test | 1 - test/memjournal2.test | 2 - test/pendingrace.test | 3 -- test/quickcheck.test | 1 - test/rowvalue9.test | 2 - test/rowvalueA.test | 1 - test/scanstatus2.test | 2 - test/select3.test | 1 - test/statfault.test | 1 - test/table.test | 6 +-- test/thread3.test | 1 - test/tkt-cbd054fa6b.test | 2 +- test/trigger2.test | 1 - test/unhex.test | 2 - test/vacuum-into.test | 3 -- test/walseh1.test | 2 - test/window1.test | 10 ++--- test/window3.test | 8 ++-- 39 files changed, 89 insertions(+), 125 deletions(-) diff --git a/manifest b/manifest index cc92f43812..f3ff27e0c6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sallowing\sa\sCOMMIT\sfollowing\san\sOOM\sto\scause\sfts5\scorruption. -D 2023-10-20T19:59:12.660 +C Add\sstring_agg(X,Y)\sas\san\salias\sfor\sgroup_concat(X,Y),\sfor\scompatibility\nwith\sSQLServer\sand\sPG. +D 2023-10-20T20:19:30.189 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -673,7 +673,7 @@ F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c ddb8e310561c761b29f993490eaa64b8a3496032140db74b5ebaeca4a7c96cb3 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 360a9b644efc9e05746e0b5b6ccb4760fd039d287ebdf090723b9c97f6d163d9 -F src/func.c e8d7b3587a225f4f1116f720b72090511fe9feb936e960bd26a053cea6a17a63 +F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 @@ -815,8 +815,8 @@ F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867d F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 -F test/aggnested.test 7269d07ac879fce161cb26c8fabe65cba5715742fac8a1fccac570dcdaf28f00 -F test/aggorderby.test d0011beb1dec691ee18978d2d43e0f4af7043a1726f33e06c9f60e83112a917b +F test/aggnested.test 2e738bfe2980df301a782f6e7bbf9459266f64f7e72f58f3b5c843bf897c568c +F test/aggorderby.test d110490c62d29318fa56831cd67bc49b07789592f1cdd7881725735ecd05308a F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -834,11 +834,11 @@ F test/alterlegacy.test f38c6d06cda39e1f7b955bbce57f2e3ef5b7cb566d3d1234502093e2 F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74a3fb80c9 F test/altermalloc2.test 17fb3724c4b004c469c27dc4ef181608aa644555fbd3f3236767584f73747c81 F test/altermalloc3.test 8531b3086f0a7889f43971a579a8c81832d5123f4703d8c86b89ba1136c63b9a -F test/alterqf.test ff6c6f881485c29ed699b8ef4774864ca1b0c01a6c08f5cdd624a008e4b40fca +F test/alterqf.test 384efa7a1d0d3e404a5e21abdfc27298ce945e7f68a032e8f7acbafb4102a96b F test/altertab.test 8a2712f9076da5012a002d0b5cc0a421398a5bf61c25bab41b77c427586a7a27 F test/altertab2.test 62597b6fd08feaba1b6bfe7d31dac6117c67e06dc9ce9c478a3abe75b5926de0 F test/altertab3.test 6c432fbb9963e0bd6549bf1422f6861d744ee5a80cb3298564e81e556481df16 -F test/altertrig.test fb5951d21a2c954be3b8a8cf8e10b5c0fa20687c53fd67d63cea88d08dd058d5 +F test/altertrig.test aacc980b657354fe2d3d4d3a004f07d04ccc1a93e5ef82d68a79088c274ddc6b F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f F test/analyze.test 2fb21d7d64748636384e6cb8998dbf83968caf644c07fcb4f76c18f2e7ede94b F test/analyze3.test 03f4b3d794760cf15da2d85a52df9bae300e51c8fefe9c36cfae1f86dc10d23f @@ -902,8 +902,8 @@ F test/bestindex5.test a0c90b2dad7836e80a01379e200e5f8ec9476d49b349af02c0dbff2fb F test/bestindex6.test 16942535b551273f3ad9df8d7cc4b7f22b1fcd8882714358859eb049a6f99dd4 F test/bestindex7.test f094c669a6400777f4d2ddc3ed28e39169f1adb5be3d59b55f22ccf8c414b71e F test/bestindex8.test 333ad8c6a554b885a49b68c019166eda92b05f493a92b36b0acdf7f766d04dad -F test/bestindex9.test bf2eb8556e8d5c00ef3ee18c521751cd03c1b55454b6e7683b4c6742e3131b23 -F test/bestindexA.test dd7b7439a46169b45d0305c4cbbb14fc20c7044acc2055c767d2f838b3479c3f +F test/bestindex9.test 1a4b93db117fd8abe74ae9be982f86aa72f01e60cd4ac541e6ede39673a451a0 +F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572eef44c7f F test/between.test b9a65fb065391980119e8a781a7409d3fcf059d89968279c750e190a9a1d5263 F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -941,8 +941,8 @@ F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe F test/carray01.test 23ed7074307c4a829ba5ff2970993a9d87db7c5cdbbe1a2cbef672d0df6d6e31 F test/cast.test af2286fdd28f3470b7dcad23977282b8cc117747ad55acff74a770dad3b19398 F test/cffault.test 9d6b20606afe712374952eec4f8fd74b1a8097ef -F test/changes.test 9dd8e597d84072122fc8a4fcdea837f4a54a461e6e536053ea984303e8ca937b -F test/changes2.test d222c0cbf5ab0ac4d7c180594e486c1bf20b2098d33e56ce33b8e12eba6823b9 +F test/changes.test 4377d202a487f66fc2822c1bf57c46798c8b2caf7446f4f701723b1dbb6b86f6 +F test/changes2.test 07949edcc732af28cb54276bfb7d99723bccc1e905a423648bf57ac5cb0dc792 F test/check.test 56e4ed457e9f8683b9fc56f5b964f461f6e8a8dd5a13f3d495408215d66419ed F test/checkfault.test da6cb3d50247169efcb20bdf57863a3ccfa1d27d9e55cd324f0680096970f014 F test/chunksize.test 427d87791743486cbf0c3b8c625002f3255cb3a89c6eba655a98923b1387b760 @@ -1021,7 +1021,7 @@ F test/dbfuzz001.test 6c9a4622029d69dc38926f115864b055cb2f39badd25ec22cbfb130c8b F test/dbfuzz2-seed1.db e6225c6f3d7b63f9c5b6867146a5f329d997ab105bee64644dc2b3a2f2aebaee F test/dbfuzz2.c 4b3c12de4d98b1b2d908ab03d217d4619e47c8b23d5e67f8a6f2b1bdee7cae23 F test/dbpage.test fce29035c7566fd7835ec0f19422cb4b9c6944ce0e1b936ff8452443f92e887d -F test/dbpagefault.test d9111a62f3601d3efc6841ace3940181937342d245f92a1cca6cba8206d4f58a +F test/dbpagefault.test 35f06cfb2ef100a9b19d25754e8141b9cba9b7daabd4c60fa5af93fcce884435 F test/dbstatus.test 4a4221a883025ffd39696b3d1b3910b928fb097d77e671351acb35f3aed42759 F test/dbstatus2.test f5fe0afed3fa45e57cfa70d1147606c20d2ba23feac78e9a172f2fe8ab5b78ef F test/decimal.test ef731887b43ee32ef86e1c8fddb61a40789f988332c029c601dcf2c319277e9e @@ -1037,7 +1037,7 @@ F test/descidx3.test 953c831df7ea219c73826dfbf2f6ee02d95040725aa88ccb4fa43d1a199 F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e F test/distinct.test 691c9e850b0d0b56b66e7e235453198cb4cf0760e324b7403d3c5abbeab0a014 F test/distinct2.test bb71cc7b5e58e895787f9910a788c254f679928d324732d063fe9bc202ecbe71 -F test/distinctagg.test 14ec5026e684eddd414c61c08692b43773e224ac92efbed6ec08c6994bc39723 +F test/distinctagg.test ad2b4cf1483cd4cf24867dfafbfa0abb61184d92085fcc9784cea0592b278d64 F test/e_blobbytes.test 4c01dfe4f12087b92b20705a3fdfded45dc4ed16d5a211fed4e1d2786ba68a52 F test/e_blobclose.test 692fc02a058476c2222a63d97e3f3b2b809c1842e5525ded7f854d540ac2e075 F test/e_blobopen.test 29f6055ee453b8e679fe9570c4d3acfedbef821622c5dad16875148c5952ef50 @@ -1047,13 +1047,13 @@ F test/e_createtable.test 31b9bcb6ac8876bc7ec342d86d9c231a84c62b442093a6651dfd0f F test/e_delete.test ab39084f26ae1f033c940b70ebdbbd523dc4962e F test/e_droptrigger.test 235c610f8bf8ec44513e222b9085c7e49fad65ad0c1975ac2577109dd06fd8fa F test/e_dropview.test 74e405df7fa0f762e0c9445b166fe03955856532e2bb234c372f7c51228d75e7 -F test/e_expr.test 27e905ed17266c745bffe65f56b809c13ae6e225e56aeda1aaec926b32439286 +F test/e_expr.test b950818a48269506d75a41c819003bd77a0893bc4a4f2fdee191bc74109c1a87 F test/e_fkey.test feeba6238aeff9d809fb6236b351da8df4ae9bda89e088e54526b31a0cbfeec5 F test/e_fts3.test 17ba7c373aba4d4f5696ba147ee23fd1a1ef70782af050e03e262ca187c5ee07 F test/e_insert.test f02f7f17852b2163732c6611d193f84fc67bc641fb4882c77a464076e5eba80e F test/e_reindex.test 2b0e29344497d9a8a999453a003cb476b6b1d2eef2d6c120f83c2d3a429f3164 F test/e_resolve.test a61751c368b109db73df0f20fc75fb47e166b1d8 -F test/e_select.test 89fa483f68d868f1be3d6f56180ed42d979979c266e051bf8b5e66a251e6b44a +F test/e_select.test 327a15f14068bbd6f647cedc67210f8680fcb2f05e481a0a855fccd2abfa1292 F test/e_select2.test aceb80ab927d46fba5ce7586ebabf23e2bb0604f F test/e_totalchanges.test c927f7499dc3aa28b9b556b7d6d115a2f0fe41f012b128d16bf1f3b30e9b41e4 F test/e_update.test f46c2554d915c9197548681e8d8c33a267e84528 @@ -1086,7 +1086,7 @@ F test/filectrl.test 6e871c2d35dead1d9a88e176e8d2ca094fec6bb3 F test/filefmt.test f393e80c4b8d493b7a7f8f3809a8425bbf4292af1f5140f01cb1427798a2bbd4 F test/filter1.test 590f8ba9a0cd0823b80d89ac75c5ce72276189cef9225d2436adaf1ee87f3727 F test/filter2.tcl 44e525497ce07382915f01bd29ffd0fa49dab3adb87253b5e5103ba8f93393e8 -F test/filter2.test 485cf95d1f6d6ceee5632201ca52a71868599836f430cdee42e5f7f14666e30a +F test/filter2.test 3cc20eaea2ea1ab245197cc4a62468deb460b78f5aa9bd7d5d3353c2fe569bae F test/filterfault.test c08fb491d698e8df6c122c98f7db1c65ffcfcad2c1ab0e07fa8a5be1b34eaa8b F test/fkey1.test e563bcb4cb108ce3f40363cda4f84009dc89a39e2973076e5057ba99fca35378 F test/fkey2.test 1063d65e5923c054cfb8f0555a92a3ae0fa8c067275a33ee1715bd856cdb304c @@ -1179,7 +1179,7 @@ F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269 F test/fts4incr.test 4e353a0bd886ea984e56fce9e77724fc923b8d0d F test/fts4langid.test 4be912f42454998e239a2e877600263e0394afbaba03e06cedcc5a08693a345a F test/fts4lastrowid.test 185835895948d5325c7710649824042373b2203149abe8024a9319d25234dfd7 -F test/fts4merge.test e2b2ec21e287d54ec09824ccfb41e66896eeca568fc818ba0e0eb2efd94c35d2 +F test/fts4merge.test 57d093660a5093ae6e9fbd2d17592a88b45bbd66db2703c4b640b28828dbe38b F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891 F test/fts4merge3.test 8d9ccb4a3d41c4c617a149d6c4b13ad02de797d0 F test/fts4merge4.test 66fce89934cd9508cbdc67de486558c34912ffb2e8ffe5c9a1bbb9b8a4408ba7 @@ -1194,7 +1194,7 @@ F test/fts4umlaut.test fcaca4471de7e78c9d1f7e8976e3e8704d7d8ad979d57a739d00f3f75 F test/fts4unicode.test 82a9c16b68ba2f358a856226bb2ee02f81583797bc4744061c54401bf1a0f4c9 F test/fts4upfrom.test f25835162c989dffd5e2ef91ec24c4848cc9973093e2d492d1c7b32afac1b49d F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d -F test/func.test cbcf086273529d4a99b7199086da637a99039d2cad81dd7d7c4c9e25258ae164 +F test/func.test 3a29323b640c0552f6e9f1577407ced3a68e7d8c0bc04b61dd6040fa593a3a02 F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test 600a632c305a88f3946d38f9a51efe145c989b2e13bd2b2a488db47fe76bab6a F test/func4.test 2285fb5792d593fef442358763f0fd9de806eda47dbc7a5934df57ffdc484c31 @@ -1223,7 +1223,7 @@ F test/fuzzer1.test 3d4c4b7e547aba5e5511a2991e3e3d07166cfbb8 F test/fuzzer2.test a85ef814ce071293bce1ad8dffa217cbbaad4c14 F test/fuzzerfault.test f64c4aef4c9e9edf1d6dc0d3f1e65dcc81e67c996403c88d14f09b74807a42bc F test/fuzzinvariants.c b34530e8431f2cf3591eff588fc7684d6fdef466916fb46141c8c5374a3d8099 -F test/gcfault.test dd28c228a38976d6336a3fc42d7e5f1ad060cb8c +F test/gcfault.test 4ea410ac161e685f17b19e1f606f58514a2850e806c65b846d05f60d436c5b0d F test/gencol1.test e169bdfa11c7ed5e9f322a98a7db3afe9e66235750b68c923efee8e1876b46ec F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98 F test/having.test a89236dd8d55aa50c4805f82ac9daf64d477a44d712d8209c118978d0ca21ec9 @@ -1260,7 +1260,7 @@ F test/index6.test b376a648e85aa71c50074382784e6cb0c126ec46e43d1ad15af9a4d234c52 F test/index7.test b238344318e0b4e42126717f6554f0e7dfd0b39cecad4b736039b43e1e3b6eb3 F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a912a3 F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997 -F test/indexA.test a9194b0d4aa04f8bab4f800951f783d0240f9369f13336ccc40bb3a03fdf6d52 +F test/indexA.test 11d84f6995e6e5b9d8315953fb1b6d29772ee7c7803ee9112715e7e4dd3e4974 F test/indexedby.test f21eca4f7a6ffe14c8500a7ad6cd53166666c99e5ccd311842a28bc94a195fe0 F test/indexexpr1.test 62558b1cfd7ccbe7bc015849cc6d1a13ef124e80cbd5b3a98dc66c3c9cce0cf4 F test/indexexpr2.test 1c382e81ef996d8ae8b834a74f2a9013dddf59214c32201d7c8a656d739f999a @@ -1302,7 +1302,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2 F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28 F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127 -F test/joinH.test 5f6107246b8509f9df4745fbdc2107a16f07594770a5c473a25f6c7f672edd86 +F test/joinH.test 84198ea42bf78b79fe399c0567218cd6df36c50c6dd27d9c4aab221acaad929e F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497 F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e @@ -1371,9 +1371,9 @@ F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test c1f2a343ad14398d5d6debda6ea33e80d0dafcc7 F test/memdb1.test 2c4e9cc10d21c6bf4e217d72b7f6b8ba9b2605971bb2c5e6df76018e189f98f5 -F test/memdb2.test 7789975b96b0726032a22c1afc026592c7ff175bf05be11f1d640791541a77ea +F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4 F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c -F test/memjournal2.test 6b9083cfaab9a3281ec545c3da2487999e8025fb7501bbae10f713f80c56454c +F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 F test/memsubsys1.test 86b8158752af9188ed5b32a30674a1ef71183e6bc4e6808e815cd658ca9058a6 F test/memsubsys2.test 774b93cb09ca50d1b759bb7c645baa2a9ce172edc3a3da67d5150a26a9fc2a08 @@ -1449,7 +1449,7 @@ F test/pagesize.test 5769fc62d8c890a83a503f67d47508dfdc543305 F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035ce4b3 F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 -F test/pendingrace.test cbdf0f74bc939fb43cebad64dda7a0b5a3941a10b7e9cc2b596ff3e423a18156 +F test/pendingrace.test 6aa33756b950c4529f79c4f3817a9a1e4025bd0d9961571a05c0279bd183d9c6 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff F test/permutations.test f7caf8dd5c7b1da74842a48df116f7f193399c656d4ffc805cd0d9658568c675 F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f @@ -1467,7 +1467,7 @@ F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/pushdown.test 1495a09837a1cedfc0adf07ba42dc6b83be05a2c15de331b67c39a0e22078238 F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 -F test/quickcheck.test f86b25b33455af0189b4d3fe7bd6e553115e80b2d7ec9bbe9a6b37fce0881bfe +F test/quickcheck.test a4b7e878cd97e46108291c409b0bf8214f29e18fddd68a42bc5c1375ad1fb80a F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26 F test/quota.test bfb269ce81ea52f593f9648316cd5013d766dd2a F test/quota2.test 7dc12e08b11cbc4c16c9ba2aa2e040ea8d8ab4b8 @@ -1500,8 +1500,8 @@ F test/rowvalue5.test 00740304ea6a53a8704640c7405690f0045d5d2a6b4b04dde7bccc14c3 F test/rowvalue6.test d19b54feb604d5601f8614b15e214e0774c01087 F test/rowvalue7.test c1cbdbf407029db01f87764097c6ac02a1c5a37efd2776eff32a9cdfdf6f2dba F test/rowvalue8.test 5900eddad9e2c3c2e26f1a95f74aafc1232ee5e0 -F test/rowvalue9.test 138252b53b835208a5712e01595403a0ae32b4bc58284d9fe6bea10e58203fe4 -F test/rowvalueA.test 51f79b6098c193f838168752c9640f4eae6c63346bf64b5bed4f4e22fe2c71d0 +F test/rowvalue9.test 7499a8fd7ca3a3f0e19d94e135355439aa2b596f86b775ca8de79672da2ca378 +F test/rowvalueA.test be8d6ad8b476eb24c151bb20bfd487e0d50c5e99618b7b0e656035069d2fc2cf F test/rowvaluefault.test 963ae9cdaed30a85a29668dd514e639f3556cae903ee9f172ea972d511c54fff F test/rowvaluevtab.test cd9747bb3f308086944c07968f547ad6b05022e698d80b9ffbdfe09ce0b8da6f F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798 @@ -1514,7 +1514,7 @@ F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7 F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2 F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e -F test/scanstatus2.test d0434bc3b356fb9d948f3417846b2ed5bbc4bd4cc49bddb38ac86469f754bfb0 +F test/scanstatus2.test 1065b9db6704ef2547a5bbdcbe188c295c738c39e4704275c216002e581b5a0a F test/schema.test 5dd11c96ba64744de955315d2e4f8992e447533690153b93377dffb2a5ef5431 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5 F test/schema3.test 8ed4ae66e082cdd8b1b1f22d8549e1e7a0db4527a8e6ee8b6193053ee1e5c9ce @@ -1527,7 +1527,7 @@ F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5 F test/seekscan1.test 31af16e3bb3203d153aea320939c5da97ec44705c2710d153c06a01397d45b09 F test/select1.test 692e84cfa29c405854c69e8a4027183d64c22952866a123fabbce741a379e889 F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56 -F test/select3.test 8d04b66df7475275a65f7e4a786d6a724c30bd9929f8ae5bd59c8d3d6e75e6cd +F test/select3.test 180223af31e1ca5537dd395ef9708ae18e651a233777fd366fd0d75469fc19c6 F test/select4.test f0684d3da3bccacbe2a1ebadf6fb49d9df6f53acb4c6ebc228a88d0d6054cc7b F test/select5.test 8afc5e5dcdebc2be54472e73ebd9cd1adef1225fd15d37a1c62f969159f390ae F test/select6.test 9b2fb4ffedf52e1b5703cfcae1212e7a4a063f014c0458d78d29aca3db766d1f @@ -1608,7 +1608,7 @@ F test/sqllimits1.test b28e5cc8d337aaf290614d96a47e8fbfb720bb7ad35620c9d5432996f F test/sqllog.test 6af6cb0b09f4e44e1917e06ce85be7670302517a F test/startup.c 1beb5ca66fcc0fce95c3444db9d1674f90fc605499a574ae2434dcfc10d22805 F test/stat.test 123212a20ceb496893d5254a5f6c76442ce549fdc08d1702d8288a2bbaac8408 -F test/statfault.test 55f86055f9cd7b2d962a621b8a04215c1cebd4eaaecde92d279442327fe648a0 +F test/statfault.test 064f43379e4992b5221b7d9ac887c313b3191f85cce605d78e416fc4045da64e F test/stmt.test 54ed2cc0764bf3e48a058331813c3dbd19fc1d0827c3d8369914a5d8f564ec75 F test/stmtvtab1.test 6873dfb24f8e79cbb5b799b95c2e4349060eb7a3b811982749a84b359468e2d5 F test/strict1.test 4d2b492152b984fd7e8196d23eb88e2ccb0ef9e46ca2f96c2ce7147ceef9d168 @@ -1631,7 +1631,7 @@ F test/sync2.test 8f9f7d4f6d5be8ca8941a8dadcc4299e558cb6a1ff653a9469146c7a76ef20 F test/syscall.test a39d9a36f852ae6e4800f861bc2f2e83f68bbc2112d9399931ecfadeabd2d69d F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04 F test/tabfunc01.test 54f27eacd054aa528a8b6e3331192c484104f30aaee351ad035f2b39a00f87c4 -F test/table.test eb3463b7add9f16a5bb836badf118cf391b809d09fdccd1f79684600d07ec132 +F test/table.test 7862a00b58b5541511a26757ea9c5c7c3f8298766e98aa099deec703d9c0a8e0 F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 F test/tclsqlite.test ad0bbd92edabe64cc91d990a0748142fe5ab962d74ac71fa3bfa94d50d2f4c87 @@ -1652,7 +1652,7 @@ F test/thread004.test f51dfc3936184aaf73ee85f315224baad272a87f F test/thread005.test 50d10b5684399676174bd96c94ad4250b1a2c8b6 F test/thread1.test df115faa10a4ba1d456e9d4d9ec165016903eae4 F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 -F test/thread3.test 5f53b6a8e7391d8653116fd0bee4f9774efee4410e039990821de39c6b4375a9 +F test/thread3.test a12656a56cdf67acb6a2ff7638826c6d6a645f79909d86df521045ad31cf547d F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b F test/threadtest2.c a70a8e94bef23339d34226eb9521015ef99f4df8 @@ -1710,7 +1710,7 @@ F test/tkt-bd484a090c.test 60460bf946f79a79712b71f202eda501ca99b898 F test/tkt-bdc6bbbb38.test fc38bb09bdd440e3513a1f5f98fc60a075182d7d F test/tkt-c48d99d690.test ba61977d62ab612fc515b3c488a6fbd6464a2447 F test/tkt-c694113d5.test 82c461924ada5c14866c47e85535b0b0923ba16a2e907e370061a5ca77f65d77 -F test/tkt-cbd054fa6b.test 708475ef4d730a6853512c8ce363bcbd3becf0e26826e1f4cd46e2f52ff38edf +F test/tkt-cbd054fa6b.test 6ec9f1a5721fba74a83397683c50f472df68a0a749d193a537264eda3ad6d113 F test/tkt-d11f09d36e.test d999b548fef885d1d1afa49a0e8544ecf436869d F test/tkt-d635236375.test 9d37e988b47d87505bc9445be0ca447002df5d09 F test/tkt-d82e3f3721.test bcc0dfba658d15bab30fd4a9320c9e35d214ce30 @@ -1815,7 +1815,7 @@ F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76 F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94 F test/transitive1.test f8ee983600b33d167da1885657f064aec404e1c0d0bc8765fdf163f4c749237a F test/trigger1.test 02cc64dc98278816c1c1ed8e472e18db8edbad88f37018bf46223e9614831963 -F test/trigger2.test 6e35bd7321c49e63d540aee980eb95dec63e1d1caca175224101045bcc80871f +F test/trigger2.test 30fcb3a6aa6782020d47968735ee6086ed795f73a7affa9406c8d5a36e7b5265 F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945 F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 @@ -1841,7 +1841,7 @@ F test/tt3_vacuum.c 71b254cde1fc49d6c8c44efd54f4668f3e57d7b3a8f4601ade069f75a999 F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 1aeb81976841a91eef292723649b5c4fe3bc3cac F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a -F test/unhex.test 777af0bad767e4ab6219e6086ea073f8836d8c34de12f9507bd39c442e89fcf2 +F test/unhex.test b7f1b806207cb77fa31c3e434fe92fba524464e3e9356809bfcc28f15af1a8b7 F test/unionall.test eb9afa030897af75fd2f0dd28354ef63c8a5897b6c76aa1f15acae61a12eabcf F test/unionall2.test 71e8fa08d5699d50dc9f9dc0c9799c2e7a6bb7931a330d369307a4df7f157fa1 F test/unionallfault.test 652bfbb630e6c43135965dc1e8f0a9a791da83aec885d626a632fe1909c56f73 @@ -1869,7 +1869,7 @@ F test/uri.test c1abaaaa28e9422d61e5f3f9cbc8ef993ec49fe802f581520731708561d49384 F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7 F test/userauth01.test e740a2697a7b40d7c5003a7d7edaee16acd349a9 F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da -F test/vacuum-into.test e0e3406845be4cf1b44db354179e5d9437e38bc267e4ac8e8dc617f9c3c903ab +F test/vacuum-into.test 35dc6f79b563f91c61822f61797363e97fed1bf28f1f722688b98d43f1980d76 F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d F test/vacuum2.test 9fd45ce6ce29f5614c249e03938d3567c06a9e772d4f155949f8eafe2d8af520 F test/vacuum3.test d9d9a04ee58c485b94694fd4f68cffaba49c32234fdefe1ac1a622c5e17d4ce3 @@ -1939,7 +1939,7 @@ F test/walprotocol2.test 7d3b6b4bf0b12f8007121b1e6ef714bc99101fb3b48e46371df1db8 F test/walro.test cb438d05ba0d191f10b688e39c4f0cd5b71569a1d1f4440e5bdf3c6880e08c20 F test/walro2.test 33955a6fd874dd9724005e17f77fef89d334b3171454a1256fe4941a96766cdc F test/walrofault.test c70cb6e308c443867701856cce92ad8288cd99488fa52afab77cca6cfd51af68 -F test/walseh1.test 82da37763b0d87942dccd191e58321532ce3d44b87ef36e04ff9ce13f382bbae +F test/walseh1.test bae700eb99519b6d5cd3f893c04759accc5a59c391d4189fe4dd6995a533442b F test/walsetlk.test 34c901443b31ab720afc463f5b236c86ca5c4134402573dce91aa0761de8db5a F test/walshared.test 42e3808582504878af237ea02c42ca793e8a0efaa19df7df26ac573370dbc7a3 F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f @@ -1978,11 +1978,11 @@ F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2 F test/win32lock.test e0924eb8daac02bf80e9da88930747bd44dd9b230b7759fed927b1655b467c9c F test/win32longpath.test 4baffc3acb2e5188a5e3a895b2b543ed09e62f7c72d713c1feebf76222fe9976 F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc -F test/window1.test 1e7e13d36235b9a08fcb9790f2b05383f2f8c9538532b027f455766686926114 +F test/window1.test ccfeaf116afc6a8f748a8122a4f1ee6b69e6bbc5acee61197d3c17167338b100 F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476 F test/window2.test e466a88bd626d66edc3d352d7d7e1d5531e0079b549ba44efb029d1fbff9fd3c F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03 -F test/window3.test e9959a993c8a71e96433be8daaa1827d78b8921e4f12debd7bdbeb3c856ef3cb +F test/window3.test 330733bcca73aba4ddae7a1011f2a2120ef7a0c68d8155854e08677417b8dbd0 F test/window4.tcl 6f85307eb67242b654d051f7da32a996a66aee039a09c5ae358541aa61720742 F test/window4.test fbead87f681400ac07ef3555e0488b544a47d35491f8bf09a7474b6f76ce9b4e F test/window5.test d328dd18221217c49c144181975eea17339eaeaf0e9aa558cee3afb84652821e @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 -R 04eef64adc8baa80e96c39c8b85b43af -U dan -Z c4161b04175a3850db328dc9504c42b8 +P fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e +R 95c65fb4c3266b8f3294640192fd3623 +U drh +Z 3ee77f6d81a02812852dda550389324b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a564dcfd24..1d1cd2a39e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e \ No newline at end of file +b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1 \ No newline at end of file diff --git a/src/func.c b/src/func.c index eed67941b4..58ef4fef9c 100644 --- a/src/func.c +++ b/src/func.c @@ -2047,6 +2047,7 @@ static void minMaxFinalize(sqlite3_context *context){ /* ** group_concat(EXPR, ?SEPARATOR?) +** string_agg(EXPR, SEPARATOR) ** ** The SEPARATOR goes before the EXPR string. This is tragic. The ** groupConcatInverse() implementation would have been easier if the @@ -2671,6 +2672,8 @@ void sqlite3RegisterBuiltinFunctions(void){ groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), WAGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), + WAGGREGATE(string_agg, 2, 0, 0, groupConcatStep, + groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), #ifdef SQLITE_CASE_SENSITIVE_LIKE diff --git a/test/aggnested.test b/test/aggnested.test index 1b8b608803..5f033a246c 100644 --- a/test/aggnested.test +++ b/test/aggnested.test @@ -25,19 +25,19 @@ do_test aggnested-1.1 { INSERT INTO t1 VALUES(1), (2), (3); CREATE TABLE t2(b1 INTEGER); INSERT INTO t2 VALUES(4), (5); - SELECT (SELECT group_concat(a1,'x') FROM t2) FROM t1; + SELECT (SELECT string_agg(a1,'x') FROM t2) FROM t1; } } {1x2x3} do_test aggnested-1.2 { db eval { SELECT - (SELECT group_concat(a1,'x') || '-' || group_concat(b1,'y') FROM t2) + (SELECT string_agg(a1,'x') || '-' || string_agg(b1,'y') FROM t2) FROM t1; } } {1x2x3-4y5} do_test aggnested-1.3 { db eval { - SELECT (SELECT group_concat(b1,a1) FROM t2) FROM t1; + SELECT (SELECT string_agg(b1,a1) FROM t2) FROM t1; } } {415 425 435} do_test aggnested-1.4 { @@ -309,7 +309,7 @@ do_execsql_test 5.4 { do_execsql_test 5.5 { CREATE TABLE a(b); WITH c AS(SELECT a) - SELECT(SELECT(SELECT group_concat(b, b) + SELECT(SELECT(SELECT string_agg(b, b) LIMIT(SELECT 0.100000 * AVG(DISTINCT(SELECT 0 FROM a ORDER BY b, b, b)))) FROM a GROUP BY b, diff --git a/test/aggorderby.test b/test/aggorderby.test index 7d7d86a09f..bf77a7d4cf 100644 --- a/test/aggorderby.test +++ b/test/aggorderby.test @@ -38,7 +38,7 @@ do_execsql_test aggorderby-2.2 { SELECT group_concat(a ORDER BY b, d) FROM t1; } {3,6,9,2,5,8,1,4,7,0,0,7,4,1,8,5,2,9,6,3} do_execsql_test aggorderby-2.3 { - SELECT group_concat(a ORDER BY b DESC, d) FROM t1; + SELECT string_agg(a, ',' ORDER BY b DESC, d) FROM t1; } {0,7,4,1,8,5,2,9,6,3,3,6,9,2,5,8,1,4,7,0} do_execsql_test aggorderby-2.4 { SELECT b, group_concat(a ORDER BY d) FROM t1 GROUP BY b ORDER BY b; @@ -64,16 +64,16 @@ do_execsql_test aggorderby-5.0 { DROP TABLE IF EXISTS t3; CREATE TABLE t1(a TEXT); INSERT INTO t1 VALUES('aaa'),('bbb'); CREATE TABLE t3(d TEXT); INSERT INTO t3 VALUES('/'),('-'); - SELECT (SELECT group_concat(a,d) FROM t3) FROM t1; + SELECT (SELECT string_agg(a,d) FROM t3) FROM t1; } {aaa-aaa bbb-bbb} do_execsql_test aggorderby-5.1 { SELECT (SELECT group_concat(a,d ORDER BY d) FROM t3) FROM t1; } {aaa/aaa bbb/bbb} do_execsql_test aggorderby-5.2 { - SELECT (SELECT group_concat(a,d ORDER BY d DESC) FROM t3) FROM t1; + SELECT (SELECT string_agg(a,d ORDER BY d DESC) FROM t3) FROM t1; } {aaa-aaa bbb-bbb} do_execsql_test aggorderby-5.3 { - SELECT (SELECT group_concat(a,'#' ORDER BY d) FROM t3) FROM t1; + SELECT (SELECT string_agg(a,'#' ORDER BY d) FROM t3) FROM t1; } {aaa#aaa bbb#bbb} finish_test diff --git a/test/alterqf.test b/test/alterqf.test index 423a9fa865..9327c50854 100644 --- a/test/alterqf.test +++ b/test/alterqf.test @@ -65,7 +65,7 @@ foreach {tn before after} { 11 {CREATE TRIGGER ott AFTER UPDATE ON t1 BEGIN SELECT max("str", new."a") FROM t1 - WHERE group_concat("b", ",") OVER (ORDER BY c||"str"); + WHERE string_agg("b", ",") OVER (ORDER BY c||"str"); UPDATE t1 SET c= b + "str"; DELETE FROM t1 WHERE EXISTS ( SELECT 1 FROM t1 AS o WHERE o."a" = "o.a" AND t1.b IN("t1.b") diff --git a/test/altertrig.test b/test/altertrig.test index 934a636669..556dc3fea4 100644 --- a/test/altertrig.test +++ b/test/altertrig.test @@ -160,4 +160,3 @@ foreach {tn alter update final} { } finish_test - diff --git a/test/bestindex9.test b/test/bestindex9.test index 94b9da0d38..d591b30efe 100644 --- a/test/bestindex9.test +++ b/test/bestindex9.test @@ -102,7 +102,3 @@ do_bestindex9_test 4 { finish_test - - - - diff --git a/test/bestindexA.test b/test/bestindexA.test index 650404eaa0..1976986471 100644 --- a/test/bestindexA.test +++ b/test/bestindexA.test @@ -133,6 +133,3 @@ do_xbestindex_test 1.9 { finish_test - - - diff --git a/test/changes.test b/test/changes.test index 21db075f96..b3a2ae1eef 100644 --- a/test/changes.test +++ b/test/changes.test @@ -86,5 +86,3 @@ foreach {tn nRow wor} { } finish_test - - diff --git a/test/changes2.test b/test/changes2.test index 46e25c03a7..5b2684a8df 100644 --- a/test/changes2.test +++ b/test/changes2.test @@ -92,4 +92,3 @@ do_execsql_test 2.4 { } {{2 changes} {2 changes}} finish_test - diff --git a/test/dbpagefault.test b/test/dbpagefault.test index 544d279ce9..f27741cba1 100644 --- a/test/dbpagefault.test +++ b/test/dbpagefault.test @@ -84,5 +84,3 @@ do_catchsql_test 3.2 { finish_test - - diff --git a/test/distinctagg.test b/test/distinctagg.test index 6e46c88616..199ca0666e 100644 --- a/test/distinctagg.test +++ b/test/distinctagg.test @@ -56,7 +56,7 @@ do_test distinctagg-2.1 { } {1 {DISTINCT aggregates must have exactly one argument}} do_test distinctagg-2.2 { catchsql { - SELECT group_concat(distinct a,b) FROM t1; + SELECT string_agg(distinct a,b) FROM t1; } } {1 {DISTINCT aggregates must have exactly one argument}} @@ -215,4 +215,3 @@ do_execsql_test 7.0 { finish_test - diff --git a/test/e_expr.test b/test/e_expr.test index 5ad5993bb4..0db63a8ac4 100644 --- a/test/e_expr.test +++ b/test/e_expr.test @@ -1930,7 +1930,7 @@ foreach {tn expr restype resval} { 6 { ( SELECT y FROM t4 ORDER BY y DESC ) } text two 7 { ( SELECT sum(x) FROM t4 ) } integer 6 - 8 { ( SELECT group_concat(y,'') FROM t4 ) } text onetwothree + 8 { ( SELECT string_agg(y,'') FROM t4 ) } text onetwothree 9 { ( SELECT max(x) FROM t4 WHERE y LIKE '___') } integer 2 } { diff --git a/test/e_select.test b/test/e_select.test index 5a3f0d30dc..e2e969dcf9 100644 --- a/test/e_select.test +++ b/test/e_select.test @@ -943,7 +943,7 @@ do_select_tests e_select-4.6 { 4 "SELECT *, count(*) FROM a1 JOIN a2" {1 1 1 1 16} 5 "SELECT *, sum(three) FROM a1 NATURAL JOIN a2" {1 1 1 3} 6 "SELECT *, sum(three) FROM a1 NATURAL JOIN a2" {1 1 1 3} - 7 "SELECT group_concat(three, ''), a1.* FROM a1 NATURAL JOIN a2" {12 1 1} + 7 "SELECT string_agg(three, ''), a1.* FROM a1 NATURAL JOIN a2" {12 1 1} } # EVIDENCE-OF: R-04486-07266 Or, if the dataset contains zero rows, then diff --git a/test/filter2.test b/test/filter2.test index 21ee6659ff..06cfd2a4c3 100644 --- a/test/filter2.test +++ b/test/filter2.test @@ -113,7 +113,7 @@ do_execsql_test 1.12 { do_execsql_test 1.13 { SELECT - group_concat(CAST(b AS TEXT), '_') FILTER (WHERE b%2!=0), + string_agg(CAST(b AS TEXT), '_') FILTER (WHERE b%2!=0), group_concat(CAST(b AS TEXT), '_') FILTER (WHERE b%2!=1), count(*) FILTER (WHERE b%2!=0), count(*) FILTER (WHERE b%2!=1) diff --git a/test/fts4merge.test b/test/fts4merge.test index 3cd693209d..ffef0e9334 100644 --- a/test/fts4merge.test +++ b/test/fts4merge.test @@ -37,7 +37,7 @@ foreach mod {fts3 fts4} { do_test 1.0 { fts3_build_db_1 -module $mod 1004 } {} do_test 1.1 { fts3_integrity_check t1 } {ok} do_execsql_test 1.1 { - SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level + SELECT level, string_agg(idx, ' ') FROM t1_segdir GROUP BY level } { 0 {0 1 2 3 4 5 6 7 8 9 10 11} 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13} @@ -67,7 +67,7 @@ foreach mod {fts3 fts4} { } do_execsql_test 1.5 { - SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level + SELECT level, string_agg(idx, ' ') FROM t1_segdir GROUP BY level } { 3 0 } @@ -103,7 +103,7 @@ foreach mod {fts3 fts4} { do_test 3.1 { fts3_integrity_check t2 } {ok} do_execsql_test 3.2 { - SELECT level, group_concat(idx, ' ') FROM t2_segdir GROUP BY level + SELECT level, string_agg(idx, ' ') FROM t2_segdir GROUP BY level } { 0 {0 1 2 3 4 5 6} 1 {0 1 2 3 4} @@ -132,7 +132,7 @@ foreach mod {fts3 fts4} { foreach x {a c b d e f g h i j k l m n o p} { execsql "INSERT INTO t4 VALUES('[string repeat $x 600]')" } - execsql {SELECT level, group_concat(idx, ' ') FROM t4_segdir GROUP BY level} + execsql {SELECT level, string_agg(idx, ' ') FROM t4_segdir GROUP BY level} } {0 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15}} foreach {tn expect} { @@ -160,7 +160,7 @@ foreach mod {fts3 fts4} { do_execsql_test 4.4.2 { DELETE FROM t4_stat WHERE rowid=1; INSERT INTO t4(t4) VALUES('merge=1,12'); - SELECT level, group_concat(idx, ' ') FROM t4_segdir GROUP BY level; + SELECT level, string_agg(idx, ' ') FROM t4_segdir GROUP BY level; } "0 {0 1 2 3 4 5} 1 0" @@ -194,7 +194,7 @@ foreach mod {fts3 fts4} { do_execsql_test 5.3 { INSERT INTO t1(t1) VALUES('merge=1,5'); INSERT INTO t1(t1) VALUES('merge=1,5'); - SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; + SELECT level, string_agg(idx, ' ') FROM t1_segdir GROUP BY level; } { 1 {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14} 2 {0 1 2 3} @@ -249,7 +249,7 @@ foreach mod {fts3 fts4} { do_execsql_test 5.11 { INSERT INTO t1(t1) VALUES('merge=1,6'); - SELECT level, group_concat(idx, ' ') FROM t1_segdir GROUP BY level; + SELECT level, string_agg(idx, ' ') FROM t1_segdir GROUP BY level; SELECT quote(value) from t1_stat WHERE rowid=1; } { 1 {0 1} 2 0 3 0 X'010E' diff --git a/test/func.test b/test/func.test index aea372e08e..883950a0c4 100644 --- a/test/func.test +++ b/test/func.test @@ -1136,18 +1136,18 @@ ifcapable deprecated { } {3} } -# The group_concat() function. +# The group_concat() and string_agg() functions. # do_test func-24.1 { execsql { - SELECT group_concat(t1) FROM tbl1 + SELECT group_concat(t1), string_agg(t1,',') FROM tbl1 } -} {this,program,is,free,software} +} {this,program,is,free,software this,program,is,free,software} do_test func-24.2 { execsql { - SELECT group_concat(t1,' ') FROM tbl1 + SELECT group_concat(t1,' '), string_agg(t1,' ') FROM tbl1 } -} {{this program is free software}} +} {{this program is free software} {this program is free software}} do_test func-24.3 { execsql { SELECT group_concat(t1,' ' || rowid || ' ') FROM tbl1 @@ -1160,9 +1160,9 @@ do_test func-24.4 { } {{}} do_test func-24.5 { execsql { - SELECT group_concat(t1,NULL) FROM tbl1 + SELECT group_concat(t1,NULL), string_agg(t1,NULL) FROM tbl1 } -} {thisprogramisfreesoftware} +} {thisprogramisfreesoftware thisprogramisfreesoftware} do_test func-24.6 { execsql { SELECT 'BEGIN-'||group_concat(t1) FROM tbl1 diff --git a/test/gcfault.test b/test/gcfault.test index d54b78fafc..2d77f9ef2c 100644 --- a/test/gcfault.test +++ b/test/gcfault.test @@ -10,7 +10,7 @@ #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing OOM error handling within the built-in -# group_concat() function. +# group_concat() and string_agg() functions. # set testdir [file dirname $argv0] @@ -40,7 +40,7 @@ foreach {enc} { } do_faultsim_test 1.$enc.2 -faults oom-t* -body { - execsql { SELECT group_concat(e, (SELECT s FROM s WHERE i=2)) FROM e } + execsql { SELECT string_agg(e, (SELECT s FROM s WHERE i=2)) FROM e } } do_faultsim_test 1.$enc.3 -faults oom-t* -prep { diff --git a/test/indexA.test b/test/indexA.test index f3afdb708a..518d7e18ad 100644 --- a/test/indexA.test +++ b/test/indexA.test @@ -348,4 +348,3 @@ do_execsql_test 8.1 { } finish_test - diff --git a/test/joinH.test b/test/joinH.test index 027f0a3999..0fed7f2aa0 100644 --- a/test/joinH.test +++ b/test/joinH.test @@ -252,4 +252,3 @@ do_catchsql_test 9.11 { finish_test - diff --git a/test/memdb2.test b/test/memdb2.test index 286bfc3f84..7c2144991f 100644 --- a/test/memdb2.test +++ b/test/memdb2.test @@ -74,4 +74,3 @@ foreach {tn fname} { } finish_test - diff --git a/test/memjournal2.test b/test/memjournal2.test index ec5ba56da3..d08bcb5a6a 100644 --- a/test/memjournal2.test +++ b/test/memjournal2.test @@ -59,5 +59,3 @@ for {set jj 200} {$jj <= 300} {incr jj} { finish_test - - diff --git a/test/pendingrace.test b/test/pendingrace.test index f0e1a18ffa..ef42578f21 100644 --- a/test/pendingrace.test +++ b/test/pendingrace.test @@ -121,6 +121,3 @@ tvfs delete tvfs2 delete finish_test - - - diff --git a/test/quickcheck.test b/test/quickcheck.test index 94016e845f..18c42a13d0 100644 --- a/test/quickcheck.test +++ b/test/quickcheck.test @@ -31,4 +31,3 @@ do_execsql_test 1.1 { } finish_test - diff --git a/test/rowvalue9.test b/test/rowvalue9.test index aee5e7ea4f..baa13f4f94 100644 --- a/test/rowvalue9.test +++ b/test/rowvalue9.test @@ -350,5 +350,3 @@ do_eqp_test 9.5e { finish_test - - diff --git a/test/rowvalueA.test b/test/rowvalueA.test index dc5a7a014b..8760c2c396 100644 --- a/test/rowvalueA.test +++ b/test/rowvalueA.test @@ -74,4 +74,3 @@ do_catchsql_test 2.3 { } {1 {row value misused}} finish_test - diff --git a/test/scanstatus2.test b/test/scanstatus2.test index cbffee0185..6d11628f9e 100644 --- a/test/scanstatus2.test +++ b/test/scanstatus2.test @@ -332,5 +332,3 @@ QUERY (nCycle=nnn) #puts_debug_info { SELECT (a % 2), group_concat(b) FROM t1 GROUP BY 1 } finish_test - - diff --git a/test/select3.test b/test/select3.test index 4c9d71b4f5..4bbd70cc75 100644 --- a/test/select3.test +++ b/test/select3.test @@ -434,4 +434,3 @@ do_execsql_test 12.8 { } finish_test - diff --git a/test/statfault.test b/test/statfault.test index b5980d417d..19e0a67874 100644 --- a/test/statfault.test +++ b/test/statfault.test @@ -52,4 +52,3 @@ do_faultsim_test 2 -faults * -prep { } finish_test - diff --git a/test/table.test b/test/table.test index 7be6b37695..b961207f8b 100644 --- a/test/table.test +++ b/test/table.test @@ -784,13 +784,13 @@ do_catchsql_test table-16.5 { } {1 {unknown function: count()}} do_catchsql_test table-16.6 { DROP TABLE t16; - CREATE TABLE t16(x DEFAULT(group_concat('x',','))); + CREATE TABLE t16(x DEFAULT(string_agg('x',','))); INSERT INTO t16(rowid) VALUES(123); SELECT rowid, x FROM t16; -} {1 {unknown function: group_concat()}} +} {1 {unknown function: string_agg()}} do_catchsql_test table-16.7 { INSERT INTO t16 DEFAULT VALUES; -} {1 {unknown function: group_concat()}} +} {1 {unknown function: string_agg()}} # Ticket [https://www.sqlite.org/src/info/094d39a4c95ee4abbc417f04214617675ba15c63] # describes a assertion fault that occurs on a CREATE TABLE .. AS SELECT statement. diff --git a/test/thread3.test b/test/thread3.test index 25699b7655..79a75bdbb7 100644 --- a/test/thread3.test +++ b/test/thread3.test @@ -75,4 +75,3 @@ do_execsql_test "1.Total BUSY errors: $nTotalBusy .2" { } $nAttempt finish_test - diff --git a/test/tkt-cbd054fa6b.test b/test/tkt-cbd054fa6b.test index 86248ca21d..435d807873 100644 --- a/test/tkt-cbd054fa6b.test +++ b/test/tkt-cbd054fa6b.test @@ -65,7 +65,7 @@ do_test tkt-cbd05-1.2 { } {} do_test tkt-cbd05-1.3 { execsql { - SELECT tbl,idx,group_concat(s(sample),' ') + SELECT tbl,idx,string_agg(s(sample),' ') FROM vvv WHERE idx = 't1_x' GROUP BY tbl,idx diff --git a/test/trigger2.test b/test/trigger2.test index 6e007e969a..70d59f3a0b 100644 --- a/test/trigger2.test +++ b/test/trigger2.test @@ -790,4 +790,3 @@ do_catchsql_test 11.2 { finish_test - diff --git a/test/unhex.test b/test/unhex.test index d97438f0d6..af2cfae390 100644 --- a/test/unhex.test +++ b/test/unhex.test @@ -100,5 +100,3 @@ do_execsql_test 6.4.3 { SELECT typeof(unhex('1234', NULL)) } {null} finish_test - - diff --git a/test/vacuum-into.test b/test/vacuum-into.test index 98692a108a..698d65f540 100644 --- a/test/vacuum-into.test +++ b/test/vacuum-into.test @@ -185,6 +185,3 @@ tvfs delete finish_test - - - diff --git a/test/walseh1.test b/test/walseh1.test index c3a655f534..225b69f742 100644 --- a/test/walseh1.test +++ b/test/walseh1.test @@ -146,5 +146,3 @@ do_faultsim_test 6 -faults seh -prep { catch { db close } finish_test - - diff --git a/test/window1.test b/test/window1.test index 37a5183f90..c9bbae3ee0 100644 --- a/test/window1.test +++ b/test/window1.test @@ -158,7 +158,7 @@ do_execsql_test 4.9 { do_execsql_test 4.10.1 { SELECT a, count() OVER (ORDER BY a DESC), - group_concat(a, '.') OVER (ORDER BY a DESC) + string_agg(a, '.') OVER (ORDER BY a DESC) FROM t2 ORDER BY a DESC } { 6 1 6 @@ -825,7 +825,7 @@ foreach {tn sql error} { } do_execsql_test 18.3.1 { - SELECT group_concat(c, '.') OVER (PARTITION BY b ORDER BY c) + SELECT string_agg(c, '.') OVER (PARTITION BY b ORDER BY c) FROM t1 } {four four.six four.six.two five five.one five.one.three} @@ -836,7 +836,7 @@ do_execsql_test 18.3.2 { } {four four.six four.six.two five five.one five.one.three} do_execsql_test 18.3.3 { - SELECT group_concat(c, '.') OVER win2 + SELECT string_agg(c, '.') OVER win2 FROM t1 WINDOW win1 AS (PARTITION BY b), win2 AS (win1 ORDER BY c) @@ -850,7 +850,7 @@ do_execsql_test 18.3.4 { } {four four.six four.six.two five five.one five.one.three} do_execsql_test 18.3.5 { - SELECT group_concat(c, '.') OVER win5 + SELECT string_agg(c, '.') OVER win5 FROM t1 WINDOW win1 AS (PARTITION BY b), win2 AS (win1), @@ -1127,7 +1127,7 @@ do_execsql_test 28.1.1 { } do_execsql_test 28.1.2 { - SELECT group_concat(b,'') OVER w1 FROM t1 + SELECT string_agg(b,'') OVER w1 FROM t1 WINDOW w1 AS (ORDER BY a RANGE BETWEEN 3 PRECEDING AND 1 PRECEDING) } { {} {} diff --git a/test/window3.test b/test/window3.test index 4f759abb7e..1893b539d3 100644 --- a/test/window3.test +++ b/test/window3.test @@ -1181,7 +1181,7 @@ do_execsql_test 1.1.13.6 { {} {} {} {} {} {} {} {} {} {} {}} do_execsql_test 1.1.14.1 { - SELECT group_concat(CAST(b AS TEXT), '.') OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2 + SELECT string_agg(CAST(b AS TEXT), '.') OVER (ORDER BY a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2 } {89 89.81 89.81.96 89.81.96.59 89.81.96.59.38 89.81.96.59.38.68 89.81.96.59.38.68.39 89.81.96.59.38.68.39.62 89.81.96.59.38.68.39.62.91 89.81.96.59.38.68.39.62.91.46 89.81.96.59.38.68.39.62.91.46.6 @@ -1471,7 +1471,7 @@ do_execsql_test 1.1.14.2 { 89.59.39.99.29.59.89.89.29.9.79.49.59.29.59.19.39.9.9.99.69.39} do_execsql_test 1.1.14.3 { - SELECT group_concat(CAST(b AS TEXT), '.') OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2 + SELECT string_agg(CAST(b AS TEXT), '.') OVER ( ORDER BY b,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2 } {1 1.1 1.1.2 1.1.2.2 1.1.2.2.3 1.1.2.2.3.3 1.1.2.2.3.3.4 1.1.2.2.3.3.4.5 1.1.2.2.3.3.4.5.6 1.1.2.2.3.3.4.5.6.7 1.1.2.2.3.3.4.5.6.7.7 1.1.2.2.3.3.4.5.6.7.7.7 1.1.2.2.3.3.4.5.6.7.7.7.8 @@ -1758,7 +1758,7 @@ do_execsql_test 1.1.14.4 { 9.9.9.19.29.29.29.39.39.39.49.59.59.59.59.69.79.89.89.89.99.99} do_execsql_test 1.1.14.5 { - SELECT group_concat(CAST(b AS TEXT), '.') OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2 + SELECT string_agg(CAST(b AS TEXT), '.') OVER ( ORDER BY b%10,a RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) FROM t2 } {90 90.40 90.40.30 90.40.30.80 90.40.30.80.20 90.40.30.80.20.90 90.40.30.80.20.90.60 90.40.30.80.20.90.60.70 90.40.30.80.20.90.60.70.80 90.40.30.80.20.90.60.70.80.90 90.40.30.80.20.90.60.70.80.90.30 @@ -1960,7 +1960,7 @@ do_execsql_test 1.1.14.6 { 83 27 17 7} do_execsql_test 1.1.14.7 { - SELECT group_concat(CAST(b AS TEXT), '.') OVER (win1 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) + SELECT string_agg(CAST(b AS TEXT), '.') OVER (win1 ORDER BY b%10 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) FROM t2 WINDOW win1 AS (PARTITION BY b%2,a) ORDER BY 1 From 51bb5dec6c76ed832c6fceff64bf855f9d0ea87c Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 11:00:57 +0000 Subject: [PATCH 124/242] Fix a test case broken by the previous check-in. FossilOrigin-Name: 1e61864c3bffec133632f4575d59d11936e8bafc089c4d84a129dcaf7e9b6d7d --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/alterqf.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index f3ff27e0c6..4622f040b4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sstring_agg(X,Y)\sas\san\salias\sfor\sgroup_concat(X,Y),\sfor\scompatibility\nwith\sSQLServer\sand\sPG. -D 2023-10-20T20:19:30.189 +C Fix\sa\stest\scase\sbroken\sby\sthe\sprevious\scheck-in. +D 2023-10-21T11:00:57.055 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -834,7 +834,7 @@ F test/alterlegacy.test f38c6d06cda39e1f7b955bbce57f2e3ef5b7cb566d3d1234502093e2 F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74a3fb80c9 F test/altermalloc2.test 17fb3724c4b004c469c27dc4ef181608aa644555fbd3f3236767584f73747c81 F test/altermalloc3.test 8531b3086f0a7889f43971a579a8c81832d5123f4703d8c86b89ba1136c63b9a -F test/alterqf.test 384efa7a1d0d3e404a5e21abdfc27298ce945e7f68a032e8f7acbafb4102a96b +F test/alterqf.test 8ec03d776de9c391daa0078ea8f838903bdcfb11dfae4ba3576b48436834ccba F test/altertab.test 8a2712f9076da5012a002d0b5cc0a421398a5bf61c25bab41b77c427586a7a27 F test/altertab2.test 62597b6fd08feaba1b6bfe7d31dac6117c67e06dc9ce9c478a3abe75b5926de0 F test/altertab3.test 6c432fbb9963e0bd6549bf1422f6861d744ee5a80cb3298564e81e556481df16 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e -R 95c65fb4c3266b8f3294640192fd3623 +P b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1 +R b12c88ebf681ec83072eb7a1b7c6464a U drh -Z 3ee77f6d81a02812852dda550389324b +Z 6593ab47c0a95475df821d2e4248f428 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1d1cd2a39e..21862a2066 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1 \ No newline at end of file +1e61864c3bffec133632f4575d59d11936e8bafc089c4d84a129dcaf7e9b6d7d \ No newline at end of file diff --git a/test/alterqf.test b/test/alterqf.test index 9327c50854..b248c7c7f4 100644 --- a/test/alterqf.test +++ b/test/alterqf.test @@ -73,7 +73,7 @@ foreach {tn before after} { END; } {CREATE TRIGGER ott AFTER UPDATE ON t1 BEGIN SELECT max('str', new."a") FROM t1 - WHERE group_concat("b", ',') OVER (ORDER BY c||'str'); + WHERE string_agg("b", ',') OVER (ORDER BY c||'str'); UPDATE t1 SET c= b + 'str'; DELETE FROM t1 WHERE EXISTS ( SELECT 1 FROM t1 AS o WHERE o."a" = 'o.a' AND t1.b IN('t1.b') From 266e5d034b14615c56c09efbfafb7b6748b5c971 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 11:06:03 +0000 Subject: [PATCH 125/242] Avoid an unnecessary malloc() for the page usage bitmap when running a partial integrity_check. FossilOrigin-Name: 2904fcbeebba9189cebc48e58d12fc46f78ee23d8c4d46644606691f8cabb80c --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 28 +++++++++++++++++----------- src/btreeInt.h | 2 +- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index cc92f43812..68e5bc0017 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sallowing\sa\sCOMMIT\sfollowing\san\sOOM\sto\scause\sfts5\scorruption. -D 2023-10-20T19:59:12.660 +C Avoid\san\sunnecessary\smalloc()\sfor\sthe\spage\susage\sbitmap\swhen\srunning\na\spartial\sintegrity_check. +D 2023-10-21T11:06:03.224 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -659,9 +659,9 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 63fb3269c93924e734e0586c22816effa530cee933df4aeb2b2e045de0339280 +F src/btree.c 58f5cca2aced6888824ed69d19a0c398d288d0840b1c72c0834525e82b10c076 F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 -F src/btreeInt.h 91a9e0c41a0e71fa91a742ec285c63dd8dcb38b73d14fae0ed7209174ff0fdc1 +F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15 F src/build.c 1a9061ab67987cfa9c7f9d52ccc862a31d37ad2b05faaf0d72eeb4b4b5ee37cf F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82 -R 04eef64adc8baa80e96c39c8b85b43af -U dan -Z c4161b04175a3850db328dc9504c42b8 +P fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e +R e2705175b24cd3b2e01ea68ed578aaef +U drh +Z cc633995022531837a5b59b3eaccd09f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a564dcfd24..b9621f9e85 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fba3129d1362dd3ee04d61cb3d3c48518cd98dde3febc85298f411776d60073e \ No newline at end of file +2904fcbeebba9189cebc48e58d12fc46f78ee23d8c4d46644606691f8cabb80c \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 3c4f00d154..ec4d02d195 100644 --- a/src/btree.c +++ b/src/btree.c @@ -10459,7 +10459,7 @@ static void checkAppendMsg( ** corresponds to page iPg is already set. */ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); + assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07))); } @@ -10467,7 +10467,7 @@ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ ** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. */ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); + assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07)); } @@ -10481,7 +10481,8 @@ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ ** Also check that the page number is in bounds. */ static int checkRef(IntegrityCk *pCheck, Pgno iPage){ - if( iPage>pCheck->nPage || iPage==0 ){ + if( iPage>pCheck->nCkPage || iPage==0 ){ + if( pCheck->nCkPage==0 ) return 0; /* omit reference counting */ checkAppendMsg(pCheck, "invalid page number %u", iPage); return 1; } @@ -10979,18 +10980,23 @@ int sqlite3BtreeIntegrityCheck( sCheck.db = db; sCheck.pBt = pBt; sCheck.pPager = pBt->pPager; - sCheck.nPage = btreePagecount(sCheck.pBt); + sCheck.nCkPage = btreePagecount(sCheck.pBt); sCheck.mxErr = mxErr; sqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); sCheck.errMsg.printfFlags = SQLITE_PRINTF_INTERNAL; - if( sCheck.nPage==0 ){ + if( sCheck.nCkPage==0 ){ goto integrity_ck_cleanup; } - sCheck.aPgRef = sqlite3MallocZero((sCheck.nPage / 8)+ 1); - if( !sCheck.aPgRef ){ - checkOom(&sCheck); - goto integrity_ck_cleanup; + if( bPartial ){ + sCheck.nCkPage = 0; + sCheck.aPgRef = 0; + }else{ + sCheck.aPgRef = sqlite3MallocZero((sCheck.nCkPage / 8)+ 1); + if( !sCheck.aPgRef ){ + checkOom(&sCheck); + goto integrity_ck_cleanup; + } } sCheck.heap = (u32*)sqlite3PageMalloc( pBt->pageSize ); if( sCheck.heap==0 ){ @@ -10999,7 +11005,7 @@ int sqlite3BtreeIntegrityCheck( } i = PENDING_BYTE_PAGE(pBt); - if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); + if( i<=sCheck.nCkPage ) setPageReferenced(&sCheck, i); /* Check the integrity of the freelist */ @@ -11050,7 +11056,7 @@ int sqlite3BtreeIntegrityCheck( /* Make sure every page in the file is referenced */ if( !bPartial ){ - for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){ + for(i=1; i<=sCheck.nCkPage && sCheck.mxErr; i++){ #ifdef SQLITE_OMIT_AUTOVACUUM if( getPageReferenced(&sCheck, i)==0 ){ checkAppendMsg(&sCheck, "Page %u: never used", i); diff --git a/src/btreeInt.h b/src/btreeInt.h index 26a0bc6869..563e15f8ac 100644 --- a/src/btreeInt.h +++ b/src/btreeInt.h @@ -695,7 +695,7 @@ struct IntegrityCk { BtShared *pBt; /* The tree being checked out */ Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */ u8 *aPgRef; /* 1 bit per page in the db (see above) */ - Pgno nPage; /* Number of pages in the database */ + Pgno nCkPage; /* Pages in the database. 0 for partial check */ int mxErr; /* Stop accumulating errors when this reaches zero */ int nErr; /* Number of messages written to zErrMsg so far */ int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */ From 813159e2ea8e183851c2dbe683081a65301eea2f Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 11:34:59 +0000 Subject: [PATCH 126/242] Compress the content of the status line in testrunning.tcl so that all the same status information appears but with less punctuation and with "zero" values omitted, so that the status line will fit comfortably on an 80-column terminal window. FossilOrigin-Name: 966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/testrunner.tcl | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d0d2798f6f..9d1e12fea8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Create\sthe\snew\sstring_agg(X,Y)\saggregate\sfunction\swhich\sis\san\salias\sfor\nthe\stwo-argument\sgroup_concat(X,Y)\sfunction,\sfor\scompatibility\swith\nSQL-Server\sand\sPostgreSQL. -D 2023-10-21T11:13:47.696 +C Compress\sthe\scontent\sof\sthe\sstatus\sline\sin\stestrunning.tcl\sso\sthat\sall\sthe\nsame\sstatus\sinformation\sappears\sbut\swith\sless\spunctuation\sand\swith\s"zero"\nvalues\somitted,\sso\sthat\sthe\sstatus\sline\swill\sfit\scomfortably\son\san\s80-column\nterminal\swindow. +D 2023-10-21T11:34:59.590 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1643,7 +1643,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 68454ef88508c196d19e8694daa27bff7107a91857799eaa12f417188ae53ede -F test/testrunner.tcl c88eae7d8ba9825d09f080ee2aa98b8e65c381bb56b4d427fb492625d2d4c36b +F test/testrunner.tcl 14c8b8ece841b1dd17516a0dc9c7ad9b5f4d4db7987974d3fdf66ae56b2a71fa F test/testrunner_data.tcl 7f73f93634d32dafc857ed491b840f371113d09fde6a8bfb9e47b938d47b8c85 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 2904fcbeebba9189cebc48e58d12fc46f78ee23d8c4d46644606691f8cabb80c 1e61864c3bffec133632f4575d59d11936e8bafc089c4d84a129dcaf7e9b6d7d -R 49f580e4bb2041a30e18623895893528 +P a3b3df8a9e43f1880a904b76027db56ed504a84622831c96ba1962a19bbed762 +R c09cd61cb274968f322c7fa7907df922 U drh -Z 18932cf81e43303a0689b13f1b4c7092 +Z 764323ff2562e3191a81fc0dd1ca651e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f6e0c18d13..72a182c4c7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a3b3df8a9e43f1880a904b76027db56ed504a84622831c96ba1962a19bbed762 \ No newline at end of file +966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925 \ No newline at end of file diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 9946d88649..1f1862ffdd 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -963,13 +963,19 @@ proc one_line_report {} { foreach j [lsort [array names t]] { foreach k {done failed running} { incr v($k,$j) 0 } set fin [expr $v(done,$j) + $v(failed,$j)] - lappend text "$j ($fin/$t($j)) f=$v(failed,$j) r=$v(running,$j)" + lappend text "${j}($fin/$t($j))" + if {$v(failed,$j)>0} { + lappend text "f$v(failed,$j)" + } + if {$v(running,$j)>0} { + lappend text "r$v(running,$j)" + } } if {[info exists TRG(reportlength)]} { puts -nonewline "[string repeat " " $TRG(reportlength)]\r" } - set report "${tm}s: [join $text { }]" + set report "${tm} [join $text { }]" set TRG(reportlength) [string length $report] if {[string length $report]<100} { puts -nonewline "$report\r" From a35a54b82431e7a919af8d80bfda86cab37963c1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 11:43:54 +0000 Subject: [PATCH 127/242] Adjust an EXPLAIN QUERY PLAN output in scanstatus2.test to account for a different loop order taken due to the removal of the view-scan optimization. FossilOrigin-Name: 9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/scanstatus2.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9d1e12fea8..8524158ffd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Compress\sthe\scontent\sof\sthe\sstatus\sline\sin\stestrunning.tcl\sso\sthat\sall\sthe\nsame\sstatus\sinformation\sappears\sbut\swith\sless\spunctuation\sand\swith\s"zero"\nvalues\somitted,\sso\sthat\sthe\sstatus\sline\swill\sfit\scomfortably\son\san\s80-column\nterminal\swindow. -D 2023-10-21T11:34:59.590 +C Adjust\san\sEXPLAIN\sQUERY\sPLAN\soutput\sin\sscanstatus2.test\sto\saccount\sfor\sa\ndifferent\sloop\sorder\staken\sdue\sto\sthe\sremoval\sof\sthe\sview-scan\soptimization. +D 2023-10-21T11:43:54.080 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1514,7 +1514,7 @@ F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7 F test/savepoint7.test cde525ea3075283eb950cdcdefe23ead4f700daa F test/savepointfault.test f044eac64b59f09746c7020ee261734de82bf9b2 F test/scanstatus.test b249328caf4d317e71058006872b8012598a5fa045b30bf24a81eeff650ab49e -F test/scanstatus2.test 1065b9db6704ef2547a5bbdcbe188c295c738c39e4704275c216002e581b5a0a +F test/scanstatus2.test 317670daf7f3eef48a9598cb7800ba8eccab51949cf52bca3f7da3b83a0c1c8c F test/schema.test 5dd11c96ba64744de955315d2e4f8992e447533690153b93377dffb2a5ef5431 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5 F test/schema3.test 8ed4ae66e082cdd8b1b1f22d8549e1e7a0db4527a8e6ee8b6193053ee1e5c9ce @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a3b3df8a9e43f1880a904b76027db56ed504a84622831c96ba1962a19bbed762 -R c09cd61cb274968f322c7fa7907df922 +P 966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925 +R 4f8abf0c5506c8daf7597799f05bea2d U drh -Z 764323ff2562e3191a81fc0dd1ca651e +Z f1b1288708616bc98ffb5afd97b6b0f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 72a182c4c7..3a0327719b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925 \ No newline at end of file +9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 \ No newline at end of file diff --git a/test/scanstatus2.test b/test/scanstatus2.test index 6d11628f9e..e4b510d20f 100644 --- a/test/scanstatus2.test +++ b/test/scanstatus2.test @@ -145,8 +145,8 @@ do_graph_test 1.4 { QUERY (nCycle=nnn) --MATERIALIZE v2 (nCycle=nnn) ----SCAN t2 (nCycle=nnn) ---SCAN v2 (nCycle=nnn) --SCAN t1 (nCycle=nnn) +--SCAN v2 (nCycle=nnn) --USE TEMP B-TREE FOR ORDER BY (nCycle=nnn) } From 51b358e5e54b9a64d2ee9ecb2f035780e74ddb8c Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 12:54:37 +0000 Subject: [PATCH 128/242] Add SQLITE_TESTCTRL_FK_NO_ACTION. FossilOrigin-Name: 563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9 --- manifest | 19 +++++++++++-------- manifest.uuid | 2 +- src/main.c | 18 ++++++++++++++++++ src/shell.c.in | 2 ++ src/sqlite.h.in | 1 + 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 8524158ffd..b1f2c581e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adjust\san\sEXPLAIN\sQUERY\sPLAN\soutput\sin\sscanstatus2.test\sto\saccount\sfor\sa\ndifferent\sloop\sorder\staken\sdue\sto\sthe\sremoval\sof\sthe\sview-scan\soptimization. -D 2023-10-21T11:43:54.080 +C Add\sSQLITE_TESTCTRL_FK_NO_ACTION. +D 2023-10-21T12:54:37.143 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -683,7 +683,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c 73ae4cab166b0fd36352446de7f7d91f89bde86686ae18f0bb7b245173479831 +F src/main.c 0dfcdba3a1b3dab9db971aab11ec17f90257043e49b0e48377ab92d278373ec9 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -721,8 +721,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 -F src/shell.c.in cf0a3387c5bb05ca2fe6073fa7df21aaa11e749ca5b3846b80b586a447e728aa -F src/sqlite.h.in 60e5698417e674f44be17d5ceeb4c2d395ccedba18d6de05435dec0135d9eff1 +F src/shell.c.in 2ebcf31e12b4a2a30338a016524720ce38cbcd6faba72521d77e14d0346e5620 +F src/sqlite.h.in b37b3df6fb0684929446c095e81287fbdffd64f55481e4195ee7768f2f0ae72e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef @@ -2135,8 +2135,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 966351311682a319ec796c07d407ce90cd1aa0cea9e904ba1085a4ebadbdf925 -R 4f8abf0c5506c8daf7597799f05bea2d +P 9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 +R 88beb1a112cd95408113959aeb00197a +T *branch * fknoaction +T *sym-fknoaction * +T -sym-trunk * U drh -Z f1b1288708616bc98ffb5afd97b6b0f5 +Z 2a937bb8a0eae27c2684e23f20721b21 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3a0327719b..9405f0698e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 \ No newline at end of file +563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 893326c2b5..334a3c826f 100644 --- a/src/main.c +++ b/src/main.c @@ -4170,6 +4170,24 @@ int sqlite3_test_control(int op, ...){ } #endif + /* sqlite3_test_control(SQLITE_TESTCTRL_FK_NO_ACTION, sqlite3 *db, int b); + ** + ** If b is true, then activate the SQLITE_FkNoAction setting. If b is + ** false then clearn that setting. If the SQLITE_FkNoAction setting is + ** abled, all foreign key ON DELETE and ON UPDATE actions behave as if + ** they were NO ACTION, regardless of how they are defined. + */ + case SQLITE_TESTCTRL_FK_NO_ACTION: { + sqlite3 *db = va_arg(ap, sqlite3*); + int b = va_arg(ap, int); + if( b ){ + db->flags |= SQLITE_FkNoAction; + }else{ + db->flags &= ~SQLITE_FkNoAction; + } + break; + } + /* ** sqlite3_test_control(BITVEC_TEST, size, program) ** diff --git a/src/shell.c.in b/src/shell.c.in index beea0f9b07..6cd6a18ab6 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -10911,6 +10911,7 @@ static int do_meta_command(char *zLine, ShellState *p){ {"byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" }, {"extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" }, /*{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/ + {"fk_no_action", SQLITE_TESTCTRL_FK_NO_ACTION, 0, "BOOLEAN" }, {"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"}, {"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" }, {"localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" }, @@ -10981,6 +10982,7 @@ static int do_meta_command(char *zLine, ShellState *p){ /* sqlite3_test_control(int, db, int) */ case SQLITE_TESTCTRL_OPTIMIZATIONS: + case SQLITE_TESTCTRL_FK_NO_ACTION: if( nArg==3 ){ unsigned int opt = (unsigned int)strtol(azArg[2], 0, 0); rc2 = sqlite3_test_control(testctrl, p->db, opt); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index af648829d6..b915ef4fb7 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -8245,6 +8245,7 @@ int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ +#define SQLITE_TESTCTRL_FK_NO_ACTION 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 From ca9dc173a2b95b4af9cc65557faaf3d2b3fa9e3d Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 21 Oct 2023 15:04:24 +0000 Subject: [PATCH 129/242] Fix a problem with SQLITE_CHANGESETAPPLY_FKNOACTION and the foreign-key-trigger-cache. FossilOrigin-Name: 95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6 --- ext/session/sessionnoact.test | 25 +++++++++++++++++++++++-- ext/session/sqlite3session.c | 4 +++- manifest | 21 +++++++++------------ manifest.uuid | 2 +- src/test1.c | 15 +++++++++++++++ 5 files changed, 51 insertions(+), 16 deletions(-) diff --git a/ext/session/sessionnoact.test b/ext/session/sessionnoact.test index 9750d5f3d7..cee59de5ce 100644 --- a/ext/session/sessionnoact.test +++ b/ext/session/sessionnoact.test @@ -73,9 +73,17 @@ do_execsql_test 1.3 { } db_restore_and_reopen -sqlite3changeset_apply_v2 -noaction db $C conflict do_execsql_test 1.4 { + PRAGMA foreign_keys = 1; +} + +do_execsql_test 1.5 { + UPDATE p1 SET c=12345 WHERE a = 45; +} + +sqlite3changeset_apply_v2 -noaction db $C conflict +do_execsql_test 1.6 { SELECT * FROM c1 } { 10 one @@ -84,5 +92,18 @@ do_execsql_test 1.4 { 40 four } +do_execsql_test 1.7 { + PRAGMA foreign_keys = 1; + UPDATE p1 SET c = 'ten' WHERE c='two'; + SELECT * FROM c1; +} { + 10 one + 20 {} + 30 three + 40 four +} + +do_execsql_test 1.8 { + PRAGMA foreign_key_check +} -finish_test diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index bf3f1390d6..e7459b1af9 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -5326,6 +5326,7 @@ int sqlite3changeset_apply_v2( if( flags & SQLITE_CHANGESETAPPLY_FKNOACTION ){ db->flags |= ((u64)SQLITE_FkNoAction); + db->aDb[0].pSchema->schema_cookie -= 32; } if( rc==SQLITE_OK ){ @@ -5336,7 +5337,8 @@ int sqlite3changeset_apply_v2( if( (flags & SQLITE_CHANGESETAPPLY_FKNOACTION) && savedFlag==0 ){ assert( db->flags & SQLITE_FkNoAction ); - db->flags &= ((u64)SQLITE_FkNoAction); + db->flags &= ~((u64)SQLITE_FkNoAction); + db->aDb[0].pSchema->schema_cookie -= 32; } return rc; } diff --git a/manifest b/manifest index b1f2c581e5..95a6a74484 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sSQLITE_TESTCTRL_FK_NO_ACTION. -D 2023-10-21T12:54:37.143 +C Fix\sa\sproblem\swith\sSQLITE_CHANGESETAPPLY_FKNOACTION\sand\sthe\sforeign-key-trigger-cache. +D 2023-10-21T15:04:24.399 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -545,7 +545,7 @@ F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576d F ext/session/sessionfault3.test 7c7547202775de268f3fe6f074c4d0d165151829710b4e64f90d4a01645ba9e7 F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25 F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09 -F ext/session/sessionnoact.test 61d9ec369e5851fd7326c79ebb76df0b3dd7b21c0e2cb6d554eea3351b0a57de +F ext/session/sessionnoact.test 8c8d21db084ac1bb952d08c7236c4c38d30f5dbf3bfe4fa8b7872c2704a5f6d5 F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7 F ext/session/sessionnoop2.test de4672dce88464396ec9f30ed08c6c01643a69c53ae540fadbbf6d30642d64e8 F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2 @@ -553,7 +553,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c 6da2db8b2d525a6fe0b6f451743dcb098f609fcc3733aa044406f2d28068aeb2 +F ext/session/sqlite3session.c a0694a23f9c72f25e98b7c3a1bc8cfa7e5903d4edafe31efec47de7cd54f5df9 F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e F ext/session/test_session.c 73e9921205633a08c1497770beecf3dcbc9b826dd4358f7f8152f706eaac5d71 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -730,7 +730,7 @@ F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 F src/tclsqlite.c ecbc3c99c0d0c3ed122a913f143026c26d38d57f33e06bb71185dd5c1efe37cd -F src/test1.c c9f5b6f13797bd441ae810fbee27ff34b21000e1950dbeb779ea31154252dd1a +F src/test1.c f9620e8f0d0fa4edb239201a732c4dd1562f0cdd9741955c89332d49e14a5edd F src/test2.c 54520d0565ef2b9bf0f8f1dcac43dc4d06baf4ffe13d10905f8d8c3ad3e4b9ab F src/test3.c e5178558c41ff53236ae0271e9acb3d6885a94981d2eb939536ee6474598840e F src/test4.c 4533b76419e7feb41b40582554663ed3cd77aaa54e135cf76b3205098cd6e664 @@ -2135,11 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 -R 88beb1a112cd95408113959aeb00197a -T *branch * fknoaction -T *sym-fknoaction * -T -sym-trunk * -U drh -Z 2a937bb8a0eae27c2684e23f20721b21 +P 563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9 +R 8851a240e077d885b4dd7be6f7eb6ebd +U dan +Z c750bc1fd930bc70aff345b22b4bad5e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9405f0698e..071a3dd836 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9 \ No newline at end of file +95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 9ed9a7f000..55be0596b0 100644 --- a/src/test1.c +++ b/src/test1.c @@ -7653,6 +7653,7 @@ static int SQLITE_TCLAPI test_test_control( { "SQLITE_TESTCTRL_SORTER_MMAP", SQLITE_TESTCTRL_SORTER_MMAP }, { "SQLITE_TESTCTRL_IMPOSTER", SQLITE_TESTCTRL_IMPOSTER }, { "SQLITE_TESTCTRL_INTERNAL_FUNCTIONS", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS}, + { "SQLITE_TESTCTRL_FK_NO_ACTION", SQLITE_TESTCTRL_FK_NO_ACTION}, { 0, 0 } }; int iVerb; @@ -7692,6 +7693,20 @@ static int SQLITE_TCLAPI test_test_control( break; } + case SQLITE_TESTCTRL_FK_NO_ACTION: { + int val = 0; + sqlite3 *db = 0; + if( objc!=4 ){ + Tcl_WrongNumArgs(interp, 2, objv, "DB BOOLEAN"); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[2]), &db) ) return TCL_ERROR; + if( Tcl_GetBooleanFromObj(interp, objv[3], &val) ) return TCL_ERROR; + + sqlite3_test_control(SQLITE_TESTCTRL_FK_NO_ACTION, db, val); + break; + } + case SQLITE_TESTCTRL_SORTER_MMAP: { int val; sqlite3 *db; From fcef73a78761f55bc1e9a78f250448f37ad410ed Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 21 Oct 2023 15:21:06 +0000 Subject: [PATCH 130/242] Add missing "finish_test" to sessionnoact.test. FossilOrigin-Name: 9a1d37f5479adedb93f40e8189ad0efa891a438805d80774ee992d4dfd71150f --- ext/session/sessionnoact.test | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/session/sessionnoact.test b/ext/session/sessionnoact.test index cee59de5ce..1274ecb146 100644 --- a/ext/session/sessionnoact.test +++ b/ext/session/sessionnoact.test @@ -107,3 +107,4 @@ do_execsql_test 1.8 { PRAGMA foreign_key_check } +finish_test diff --git a/manifest b/manifest index 95a6a74484..6a0a1236d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sSQLITE_CHANGESETAPPLY_FKNOACTION\sand\sthe\sforeign-key-trigger-cache. -D 2023-10-21T15:04:24.399 +C Add\smissing\s"finish_test"\sto\ssessionnoact.test. +D 2023-10-21T15:21:06.320 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -545,7 +545,7 @@ F ext/session/sessionfault2.test b0d6a7c1d7398a7e800d84657404909c7d385965ea8576d F ext/session/sessionfault3.test 7c7547202775de268f3fe6f074c4d0d165151829710b4e64f90d4a01645ba9e7 F ext/session/sessioninvert.test 04075517a9497a80d39c495ba6b44f3982c7371129b89e2c52219819bc105a25 F ext/session/sessionmem.test f2a735db84a3e9e19f571033b725b0b2daf847f3f28b1da55a0c1a4e74f1de09 -F ext/session/sessionnoact.test 8c8d21db084ac1bb952d08c7236c4c38d30f5dbf3bfe4fa8b7872c2704a5f6d5 +F ext/session/sessionnoact.test 506526a5fe29421ecc50d371774ef1bb04cbd9d906a8a468f0556cdbde184c22 F ext/session/sessionnoop.test a9366a36a95ef85f8a3687856ebef46983df399541174cb1ede2ee53b8011bc7 F ext/session/sessionnoop2.test de4672dce88464396ec9f30ed08c6c01643a69c53ae540fadbbf6d30642d64e8 F ext/session/sessionrebase.test 702378bdcb5062f1106e74457beca8797d09c113a81768734a58b197b5b334e2 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 563cf5f782cdddbbd7f727c65118edfd109aeb731c8aaf0d6ee5ee7030e61ea9 -R 8851a240e077d885b4dd7be6f7eb6ebd +P 95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6 +R ba4bcd2d6342b08c7dacb17431cb3038 U dan -Z c750bc1fd930bc70aff345b22b4bad5e +Z 0e2c07cdd748b69afa0ef3e62386cf6c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 071a3dd836..d1becf098f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6 \ No newline at end of file +9a1d37f5479adedb93f40e8189ad0efa891a438805d80774ee992d4dfd71150f \ No newline at end of file From 5c8cfe9617fe800ec6e98b14594a2eca9661f402 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 16:25:44 +0000 Subject: [PATCH 131/242] Extra comment on the implementation of SQLITE_TESTCTRL_FK_NO_ACTION, warning about the need to reset the schema in order for the setting change to take full effect. FossilOrigin-Name: a50a333ae11ba5d92f432108308ac0bec9afb00f466b78c8d3f3aa7e2851ef21 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/main.c | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6a0a1236d2..109ea86aee 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\s"finish_test"\sto\ssessionnoact.test. -D 2023-10-21T15:21:06.320 +C Extra\scomment\son\sthe\simplementation\sof\sSQLITE_TESTCTRL_FK_NO_ACTION,\nwarning\sabout\sthe\sneed\sto\sreset\sthe\sschema\sin\sorder\sfor\sthe\ssetting\schange\nto\stake\sfull\seffect. +D 2023-10-21T16:25:44.562 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -683,7 +683,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c 0dfcdba3a1b3dab9db971aab11ec17f90257043e49b0e48377ab92d278373ec9 +F src/main.c db12d1e572b6bbb617bcc6686f18aba30b49a6c257bacbabcb81320653029b23 F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 95304ec6c9654b4366dc58ae263270cb42861cb5017174936f816922b5eb61e6 -R ba4bcd2d6342b08c7dacb17431cb3038 -U dan -Z 0e2c07cdd748b69afa0ef3e62386cf6c +P 9a1d37f5479adedb93f40e8189ad0efa891a438805d80774ee992d4dfd71150f +R 04a86bb9860fea6216c599ef4bafe3b4 +U drh +Z c39b6133ba2e20b64defbf4fa26dcbfa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d1becf098f..6264f8c39d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a1d37f5479adedb93f40e8189ad0efa891a438805d80774ee992d4dfd71150f \ No newline at end of file +a50a333ae11ba5d92f432108308ac0bec9afb00f466b78c8d3f3aa7e2851ef21 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 334a3c826f..030b725b1e 100644 --- a/src/main.c +++ b/src/main.c @@ -4176,6 +4176,10 @@ int sqlite3_test_control(int op, ...){ ** false then clearn that setting. If the SQLITE_FkNoAction setting is ** abled, all foreign key ON DELETE and ON UPDATE actions behave as if ** they were NO ACTION, regardless of how they are defined. + ** + ** NB: One must usually run "PRAGMA writable_schema=RESET" after + ** using this test-control, before it will take full effect. failing + ** to reset the schema can result in some unexpected behavior. */ case SQLITE_TESTCTRL_FK_NO_ACTION: { sqlite3 *db = va_arg(ap, sqlite3*); From ef6bf1bbe5b0ef9838ccdf5486f900bac75db87c Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 21 Oct 2023 18:12:07 +0000 Subject: [PATCH 132/242] Fix a problem allowing a COMMIT following an OOM to cause fts3/4 corruption. FossilOrigin-Name: 7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6 --- ext/fts3/fts3.c | 53 ++++++++++++++++++++++---------- ext/fts3/fts3Int.h | 1 + ext/fts3/fts3_write.c | 12 ++++++-- ext/fts5/fts5_main.c | 3 -- ext/fts5/test/fts5faultG.test | 2 +- ext/fts5/test/fts5savepoint.test | 2 +- manifest | 27 ++++++++-------- manifest.uuid | 2 +- test/fts3corrupt4.test | 10 ++---- 9 files changed, 66 insertions(+), 46 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index aa2653050b..491a658871 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -3890,6 +3890,8 @@ static int fts3RenameMethod( rc = sqlite3Fts3PendingTermsFlush(p); } + p->bIgnoreSavepoint = 1; + if( p->zContentTbl==0 ){ fts3DbExec(&rc, db, "ALTER TABLE %Q.'%q_content' RENAME TO '%q_content';", @@ -3917,6 +3919,8 @@ static int fts3RenameMethod( "ALTER TABLE %Q.'%q_segdir' RENAME TO '%q_segdir';", p->zDb, p->zName, zName ); + + p->bIgnoreSavepoint = 0; return rc; } @@ -3927,12 +3931,28 @@ static int fts3RenameMethod( */ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ int rc = SQLITE_OK; - UNUSED_PARAMETER(iSavepoint); - assert( ((Fts3Table *)pVtab)->inTransaction ); - assert( ((Fts3Table *)pVtab)->mxSavepoint <= iSavepoint ); - TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint ); - if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){ - rc = fts3SyncMethod(pVtab); + Fts3Table *pTab = (Fts3Table*)pVtab; + assert( pTab->inTransaction ); + assert( pTab->mxSavepoint<=iSavepoint ); + TESTONLY( pTab->mxSavepoint = iSavepoint ); + + if( pTab->bIgnoreSavepoint==0 ){ + if( fts3HashCount(&pTab->aIndex[0].hPending)>0 ){ + char *zSql = sqlite3_mprintf("INSERT INTO %Q.%Q(%Q) VALUES('flush')", + pTab->zDb, pTab->zName, pTab->zName + ); + if( zSql ){ + pTab->bIgnoreSavepoint = 1; + rc = sqlite3_exec(pTab->db, zSql, 0, 0, 0); + pTab->bIgnoreSavepoint = 0; + sqlite3_free(zSql); + }else{ + rc = SQLITE_NOMEM; + } + } + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint+1; + } } return rc; } @@ -3943,12 +3963,11 @@ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** This is a no-op. */ static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ - TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); - UNUSED_PARAMETER(iSavepoint); - UNUSED_PARAMETER(pVtab); - assert( p->inTransaction ); - assert( p->mxSavepoint >= iSavepoint ); - TESTONLY( p->mxSavepoint = iSavepoint-1 ); + Fts3Table *pTab = (Fts3Table*)pVtab; + assert( pTab->inTransaction ); + assert( pTab->mxSavepoint >= iSavepoint ); + TESTONLY( pTab->mxSavepoint = iSavepoint-1 ); + pTab->iSavepoint = iSavepoint; return SQLITE_OK; } @@ -3958,11 +3977,13 @@ static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** Discard the contents of the pending terms table. */ static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ - Fts3Table *p = (Fts3Table*)pVtab; + Fts3Table *pTab = (Fts3Table*)pVtab; UNUSED_PARAMETER(iSavepoint); - assert( p->inTransaction ); - TESTONLY( p->mxSavepoint = iSavepoint ); - sqlite3Fts3PendingTermsClear(p); + assert( pTab->inTransaction ); + TESTONLY( pTab->mxSavepoint = iSavepoint ); + if( (iSavepoint+1)<=pTab->iSavepoint ){ + sqlite3Fts3PendingTermsClear(pTab); + } return SQLITE_OK; } diff --git a/ext/fts3/fts3Int.h b/ext/fts3/fts3Int.h index 3a8a884f92..5a5b123b4c 100644 --- a/ext/fts3/fts3Int.h +++ b/ext/fts3/fts3Int.h @@ -265,6 +265,7 @@ struct Fts3Table { int nPgsz; /* Page size for host database */ char *zSegmentsTbl; /* Name of %_segments table */ sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ + int iSavepoint; /* ** The following array of hash tables is used to buffer pending index diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 9bacd4235c..08884a1b1b 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -3325,7 +3325,6 @@ int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); if( rc==SQLITE_DONE ) rc = SQLITE_OK; } - sqlite3Fts3PendingTermsClear(p); /* Determine the auto-incr-merge setting if unknown. If enabled, ** estimate the number of leaf blocks of content to be written @@ -3347,6 +3346,10 @@ int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ rc = sqlite3_reset(pStmt); } } + + if( rc==SQLITE_OK ){ + sqlite3Fts3PendingTermsClear(p); + } return rc; } @@ -5437,8 +5440,11 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ rc = fts3DoIncrmerge(p, &zVal[6]); }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){ rc = fts3DoAutoincrmerge(p, &zVal[10]); + }else if( nVal==5 && 0==sqlite3_strnicmp(zVal, "flush", 5) ){ + rc = sqlite3Fts3PendingTermsFlush(p); + } #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - }else{ + else{ int v; if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ v = atoi(&zVal[9]); @@ -5456,8 +5462,8 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ if( v>=4 && v<=FTS3_MERGE_COUNT && (v&1)==0 ) p->nMergeCount = v; rc = SQLITE_OK; } -#endif } +#endif return rc; } diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 6e60a4cc2a..d4a36a22aa 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -2635,7 +2635,6 @@ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; int rc = SQLITE_OK; char *zSql = 0; - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint); if( pTab->bInSavepoint==0 ){ @@ -2666,7 +2665,6 @@ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; int rc = SQLITE_OK; - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint); if( (iSavepoint+1)iSavepoint ){ rc = sqlite3Fts5FlushToDisk(&pTab->p); @@ -2685,7 +2683,6 @@ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ static int fts5RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; int rc = SQLITE_OK; - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint); fts5TripCursors(pTab); pTab->p.pConfig->pgsz = 0; diff --git a/ext/fts5/test/fts5faultG.test b/ext/fts5/test/fts5faultG.test index f6ec781c8b..bdcc153ad2 100644 --- a/ext/fts5/test/fts5faultG.test +++ b/ext/fts5/test/fts5faultG.test @@ -30,7 +30,7 @@ do_execsql_test 1.0 { INSERT INTO t1 VALUES(' actually other stuff instead'); } faultsim_save_and_close -do_faultsim_test 1 -faults oom-t* -prep { +do_faultsim_test 1 -faults oom* -prep { faultsim_restore_and_reopen execsql { BEGIN; diff --git a/ext/fts5/test/fts5savepoint.test b/ext/fts5/test/fts5savepoint.test index e431f9f5fd..1126222750 100644 --- a/ext/fts5/test/fts5savepoint.test +++ b/ext/fts5/test/fts5savepoint.test @@ -71,7 +71,7 @@ ifcapable fts3 { do_catchsql_test 3.2 { DROP TABLE vt1; - } {1 {SQL logic error}} + } {0 {}} do_execsql_test 3.3 { SAVEPOINT x; diff --git a/manifest b/manifest index c90aaf8b40..7d10eaa3a0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_TESTCTRL_FK_NO_ACTION\stest\scontrol.\s\sMake\sit\savailable\sin\sthe\nCLI.\s\sFix\sa\sminor\sproblems\swith\sSQLITE_CHANGESETAPPLY_FKNOACTION\sin\ssessions. -D 2023-10-21T16:33:20.752 +C Fix\sa\sproblem\sallowing\sa\sCOMMIT\sfollowing\san\sOOM\sto\scause\sfts3/4\scorruption. +D 2023-10-21T18:12:07.638 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -60,9 +60,9 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 89298f42a071d4f08588a308cf2904fc5014f59b47ea48949a127b5747e9b90a +F ext/fts3/fts3.c c409b5f9211dbe9336210435ef3bc936e54c4f2ad9b92c9a7cd5442cbbbf1411 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe -F ext/fts3/fts3Int.h e573c6d881f7238d77cc3fd2396cbb9b2fe13efef7d2ad295a155151c4e7efbd +F ext/fts3/fts3Int.h be688580701d41340de73384e3acc8c55be12a438583207444bd5e20f9ef426c F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 F ext/fts3/fts3_expr.c 903bfb9433109fffb10e910d7066c49cbf8eeae316adc93f0499c4da7dfc932a F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 @@ -78,7 +78,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154 F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226 F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f -F ext/fts3/fts3_write.c 3a0043bb527c5d11e90493fd9fead30836e161a5330ba2ba739b372b03ea0459 +F ext/fts3/fts3_write.c 16df5ea9ff3634821003ac71a0275e3af030517b8768680062f425a347aab5f0 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73 F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674 @@ -95,7 +95,7 @@ F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d F ext/fts5/fts5_index.c 730c9c32ada18ce1eb7ff847b36507f4b005d88d47af7b47db521e695a8ea4c7 -F ext/fts5/fts5_main.c e345282be41c646702bbb91d488b78c35d9fa6e5a375d2809d9eb7dfbaed3314 +F ext/fts5/fts5_main.c 1ce6c8f446afbaaf22f4e1ccc0ec46d653168545b89a53bdbba0beddda820bec F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca56d6601426d F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee @@ -167,7 +167,7 @@ F ext/fts5/test/fts5faultB.test d606bdb8e81aaeb6f41de3fc9fc7ae315733f0903fbff05c F ext/fts5/test/fts5faultD.test e7ed7895abfe6bc98a5e853826f6b74956e7ba7f594f1860bbf9e504b9647996 F ext/fts5/test/fts5faultE.test 844586ce71dab4be85bb86880e87b624d089f851654cd22e4710c77eb8ce7075 F ext/fts5/test/fts5faultF.test 4abef99f86e99d9f0c6460dd68c586a766b6b9f1f660ada55bf2e8266bd1bbc1 -F ext/fts5/test/fts5faultG.test 7528654556b047ac515fc2790c03f71475141d5522a28edd3a6a630af269d9b1 +F ext/fts5/test/fts5faultG.test 340e59d2c2c1c7c379224f3968ee8d09b0f64bf56c5194217d1ded887b9d47c4 F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b996159f6909dc8079 F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717 F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e @@ -199,7 +199,7 @@ F ext/fts5/test/fts5rank.test 30f29e278cd7fb8831ba4f082feb74d8eb90c463bf07113ae2 F ext/fts5/test/fts5rebuild.test 55d6f17715cddbf825680dd6551efbc72ed916d8cf1cde40a46fc5d785b451e7 F ext/fts5/test/fts5restart.test 835ecc8f449e3919f72509ab58056d0cedca40d1fe04108ccf8ac4c2ba41f415 F ext/fts5/test/fts5rowid.test b8790ec170a8dc1942a15aef3db926a5f3061b1ff171013003d8297203a20ad6 -F ext/fts5/test/fts5savepoint.test fc02929f238d02a22df4172625704e029f7c1e0e92e332d654375690f8e6e43f +F ext/fts5/test/fts5savepoint.test 050796b24929325cdbbb2fbfe2794816ae95d298e940ae15032200c2f4a73725 F ext/fts5/test/fts5secure.test a02f771742fb2b1b9bdcb4bf523bcf2d0aa1ff597831d40fe3e72aaa6d0ec40f F ext/fts5/test/fts5secure2.test 2e961d7eef939f294c56b5d895cac7f1c3a60b934ee2cfd5e5e620bdf1ba6bbc F ext/fts5/test/fts5secure3.test c7e1080a6912f2a3ac68f2e05b88b72a99de38543509b2bbf427cac5c9c1c610 @@ -1130,7 +1130,7 @@ F test/fts3conf.test c9cd45433b6787d48a43e84949aa2eb8b3b3d242bac7276731c1476290d F test/fts3corrupt.test 6732477c5ace050c5758a40a8b5706c8c0cccd416b9c558e0e15224805a40e57 F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c7880bb0c67d0 F test/fts3corrupt3.test 0d5b69a0998b4adf868cc301fc78f3d0707745f1d984ce044c205cdb764b491f -F test/fts3corrupt4.test 64c6729721575e16bb7fdfc3d23092bb84ac032b0980b891a10483cb84bc1931 +F test/fts3corrupt4.test 48bd57baed9654e511709a02dbef2d22ee54c012ad466e8648f0f825233faa08 F test/fts3corrupt5.test 0549f85ec4bd22e992f645f13c59b99d652f2f5e643dac75568bfd23a6db7ed5 F test/fts3corrupt6.test f417c910254f32c0bc9ead7affa991a1d5aec35b3b32a183ffb05eea78289525 F test/fts3cov.test 7eacdbefd756cfa4dc2241974e3db2834e9b372ca215880e00032222f32194cf @@ -2135,9 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9deb8b6915e794bf9c5de88f2727ef9857351eaf905f8ab56754bc4d399c88b4 a50a333ae11ba5d92f432108308ac0bec9afb00f466b78c8d3f3aa7e2851ef21 -R 04a86bb9860fea6216c599ef4bafe3b4 -T +closed a50a333ae11ba5d92f432108308ac0bec9afb00f466b78c8d3f3aa7e2851ef21 -U drh -Z b0ccf6a50f82a49d4b230a7f548e7633 +P 91b64c6a70744704fc3285be7d8d46ba679ea5f0f69bd77b0e093eeb7447947d +R 40550ff3002f44e1c120a49acdcaa100 +U dan +Z cc7f79151d80761539bb72edb302f3f6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b9a3eb1a10..b21f23030a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -91b64c6a70744704fc3285be7d8d46ba679ea5f0f69bd77b0e093eeb7447947d \ No newline at end of file +7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6 \ No newline at end of file diff --git a/test/fts3corrupt4.test b/test/fts3corrupt4.test index 74aaa18fb8..433a486359 100644 --- a/test/fts3corrupt4.test +++ b/test/fts3corrupt4.test @@ -2595,17 +2595,13 @@ do_execsql_test 17.1 { UPDATE t1 SET b=quote(zeroblob(200)) WHERE a MATCH 'thread*'; } -do_catchsql_test 17.2 { - DROP TABLE IF EXISTS t1; -} {1 {SQL logic error}} - -do_execsql_test 17.3 { +do_execsql_test 17.2 { INSERT INTO t1(t1) VALUES('optimize'); } -do_catchsql_test 17.4 { +do_catchsql_test 17.3 { DROP TABLE IF EXISTS t1; -} {1 {SQL logic error}} +} {0 {}} #------------------------------------------------------------------------- reset_db From 76bd238a6635c3ddff97da8e9e29d15898838dae Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 20:03:44 +0000 Subject: [PATCH 133/242] Replace the patch at [5cb61c6788d7c017] with a better way to avoid failing PRAGMA integrity_check if a module implementation is not loaded, as the use of suppressErr can lead to problems. FossilOrigin-Name: be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pragma.c | 9 +++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 7d10eaa3a0..5f7b2ad0ea 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sallowing\sa\sCOMMIT\sfollowing\san\sOOM\sto\scause\sfts3/4\scorruption. -D 2023-10-21T18:12:07.638 +C Replace\sthe\spatch\sat\s[5cb61c6788d7c017]\swith\sa\sbetter\sway\sto\savoid\sfailing\nPRAGMA\sintegrity_check\sif\sa\smodule\simplementation\sis\snot\sloaded,\sas\sthe\suse\nof\ssuppressErr\scan\slead\sto\sproblems. +D 2023-10-21T20:03:44.794 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -713,7 +713,7 @@ F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c 63b3af7288c91cbfa24797e3eee74913437623683d8080d1db3ea422353aa77a +F src/pragma.c 10dae0459c38201427c4550607f58ec0c865092f26e7966fd637e7e2b5156c82 F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 91b64c6a70744704fc3285be7d8d46ba679ea5f0f69bd77b0e093eeb7447947d -R 40550ff3002f44e1c120a49acdcaa100 -U dan -Z cc7f79151d80761539bb72edb302f3f6 +P 7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6 +R a5c52b227030018aeec200698cc91df9 +U drh +Z c49ccd8551b850e03ffaf4a55e807aa8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b21f23030a..19a548afed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6 \ No newline at end of file +be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 0ec745d57d..cbf5b0b455 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1765,11 +1765,12 @@ void sqlite3Pragma( if( !IsOrdinaryTable(pTab) ){ sqlite3_vtab *pVTab; int a1; - int savedErr = db->suppressErr; if( !IsVirtual(pTab) ) continue; - db->suppressErr = 1; - rc = sqlite3ViewGetColumnNames(pParse, pTab); - db->suppressErr = savedErr; + if( pTab->nCol<=0 ){ + const char *zMod = pTab->u.vtab.azArg[0]; + if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue; + } + sqlite3ViewGetColumnNames(pParse, pTab); if( pTab->u.vtab.p==0 ) continue; pVTab = pTab->u.vtab.p->pVtab; if( NEVER(pVTab==0) ) continue; From d2c737f2e487331732ac20b11dc406264a3af4ab Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 20:34:57 +0000 Subject: [PATCH 134/242] Remove a branch that cannot affect the outcome from FkNoAction processing in fkey.c. Replace it with an assert(). FossilOrigin-Name: 023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/fkey.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5f7b2ad0ea..f0af6d8ad7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\sthe\spatch\sat\s[5cb61c6788d7c017]\swith\sa\sbetter\sway\sto\savoid\sfailing\nPRAGMA\sintegrity_check\sif\sa\smodule\simplementation\sis\snot\sloaded,\sas\sthe\suse\nof\ssuppressErr\scan\slead\sto\sproblems. -D 2023-10-21T20:03:44.794 +C Remove\sa\sbranch\sthat\scannot\saffect\sthe\soutcome\sfrom\sFkNoAction\sprocessing\sin\nfkey.c.\s\sReplace\sit\swith\san\sassert(). +D 2023-10-21T20:34:57.969 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -672,7 +672,7 @@ F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 F src/expr.c ddb8e310561c761b29f993490eaa64b8a3496032140db74b5ebaeca4a7c96cb3 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 -F src/fkey.c 360a9b644efc9e05746e0b5b6ccb4760fd039d287ebdf090723b9c97f6d163d9 +F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00 F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 F src/global.c 29f56a330ed9d1b5cd9b79ac0ca36f97ac3afc730ff8bfa987b0db9e559d684d F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220 @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7f41d7006db4225cf9b3d197d3a76842778669ac079e76361214a8023c9976e6 -R a5c52b227030018aeec200698cc91df9 +P be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722 +R 267ff241b67c0fb3bb23fbb9c0b3972f U drh -Z c49ccd8551b850e03ffaf4a55e807aa8 +Z 172733ec22e8d6da45a510ca8d2a88d6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 19a548afed..aa1c582946 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722 \ No newline at end of file +023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555 \ No newline at end of file diff --git a/src/fkey.c b/src/fkey.c index 6b1d747c88..bace1ae5e2 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -853,11 +853,12 @@ static int fkParentIsModified( */ static int isSetNullAction(Parse *pParse, FKey *pFKey){ Parse *pTop = sqlite3ParseToplevel(pParse); - if( pTop->pTriggerPrg && 0==(pTop->db->flags & SQLITE_FkNoAction) ){ + if( pTop->pTriggerPrg ){ Trigger *p = pTop->pTriggerPrg->pTrigger; if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull) || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull) ){ + assert( (pTop->db->flags & SQLITE_FkNoAction)==0 ); return 1; } } From 06f4dc7edb37ecd2130633a488df178608e34907 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 21 Oct 2023 22:31:00 +0000 Subject: [PATCH 135/242] In the CLI, do not translate unquoted backslash escapes on dot-commands as that can damage filename arguments. FossilOrigin-Name: 4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index f0af6d8ad7..c8f2d10699 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sbranch\sthat\scannot\saffect\sthe\soutcome\sfrom\sFkNoAction\sprocessing\sin\nfkey.c.\s\sReplace\sit\swith\san\sassert(). -D 2023-10-21T20:34:57.969 +C In\sthe\sCLI,\sdo\snot\stranslate\sunquoted\sbackslash\sescapes\son\sdot-commands\nas\sthat\scan\sdamage\sfilename\sarguments. +D 2023-10-21T22:31:00.353 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,7 +721,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 -F src/shell.c.in 2ebcf31e12b4a2a30338a016524720ce38cbcd6faba72521d77e14d0346e5620 +F src/shell.c.in 3399636eedfea4e7f7dfd07634615b6175b6b2228ab236d737f7a656b2c4fc2d F src/sqlite.h.in b37b3df6fb0684929446c095e81287fbdffd64f55481e4195ee7768f2f0ae72e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2135,8 +2135,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P be5737ee4f4f1d5f8b3126f6eb70210bf3d8b1cdaef51aae818eaaba43ccf722 -R 267ff241b67c0fb3bb23fbb9c0b3972f +P 023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555 +R 7357061e9fc49b9bb7a383e84cdcd0ba U drh -Z 172733ec22e8d6da45a510ca8d2a88d6 +Z 674759ef24499708cece7aee8aa913b6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index aa1c582946..68b8ee0ef3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555 \ No newline at end of file +4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 6cd6a18ab6..f314a2ea35 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -8033,7 +8033,9 @@ static int do_meta_command(char *zLine, ShellState *p){ azArg[nArg++] = &zLine[h]; while( zLine[h] && !IsSpace(zLine[h]) ){ h++; } if( zLine[h] ) zLine[h++] = 0; +#ifndef _WIN32 /* Don't convert bare \ on Windows - doing so damages filenames */ resolve_backslashes(azArg[nArg-1]); +#endif } } azArg[nArg] = 0; From 6e4ef06ca15e75f04c0317f5a347cd1df7c37879 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 11:11:54 +0000 Subject: [PATCH 136/242] Add missing ScalarFunction.java to JNI build. FossilOrigin-Name: b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b --- .../sqlite/jni/wrapper1/ScalarFunction.java | 37 +++++++++++++++++++ manifest | 13 ++++--- manifest.uuid | 2 +- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java new file mode 100644 index 0000000000..067a6983eb --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java @@ -0,0 +1,37 @@ +/* +** 2023-10-16 +** +** 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 is part of the wrapper1 interface for sqlite3. +*/ +package org.sqlite.jni.wrapper1; +import org.sqlite.jni.capi.CApi; +import org.sqlite.jni.annotation.*; +import org.sqlite.jni.capi.sqlite3_context; +import org.sqlite.jni.capi.sqlite3_value; + +/** + The SqlFunction type for scalar SQL functions. +*/ +public abstract class ScalarFunction implements SqlFunction { + /** + As for the xFunc() argument of the C API's + sqlite3_create_function(). If this function throws, it is + translated into an sqlite3_result_error(). + */ + public abstract void xFunc(SqlFunction.Arguments args); + + /** + Optionally override to be notified when the UDF is finalized by + SQLite. This default implementation does nothing. + */ + public void xDestroy() {} + +} diff --git a/manifest b/manifest index c8f2d10699..293cd130bc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sCLI,\sdo\snot\stranslate\sunquoted\sbackslash\sescapes\son\sdot-commands\nas\sthat\scan\sdamage\sfilename\sarguments. -D 2023-10-21T22:31:00.353 +C Add\smissing\sScalarFunction.java\sto\sJNI\sbuild. +D 2023-10-22T11:11:54.330 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -292,6 +292,7 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d57255 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a +F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 004394eeb944baa56e36cd7ae69ba6d4a52b52db3c49439db16e98270b861421 F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java a9ddc6a9e8c113168cc67592ae24c0e56d30dd06226eeab012f2761a0889d7bb F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 @@ -2135,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 023a9dbe83c0042e9d500e3ae6c0592a468982e4ac278d08c9201967506c7555 -R 7357061e9fc49b9bb7a383e84cdcd0ba -U drh -Z 674759ef24499708cece7aee8aa913b6 +P 4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a +R 3fe1108f65f1caab77f9fbf8767ff3b7 +U stephan +Z 479ae6fc35bc2a0cdd617f9441ccbd5d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 68b8ee0ef3..571d755baa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a \ No newline at end of file +b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b \ No newline at end of file From 28f45b1ab1b38b2dbb7800a8978dc00a363a92b3 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 12:33:05 +0000 Subject: [PATCH 137/242] JNI: improve UB protections in sqlite3_bind_blob/text/text16(). FossilOrigin-Name: 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 --- ext/jni/src/c/sqlite3-jni.c | 112 +++++++++++++++------- ext/jni/src/org/sqlite/jni/capi/CApi.java | 20 ++-- manifest | 14 +-- manifest.uuid | 2 +- 4 files changed, 94 insertions(+), 54 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 8009592b6b..245ce4f9e9 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -841,13 +841,23 @@ static const char * s3jni__jstring_to_mutf8(JNIEnv * const env, jstring v ){ #define s3jni_jstring_to_mutf8(ARG) s3jni__jstring_to_mutf8(env, (ARG)) #define s3jni_mutf8_release(ARG,VAR) if( VAR ) (*env)->ReleaseStringUTFChars(env, ARG, VAR) -static jbyte * s3jni__jbyteArray_bytes(JNIEnv * const env, jbyteArray jBA ){ +/* +** If jBA is not NULL then its GetByteArrayElements() value is +** returned. If jBA is not NULL and nBA is not NULL then *nBA is set +** to the GetArrayLength() of jBA. If GetByteArrayElements() requires +** an allocation and that allocation fails then this function either +** fails fatally or returns 0, depending on build-time options. + */ +static jbyte * s3jni__jbyteArray_bytes2(JNIEnv * const env, jbyteArray jBA, jsize * nBA ){ jbyte * const rv = jBA ? (*env)->GetByteArrayElements(env, jBA, NULL) : 0; s3jni_oom_check( jBA ? !!rv : 1 ); + if( jBA && nBA ) *nBA = (*env)->GetArrayLength(env, jBA); return rv; } -#define s3jni_jbyteArray_bytes(jByteArray) s3jni__jbyteArray_bytes(env, (jByteArray)) +#define s3jni_jbyteArray_bytes2(jByteArray,ptrToSz) \ + s3jni__jbyteArray_bytes2(env, (jByteArray), (ptrToSz)) +#define s3jni_jbyteArray_bytes(jByteArray) s3jni__jbyteArray_bytes2(env, (jByteArray), 0) #define s3jni_jbyteArray_release(jByteArray,jBytes) \ if( jBytes ) (*env)->ReleaseByteArrayElements(env, jByteArray, jBytes, JNI_ABORT) #define s3jni_jbyteArray_commit(jByteArray,jBytes) \ @@ -1010,7 +1020,7 @@ static jstring s3jni__utf8_to_jstring(JNIEnv * const env, static char * s3jni__jstring_to_utf8(JNIEnv * const env, jstring jstr, int *nLen){ jbyteArray jba; - jsize nBa; + jsize nBA; char *rv; if( !jstr ) return 0; @@ -1024,12 +1034,12 @@ static char * s3jni__jstring_to_utf8(JNIEnv * const env, if( nLen ) *nLen = 0; return 0; } - nBa = (*env)->GetArrayLength(env, jba); - if( nLen ) *nLen = (int)nBa; - rv = s3jni_malloc( nBa + 1 ); + nBA = (*env)->GetArrayLength(env, jba); + if( nLen ) *nLen = (int)nBA; + rv = s3jni_malloc( nBA + 1 ); if( rv ){ - (*env)->GetByteArrayRegion(env, jba, 0, nBa, (jbyte*)rv); - rv[nBa] = 0; + (*env)->GetByteArrayRegion(env, jba, 0, nBA, (jbyte*)rv); + rv[nBA] = 0; } S3JniUnrefLocal(jba); return rv; @@ -2359,9 +2369,13 @@ S3JniApi(sqlite3_backup_step(),jint,1backup_1step)( S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)( JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax ){ - jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0; + jsize nBA = 0; + jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes2(baData, &nBA) : 0; int rc; if( pBuf ){ + if( nMax>nBA ){ + nMax = nBA; + } rc = sqlite3_bind_blob(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, pBuf, (int)nMax, SQLITE_TRANSIENT); s3jni_jbyteArray_release(baData, pBuf); @@ -2448,25 +2462,49 @@ S3JniApi(sqlite3_bind_parameter_name(),jstring,1bind_1parameter_1name)( return z ? s3jni_utf8_to_jstring(z, -1) : 0; } +/* +** Impl of sqlite3_bind_text/text16(). +*/ +static int s3jni__bind_text(int is16, JNIEnv *env, jlong jpStmt, jint ndx, + jbyteArray baData, jint nMax){ + jsize nBA = 0; + jbyte * const pBuf = + baData ? s3jni_jbyteArray_bytes2(baData, &nBA) : 0; + int rc; + if( pBuf ){ + if( nMax>nBA ){ + nMax = nBA; + } + /* Note that we rely on the Java layer having assured that baData + is NUL-terminated if nMax is negative. In order to avoid UB for + such cases, we do not expose the byte-limit arguments in the + public API. */ + rc = is16 + ? sqlite3_bind_text16(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, + pBuf, (int)nMax, SQLITE_TRANSIENT) + : sqlite3_bind_text(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, + (const char *)pBuf, + (int)nMax, SQLITE_TRANSIENT); + }else{ + rc = baData + ? sqlite3_bind_null(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx) + : SQLITE_NOMEM; + } + s3jni_jbyteArray_release(baData, pBuf); + return (jint)rc; + +} + S3JniApi(sqlite3_bind_text(),jint,1bind_1text)( JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax ){ - jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0; - int const rc = sqlite3_bind_text(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, - (const char *)pBuf, - (int)nMax, SQLITE_TRANSIENT); - s3jni_jbyteArray_release(baData, pBuf); - return (jint)rc; + return s3jni__bind_text(0, env, jpStmt, ndx, baData, nMax); } S3JniApi(sqlite3_bind_text16(),jint,1bind_1text16)( JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax ){ - jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0; - int const rc = sqlite3_bind_text16(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, - pBuf, (int)nMax, SQLITE_TRANSIENT); - s3jni_jbyteArray_release(baData, pBuf); - return (jint)rc; + return s3jni__bind_text(1, env, jpStmt, ndx, baData, nMax); } S3JniApi(sqlite3_bind_value(),jint,1bind_1value)( @@ -2575,10 +2613,10 @@ S3JniApi(sqlite3_blob_write(),jint,1blob_1write)( ){ sqlite3_blob * const b = S3JniLongPtr_sqlite3_blob(jpBlob); jbyte * const pBuf = b ? s3jni_jbyteArray_bytes(jBa) : 0; - const jsize nBa = pBuf ? (*env)->GetArrayLength(env, jBa) : 0; + const jsize nBA = pBuf ? (*env)->GetArrayLength(env, jBa) : 0; int rc = SQLITE_MISUSE; if(b && pBuf){ - rc = sqlite3_blob_write( b, pBuf, (int)nBa, (int)iOffset ); + rc = sqlite3_blob_write( b, pBuf, (int)nBA, (int)iOffset ); } s3jni_jbyteArray_release(jBa, pBuf); return (jint)rc; @@ -2994,12 +3032,12 @@ S3JniApi(sqlite3_complete(),int,1complete)( JniArgsEnvClass, jbyteArray jSql ){ jbyte * const pBuf = s3jni_jbyteArray_bytes(jSql); - const jsize nBa = pBuf ? (*env)->GetArrayLength(env, jSql) : 0; + const jsize nBA = pBuf ? (*env)->GetArrayLength(env, jSql) : 0; int rc; - assert( (nBa>0 ? 0==pBuf[nBa-1] : (pBuf ? 0==*pBuf : 1)) + assert( (nBA>0 ? 0==pBuf[nBA-1] : (pBuf ? 0==*pBuf : 1)) && "Byte array is not NUL-terminated." ); - rc = (pBuf && 0==pBuf[(nBa ? nBa-1 : 0)]) + rc = (pBuf && 0==pBuf[(nBA ? nBA-1 : 0)]) ? sqlite3_complete( (const char *)pBuf ) : (jSql ? SQLITE_NOMEM : SQLITE_MISUSE); s3jni_jbyteArray_release(jSql, pBuf); @@ -4159,9 +4197,9 @@ static void result_blob_text(int as64 /* true for text64/blob64() mode */, return; }else if( jBa ){ jbyte * const pBuf = s3jni_jbyteArray_bytes(jBa); - jsize nBa = (*env)->GetArrayLength(env, jBa); - if( nMax>=0 && nBa>(jsize)nMax ){ - nBa = (jsize)nMax; + jsize nBA = (*env)->GetArrayLength(env, jBa); + if( nMax>=0 && nBA>(jsize)nMax ){ + nBA = (jsize)nMax; /** From the sqlite docs: @@ -4181,15 +4219,15 @@ static void result_blob_text(int as64 /* true for text64/blob64() mode */, if( as64 ){ /* 64-bit... */ static const jsize nLimit64 = SQLITE_MAX_ALLOCATION_SIZE/*only _kinda_ arbitrary*/; - if( nBa > nLimit64 ){ + if( nBA > nLimit64 ){ sqlite3_result_error_toobig(pCx); }else if( asBlob ){ - sqlite3_result_blob64(pCx, pBuf, (sqlite3_uint64)nBa, + sqlite3_result_blob64(pCx, pBuf, (sqlite3_uint64)nBA, SQLITE_TRANSIENT); }else{ /* text64... */ if( encodingTypeIsValid(eTextRep) ){ sqlite3_result_text64(pCx, (const char *)pBuf, - (sqlite3_uint64)nBa, + (sqlite3_uint64)nBA, SQLITE_TRANSIENT, eTextRep); }else{ sqlite3_result_error_code(pCx, SQLITE_FORMAT); @@ -4197,27 +4235,27 @@ static void result_blob_text(int as64 /* true for text64/blob64() mode */, } }else{ /* 32-bit... */ static const jsize nLimit = SQLITE_MAX_ALLOCATION_SIZE; - if( nBa > nLimit ){ + if( nBA > nLimit ){ sqlite3_result_error_toobig(pCx); }else if( asBlob ){ - sqlite3_result_blob(pCx, pBuf, (int)nBa, + sqlite3_result_blob(pCx, pBuf, (int)nBA, SQLITE_TRANSIENT); }else{ switch( eTextRep ){ case SQLITE_UTF8: - sqlite3_result_text(pCx, (const char *)pBuf, (int)nBa, + sqlite3_result_text(pCx, (const char *)pBuf, (int)nBA, SQLITE_TRANSIENT); break; case SQLITE_UTF16: - sqlite3_result_text16(pCx, (const char *)pBuf, (int)nBa, + sqlite3_result_text16(pCx, (const char *)pBuf, (int)nBA, SQLITE_TRANSIENT); break; case SQLITE_UTF16LE: - sqlite3_result_text16le(pCx, (const char *)pBuf, (int)nBa, + sqlite3_result_text16le(pCx, (const char *)pBuf, (int)nBA, SQLITE_TRANSIENT); break; case SQLITE_UTF16BE: - sqlite3_result_text16be(pCx, (const char *)pBuf, (int)nBa, + sqlite3_result_text16be(pCx, (const char *)pBuf, (int)nBA, SQLITE_TRANSIENT); break; } diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index a721844744..302cdb760e 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -215,9 +215,10 @@ public final class CApi { ); /** - Results are undefined if data is not null and n<0 || n>=data.length. + If n is negative, SQLITE_MISUSE is returned. If n>data.length + then n is silently truncated to data.length. */ - public static int sqlite3_bind_blob( + static int sqlite3_bind_blob( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int n ){ return sqlite3_bind_blob(stmt.getNativePointer(), ndx, data, n); @@ -325,11 +326,12 @@ public final class CApi { SQLITE_TRANSIENT for the final C API parameter. The byte array is assumed to be in UTF-8 encoding. -

    Results are undefined if data is not null and - maxBytes>=utf8.length. If maxBytes is negative then results are - undefined if data is not null and does not contain a NUL byte. +

    If data is not null and maxBytes>utf8.length then maxBytes is + silently truncated to utf8.length. If maxBytes is negative then + results are undefined if data is not null and does not contain a + NUL byte. */ - public static int sqlite3_bind_text( + static int sqlite3_bind_text( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] utf8, int maxBytes ){ return sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, maxBytes); @@ -354,7 +356,7 @@ public final class CApi { public static int sqlite3_bind_text( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] utf8 ){ - return (null == utf8) + return ( null==utf8 ) ? sqlite3_bind_null(stmt.getNativePointer(), ndx) : sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, utf8.length); } @@ -368,7 +370,7 @@ public final class CApi { signature but requires that its input be encoded in UTF-16 in platform byte order. */ - public static int sqlite3_bind_text16( + static int sqlite3_bind_text16( @NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int maxBytes ){ return sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, maxBytes); @@ -982,7 +984,7 @@ public final class CApi { necessary, however, and overloads are provided which gloss over that. -

    Results are undefined if maxBytes>=sqlUtf8.length. +

    Results are undefined if maxBytes>sqlUtf8.length.

    This routine is private because its maxBytes value is not strictly necessary in the Java interface, as sqlUtf8.length tells diff --git a/manifest b/manifest index 293cd130bc..16ecd5eb71 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\sScalarFunction.java\sto\sJNI\sbuild. -D 2023-10-22T11:11:54.330 +C JNI:\simprove\sUB\sprotections\sin\ssqlite3_bind_blob/text/text16(). +D 2023-10-22T12:33:05.772 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -239,7 +239,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 5c3ac326bf3853486ebe0d70819abc790cc65c412182ce4ebd5012b008d9b059 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 8d32ca0598a11370a9e92a6d111f38934c225056b42b13512175acf6e37eed4c +F ext/jni/src/c/sqlite3-jni.c 6f6df9657989e9ca2cfdcc2fe9a71c279de56d5c941adfd09a0f24256de35c8f F ext/jni/src/c/sqlite3-jni.h b4c413a0d0c734683da1049cfcf89e35ae2719759d0656ec0f8c57188f18cab8 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba @@ -249,7 +249,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f93 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 5d754b4bb57852d006ad046b2860eb23ba406f800846460b26beee5172df4fc3 +F ext/jni/src/org/sqlite/jni/capi/CApi.java bccb442ca81cd4decb1adae99006a60b7a9f54e5153842e738c01104e97d1de0 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4a0e2c6e17eefb296b7e91a13305b2260d6eb869a37bc5e5b79edaf3c19c810a -R 3fe1108f65f1caab77f9fbf8767ff3b7 +P b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b +R 10dd3eddc3858c0c90f96d7af2dd213f U stephan -Z 479ae6fc35bc2a0cdd617f9441ccbd5d +Z 39a3acd541e66480809465cadb3002fa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 571d755baa..bcfb4efa95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b \ No newline at end of file +5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 \ No newline at end of file From 4bcde614d8680fcabd69cd607d65ed5b4c4a0eae Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 12:43:30 +0000 Subject: [PATCH 138/242] Add JNI wrapper1.SqliteStmt.bindXyz() APIs. FossilOrigin-Name: 54fce9bf04a7517cdc8e96fe2efec66f03b0d03983c3a45d0ae7e1f16aa5a6c9 --- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 153 ++++++++++++------ .../src/org/sqlite/jni/wrapper1/Tester2.java | 24 ++- manifest | 17 +- manifest.uuid | 2 +- 4 files changed, 138 insertions(+), 58 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index bcf97b2394..4cf06d355c 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -77,7 +77,7 @@ public final class Sqlite implements AutoCloseable { */ sqlite3 nativeHandle(){ return this.db; } - private sqlite3 affirmOpen(){ + private sqlite3 thisDb(){ if( null==db || 0==db.getNativePointer() ){ throw new IllegalArgumentException("This database instance is closed."); } @@ -88,12 +88,58 @@ public final class Sqlite implements AutoCloseable { // return s==null ? null : s.getBytes(StandardCharsets.UTF_8); // } + /** + If rc!=0, throws an SqliteException. If this db is currently + opened, the error state is extracted from it, else only the + string form of rc is used. + */ private void affirmRcOk(int rc){ if( 0!=rc ){ - throw new SqliteException(db); + if( null==db ) throw new SqliteException(rc); + else throw new SqliteException(db); } } + /** + prepare() TODOs include: + + - overloads taking byte[] and ByteBuffer. + + - multi-statement processing, like CApi.sqlite3_prepare_multi() + but using a callback specific to the higher-level Stmt class + rather than the sqlite3_stmt class. + */ + public Stmt prepare(String sql, int prepFlags){ + final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); + final int rc = sqlite3_prepare_v3(thisDb(), sql, prepFlags, out); + affirmRcOk(rc); + return new Stmt(this, out.take()); + } + + public Stmt prepare(String sql){ + return prepare(sql, 0); + } + + public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f ){ + int rc = CApi.sqlite3_create_function(thisDb(), name, nArg, eTextRep, + new SqlFunction.ScalarAdapter(f)); + if( 0!=rc ) throw new SqliteException(db); + } + + public void createFunction(String name, int nArg, ScalarFunction f){ + this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); + } + + public void createFunction(String name, int nArg, int eTextRep, AggregateFunction f ){ + int rc = CApi.sqlite3_create_function(thisDb(), name, nArg, eTextRep, + new SqlFunction.AggregateAdapter(f)); + if( 0!=rc ) throw new SqliteException(db); + } + + public void createFunction(String name, int nArg, AggregateFunction f){ + this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); + } + /** Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to create new instances. @@ -111,7 +157,11 @@ public final class Sqlite implements AutoCloseable { return stmt; } - private sqlite3_stmt affirmOpen(){ + /** + If this statement is still opened, its low-level handle is + returned, eelse an IllegalArgumentException is thrown. + */ + private sqlite3_stmt thisStmt(){ if( null==stmt || 0==stmt.getNativePointer() ){ throw new IllegalArgumentException("This Stmt has been finalized."); } @@ -140,7 +190,9 @@ public final class Sqlite implements AutoCloseable { /** Throws if rc is any value other than 0, SQLITE_ROW, or - SQLITE_DONE, else returns rc. + SQLITE_DONE, else returns rc. Error state for the exception is + extracted from this statement object (if it's opened) or the + string form of rc. */ private int checkRc(int rc){ switch(rc){ @@ -148,7 +200,8 @@ public final class Sqlite implements AutoCloseable { case SQLITE_ROW: case SQLITE_DONE: return rc; default: - throw new SqliteException(this); + if( null==stmt ) throw new SqliteException(rc); + else throw new SqliteException(this); } } @@ -157,7 +210,7 @@ public final class Sqlite implements AutoCloseable { result other than 0, SQLITE_ROW, or SQLITE_DONE. */ public int step(){ - return checkRc(sqlite3_step(affirmOpen())); + return checkRc(sqlite3_step(thisStmt())); } public Sqlite db(){ return this._db; } @@ -166,53 +219,55 @@ public final class Sqlite implements AutoCloseable { Works like sqlite3_reset() but throws on error. */ public void reset(){ - checkRc(sqlite3_reset(affirmOpen())); + checkRc(CApi.sqlite3_reset(thisStmt())); } public void clearBindings(){ - sqlite3_clear_bindings( affirmOpen() ); + CApi.sqlite3_clear_bindings( thisStmt() ); + } + public void bindInt(int ndx, int val){ + checkRc(CApi.sqlite3_bind_int(thisStmt(), ndx, val)); + } + public void bindInt64(int ndx, long val){ + checkRc(CApi.sqlite3_bind_int64(thisStmt(), ndx, val)); + } + public void bindDouble(int ndx, double val){ + checkRc(CApi.sqlite3_bind_double(thisStmt(), ndx, val)); + } + public void bindObject(int ndx, Object o){ + checkRc(CApi.sqlite3_bind_java_object(thisStmt(), ndx, o)); + } + public void bindNull(int ndx){ + checkRc(CApi.sqlite3_bind_null(thisStmt(), ndx)); + } + public int bindParameterCount(){ + return CApi.sqlite3_bind_parameter_count(thisStmt()); + } + public int bindParameterIndex(String paramName){ + return CApi.sqlite3_bind_parameter_index(thisStmt(), paramName); + } + public String bindParameterName(int ndx){ + return CApi.sqlite3_bind_parameter_name(thisStmt(), ndx); + } + public void bindText(int ndx, byte[] utf8){ + checkRc(CApi.sqlite3_bind_text(thisStmt(), ndx, utf8)); + } + public void bindText(int ndx, String asUtf8){ + checkRc(CApi.sqlite3_bind_text(thisStmt(), ndx, asUtf8)); + } + public void bindText16(int ndx, byte[] utf16){ + checkRc(CApi.sqlite3_bind_text16(thisStmt(), ndx, utf16)); + } + public void bindText16(int ndx, String txt){ + checkRc(CApi.sqlite3_bind_text16(thisStmt(), ndx, txt)); + } + public void bindZeroBlob(int ndx, int n){ + checkRc(CApi.sqlite3_bind_zeroblob(thisStmt(), ndx, n)); + } + public void bindBlob(int ndx, byte[] bytes){ + checkRc(CApi.sqlite3_bind_blob(thisStmt(), ndx, bytes)); } - } - - /** - prepare() TODOs include: - - - overloads taking byte[] and ByteBuffer. - - - multi-statement processing, like CApi.sqlite3_prepare_multi() - but using a callback specific to the higher-level Stmt class - rather than the sqlite3_stmt class. - */ - public Stmt prepare(String sql, int prepFlags){ - final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); - final int rc = sqlite3_prepare_v3(affirmOpen(), sql, prepFlags, out); - affirmRcOk(rc); - return new Stmt(this, out.take()); - } - - public Stmt prepare(String sql){ - return prepare(sql, 0); - } - - public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f ){ - int rc = CApi.sqlite3_create_function(affirmOpen(), name, nArg, eTextRep, - new SqlFunction.ScalarAdapter(f)); - if( 0!=rc ) throw new SqliteException(db); - } - - public void createFunction(String name, int nArg, ScalarFunction f){ - this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); - } - - public void createFunction(String name, int nArg, int eTextRep, AggregateFunction f ){ - int rc = CApi.sqlite3_create_function(affirmOpen(), name, nArg, eTextRep, - new SqlFunction.AggregateAdapter(f)); - if( 0!=rc ) throw new SqliteException(db); - } - - public void createFunction(String name, int nArg, AggregateFunction f){ - this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); - } + } /* Stmt class */ } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index f5fd5f84e6..cf3364bc16 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -224,8 +224,26 @@ public class Tester2 implements Runnable { void testPrepare1(){ try (Sqlite db = openDb()) { - Sqlite.Stmt stmt = db.prepare("SELECT 1"); + Sqlite.Stmt stmt = db.prepare("SELECT ?1"); + Exception e = null; affirm( null!=stmt.nativeHandle() ); + affirm( 1==stmt.bindParameterCount() ); + affirm( "?1".equals(stmt.bindParameterName(1)) ); + affirm( null==stmt.bindParameterName(2) ); + stmt.bindInt(1, 1); + stmt.bindInt64(1, 1); + stmt.bindDouble(1, 1.1); + stmt.bindObject(1, db); + stmt.bindNull(1); + stmt.bindText(1, new byte[] {32,32,32}); + stmt.bindText(1, "123"); + stmt.bindText16(1, "123".getBytes(StandardCharsets.UTF_16)); + stmt.bindText16(1, "123"); + stmt.bindZeroBlob(1, 8); + stmt.bindBlob(1, new byte[] {1,2,3,4}); + try{ stmt.bindInt(2,1); } + catch(Exception ex){ e = ex; } + affirm( null!=e ); affirm( CApi.SQLITE_ROW == stmt.step() ); affirm( CApi.SQLITE_DONE == stmt.step() ); stmt.reset(); @@ -269,6 +287,10 @@ public class Tester2 implements Runnable { } void testUdfAggregate(){ + /* FIXME/TODO: once we've added the stmt bind/step/fetch + capabilities, go back and extend these tests to correspond to + the aggregate UDF tests in ext/wasm/tester1.c-pp.js. We first + require the ability to bind/step/fetch, however. */ final ValueHolder xDestroyCalled = new ValueHolder<>(0); final ValueHolder vh = new ValueHolder<>(0); try (Sqlite db = openDb()) { diff --git a/manifest b/manifest index 16ecd5eb71..3110770045 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\simprove\sUB\sprotections\sin\ssqlite3_bind_blob/text/text16(). -D 2023-10-22T12:33:05.772 +C Add\sJNI\swrapper1.SqliteStmt.bindXyz()\sAPIs. +D 2023-10-22T12:43:30.072 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -294,9 +294,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 004394eeb944baa56e36cd7ae69ba6d4a52b52db3c49439db16e98270b861421 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java a9ddc6a9e8c113168cc67592ae24c0e56d30dd06226eeab012f2761a0889d7bb +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 25e4e65ba434d0e110e4adb6782e20cd374d83b7fe00ba5ca48a1dadd2fdd7dd F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java c24b510ebe801c30533cc62efdf69a4a5e2da9ec4b49f8d403f2060693f060a0 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 65437e09115bfef4445957db61fcf6dac9aad37ac00edb445c3de812e9750d6e F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 @@ -2136,8 +2136,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b -R 10dd3eddc3858c0c90f96d7af2dd213f +P 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 +R 186cd14750afba6ac11c0a47787c2fc3 +T *branch * jni-post-3.44 +T *sym-jni-post-3.44 * +T -sym-trunk * Cancelled\sby\sbranch. U stephan -Z 39a3acd541e66480809465cadb3002fa +Z dc6c06549901a63430a6e90b2648f01f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bcfb4efa95..166d31ff93 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 \ No newline at end of file +54fce9bf04a7517cdc8e96fe2efec66f03b0d03983c3a45d0ae7e1f16aa5a6c9 \ No newline at end of file From 4598b6e5aea09f4346e356f7dbb6540eff0c98d1 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 13:09:37 +0000 Subject: [PATCH 139/242] Add API_ARMOR to sqlite3_clear_bindings(). FossilOrigin-Name: f3fb4d345bbf5ae4a35d8076043df601b1bf7dfd68760a416440139eb3e5eb9a --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/vdbeapi.c | 10 +++++++++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 3110770045..d4e1eb3da2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sJNI\swrapper1.SqliteStmt.bindXyz()\sAPIs. -D 2023-10-22T12:43:30.072 +C Add\sAPI_ARMOR\sto\ssqlite3_clear_bindings(). +D 2023-10-22T13:09:37.276 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -794,7 +794,7 @@ F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c -F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 +F src/vdbeapi.c db190d007bdf5b9165edeb12369f4c59a459f88fd652c1671c1238862e662cc3 F src/vdbeaux.c 929a4edecf9845fb063b47b23b9d187473a648470d915521cf72419f5219c4b7 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b @@ -2136,11 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 -R 186cd14750afba6ac11c0a47787c2fc3 -T *branch * jni-post-3.44 -T *sym-jni-post-3.44 * -T -sym-trunk * Cancelled\sby\sbranch. +P 54fce9bf04a7517cdc8e96fe2efec66f03b0d03983c3a45d0ae7e1f16aa5a6c9 +R 17c045c95304ed4e3d6135c84273c496 U stephan -Z dc6c06549901a63430a6e90b2648f01f +Z 1cc1c3ab8b0755073c3409e264c96da6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 166d31ff93..237845ed02 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -54fce9bf04a7517cdc8e96fe2efec66f03b0d03983c3a45d0ae7e1f16aa5a6c9 \ No newline at end of file +f3fb4d345bbf5ae4a35d8076043df601b1bf7dfd68760a416440139eb3e5eb9a \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 31ebbc6976..6724035fd5 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -152,7 +152,15 @@ int sqlite3_clear_bindings(sqlite3_stmt *pStmt){ int rc = SQLITE_OK; Vdbe *p = (Vdbe*)pStmt; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex; + sqlite3_mutex *mutex; +#endif +#ifdef SQLITE_ENABLE_API_ARMOR + if( pStmt==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif +#if SQLITE_THREADSAFE + mutex = p->db->mutex; #endif sqlite3_mutex_enter(mutex); for(i=0; inVar; i++){ From 32a0d6129f240829f2d8811800869f7998b4b5e8 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 13:54:26 +0000 Subject: [PATCH 140/242] JNI: add column-get bindings to the wrapper1 Stmt class and extend the AggregateFunction tests to ensure that the aggregate context is honored. FossilOrigin-Name: 60a0e82db26270af9d0a5f55c6173e4fd0bdc90a885e838480ed75f8ef193287 --- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 73 +++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 48 +++++++++--- manifest | 14 ++-- manifest.uuid | 2 +- 4 files changed, 118 insertions(+), 19 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 4cf06d355c..cefc0aa78b 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -147,10 +147,18 @@ public final class Sqlite implements AutoCloseable { public final class Stmt implements AutoCloseable { private Sqlite _db = null; private sqlite3_stmt stmt = null; + /** + We save the result column count in order to prevent having to + call into C to fetch that value every time we need to check + that value for the columnXyz() methods. + */ + private final int resultColCount; + /** Only called by the prepare() factory functions. */ Stmt(Sqlite db, sqlite3_stmt stmt){ this._db = db; this.stmt = stmt; + this.resultColCount = CApi.sqlite3_column_count(stmt); } sqlite3_stmt nativeHandle(){ @@ -168,6 +176,15 @@ public final class Sqlite implements AutoCloseable { return stmt; } + /** Throws if n is out of range of this.resultColCount. Intended + to be used by the columnXyz() methods. */ + private sqlite3_stmt checkColIndex(int n){ + if(n<0 || n>=this.resultColCount){ + throw new IllegalArgumentException("Column index "+n+" is out of range."); + } + return thisStmt(); + } + /** Corresponds to sqlite3_finalize(), but we cannot override the name finalize() here because this one requires a different @@ -211,6 +228,14 @@ public final class Sqlite implements AutoCloseable { */ public int step(){ return checkRc(sqlite3_step(thisStmt())); + /* + Potential signature change TODO: + + boolean step() + + Returning true for SQLITE_ROW and false for anything else. + Those semantics have proven useful in the WASM/JS bindings. + */ } public Sqlite db(){ return this._db; } @@ -268,6 +293,54 @@ public final class Sqlite implements AutoCloseable { checkRc(CApi.sqlite3_bind_blob(thisStmt(), ndx, bytes)); } + public byte[] columnBlob(int ndx){ + return CApi.sqlite3_column_blob( checkColIndex(ndx), ndx ); + } + public byte[] columnText(int ndx){ + return CApi.sqlite3_column_text( checkColIndex(ndx), ndx ); + } + public String columnText16(int ndx){ + return CApi.sqlite3_column_text16( checkColIndex(ndx), ndx ); + } + public int columnBytes(int ndx){ + return CApi.sqlite3_column_bytes( checkColIndex(ndx), ndx ); + } + public int columnBytes16(int ndx){ + return CApi.sqlite3_column_bytes16( checkColIndex(ndx), ndx ); + } + public int columnInt(int ndx){ + return CApi.sqlite3_column_int( checkColIndex(ndx), ndx ); + } + public long columnInt64(int ndx){ + return CApi.sqlite3_column_int64( checkColIndex(ndx), ndx ); + } + public double columnDouble(int ndx){ + return CApi.sqlite3_column_double( checkColIndex(ndx), ndx ); + } + public int columnType(int ndx){ + return CApi.sqlite3_column_type( checkColIndex(ndx), ndx ); + } + public String columnDeclType(int ndx){ + return CApi.sqlite3_column_decltype( checkColIndex(ndx), ndx ); + } + public int columnCount(){ + return resultColCount; + } + public int columnDataCount(){ + return CApi.sqlite3_data_count( thisStmt() ); + } + public String columnName(int ndx){ + return CApi.sqlite3_column_name( checkColIndex(ndx), ndx ); + } + public String columnDatabaseName(int ndx){ + return CApi.sqlite3_column_database_name( checkColIndex(ndx), ndx ); + } + public String columnOriginName(int ndx){ + return CApi.sqlite3_column_origin_name( checkColIndex(ndx), ndx ); + } + public String columnTableName(int ndx){ + return CApi.sqlite3_column_table_name( checkColIndex(ndx), ndx ); + } } /* Stmt class */ } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index cf3364bc16..6756478f58 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -230,7 +230,6 @@ public class Tester2 implements Runnable { affirm( 1==stmt.bindParameterCount() ); affirm( "?1".equals(stmt.bindParameterName(1)) ); affirm( null==stmt.bindParameterName(2) ); - stmt.bindInt(1, 1); stmt.bindInt64(1, 1); stmt.bindDouble(1, 1.1); stmt.bindObject(1, db); @@ -241,10 +240,20 @@ public class Tester2 implements Runnable { stmt.bindText16(1, "123"); stmt.bindZeroBlob(1, 8); stmt.bindBlob(1, new byte[] {1,2,3,4}); + stmt.bindInt(1, 17); try{ stmt.bindInt(2,1); } catch(Exception ex){ e = ex; } affirm( null!=e ); + e = null; affirm( CApi.SQLITE_ROW == stmt.step() ); + try{ stmt.columnInt(1); } + catch(Exception ex){ e = ex; } + affirm( null!=e ); + e = null; + affirm( 17 == stmt.columnInt(0) ); + affirm( 17L == stmt.columnInt64(0) ); + affirm( 17.0 == stmt.columnDouble(0) ); + affirm( "17".equals(stmt.columnText16(0)) ); affirm( CApi.SQLITE_DONE == stmt.step() ); stmt.reset(); affirm( CApi.SQLITE_ROW == stmt.step() ); @@ -287,12 +296,8 @@ public class Tester2 implements Runnable { } void testUdfAggregate(){ - /* FIXME/TODO: once we've added the stmt bind/step/fetch - capabilities, go back and extend these tests to correspond to - the aggregate UDF tests in ext/wasm/tester1.c-pp.js. We first - require the ability to bind/step/fetch, however. */ final ValueHolder xDestroyCalled = new ValueHolder<>(0); - final ValueHolder vh = new ValueHolder<>(0); + Sqlite.Stmt q = null; try (Sqlite db = openDb()) { execSql(db, "create table t(a); insert into t(a) values(1),(2),(3)"); final AggregateFunction f = new AggregateFunction(){ @@ -306,18 +311,39 @@ public class Tester2 implements Runnable { final Integer v = this.takeAggregateState(args); if( null==v ) args.resultNull(); else args.resultInt(v); - vh.value = v; } public void xDestroy(){ ++xDestroyCalled.value; } }; - db.createFunction("myagg", -1, f); - execSql(db, "select myagg(a) from t"); - affirm( 6 == vh.value ); + db.createFunction("summer", 1, f); + q = db.prepare( + "with cte(v) as ("+ + "select 3 union all select 5 union all select 7"+ + ") select summer(v), summer(v+1) from cte" + /* ------------------^^^^^^^^^^^ ensures that we're handling + sqlite3_aggregate_context() properly. */ + ); + affirm( CApi.SQLITE_ROW==q.step() ); + affirm( 15==q.columnInt(0) ); + q.finalizeStmt(); + q = null; affirm( 0 == xDestroyCalled.value ); + db.createFunction("summerN", -1, f); + + q = db.prepare("select summerN(1,8,9), summerN(2,3,4)"); + affirm( CApi.SQLITE_ROW==q.step() ); + affirm( 18==q.columnInt(0) ); + affirm( 9==q.columnInt(1) ); + q.finalizeStmt(); + q = null; + + }/*db*/ + finally{ + if( null!=q ) q.finalizeStmt(); } - affirm( 1 == xDestroyCalled.value ); + affirm( 2 == xDestroyCalled.value + /* because we've bound the same instance twice */ ); } private void runTests(boolean fromThread) throws Exception { diff --git a/manifest b/manifest index d4e1eb3da2..66f9eea687 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sAPI_ARMOR\sto\ssqlite3_clear_bindings(). -D 2023-10-22T13:09:37.276 +C JNI:\sadd\scolumn-get\sbindings\sto\sthe\swrapper1\sStmt\sclass\sand\sextend\sthe\sAggregateFunction\stests\sto\sensure\sthat\sthe\saggregate\scontext\sis\shonored. +D 2023-10-22T13:54:26.716 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -294,9 +294,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 004394eeb944baa56e36cd7ae69ba6d4a52b52db3c49439db16e98270b861421 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 25e4e65ba434d0e110e4adb6782e20cd374d83b7fe00ba5ca48a1dadd2fdd7dd +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b0ee72b60b2a15d3f19571213f62e560134d6517eacece73eb1299b6d9980f14 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 65437e09115bfef4445957db61fcf6dac9aad37ac00edb445c3de812e9750d6e +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 5ff33f3e31f5d88178e485ab334e8fb6ccf8ad1f6666136b4a613fec58888432 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 54fce9bf04a7517cdc8e96fe2efec66f03b0d03983c3a45d0ae7e1f16aa5a6c9 -R 17c045c95304ed4e3d6135c84273c496 +P f3fb4d345bbf5ae4a35d8076043df601b1bf7dfd68760a416440139eb3e5eb9a +R 4d4dd7480ffdece828c7f766b6d86d96 U stephan -Z 1cc1c3ab8b0755073c3409e264c96da6 +Z e88e3b32c9f23fead743fdff8331a212 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 237845ed02..32e6dcdc5e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3fb4d345bbf5ae4a35d8076043df601b1bf7dfd68760a416440139eb3e5eb9a \ No newline at end of file +60a0e82db26270af9d0a5f55c6173e4fd0bdc90a885e838480ed75f8ef193287 \ No newline at end of file From 166c8d00671fbd16057cc3dc6523af336591a1c5 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 14:25:37 +0000 Subject: [PATCH 141/242] JNI: flesh out and simplify the APIs for binding and fetching arbitrary Java objects. FossilOrigin-Name: 89fecf1dd8b97941f9b45130a3c8a67af36ec65cc6f70f5026c569c058a4963f --- ext/jni/src/c/sqlite3-jni.c | 31 +++++++++++++++--- ext/jni/src/c/sqlite3-jni.h | 8 +++++ ext/jni/src/org/sqlite/jni/capi/CApi.java | 32 ++++++++++++++++++- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 12 ++++--- .../org/sqlite/jni/wrapper1/SqlFunction.java | 6 ++-- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 6 ++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 8 +++-- manifest | 24 +++++++------- manifest.uuid | 2 +- 9 files changed, 101 insertions(+), 28 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 245ce4f9e9..86a4930917 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -1670,8 +1670,9 @@ static int encodingTypeIsValid(int eTextRep){ } } -/* For use with sqlite3_result/value_pointer() */ -static const char * const ResultJavaValuePtrStr = "org.sqlite.jni.capi.ResultJavaVal"; +/* For use with sqlite3_result_pointer(), sqlite3_value_pointer(), + sqlite3_bind_java_object(), and sqlite3_column_java_object(). */ +static const char * const s3jni__value_jref_key = "org.sqlite.jni.capi.ResultJavaVal"; /* ** If v is not NULL, it must be a jobject global reference. Its @@ -2418,7 +2419,7 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)( if(pStmt){ jobject const rv = S3JniRefGlobal(val); if( rv ){ - rc = sqlite3_bind_pointer(pStmt, ndx, rv, ResultJavaValuePtrStr, + rc = sqlite3_bind_pointer(pStmt, ndx, rv, s3jni__value_jref_key, S3Jni_jobject_finalizer); }else if(val){ rc = SQLITE_NOMEM; @@ -2870,6 +2871,26 @@ S3JniApi(sqlite3_column_int64(),jlong,1column_1int64)( return (jlong)sqlite3_column_int64(PtrGet_sqlite3_stmt(jpStmt), (int)ndx); } +S3JniApi(sqlite3_column_java_object(),jobject,1column_1java_1object)( + JniArgsEnvClass, jlong jpStmt, jint ndx +){ + sqlite3_stmt * const stmt = S3JniLongPtr_sqlite3_stmt(jpStmt); + jobject rv = 0; + if( stmt ){ + sqlite3 * const db = sqlite3_db_handle(stmt); + sqlite3_value * sv; + sqlite3_mutex_enter(sqlite3_db_mutex(db)); + sv = sqlite3_column_value(stmt, (int)ndx); + if( sv ){ + rv = S3JniRefLocal( + sqlite3_value_pointer(sv, s3jni__value_jref_key) + ); + } + sqlite3_mutex_leave(sqlite3_db_mutex(db)); + } + return rv; +} + S3JniApi(sqlite3_column_text(),jbyteArray,1column_1text)( JniArgsEnvClass, jobject jpStmt, jint ndx ){ @@ -4351,7 +4372,7 @@ S3JniApi(sqlite3_result_java_object(),void,1result_1java_1object)( jobject const rjv = S3JniRefGlobal(v); if( rjv ){ sqlite3_result_pointer(pCx, rjv, - ResultJavaValuePtrStr, S3Jni_jobject_finalizer); + s3jni__value_jref_key, S3Jni_jobject_finalizer); }else{ sqlite3_result_error_nomem(PtrGet_sqlite3_context(jpCx)); } @@ -4889,7 +4910,7 @@ S3JniApi(sqlite3_value_java_object(),jobject,1value_1java_1object)( ){ sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal); return sv - ? sqlite3_value_pointer(sv, ResultJavaValuePtrStr) + ? sqlite3_value_pointer(sv, s3jni__value_jref_key) : 0; } diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index bf6df7ac94..6c4d07fc43 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1119,6 +1119,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int JNIEXPORT jlong JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1int64 (JNIEnv *, jclass, jobject, jint); +/* + * Class: org_sqlite_jni_capi_CApi + * Method: sqlite3_column_java_object + * Signature: (JI)Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1column_1java_1object + (JNIEnv *, jclass, jlong, jint); + /* * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_column_name diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index 302cdb760e..ff5da01c65 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -595,6 +595,36 @@ public final class CApi { @NotNull sqlite3_stmt stmt, int ndx ); + static native Object sqlite3_column_java_object( + @NotNull long ptrToStmt, int ndx + ); + + /** + If the given result column was bound with + sqlite3_bind_java_object() or sqlite3_result_java_object() then + that object is returned, else null is returned. This routine + requires locking the owning database's mutex briefly in order to + extract the object in a thread-safe way. + */ + public static Object sqlite3_column_java_object( + @NotNull sqlite3_stmt stmt, int ndx + ){ + return sqlite3_column_java_object( stmt.getNativePointer(), ndx ); + } + + /** + If the two-parameter overload of sqlite3_column_java_object() + returns non-null and the returned value is an instance of T then + that object is returned, else null is returned. + */ + @SuppressWarnings("unchecked") + public static T sqlite3_column_java_object( + @NotNull sqlite3_stmt stmt, int ndx, @NotNull Class type + ){ + final Object o = sqlite3_column_java_object(stmt, ndx); + return type.isInstance(o) ? (T)o : null; + } + static native String sqlite3_column_name(@NotNull long ptrToStmt, int ndx); public static String sqlite3_column_name(@NotNull sqlite3_stmt stmt, int ndx){ @@ -1938,7 +1968,7 @@ public final class CApi { given Class, else it returns null. */ @SuppressWarnings("unchecked") - public static T sqlite3_value_java_casted(@NotNull sqlite3_value v, + public static T sqlite3_value_java_object(@NotNull sqlite3_value v, @NotNull Class type){ final Object o = sqlite3_value_java_object(v); return type.isInstance(o) ? (T)o : null; diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 6fb28e65b9..b1d8df11cd 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -803,13 +803,17 @@ public class Tester1 implements Runnable { affirm( 0==rc ); int n = 0; if( SQLITE_ROW == sqlite3_step(stmt) ){ + affirm( testResult.value == sqlite3_column_java_object(stmt, 0) ); + affirm( testResult.value == sqlite3_column_java_object(stmt, 0, sqlite3.class) ); + affirm( null == sqlite3_column_java_object(stmt, 0, sqlite3_stmt.class) ); + affirm( null == sqlite3_column_java_object(stmt,1) ); final sqlite3_value v = sqlite3_column_value(stmt, 0); affirm( testResult.value == sqlite3_value_java_object(v) ); - affirm( testResult.value == sqlite3_value_java_casted(v, sqlite3.class) ); + affirm( testResult.value == sqlite3_value_java_object(v, sqlite3.class) ); affirm( testResult.value == - sqlite3_value_java_casted(v, testResult.value.getClass()) ); - affirm( testResult.value == sqlite3_value_java_casted(v, Object.class) ); - affirm( null == sqlite3_value_java_casted(v, String.class) ); + sqlite3_value_java_object(v, testResult.value.getClass()) ); + affirm( testResult.value == sqlite3_value_java_object(v, Object.class) ); + affirm( null == sqlite3_value_java_object(v, String.class) ); ++n; } sqlite3_finalize(stmt); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index d6acda5aa5..2e0be3cd63 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -72,7 +72,7 @@ public interface SqlFunction { public int getBytes(){return a.getBytes(ndx);} public int getBytes16(){return a.getBytes16(ndx);} public Object getObject(){return a.getObject(ndx);} - public T getObjectCasted(Class type){ return a.getObjectCasted(ndx, type); } + public T getObject(Class type){ return a.getObject(ndx, type); } public int getType(){return a.getType(ndx);} public Object getAuxData(){return a.getAuxData(ndx);} public void setAuxData(Object o){a.setAuxData(ndx, o);} @@ -113,8 +113,8 @@ public interface SqlFunction { public int getBytes(int arg){return CApi.sqlite3_value_bytes(valueAt(arg));} public int getBytes16(int arg){return CApi.sqlite3_value_bytes16(valueAt(arg));} public Object getObject(int arg){return CApi.sqlite3_value_java_object(valueAt(arg));} - public T getObjectCasted(int arg, Class type){ - return CApi.sqlite3_value_java_casted(valueAt(arg), type); + public T getObject(int arg, Class type){ + return CApi.sqlite3_value_java_object(valueAt(arg), type); } public int getType(int arg){return CApi.sqlite3_value_type(valueAt(arg));} diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index cefc0aa78b..25628e0805 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -329,6 +329,12 @@ public final class Sqlite implements AutoCloseable { public int columnDataCount(){ return CApi.sqlite3_data_count( thisStmt() ); } + public Object columnObject(int ndx){ + return CApi.sqlite3_column_java_object( checkColIndex(ndx), ndx ); + } + public T columnObject(int ndx, Class type){ + return CApi.sqlite3_column_java_object( checkColIndex(ndx), ndx, type ); + } public String columnName(int ndx){ return CApi.sqlite3_column_name( checkColIndex(ndx), ndx ); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 6756478f58..8fb36a3b54 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -261,9 +261,13 @@ public class Tester2 implements Runnable { affirm( 0 == stmt.finalizeStmt() ); affirm( null==stmt.nativeHandle() ); - stmt = db.prepare("SELECT 1"); + stmt = db.prepare("SELECT ?"); + stmt.bindObject(1, db); affirm( CApi.SQLITE_ROW == stmt.step() ); - affirm( 0 == stmt.finalizeStmt() ) + affirm( db==stmt.columnObject(0) ); + affirm( db==stmt.columnObject(0, Sqlite.class ) ); + affirm( null==stmt.columnObject(0, Sqlite.Stmt.class ) ); + affirm( 0==stmt.finalizeStmt() ) /* getting a non-0 out of sqlite3_finalize() is tricky */; affirm( null==stmt.nativeHandle() ); } diff --git a/manifest b/manifest index 66f9eea687..d20131a353 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sadd\scolumn-get\sbindings\sto\sthe\swrapper1\sStmt\sclass\sand\sextend\sthe\sAggregateFunction\stests\sto\sensure\sthat\sthe\saggregate\scontext\sis\shonored. -D 2023-10-22T13:54:26.716 +C JNI:\sflesh\sout\sand\ssimplify\sthe\sAPIs\sfor\sbinding\sand\sfetching\sarbitrary\sJava\sobjects. +D 2023-10-22T14:25:37.634 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -239,8 +239,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 5c3ac326bf3853486ebe0d70819abc790cc65c412182ce4ebd5012b008d9b059 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 6f6df9657989e9ca2cfdcc2fe9a71c279de56d5c941adfd09a0f24256de35c8f -F ext/jni/src/c/sqlite3-jni.h b4c413a0d0c734683da1049cfcf89e35ae2719759d0656ec0f8c57188f18cab8 +F ext/jni/src/c/sqlite3-jni.c dcd6534b65b732ad927a49185c76c76abbd5ccadfa972d02f699abc45678e329 +F ext/jni/src/c/sqlite3-jni.h e839090f5ec35aa96983a5621659e55ef897dc0522242fd00f107028ef5e7dd5 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca @@ -249,7 +249,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f93 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java bccb442ca81cd4decb1adae99006a60b7a9f54e5153842e738c01104e97d1de0 +F ext/jni/src/org/sqlite/jni/capi/CApi.java f23e8139cdb1d9c850f28ccf95384e37239cee47fd683bfb199f50aa7ce011fc F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -267,7 +267,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bd F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java ca195521b6bda3e0cd00e76bb71ec8060d1fab76a2f13b1af9feea40789f44bb +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 5c4e7ba5034aeb5c5be0361b9fa0c23fe993774e634750c775d7ad8fa19b22f3 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 9f9e151f1da017b706c0ee5f40f4c86b54e773d6ae4339723e0cc85a456251ab @@ -293,10 +293,10 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ad F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 004394eeb944baa56e36cd7ae69ba6d4a52b52db3c49439db16e98270b861421 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b0ee72b60b2a15d3f19571213f62e560134d6517eacece73eb1299b6d9980f14 +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 92c28b9de358407c8c5e772e0408db528e47eeeb50ffd87b86563a5f078198ad +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 882e345d925a79b575b1182efd816dcc72d6814922b4f58e7f4d29f04ece1f64 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 5ff33f3e31f5d88178e485ab334e8fb6ccf8ad1f6666136b4a613fec58888432 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java e224efb77dae2f0abe18f2010c0eb5a09df991f2743597a1aff7f9283f71da7d F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f3fb4d345bbf5ae4a35d8076043df601b1bf7dfd68760a416440139eb3e5eb9a -R 4d4dd7480ffdece828c7f766b6d86d96 +P 60a0e82db26270af9d0a5f55c6173e4fd0bdc90a885e838480ed75f8ef193287 +R 5a1e4de3384c2859d02b694c480544f0 U stephan -Z e88e3b32c9f23fead743fdff8331a212 +Z 0b6f35d12f929147f1a8dbbd84db96f1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 32e6dcdc5e..a425b28981 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -60a0e82db26270af9d0a5f55c6173e4fd0bdc90a885e838480ed75f8ef193287 \ No newline at end of file +89fecf1dd8b97941f9b45130a3c8a67af36ec65cc6f70f5026c569c058a4963f \ No newline at end of file From a63539143da79df705746156923a6bfd8248932f Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 22 Oct 2023 17:27:55 +0000 Subject: [PATCH 142/242] Do not do backslash excape processing on any unquoted strings in dot-commands in the CLI - on Windows or on posix-like systems either one. This brings the processing into alignment with the documentation, allows backslash-delimited filenames on Windows (as long as they are unquoted), and causes the CLI to work the same with regard to backslash escapes on both Windows and posix. FossilOrigin-Name: bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 3 --- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 16ecd5eb71..394fca4ea2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\simprove\sUB\sprotections\sin\ssqlite3_bind_blob/text/text16(). -D 2023-10-22T12:33:05.772 +C Do\snot\sdo\sbackslash\sexcape\sprocessing\son\sany\sunquoted\sstrings\sin\sdot-commands\nin\sthe\sCLI\s-\son\sWindows\sor\son\sposix-like\ssystems\seither\sone.\s\sThis\sbrings\sthe\nprocessing\sinto\salignment\swith\sthe\sdocumentation,\sallows\sbackslash-delimited\nfilenames\son\sWindows\s(as\slong\sas\sthey\sare\sunquoted),\sand\scauses\sthe\sCLI\sto\swork\nthe\ssame\swith\sregard\sto\sbackslash\sescapes\son\sboth\sWindows\sand\sposix. +D 2023-10-22T17:27:55.683 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 -F src/shell.c.in 3399636eedfea4e7f7dfd07634615b6175b6b2228ab236d737f7a656b2c4fc2d +F src/shell.c.in 66995332610ed7d47483152c4c78810519ca9ac8b2f93ee884127ce330ca12e8 F src/sqlite.h.in b37b3df6fb0684929446c095e81287fbdffd64f55481e4195ee7768f2f0ae72e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b8258103fb433d9f5cfa15661b5edf4e60128fb4161d8a18e5cc3253e5aed72b -R 10dd3eddc3858c0c90f96d7af2dd213f -U stephan -Z 39a3acd541e66480809465cadb3002fa +P 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 +R d2a23c5e194f0fe63ea38e6c9b5e3aea +U drh +Z ef79587c1d70c03b11d881794d008e37 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bcfb4efa95..03c43b5e5f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 \ No newline at end of file +bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index f314a2ea35..50f78acca8 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -8033,9 +8033,6 @@ static int do_meta_command(char *zLine, ShellState *p){ azArg[nArg++] = &zLine[h]; while( zLine[h] && !IsSpace(zLine[h]) ){ h++; } if( zLine[h] ) zLine[h++] = 0; -#ifndef _WIN32 /* Don't convert bare \ on Windows - doing so damages filenames */ - resolve_backslashes(azArg[nArg-1]); -#endif } } azArg[nArg] = 0; From 96aa4d344d46444042960b8e0bc373b551125e73 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 22 Oct 2023 23:36:16 +0000 Subject: [PATCH 143/242] Add high-level window function wrapper to the JNI wrapper1 interface. FossilOrigin-Name: a27e7471231a24864cbd04b77cbc4b336ce180d738a36ce4318543e2666ed708 --- ext/jni/GNUmakefile | 1 + .../sqlite/jni/capi/AggregateFunction.java | 70 ++++- .../src/org/sqlite/jni/capi/SQLFunction.java | 67 ----- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 1 - .../jni/wrapper1/AggregateFunction.java | 70 ++++- .../org/sqlite/jni/wrapper1/SqlFunction.java | 282 +++++++++--------- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 34 ++- .../src/org/sqlite/jni/wrapper1/Tester2.java | 86 +++++- .../sqlite/jni/wrapper1/WindowFunction.java | 46 +++ manifest | 27 +- manifest.uuid | 2 +- 11 files changed, 436 insertions(+), 250 deletions(-) create mode 100644 ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 19a5080471..155e4e7f63 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -120,6 +120,7 @@ JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\ Sqlite.java \ SqliteException.java \ ValueHolder.java \ + WindowFunction.java \ ) JAVA_FILES.unittest := $(patsubst %,$(dir.src.jni)/%,\ diff --git a/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java b/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java index 89c4f27421..1fa6c6b805 100644 --- a/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java @@ -42,9 +42,75 @@ public abstract class AggregateFunction implements SQLFunction { */ public void xDestroy() {} + /** + PerContextState assists aggregate and window functions in + managing their accumulator state across calls to the UDF's + callbacks. + +

    T must be of a type which can be legally stored as a value in + java.util.HashMap. + +

    If a given aggregate or window function is called multiple times + in a single SQL statement, e.g. SELECT MYFUNC(A), MYFUNC(B)..., + then the clients need some way of knowing which call is which so + that they can map their state between their various UDF callbacks + and reset it via xFinal(). This class takes care of such + mappings. + +

    This class works by mapping + sqlite3_context.getAggregateContext() to a single piece of + state, of a client-defined type (the T part of this class), which + persists across a "matching set" of the UDF's callbacks. + +

    This class is a helper providing commonly-needed functionality + - it is not required for use with aggregate or window functions. + Client UDFs are free to perform such mappings using custom + approaches. The provided {@link AggregateFunction} and {@link + WindowFunction} classes use this. + */ + public static final class PerContextState { + private final java.util.Map> map + = new java.util.HashMap<>(); + + /** + Should be called from a UDF's xStep(), xValue(), and xInverse() + methods, passing it that method's first argument and an initial + value for the persistent state. If there is currently no + mapping for the given context within the map, one is created + using the given initial value, else the existing one is used + and the 2nd argument is ignored. It returns a ValueHolder + which can be used to modify that state directly without + requiring that the client update the underlying map's entry. + +

    The caller is obligated to eventually call + takeAggregateState() to clear the mapping. + */ + public ValueHolder getAggregateState(sqlite3_context cx, T initialValue){ + final Long key = cx.getAggregateContext(true); + ValueHolder rc = null==key ? null : map.get(key); + if( null==rc ){ + map.put(key, rc = new ValueHolder<>(initialValue)); + } + return rc; + } + + /** + Should be called from a UDF's xFinal() method and passed that + method's first argument. This function removes the value + associated with cx.getAggregateContext() from the map and + returns it, returning null if no other UDF method has been + called to set up such a mapping. The latter condition will be + the case if a UDF is used in a statement which has no result + rows. + */ + public T takeAggregateState(sqlite3_context cx){ + final ValueHolder h = map.remove(cx.getAggregateContext(false)); + return null==h ? null : h.value; + } + } + /** Per-invocation state for the UDF. */ - private final SQLFunction.PerContextState map = - new SQLFunction.PerContextState<>(); + private final PerContextState map = new PerContextState<>(); /** To be called from the implementation's xStep() method, as well diff --git a/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java b/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java index 4806e2fc0c..7ad1381a7a 100644 --- a/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java +++ b/ext/jni/src/org/sqlite/jni/capi/SQLFunction.java @@ -33,71 +33,4 @@ package org.sqlite.jni.capi; */ public interface SQLFunction { - /** - PerContextState assists aggregate and window functions in - managing their accumulator state across calls to the UDF's - callbacks. - -

    T must be of a type which can be legally stored as a value in - java.util.HashMap. - -

    If a given aggregate or window function is called multiple times - in a single SQL statement, e.g. SELECT MYFUNC(A), MYFUNC(B)..., - then the clients need some way of knowing which call is which so - that they can map their state between their various UDF callbacks - and reset it via xFinal(). This class takes care of such - mappings. - -

    This class works by mapping - sqlite3_context.getAggregateContext() to a single piece of - state, of a client-defined type (the T part of this class), which - persists across a "matching set" of the UDF's callbacks. - -

    This class is a helper providing commonly-needed functionality - - it is not required for use with aggregate or window functions. - Client UDFs are free to perform such mappings using custom - approaches. The provided {@link AggregateFunction} and {@link - WindowFunction} classes use this. - */ - public static final class PerContextState { - private final java.util.Map> map - = new java.util.HashMap<>(); - - /** - Should be called from a UDF's xStep(), xValue(), and xInverse() - methods, passing it that method's first argument and an initial - value for the persistent state. If there is currently no - mapping for the given context within the map, one is created - using the given initial value, else the existing one is used - and the 2nd argument is ignored. It returns a ValueHolder - which can be used to modify that state directly without - requiring that the client update the underlying map's entry. - -

    The caller is obligated to eventually call - takeAggregateState() to clear the mapping. - */ - public ValueHolder getAggregateState(sqlite3_context cx, T initialValue){ - final Long key = cx.getAggregateContext(true); - ValueHolder rc = null==key ? null : map.get(key); - if( null==rc ){ - map.put(key, rc = new ValueHolder<>(initialValue)); - } - return rc; - } - - /** - Should be called from a UDF's xFinal() method and passed that - method's first argument. This function removes the value - associated with cx.getAggregateContext() from the map and - returns it, returning null if no other UDF method has been - called to set up such a mapping. The latter condition will be - the case if a UDF is used in a statement which has no result - rows. - */ - public T takeAggregateState(sqlite3_context cx){ - final ValueHolder h = map.remove(cx.getAggregateContext(false)); - return null==h ? null : h.value; - } - } - } diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index b1d8df11cd..4657185658 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -929,7 +929,6 @@ public class Tester1 implements Runnable { "ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING"+ ") AS sum_y "+ "FROM twin ORDER BY x;"); - affirm( 0 == rc ); int n = 0; while( SQLITE_ROW == sqlite3_step(stmt) ){ final String s = sqlite3_column_text16(stmt, 0); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java index 173d775e62..6a38d4b530 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java @@ -51,9 +51,75 @@ public abstract class AggregateFunction implements SqlFunction { */ public void xDestroy() {} + /** + PerContextState assists aggregate and window functions in + managing their accumulator state across calls to the UDF's + callbacks. + +

    T must be of a type which can be legally stored as a value in + java.util.HashMap. + +

    If a given aggregate or window function is called multiple times + in a single SQL statement, e.g. SELECT MYFUNC(A), MYFUNC(B)..., + then the clients need some way of knowing which call is which so + that they can map their state between their various UDF callbacks + and reset it via xFinal(). This class takes care of such + mappings. + +

    This class works by mapping + sqlite3_context.getAggregateContext() to a single piece of + state, of a client-defined type (the T part of this class), which + persists across a "matching set" of the UDF's callbacks. + +

    This class is a helper providing commonly-needed functionality + - it is not required for use with aggregate or window functions. + Client UDFs are free to perform such mappings using custom + approaches. The provided {@link AggregateFunction} and {@link + WindowFunction} classes use this. + */ + public static final class PerContextState { + private final java.util.Map> map + = new java.util.HashMap<>(); + + /** + Should be called from a UDF's xStep(), xValue(), and xInverse() + methods, passing it that method's first argument and an initial + value for the persistent state. If there is currently no + mapping for the given context within the map, one is created + using the given initial value, else the existing one is used + and the 2nd argument is ignored. It returns a ValueHolder + which can be used to modify that state directly without + requiring that the client update the underlying map's entry. + +

    The caller is obligated to eventually call + takeAggregateState() to clear the mapping. + */ + public ValueHolder getAggregateState(SqlFunction.Arguments args, T initialValue){ + final Long key = args.getContext().getAggregateContext(true); + ValueHolder rc = null==key ? null : map.get(key); + if( null==rc ){ + map.put(key, rc = new ValueHolder<>(initialValue)); + } + return rc; + } + + /** + Should be called from a UDF's xFinal() method and passed that + method's first argument. This function removes the value + associated with with the arguments' aggregate context from the + map and returns it, returning null if no other UDF method has + been called to set up such a mapping. The latter condition will + be the case if a UDF is used in a statement which has no result + rows. + */ + public T takeAggregateState(SqlFunction.Arguments args){ + final ValueHolder h = map.remove(args.getContext().getAggregateContext(false)); + return null==h ? null : h.value; + } + } + /** Per-invocation state for the UDF. */ - private final SqlFunction.PerContextState map = - new SqlFunction.PerContextState<>(); + private final PerContextState map = new PerContextState<>(); /** To be called from the implementation's xStep() method, as well diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 2e0be3cd63..311fdcff0e 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -22,6 +22,17 @@ import org.sqlite.jni.capi.sqlite3_value; */ public interface SqlFunction { + public static final int DETERMINISTIC = CApi.SQLITE_DETERMINISTIC; + public static final int INNOCUOUS = CApi.SQLITE_INNOCUOUS; + public static final int DIRECTONLY = CApi.SQLITE_DIRECTONLY; + public static final int UTF8 = CApi.SQLITE_UTF8; + public static final int UTF16 = CApi.SQLITE_UTF16; + // /** + // For Window functions only and is not currently bound because + // doing so may require exposing sqlite3_value for effective use. + // */ + // public static final int SUBTYPE = CApi.SQLITE_SUBTYPE; + /** The Arguments type is an abstraction on top of the lower-level UDF function argument types. It provides _most_ of the functionality @@ -49,6 +60,82 @@ public interface SqlFunction { this.length = this.args.length; } + /** + Returns the sqlite3_value at the given argument index or throws + an IllegalArgumentException exception if ndx is out of range. + */ + private sqlite3_value valueAt(int ndx){ + if(ndx<0 || ndx>=args.length){ + throw new IllegalArgumentException( + "SQL function argument index "+ndx+" is out of range." + ); + } + return args[ndx]; + } + + //! Returns the underlying sqlite3_context for these arguments. + sqlite3_context getContext(){return cx;} + + public int getArgCount(){ return args.length; } + + public int getInt(int argNdx){return CApi.sqlite3_value_int(valueAt(argNdx));} + public long getInt64(int argNdx){return CApi.sqlite3_value_int64(valueAt(argNdx));} + public double getDouble(int argNdx){return CApi.sqlite3_value_double(valueAt(argNdx));} + public byte[] getBlob(int argNdx){return CApi.sqlite3_value_blob(valueAt(argNdx));} + public byte[] getText(int argNdx){return CApi.sqlite3_value_text(valueAt(argNdx));} + public String getText16(int argNdx){return CApi.sqlite3_value_text16(valueAt(argNdx));} + public int getBytes(int argNdx){return CApi.sqlite3_value_bytes(valueAt(argNdx));} + public int getBytes16(int argNdx){return CApi.sqlite3_value_bytes16(valueAt(argNdx));} + public Object getObject(int argNdx){return CApi.sqlite3_value_java_object(valueAt(argNdx));} + public T getObject(int argNdx, Class type){ + return CApi.sqlite3_value_java_object(valueAt(argNdx), type); + } + + public int getType(int argNdx){return CApi.sqlite3_value_type(valueAt(argNdx));} + public int getSubtype(int argNdx){return CApi.sqlite3_value_subtype(valueAt(argNdx));} + public int getNumericType(int argNdx){return CApi.sqlite3_value_numeric_type(valueAt(argNdx));} + public int getNoChange(int argNdx){return CApi.sqlite3_value_nochange(valueAt(argNdx));} + public boolean getFromBind(int argNdx){return CApi.sqlite3_value_frombind(valueAt(argNdx));} + public int getEncoding(int argNdx){return CApi.sqlite3_value_encoding(valueAt(argNdx));} + + public void resultInt(int v){ CApi.sqlite3_result_int(cx, v); } + public void resultInt64(long v){ CApi.sqlite3_result_int64(cx, v); } + public void resultDouble(double v){ CApi.sqlite3_result_double(cx, v); } + public void resultError(String msg){CApi.sqlite3_result_error(cx, msg);} + public void resultError(Exception e){CApi.sqlite3_result_error(cx, e);} + public void resultErrorTooBig(){CApi.sqlite3_result_error_toobig(cx);} + public void resultErrorCode(int rc){CApi.sqlite3_result_error_code(cx, rc);} + public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} + public void resultNull(){CApi.sqlite3_result_null(cx);} + public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} + public void resultZeroBlob(long n){ + // Throw on error? If n is too big, + // sqlite3_result_error_toobig() is automatically called. + CApi.sqlite3_result_zeroblob64(cx, n); + } + + public void resultBlob(byte[] blob){CApi.sqlite3_result_blob(cx, blob);} + public void resultText(byte[] utf8){CApi.sqlite3_result_text(cx, utf8);} + public void resultText(String txt){CApi.sqlite3_result_text(cx, txt);} + public void resultText16(byte[] utf16){CApi.sqlite3_result_text16(cx, utf16);} + public void resultText16(String txt){CApi.sqlite3_result_text16(cx, txt);} + + public void setAuxData(int argNdx, Object o){ + /* From the API docs: https://www.sqlite.org/c3ref/get_auxdata.html + + The value of the N parameter to these interfaces should be + non-negative. Future enhancements may make use of negative N + values to define new kinds of function caching behavior. + */ + valueAt(argNdx); + CApi.sqlite3_set_auxdata(cx, argNdx, o); + } + + public Object getAuxData(int argNdx){ + valueAt(argNdx); + return CApi.sqlite3_get_auxdata(cx, argNdx); + } + /** Wrapper for a single SqlFunction argument. Primarily intended for use with the Arguments class's Iterable interface. @@ -87,147 +174,6 @@ public interface SqlFunction { return java.util.Arrays.stream(proxies).iterator(); } - /** - Returns the sqlite3_value at the given argument index or throws - an IllegalArgumentException exception if ndx is out of range. - */ - private sqlite3_value valueAt(int ndx){ - if(ndx<0 || ndx>=args.length){ - throw new IllegalArgumentException( - "SQL function argument index "+ndx+" is out of range." - ); - } - return args[ndx]; - } - - sqlite3_context getContext(){return cx;} - - public int getArgCount(){ return args.length; } - - public int getInt(int arg){return CApi.sqlite3_value_int(valueAt(arg));} - public long getInt64(int arg){return CApi.sqlite3_value_int64(valueAt(arg));} - public double getDouble(int arg){return CApi.sqlite3_value_double(valueAt(arg));} - public byte[] getBlob(int arg){return CApi.sqlite3_value_blob(valueAt(arg));} - public byte[] getText(int arg){return CApi.sqlite3_value_text(valueAt(arg));} - public String getText16(int arg){return CApi.sqlite3_value_text16(valueAt(arg));} - public int getBytes(int arg){return CApi.sqlite3_value_bytes(valueAt(arg));} - public int getBytes16(int arg){return CApi.sqlite3_value_bytes16(valueAt(arg));} - public Object getObject(int arg){return CApi.sqlite3_value_java_object(valueAt(arg));} - public T getObject(int arg, Class type){ - return CApi.sqlite3_value_java_object(valueAt(arg), type); - } - - public int getType(int arg){return CApi.sqlite3_value_type(valueAt(arg));} - public int getSubtype(int arg){return CApi.sqlite3_value_subtype(valueAt(arg));} - public int getNumericType(int arg){return CApi.sqlite3_value_numeric_type(valueAt(arg));} - public int getNoChange(int arg){return CApi.sqlite3_value_nochange(valueAt(arg));} - public boolean getFromBind(int arg){return CApi.sqlite3_value_frombind(valueAt(arg));} - public int getEncoding(int arg){return CApi.sqlite3_value_encoding(valueAt(arg));} - - public void resultInt(int v){ CApi.sqlite3_result_int(cx, v); } - public void resultInt64(long v){ CApi.sqlite3_result_int64(cx, v); } - public void resultDouble(double v){ CApi.sqlite3_result_double(cx, v); } - public void resultError(String msg){CApi.sqlite3_result_error(cx, msg);} - public void resultError(Exception e){CApi.sqlite3_result_error(cx, e);} - public void resultErrorTooBig(){CApi.sqlite3_result_error_toobig(cx);} - public void resultErrorCode(int rc){CApi.sqlite3_result_error_code(cx, rc);} - public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} - public void resultNull(){CApi.sqlite3_result_null(cx);} - public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} - public void resultZeroBlob(long n){ - // Throw on error? If n is too big, - // sqlite3_result_error_toobig() is automatically called. - CApi.sqlite3_result_zeroblob64(cx, n); - } - - public void resultBlob(byte[] blob){CApi.sqlite3_result_blob(cx, blob);} - public void resultText(byte[] utf8){CApi.sqlite3_result_text(cx, utf8);} - public void resultText(String txt){CApi.sqlite3_result_text(cx, txt);} - public void resultText16(byte[] utf16){CApi.sqlite3_result_text16(cx, utf16);} - public void resultText16(String txt){CApi.sqlite3_result_text16(cx, txt);} - - public void setAuxData(int arg, Object o){ - /* From the API docs: https://www.sqlite.org/c3ref/get_auxdata.html - - The value of the N parameter to these interfaces should be - non-negative. Future enhancements may make use of negative N - values to define new kinds of function caching behavior. - */ - valueAt(arg); - CApi.sqlite3_set_auxdata(cx, arg, o); - } - - public Object getAuxData(int arg){ - valueAt(arg); - return CApi.sqlite3_get_auxdata(cx, arg); - } - } - - /** - PerContextState assists aggregate and window functions in - managing their accumulator state across calls to the UDF's - callbacks. - -

    T must be of a type which can be legally stored as a value in - java.util.HashMap. - -

    If a given aggregate or window function is called multiple times - in a single SQL statement, e.g. SELECT MYFUNC(A), MYFUNC(B)..., - then the clients need some way of knowing which call is which so - that they can map their state between their various UDF callbacks - and reset it via xFinal(). This class takes care of such - mappings. - -

    This class works by mapping - sqlite3_context.getAggregateContext() to a single piece of - state, of a client-defined type (the T part of this class), which - persists across a "matching set" of the UDF's callbacks. - -

    This class is a helper providing commonly-needed functionality - - it is not required for use with aggregate or window functions. - Client UDFs are free to perform such mappings using custom - approaches. The provided {@link AggregateFunction} and {@link - WindowFunction} classes use this. - */ - public static final class PerContextState { - private final java.util.Map> map - = new java.util.HashMap<>(); - - /** - Should be called from a UDF's xStep(), xValue(), and xInverse() - methods, passing it that method's first argument and an initial - value for the persistent state. If there is currently no - mapping for the given context within the map, one is created - using the given initial value, else the existing one is used - and the 2nd argument is ignored. It returns a ValueHolder - which can be used to modify that state directly without - requiring that the client update the underlying map's entry. - -

    The caller is obligated to eventually call - takeAggregateState() to clear the mapping. - */ - public ValueHolder getAggregateState(SqlFunction.Arguments args, T initialValue){ - final Long key = args.getContext().getAggregateContext(true); - ValueHolder rc = null==key ? null : map.get(key); - if( null==rc ){ - map.put(key, rc = new ValueHolder<>(initialValue)); - } - return rc; - } - - /** - Should be called from a UDF's xFinal() method and passed that - method's first argument. This function removes the value - associated with with the arguments' aggregate context from the - map and returns it, returning null if no other UDF method has - been called to set up such a mapping. The latter condition will - be the case if a UDF is used in a statement which has no result - rows. - */ - public T takeAggregateState(SqlFunction.Arguments args){ - final ValueHolder h = map.remove(args.getContext().getAggregateContext(false)); - return null==h ? null : h.value; - } } /** @@ -235,7 +181,7 @@ public interface SqlFunction { for use with the org.sqlite.jni.capi.ScalarFunction interface. */ static final class ScalarAdapter extends org.sqlite.jni.capi.ScalarFunction { - final ScalarFunction impl; + private final ScalarFunction impl; ScalarAdapter(ScalarFunction impl){ this.impl = impl; } @@ -261,8 +207,9 @@ public interface SqlFunction { Internal-use adapter for wrapping this package's AggregateFunction for use with the org.sqlite.jni.capi.AggregateFunction interface. */ - static final class AggregateAdapter extends org.sqlite.jni.capi.AggregateFunction { - final AggregateFunction impl; + static /*cannot be final without duplicating the whole body in WindowAdapter*/ + class AggregateAdapter extends org.sqlite.jni.capi.AggregateFunction { + private final AggregateFunction impl; AggregateAdapter(AggregateFunction impl){ this.impl = impl; } @@ -282,8 +229,9 @@ public interface SqlFunction { } /** - As for the xFinal() argument of the C API's sqlite3_create_function(). - If the proxied function throws, it is translated into a sqlite3_result_error(). + As for the xFinal() argument of the C API's + sqlite3_create_function(). If the proxied function throws, it + is translated into a sqlite3_result_error(). */ public void xFinal(sqlite3_context cx){ try{ @@ -298,4 +246,46 @@ public interface SqlFunction { } } + /** + Internal-use adapter for wrapping this package's WindowFunction + for use with the org.sqlite.jni.capi.WindowFunction interface. + */ + static final class WindowAdapter extends AggregateAdapter { + private final WindowFunction impl; + WindowAdapter(WindowFunction impl){ + super(impl); + this.impl = impl; + } + + /** + Proxies this.impl.xInverse(), adapting the call arguments to that + function's signature. If the proxied function throws, it is + translated to sqlite_result_error() with the exception's + message. + */ + public void xInverse(sqlite3_context cx, sqlite3_value[] args){ + try{ + impl.xInverse( new SqlFunction.Arguments(cx, args) ); + }catch(Exception e){ + CApi.sqlite3_result_error(cx, e); + } + } + + /** + As for the xValue() argument of the C API's sqlite3_create_window_function(). + If the proxied function throws, it is translated into a sqlite3_result_error(). + */ + public void xValue(sqlite3_context cx){ + try{ + impl.xValue( new SqlFunction.Arguments(cx, null) ); + }catch(Exception e){ + CApi.sqlite3_result_error(cx, e); + } + } + + public void xDestroy(){ + impl.xDestroy(); + } + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 25628e0805..016eb0b89c 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -29,6 +29,10 @@ import org.sqlite.jni.capi.OutputPointer; public final class Sqlite implements AutoCloseable { private sqlite3 db; + public static final int OPEN_READWRITE = CApi.SQLITE_OPEN_READWRITE; + public static final int OPEN_CREATE = CApi.SQLITE_OPEN_CREATE; + public static final int OPEN_EXRESCODE = CApi.SQLITE_OPEN_EXRESCODE; + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; @@ -120,7 +124,7 @@ public final class Sqlite implements AutoCloseable { return prepare(sql, 0); } - public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f ){ + public void createFunction(String name, int nArg, int eTextRep, ScalarFunction f){ int rc = CApi.sqlite3_create_function(thisDb(), name, nArg, eTextRep, new SqlFunction.ScalarAdapter(f)); if( 0!=rc ) throw new SqliteException(db); @@ -130,7 +134,7 @@ public final class Sqlite implements AutoCloseable { this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); } - public void createFunction(String name, int nArg, int eTextRep, AggregateFunction f ){ + public void createFunction(String name, int nArg, int eTextRep, AggregateFunction f){ int rc = CApi.sqlite3_create_function(thisDb(), name, nArg, eTextRep, new SqlFunction.AggregateAdapter(f)); if( 0!=rc ) throw new SqliteException(db); @@ -140,6 +144,16 @@ public final class Sqlite implements AutoCloseable { this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); } + public void createFunction(String name, int nArg, int eTextRep, WindowFunction f){ + int rc = CApi.sqlite3_create_function(thisDb(), name, nArg, eTextRep, + new SqlFunction.WindowAdapter(f)); + if( 0!=rc ) throw new SqliteException(db); + } + + public void createFunction(String name, int nArg, WindowFunction f){ + this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); + } + /** Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to create new instances. @@ -223,11 +237,19 @@ public final class Sqlite implements AutoCloseable { } /** - Works like sqlite3_step() but throws SqliteException for any - result other than 0, SQLITE_ROW, or SQLITE_DONE. + Works like sqlite3_step() but returns true for SQLITE_ROW, + false for SQLITE_DONE, and throws SqliteException for any other + result. */ - public int step(){ - return checkRc(sqlite3_step(thisStmt())); + public boolean step(){ + switch(checkRc(sqlite3_step(thisStmt()))){ + case CApi.SQLITE_ROW: return true; + case CApi.SQLITE_DONE: return false; + default: + throw new IllegalStateException( + "This \"cannot happen\": all possible result codes were checked already." + ); + } /* Potential signature change TODO: diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 8fb36a3b54..ca4e6d0521 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -129,6 +129,11 @@ public class Tester2 implements Runnable { execSql(db, String.join("", sql)); } + /** + Executes all SQL statements in the given string. If throwOnError + is true then it will throw for any prepare/step errors, else it + will return the corresponding non-0 result code. + */ public static int execSql(Sqlite dbw, boolean throwOnError, String sql){ final sqlite3 db = dbw.nativeHandle(); OutputPointer.Int32 oTail = new OutputPointer.Int32(); @@ -145,7 +150,7 @@ public class Tester2 implements Runnable { } if( 0==sqlChunk.length ) break; rc = CApi.sqlite3_prepare_v2(db, sqlChunk, outStmt, oTail); - if(throwOnError) affirm(0 == rc); + if( throwOnError ) affirm(0 == rc); else if( 0!=rc ) break; pos = oTail.value; stmt = outStmt.take(); @@ -158,7 +163,7 @@ public class Tester2 implements Runnable { } CApi.sqlite3_finalize(stmt); affirm(0 == stmt.getNativePointer()); - if(0!=rc && CApi.SQLITE_ROW!=rc && CApi.SQLITE_DONE!=rc){ + if(CApi.SQLITE_DONE!=rc){ break; } } @@ -194,9 +199,9 @@ public class Tester2 implements Runnable { } Sqlite openDb(String name){ - final Sqlite db = Sqlite.open(name, CApi.SQLITE_OPEN_READWRITE| - CApi.SQLITE_OPEN_CREATE| - CApi.SQLITE_OPEN_EXRESCODE); + final Sqlite db = Sqlite.open(name, Sqlite.OPEN_READWRITE| + Sqlite.OPEN_CREATE| + Sqlite.OPEN_EXRESCODE); ++metrics.dbOpen; return db; } @@ -245,7 +250,7 @@ public class Tester2 implements Runnable { catch(Exception ex){ e = ex; } affirm( null!=e ); e = null; - affirm( CApi.SQLITE_ROW == stmt.step() ); + affirm( stmt.step() ); try{ stmt.columnInt(1); } catch(Exception ex){ e = ex; } affirm( null!=e ); @@ -254,16 +259,16 @@ public class Tester2 implements Runnable { affirm( 17L == stmt.columnInt64(0) ); affirm( 17.0 == stmt.columnDouble(0) ); affirm( "17".equals(stmt.columnText16(0)) ); - affirm( CApi.SQLITE_DONE == stmt.step() ); + affirm( !stmt.step() ); stmt.reset(); - affirm( CApi.SQLITE_ROW == stmt.step() ); - affirm( CApi.SQLITE_DONE == stmt.step() ); + affirm( stmt.step() ); + affirm( !stmt.step() ); affirm( 0 == stmt.finalizeStmt() ); affirm( null==stmt.nativeHandle() ); stmt = db.prepare("SELECT ?"); stmt.bindObject(1, db); - affirm( CApi.SQLITE_ROW == stmt.step() ); + affirm( stmt.step() ); affirm( db==stmt.columnObject(0) ); affirm( db==stmt.columnObject(0, Sqlite.class ) ); affirm( null==stmt.columnObject(0, Sqlite.Stmt.class ) ); @@ -328,7 +333,7 @@ public class Tester2 implements Runnable { /* ------------------^^^^^^^^^^^ ensures that we're handling sqlite3_aggregate_context() properly. */ ); - affirm( CApi.SQLITE_ROW==q.step() ); + affirm( q.step() ); affirm( 15==q.columnInt(0) ); q.finalizeStmt(); q = null; @@ -336,7 +341,7 @@ public class Tester2 implements Runnable { db.createFunction("summerN", -1, f); q = db.prepare("select summerN(1,8,9), summerN(2,3,4)"); - affirm( CApi.SQLITE_ROW==q.step() ); + affirm( q.step() ); affirm( 18==q.columnInt(0) ); affirm( 9==q.columnInt(1) ); q.finalizeStmt(); @@ -350,6 +355,63 @@ public class Tester2 implements Runnable { /* because we've bound the same instance twice */ ); } + private void testUdfWindow(){ + final Sqlite db = openDb(); + /* Example window function, table, and results taken from: + https://sqlite.org/windowfunctions.html#udfwinfunc */ + final WindowFunction func = new WindowFunction(){ + //! Impl of xStep() and xInverse() + private void xStepInverse(SqlFunction.Arguments args, int v){ + this.getAggregateState(args,0).value += v; + } + @Override public void xStep(SqlFunction.Arguments args){ + this.xStepInverse(args, args.getInt(0)); + } + @Override public void xInverse(SqlFunction.Arguments args){ + this.xStepInverse(args, -args.getInt(0)); + } + //! Impl of xFinal() and xValue() + private void xFinalValue(SqlFunction.Arguments args, Integer v){ + if(null == v) args.resultNull(); + else args.resultInt(v); + } + @Override public void xFinal(SqlFunction.Arguments args){ + xFinalValue(args, this.takeAggregateState(args)); + affirm( null == this.getAggregateState(args,null).value ); + } + @Override public void xValue(SqlFunction.Arguments args){ + xFinalValue(args, this.getAggregateState(args,null).value); + } + }; + db.createFunction("winsumint", 1, func); + execSql(db, new String[] { + "CREATE TEMP TABLE twin(x, y); INSERT INTO twin VALUES", + "('a', 4),('b', 5),('c', 3),('d', 8),('e', 1)" + }); + final Sqlite.Stmt stmt = db.prepare( + "SELECT x, winsumint(y) OVER ("+ + "ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING"+ + ") AS sum_y "+ + "FROM twin ORDER BY x;" + ); + int n = 0; + while( stmt.step() ){ + final String s = stmt.columnText16(0); + final int i = stmt.columnInt(1); + switch(++n){ + case 1: affirm( "a".equals(s) && 9==i ); break; + case 2: affirm( "b".equals(s) && 12==i ); break; + case 3: affirm( "c".equals(s) && 16==i ); break; + case 4: affirm( "d".equals(s) && 12==i ); break; + case 5: affirm( "e".equals(s) && 9==i ); break; + default: affirm( false /* cannot happen */ ); + } + } + stmt.close(); + affirm( 5 == n ); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java new file mode 100644 index 0000000000..479fc74d7f --- /dev/null +++ b/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java @@ -0,0 +1,46 @@ +/* +** 2023-10-16 +** +** 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 is part of the wrapper1 interface for sqlite3. +*/ +package org.sqlite.jni.wrapper1; +import org.sqlite.jni.capi.CApi; +import org.sqlite.jni.annotation.*; +import org.sqlite.jni.capi.sqlite3_context; +import org.sqlite.jni.capi.sqlite3_value; + +/** + A SqlFunction implementation for window functions. The T type + represents the type of data accumulated by this function while it + works. e.g. a SUM()-like UDF might use Integer or Long and a + CONCAT()-like UDF might use a StringBuilder or a List. +*/ +public abstract class WindowFunction extends AggregateFunction { + + /** + As for the xInverse() argument of the C API's + sqlite3_create_window_function(). If this function throws, the + exception is reported via sqlite3_result_error(). + */ + public abstract void xInverse(SqlFunction.Arguments args); + + /** + As for the xValue() argument of the C API's + sqlite3_create_window_function(). If this function throws, it is + translated into sqlite3_result_error(). + + Note that the passed-in object will not actually contain any + arguments for xValue() but will contain the context object needed + for setting the call's result or error state. + */ + public abstract void xValue(SqlFunction.Arguments args); + +} diff --git a/manifest b/manifest index d20131a353..f6e1c2056a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI:\sflesh\sout\sand\ssimplify\sthe\sAPIs\sfor\sbinding\sand\sfetching\sarbitrary\sJava\sobjects. -D 2023-10-22T14:25:37.634 +C Add\shigh-level\swindow\sfunction\swrapper\sto\sthe\sJNI\swrapper1\sinterface. +D 2023-10-22T23:36:16.690 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -236,7 +236,7 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 5c3ac326bf3853486ebe0d70819abc790cc65c412182ce4ebd5012b008d9b059 +F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c dcd6534b65b732ad927a49185c76c76abbd5ccadfa972d02f699abc45678e329 @@ -245,7 +245,7 @@ F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c -F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java bc29e986c866c2ddbbb9f935f5b7264c1c1026864e50a4a735192864f75e37c0 +F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63418129656daa9a9f30e7e7be982bd5ab394b1dbd0 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca @@ -263,11 +263,11 @@ F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17 F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 -F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java fef556adbc3624292423083a648bdf97fa8a4f6b3b6577c9660dd7bd6a6d3c4a +F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385155fa3b8011a5cca0bb3c28468c7131c1a5 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 5c4e7ba5034aeb5c5be0361b9fa0c23fe993774e634750c775d7ad8fa19b22f3 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java b6b2f3354ba68956a6bcd1c586b8eb25a0bd66eed2b58b340405e1129da15de9 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 9f9e151f1da017b706c0ee5f40f4c86b54e773d6ae4339723e0cc85a456251ab @@ -291,13 +291,14 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java 5ad99bd74c85f56bbef324d9ec29b4048f4620547c9a80093d8586c3557f9f9a +F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 92c28b9de358407c8c5e772e0408db528e47eeeb50ffd87b86563a5f078198ad -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 882e345d925a79b575b1182efd816dcc72d6814922b4f58e7f4d29f04ece1f64 +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 585309311ffce6f39626024bf2ea3add91339f6a146b674720165c1955efbe68 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3e6cdb5fe1b01a592ba5ca6ae7d11681a85d081786ce8d046ef631a08ae82dde F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java e224efb77dae2f0abe18f2010c0eb5a09df991f2743597a1aff7f9283f71da7d +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 13008f8d3c34c1dd55c3afe6dd18dcf94316874cde893ab0661a973fc51a87a4 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af +F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2136,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 60a0e82db26270af9d0a5f55c6173e4fd0bdc90a885e838480ed75f8ef193287 -R 5a1e4de3384c2859d02b694c480544f0 +P 89fecf1dd8b97941f9b45130a3c8a67af36ec65cc6f70f5026c569c058a4963f +R 160b97c24140d26b449a4e16b3331ec4 U stephan -Z 0b6f35d12f929147f1a8dbbd84db96f1 +Z 05c9adecf2f51f54547f1d6b2c6aaa3c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a425b28981..fbcdd1ab29 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -89fecf1dd8b97941f9b45130a3c8a67af36ec65cc6f70f5026c569c058a4963f \ No newline at end of file +a27e7471231a24864cbd04b77cbc4b336ce180d738a36ce4318543e2666ed708 \ No newline at end of file From 5e6dde3b3556672b6272456608578ff7b585c62a Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 22 Oct 2023 23:44:32 +0000 Subject: [PATCH 144/242] Fix [f5c01676fd281e93] so that it always preserves 8-byte alignment for Expr objects. Add new assert() statement to verify this. FossilOrigin-Name: 678a9728dc6b88d8ef924c86603056df18204bc9a9c4776b9baffd7c5b10c5f2 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 15 +++++++++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 394fca4ea2..1d5e928473 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sdo\sbackslash\sexcape\sprocessing\son\sany\sunquoted\sstrings\sin\sdot-commands\nin\sthe\sCLI\s-\son\sWindows\sor\son\sposix-like\ssystems\seither\sone.\s\sThis\sbrings\sthe\nprocessing\sinto\salignment\swith\sthe\sdocumentation,\sallows\sbackslash-delimited\nfilenames\son\sWindows\s(as\slong\sas\sthey\sare\sunquoted),\sand\scauses\sthe\sCLI\sto\swork\nthe\ssame\swith\sregard\sto\sbackslash\sescapes\son\sboth\sWindows\sand\sposix. -D 2023-10-22T17:27:55.683 +C Fix\s[f5c01676fd281e93]\sso\sthat\sit\salways\spreserves\s8-byte\salignment\sfor\sExpr\nobjects.\s\sAdd\snew\sassert()\sstatement\sto\sverify\sthis. +D 2023-10-22T23:44:32.467 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -671,7 +671,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c ddb8e310561c761b29f993490eaa64b8a3496032140db74b5ebaeca4a7c96cb3 +F src/expr.c 0a499c92bef5129e516c229fb305a6345be24ccb5ae6d63eaff91705ec06fa7e F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00 F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5c8383210a87d7f9d37a27053b5b1b6f41794fa8612826c68c1ca49c495cbd97 -R d2a23c5e194f0fe63ea38e6c9b5e3aea +P bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c +R 902811deded0933db7129771b3f80f6f U drh -Z ef79587c1d70c03b11d881794d008e37 +Z d392e05c74441a6c706773fdffb67deb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 03c43b5e5f..c6f6b231e8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c \ No newline at end of file +678a9728dc6b88d8ef924c86603056df18204bc9a9c4776b9baffd7c5b10c5f2 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 73ff553730..3eb2c03ac5 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1544,6 +1544,7 @@ static int dupedExprSize(const Expr *p){ nByte = dupedExprNodeSize(p, EXPRDUP_REDUCE); if( p->pLeft ) nByte += dupedExprSize(p->pLeft); if( p->pRight ) nByte += dupedExprSize(p->pRight); + assert( nByte==ROUND8(nByte) ); return nByte; } @@ -1600,11 +1601,12 @@ static Expr *exprDup( nAlloc = dupedExprSize(p); }else if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ nToken = sqlite3Strlen30NN(p->u.zToken)+1; - nAlloc = EXPR_FULLSIZE + nToken; + nAlloc = EXPR_FULLSIZE + ROUND8(nToken); }else{ nToken = 0; nAlloc = EXPR_FULLSIZE; } + assert( nAlloc==ROUND8(nAlloc) ); sEdupBuf.zAlloc = sqlite3DbMallocRawNN(db, nAlloc); #ifdef SQLITE_DEBUG sEdupBuf.zEnd = sEdupBuf.zAlloc ? sEdupBuf.zAlloc+nAlloc : 0; @@ -1613,6 +1615,7 @@ static Expr *exprDup( staticFlag = 0; } pNew = (Expr *)sEdupBuf.zAlloc; + assert( EIGHT_BYTE_ALIGNMENT(pNew) ); if( pNew ){ /* Set nNewSize to the size allocated for the structure pointed to @@ -1621,7 +1624,7 @@ static Expr *exprDup( ** by the copy of the p->u.zToken string (if any). */ const unsigned nStructSize = dupedExprStructSize(p, dupFlags); - const int nNewSize = nStructSize & 0xfff; + int nNewSize = nStructSize & 0xfff; if( nToken<0 ){ if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ nToken = sqlite3Strlen30(p->u.zToken) + 1; @@ -1633,7 +1636,6 @@ static Expr *exprDup( assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken ); assert( ExprHasProperty(p, EP_Reduced)==0 ); memcpy(sEdupBuf.zAlloc, p, nNewSize); - sEdupBuf.zAlloc += nNewSize; }else{ u32 nSize = (u32)exprStructSize(p); assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= EXPR_FULLSIZE+nToken ); @@ -1641,7 +1643,7 @@ static Expr *exprDup( if( nSizeu.zToken string, if any. */ assert( nToken>=0 ); if( nToken>0 ){ - char *zToken = pNew->u.zToken = (char*)sEdupBuf.zAlloc; + char *zToken = pNew->u.zToken = (char*)&sEdupBuf.zAlloc[nNewSize]; memcpy(zToken, p->u.zToken, nToken); - sEdupBuf.zAlloc += nToken; + nNewSize += nToken; } + sEdupBuf.zAlloc += ROUND8(nNewSize); if( ((p->flags|pNew->flags)&(EP_TokenOnly|EP_Leaf))==0 ){ From 90a5617b556c78d6890dc272e6312dac981614a8 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 23 Oct 2023 01:34:17 +0000 Subject: [PATCH 145/242] Add many more high-level wrappers to the JNI wrapper1 API. Correct the JNI bindings of sqlite3_strglob/strlike() to compare as the core lib does if their glob argument is NULL and the other is not. FossilOrigin-Name: 55c4b1dc402b358d53d65fa1f6ec063e9e38e95c81a05d98dae3cb58c52ef55c --- ext/jni/src/c/sqlite3-jni.c | 19 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 276 +++++++++++++++++- .../sqlite/jni/wrapper1/SqliteException.java | 31 +- manifest | 16 +- manifest.uuid | 2 +- 5 files changed, 310 insertions(+), 34 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 86a4930917..ed89b86e8b 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2182,7 +2182,9 @@ S3JniApi(sqlite3_aggregate_context(),jlong,1aggregate_1context)( return S3JniCast_P2L(p); } -/* Central auto-extension handler. */ +/* +** Central auto-extension runner for auto-extensions created in Java. +*/ static int s3jni_run_java_auto_extensions(sqlite3 *pDb, const char **pzErr, const struct sqlite3_api_routines *ignored){ int rc = 0; @@ -3537,9 +3539,16 @@ S3JniApi(sqlite3_errmsg(),jstring,1errmsg)( S3JniApi(sqlite3_errstr(),jstring,1errstr)( JniArgsEnvClass, jint rcCode ){ - jstring const rv = (*env)->NewStringUTF(env, sqlite3_errstr((int)rcCode)) - /* We know these values to be plain ASCII, so pose no MUTF-8 - ** incompatibility */; + jstring rv; + const char * z = sqlite3_errstr((int)rcCode); + if( !z ){ + /* This hypothetically cannot happen, but we'll behave like the + low-level library would in such a case... */ + z = "unknown error"; + } + rv = (*env)->NewStringUTF(env, z) + /* We know these values to be plain ASCII, so pose no MUTF-8 + ** incompatibility */; s3jni_oom_check( rv ); return rv; } @@ -4615,7 +4624,7 @@ static int s3jni_strlike_glob(int isLike, JNIEnv *const env, jbyteArray baG, jbyteArray baT, jint escLike){ int rc = 0; jbyte * const pG = s3jni_jbyteArray_bytes(baG); - jbyte * const pT = pG ? s3jni_jbyteArray_bytes(baT) : 0; + jbyte * const pT = s3jni_jbyteArray_bytes(baT); /* Note that we're relying on the byte arrays having been NUL-terminated on the Java side. */ diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 016eb0b89c..b464bd7d5c 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -32,6 +32,34 @@ public final class Sqlite implements AutoCloseable { public static final int OPEN_READWRITE = CApi.SQLITE_OPEN_READWRITE; public static final int OPEN_CREATE = CApi.SQLITE_OPEN_CREATE; public static final int OPEN_EXRESCODE = CApi.SQLITE_OPEN_EXRESCODE; + public static final int TXN_NONE = CApi.SQLITE_TXN_NONE; + public static final int TXN_READ = CApi.SQLITE_TXN_READ; + public static final int TXN_WRITE = CApi.SQLITE_TXN_WRITE; + + public static final int STATUS_MEMORY_USED = CApi.SQLITE_STATUS_MEMORY_USED; + public static final int STATUS_PAGECACHE_USED = CApi.SQLITE_STATUS_PAGECACHE_USED; + public static final int STATUS_PAGECACHE_OVERFLOW = CApi.SQLITE_STATUS_PAGECACHE_OVERFLOW; + public static final int STATUS_MALLOC_SIZE = CApi.SQLITE_STATUS_MALLOC_SIZE; + public static final int STATUS_PARSER_STACK = CApi.SQLITE_STATUS_PARSER_STACK; + public static final int STATUS_PAGECACHE_SIZE = CApi.SQLITE_STATUS_PAGECACHE_SIZE; + public static final int STATUS_MALLOC_COUNT = CApi.SQLITE_STATUS_MALLOC_COUNT; + + public static final int LIMIT_LENGTH = CApi.SQLITE_LIMIT_LENGTH; + public static final int LIMIT_SQL_LENGTH = CApi.SQLITE_LIMIT_SQL_LENGTH; + public static final int LIMIT_COLUMN = CApi.SQLITE_LIMIT_COLUMN; + public static final int LIMIT_EXPR_DEPTH = CApi.SQLITE_LIMIT_EXPR_DEPTH; + public static final int LIMIT_COMPOUND_SELECT = CApi.SQLITE_LIMIT_COMPOUND_SELECT; + public static final int LIMIT_VDBE_OP = CApi.SQLITE_LIMIT_VDBE_OP; + public static final int LIMIT_FUNCTION_ARG = CApi.SQLITE_LIMIT_FUNCTION_ARG; + public static final int LIMIT_ATTACHED = CApi.SQLITE_LIMIT_ATTACHED; + public static final int LIMIT_LIKE_PATTERN_LENGTH = CApi.SQLITE_LIMIT_LIKE_PATTERN_LENGTH; + public static final int LIMIT_VARIABLE_NUMBER = CApi.SQLITE_LIMIT_VARIABLE_NUMBER; + public static final int LIMIT_TRIGGER_DEPTH = CApi.SQLITE_LIMIT_TRIGGER_DEPTH; + public static final int LIMIT_WORKER_THREADS = CApi.SQLITE_LIMIT_WORKER_THREADS; + + public static final int PREPARE_PERSISTENT = CApi.SQLITE_PREPARE_PERSISTENT; + public static final int PREPARE_NORMALIZE = CApi.SQLITE_PREPARE_NORMALIZE; + public static final int PREPARE_NO_VTAB = CApi.SQLITE_PREPARE_NO_VTAB; //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ @@ -67,6 +95,33 @@ public final class Sqlite implements AutoCloseable { return open(filename, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, null); } + public static String libVersion(){ + return CApi.sqlite3_libversion(); + } + + public static int libVersionNumber(){ + return CApi.sqlite3_libversion_number(); + } + + public static String libSourceId(){ + return CApi.sqlite3_sourceid(); + } + + /** + As per sqlite3_status64(), but returns its current and high-water + results as a two-element array. Throws if the first argument is + not one of the STATUS_... constants. + */ + public long[] libStatus(int op, boolean resetStats){ + org.sqlite.jni.capi.OutputPointer.Int64 pCurrent = + new org.sqlite.jni.capi.OutputPointer.Int64(); + org.sqlite.jni.capi.OutputPointer.Int64 pHighwater = + new org.sqlite.jni.capi.OutputPointer.Int64(); + final int rc = CApi.sqlite3_status64(op, pCurrent, pHighwater, resetStats); + checkRc(rc); + return new long[] {pCurrent.value, pHighwater.value}; + } + @Override public void close(){ if(null!=this.db){ this.db.close(); @@ -74,6 +129,22 @@ public final class Sqlite implements AutoCloseable { } } + /** + Returns the value of the native library's build-time value of the + SQLITE_THREADSAFE build option. + */ + public static int libThreadsafe(){ + return CApi.sqlite3_threadsafe(); + } + + public static boolean strglob(String glob, String txt){ + return 0==CApi.sqlite3_strglob(glob, txt); + } + + public static boolean strlike(String glob, String txt, char escChar){ + return 0==CApi.sqlite3_strlike(glob, txt, escChar); + } + /** Returns this object's underlying native db handle, or null if this instance has been closed. This is very specifically not @@ -94,17 +165,21 @@ public final class Sqlite implements AutoCloseable { /** If rc!=0, throws an SqliteException. If this db is currently - opened, the error state is extracted from it, else only the - string form of rc is used. + opened and has non-0 sqlite3_errcode(), the error state is + extracted from it, else only the string form of rc is used. It is + the caller's responsibility to filter out non-error codes such as + SQLITE_ROW and SQLITE_DONE before calling this. */ - private void affirmRcOk(int rc){ + private void checkRc(int rc){ if( 0!=rc ){ - if( null==db ) throw new SqliteException(rc); + if( null==db || 0==sqlite3_errcode(db)) throw new SqliteException(rc); else throw new SqliteException(db); } } /** + prepFlags must be 0 or a bitmask of the PREPARE_... constants. + prepare() TODOs include: - overloads taking byte[] and ByteBuffer. @@ -116,8 +191,20 @@ public final class Sqlite implements AutoCloseable { public Stmt prepare(String sql, int prepFlags){ final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); final int rc = sqlite3_prepare_v3(thisDb(), sql, prepFlags, out); - affirmRcOk(rc); - return new Stmt(this, out.take()); + checkRc(rc); + final sqlite3_stmt q = out.take(); + if( null==q ){ + /* The C-level API treats input which is devoid of SQL + statements (e.g. all comments or an empty string) as success + but returns a NULL sqlite3_stmt object. In higher-level APIs, + wrapping a "successful NULL" object that way is tedious to + use because it forces clients and/or wrapper-level code to + check for that unusual case. In practice, higher-level + bindings are generally better-served by treating empty SQL + input as an error. */ + throw new IllegalArgumentException("Input contains no SQL statements."); + } + return new Stmt(this, q); } public Stmt prepare(String sql){ @@ -154,6 +241,183 @@ public final class Sqlite implements AutoCloseable { this.createFunction(name, nArg, CApi.SQLITE_UTF8, f); } + public long changes(){ + return CApi.sqlite3_changes64(thisDb()); + } + + public long totalChanges(){ + return CApi.sqlite3_total_changes64(thisDb()); + } + + public long lastInsertRowId(){ + return CApi.sqlite3_last_insert_rowid(thisDb()); + } + + public void setLastInsertRowId(long rowId){ + CApi.sqlite3_set_last_insert_rowid(thisDb(), rowId); + } + + public void interrupt(){ + CApi.sqlite3_interrupt(thisDb()); + } + + public boolean isInterrupted(){ + return CApi.sqlite3_is_interrupted(thisDb()); + } + + public boolean isAutoCommit(){ + return CApi.sqlite3_get_autocommit(thisDb()); + } + + public void setBusyTimeout(int ms){ + checkRc(CApi.sqlite3_busy_timeout(thisDb(), ms)); + } + + /** + Analog to sqlite3_txn_state(). Returns one of TXN_NONE, TXN_READ, + or TXN_WRITE to denote this database's current transaction state + for the given schema name (or the most restrictive state of any + schema if zSchema is null). + */ + public int transactionState(String zSchema){ + return CApi.sqlite3_txn_state(thisDb(), zSchema); + } + + /** + Analog to sqlite3_db_name(). Returns null if passed an unknown + index. + */ + public String dbName(int dbNdx){ + return CApi.sqlite3_db_name(thisDb(), dbNdx); + } + + /** + Analog to sqlite3_db_filename(). Returns null if passed an + unknown db name. + */ + public String dbFileName(String dbName){ + return CApi.sqlite3_db_filename(thisDb(), dbName); + } + + /** + Analog to the variant of sqlite3_db_config() for configuring the + SQLITE_DBCONFIG_MAINDBNAME option. Throws on error. + */ + public void setMainDbName(String name){ + checkRc( + CApi.sqlite3_db_config(thisDb(), CApi.SQLITE_DBCONFIG_MAINDBNAME, + name) + ); + } + + /** + Analog to sqlite3_db_readonly() but throws an SqliteException + with result code SQLITE_NOTFOUND if given an unknown database + name. + */ + public boolean readOnly(String dbName){ + final int rc = CApi.sqlite3_db_readonly(thisDb(), dbName); + if( 0==rc ) return false; + else if( rc>0 ) return true; + throw new SqliteException(CApi.SQLITE_NOTFOUND); + } + + /** + Analog to sqlite3_db_release_memory(). + */ + public void releaseMemory(){ + CApi.sqlite3_db_release_memory(thisDb()); + } + + /** + Analog to sqlite3_release_memory(). + */ + public static int releaseMemory(int n){ + return CApi.sqlite3_release_memory(n); + } + + /** + Analog to sqlite3_limit(). limitId must be one of the + LIMIT_... constants. + + Returns the old limit for the given option. If newLimit is + negative, it returns the old limit without modifying the limit. + + If sqlite3_limit() returns a negative value, this function throws + an SqliteException with the SQLITE_RANGE result code but no + further error info (because that case does not qualify as a + db-level error). Such errors may indicate an invalid argument + value or an invalid range for newLimit (the underlying function + does not differentiate between those). + */ + public int limit(int limitId, int newLimit){ + final int rc = CApi.sqlite3_limit(thisDb(), limitId, newLimit); + if( rc<0 ){ + throw new SqliteException(CApi.SQLITE_RANGE); + } + return rc; + } + + /** + Analog to sqlite3_errstr(). + */ + static String errstr(int resultCode){ + return CApi.sqlite3_errstr(resultCode); + } + + /** + A wrapper object for use with tableColumnMetadata(). They are + created and populated only via that interface. + */ + public final class TableColumnMetadata { + Boolean pNotNull = null; + Boolean pPrimaryKey = null; + Boolean pAutoinc = null; + String pzCollSeq = null; + String pzDataType = null; + + private TableColumnMetadata(){} + + public String getDataType(){ return pzDataType; } + public String getCollation(){ return pzCollSeq; } + public boolean isNotNull(){ return pNotNull; } + public boolean isPrimaryKey(){ return pPrimaryKey; } + public boolean isAutoincrement(){ return pAutoinc; } + } + + /** + Returns data about a database, table, and (optionally) column + (which may be null), as per sqlite3_table_column_metadata(). + Throws if passed invalid arguments, else returns the result as a + new TableColumnMetadata object. + */ + TableColumnMetadata tableColumnMetadata( + String zDbName, String zTableName, String zColumnName + ){ + org.sqlite.jni.capi.OutputPointer.String pzDataType + = new org.sqlite.jni.capi.OutputPointer.String(); + org.sqlite.jni.capi.OutputPointer.String pzCollSeq + = new org.sqlite.jni.capi.OutputPointer.String(); + org.sqlite.jni.capi.OutputPointer.Bool pNotNull + = new org.sqlite.jni.capi.OutputPointer.Bool(); + org.sqlite.jni.capi.OutputPointer.Bool pPrimaryKey + = new org.sqlite.jni.capi.OutputPointer.Bool(); + org.sqlite.jni.capi.OutputPointer.Bool pAutoinc + = new org.sqlite.jni.capi.OutputPointer.Bool(); + final int rc = CApi.sqlite3_table_column_metadata( + thisDb(), zDbName, zTableName, zColumnName, + pzDataType, pzCollSeq, pNotNull, pPrimaryKey, pAutoinc + ); + checkRc(rc); + TableColumnMetadata rv = new TableColumnMetadata(); + rv.pzDataType = pzDataType.value; + rv.pzCollSeq = pzCollSeq.value; + rv.pNotNull = pNotNull.value; + rv.pPrimaryKey = pPrimaryKey.value; + rv.pAutoinc = pAutoinc.value; + return rv; + } + /** Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to create new instances. diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java index 111f004db4..27cfc0e6bb 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java @@ -12,7 +12,7 @@ ** This file is part of the wrapper1 interface for sqlite3. */ package org.sqlite.jni.wrapper1; -import static org.sqlite.jni.capi.CApi.*; +import org.sqlite.jni.capi.CApi; import org.sqlite.jni.capi.sqlite3; /** @@ -22,10 +22,10 @@ import org.sqlite.jni.capi.sqlite3; and C via JNI. */ public final class SqliteException extends java.lang.RuntimeException { - int errCode = SQLITE_ERROR; - int xerrCode = SQLITE_ERROR; - int errOffset = -1; - int sysErrno = 0; + private int errCode = CApi.SQLITE_ERROR; + private int xerrCode = CApi.SQLITE_ERROR; + private int errOffset = -1; + private int sysErrno = 0; /** Records the given error string and uses SQLITE_ERROR for both the @@ -38,10 +38,13 @@ public final class SqliteException extends java.lang.RuntimeException { /** Uses sqlite3_errstr(sqlite3ResultCode) for the error string and sets both the error code and extended error code to the given - value. + value. This approach includes no database-level information and + systemErrno() will be 0, so is intended only for use with sqlite3 + APIs for which a result code is not an error but which the + higher-level wrapper should treat as one. */ public SqliteException(int sqlite3ResultCode){ - super(sqlite3_errstr(sqlite3ResultCode)); + super(CApi.sqlite3_errstr(sqlite3ResultCode)); errCode = xerrCode = sqlite3ResultCode; } @@ -50,16 +53,16 @@ public final class SqliteException extends java.lang.RuntimeException { must refer to an opened db object). Note that this does NOT close the db. - Design note: closing the db on error is likely only useful during + Design note: closing the db on error is really only useful during a failed db-open operation, and the place(s) where that can happen are inside this library, not client-level code. */ SqliteException(sqlite3 db){ - super(sqlite3_errmsg(db)); - errCode = sqlite3_errcode(db); - xerrCode = sqlite3_extended_errcode(db); - errOffset = sqlite3_error_offset(db); - sysErrno = sqlite3_system_errno(db); + super(CApi.sqlite3_errmsg(db)); + errCode = CApi.sqlite3_errcode(db); + xerrCode = CApi.sqlite3_extended_errcode(db); + errOffset = CApi.sqlite3_error_offset(db); + sysErrno = CApi.sqlite3_system_errno(db); } /** @@ -71,7 +74,7 @@ public final class SqliteException extends java.lang.RuntimeException { } public SqliteException(Sqlite.Stmt stmt){ - this( stmt.db() ); + this(stmt.db()); } public int errcode(){ return errCode; } diff --git a/manifest b/manifest index f6e1c2056a..173d2bbaa7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\shigh-level\swindow\sfunction\swrapper\sto\sthe\sJNI\swrapper1\sinterface. -D 2023-10-22T23:36:16.690 +C Add\smany\smore\shigh-level\swrappers\sto\sthe\sJNI\swrapper1\sAPI.\sCorrect\sthe\sJNI\sbindings\sof\ssqlite3_strglob/strlike()\sto\scompare\sas\sthe\score\slib\sdoes\sif\stheir\sglob\sargument\sis\sNULL\sand\sthe\sother\sis\snot. +D 2023-10-23T01:34:17.318 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -239,7 +239,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c dcd6534b65b732ad927a49185c76c76abbd5ccadfa972d02f699abc45678e329 +F ext/jni/src/c/sqlite3-jni.c 21a218f50cfae116c5dbe780fd14181338e5b608dd6d52751e4a982c1b41c877 F ext/jni/src/c/sqlite3-jni.h e839090f5ec35aa96983a5621659e55ef897dc0522242fd00f107028ef5e7dd5 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba @@ -294,8 +294,8 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 585309311ffce6f39626024bf2ea3add91339f6a146b674720165c1955efbe68 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3e6cdb5fe1b01a592ba5ca6ae7d11681a85d081786ce8d046ef631a08ae82dde -F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 1386f7b753134fc12253ce2fbbc448ba8c970567fac01a3356cb672e14408d73 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java fae71b7454fa3d9243ad26c80e55b590c044a0f0a23d18cae21f0cfa3a92a969 +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 13008f8d3c34c1dd55c3afe6dd18dcf94316874cde893ab0661a973fc51a87a4 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 89fecf1dd8b97941f9b45130a3c8a67af36ec65cc6f70f5026c569c058a4963f -R 160b97c24140d26b449a4e16b3331ec4 +P a27e7471231a24864cbd04b77cbc4b336ce180d738a36ce4318543e2666ed708 +R ba0772b5db9c34b23be02455e60dfd03 U stephan -Z 05c9adecf2f51f54547f1d6b2c6aaa3c +Z eac6f822004436c39a1705e9823cdae5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fbcdd1ab29..f6f9688333 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a27e7471231a24864cbd04b77cbc4b336ce180d738a36ce4318543e2666ed708 \ No newline at end of file +55c4b1dc402b358d53d65fa1f6ec063e9e38e95c81a05d98dae3cb58c52ef55c \ No newline at end of file From aa040d891fe4a63864aa666592f79ab16835a83a Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 02:01:14 +0000 Subject: [PATCH 146/242] Fix the shell1.test test so to align with the new behavior imposed by [bce807cd48763273] - that backslash escapes only work without quoted arguments in dot-commands of the CLI. FossilOrigin-Name: 0db82b4281a0e0d5e365553df11e0347f60c00c861c0fb96227059edff3a0ef6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/shell1.test | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 1d5e928473..392ab47e61 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\s[f5c01676fd281e93]\sso\sthat\sit\salways\spreserves\s8-byte\salignment\sfor\sExpr\nobjects.\s\sAdd\snew\sassert()\sstatement\sto\sverify\sthis. -D 2023-10-22T23:44:32.467 +C Fix\sthe\sshell1.test\stest\sso\sto\salign\swith\sthe\snew\sbehavior\simposed\sby\n[bce807cd48763273]\s-\sthat\sbackslash\sescapes\sonly\swork\swithout\squoted\sarguments\nin\sdot-commands\sof\sthe\sCLI. +D 2023-10-23T02:01:14.037 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1558,7 +1558,7 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21 F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707 F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 300b77328aaafb9f3e7a53a26e4162fbf92181d92251d259ff105a2275ff998d +F test/shell1.test 2191c892d8256b1b6cccb4fca894cfc2e748450cf422e6ec80a320a0d538b6df F test/shell2.test 35226c070a8c7f64fd016dfac2a0db2a40f709b3131f61daacd9dad61536c9cb F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f @@ -2136,8 +2136,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bce807cd4876327396b4ffcdf77f6931dd3bbd3314336eedf38bcf01d17af32c -R 902811deded0933db7129771b3f80f6f +P 678a9728dc6b88d8ef924c86603056df18204bc9a9c4776b9baffd7c5b10c5f2 +R 7cea9307a508c1bb73575e5aab23cb6f U drh -Z d392e05c74441a6c706773fdffb67deb +Z f84a1fffe1798f9d2981149753edf239 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c6f6b231e8..6329cf6a90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -678a9728dc6b88d8ef924c86603056df18204bc9a9c4776b9baffd7c5b10c5f2 \ No newline at end of file +0db82b4281a0e0d5e365553df11e0347f60c00c861c0fb96227059edff3a0ef6 \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index d017379107..19848549ac 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -1081,10 +1081,10 @@ do_test shell1-5.0 { # set escapes [list \ \t \\t \n \\n \v \\v \f \\f \ - " " "\" \"" \" \\\" ' \"'\" \\ \\\\] + " " "\" \"" \" \\\" \\ \\\\] } set char [string map $escapes $char] - set x [catchcmdex test.db ".print $char\n"] + set x [catchcmdex test.db ".print \"$char\"\n"] set code [lindex $x 0] set res [lindex $x 1] if {$code ne "0"} { @@ -1165,21 +1165,21 @@ do_test shell1-7.1.2 { } {0 {CREATE TABLE Z (x TEXT PRIMARY KEY); CREATE TABLE _ (x TEXT PRIMARY KEY);}} do_test shell1-7.1.3 { - catchcmd "test.db" ".schema \\\\_" + catchcmd "test.db" ".schema \"\\\\_\"" } {0 {CREATE TABLE _ (x TEXT PRIMARY KEY);}} do_test shell1-7.1.4 { catchcmd "test.db" ".schema __" } {0 {CREATE TABLE YY (x TEXT PRIMARY KEY); CREATE TABLE __ (x TEXT PRIMARY KEY);}} do_test shell1-7.1.5 { - catchcmd "test.db" ".schema \\\\_\\\\_" + catchcmd "test.db" ".schema \"\\\\_\\\\_\"" } {0 {CREATE TABLE __ (x TEXT PRIMARY KEY);}} do_test shell1-7.1.6 { catchcmd "test.db" ".schema ___" } {0 {CREATE TABLE WWW (x TEXT PRIMARY KEY); CREATE TABLE ___ (x TEXT PRIMARY KEY);}} do_test shell1-7.1.7 { - catchcmd "test.db" ".schema \\\\_\\\\_\\\\_" + catchcmd "test.db" ".schema \"\\\\_\\\\_\\\\_\"" } {0 {CREATE TABLE ___ (x TEXT PRIMARY KEY);}} } From 334b6fe418a504129959bc6bbc4ef3e044887244 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 23 Oct 2023 02:06:27 +0000 Subject: [PATCH 147/242] Add missing JNI sqlite3_result_subtype() binding. FossilOrigin-Name: ac920b5386db525c794f4cae332dedcc709cac356f6fb85f3e92bc0a34602511 --- ext/jni/src/c/sqlite3-jni.c | 7 ++++++ ext/jni/src/c/sqlite3-jni.h | 24 ++++++++++++------- ext/jni/src/org/sqlite/jni/capi/CApi.java | 12 ++++++---- .../org/sqlite/jni/wrapper1/SqlFunction.java | 1 + manifest | 18 +++++++------- manifest.uuid | 2 +- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index ed89b86e8b..3ec0916b45 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -4396,6 +4396,13 @@ S3JniApi(sqlite3_result_null(),void,1result_1null)( sqlite3_result_null(PtrGet_sqlite3_context(jpCx)); } +S3JniApi(sqlite3_result_subtype(),void,1result_1subtype)( + JniArgsEnvClass, jobject jpCx, jint v +){ + sqlite3_result_subtype(PtrGet_sqlite3_context(jpCx), (unsigned int)v); +} + + S3JniApi(sqlite3_result_text(),void,1result_1text)( JniArgsEnvClass, jobject jpCx, jbyteArray jBa, jint nMax ){ diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index 6c4d07fc43..e4393ddd8b 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1687,14 +1687,6 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1nom JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1error_1code (JNIEnv *, jclass, jobject, jint); -/* - * Class: org_sqlite_jni_capi_CApi - * Method: sqlite3_result_null - * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V - */ -JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1null - (JNIEnv *, jclass, jobject); - /* * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_int @@ -1719,6 +1711,22 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1int64 JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1java_1object (JNIEnv *, jclass, jobject, jobject); +/* + * Class: org_sqlite_jni_capi_CApi + * Method: sqlite3_result_null + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;)V + */ +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1null + (JNIEnv *, jclass, jobject); + +/* + * Class: org_sqlite_jni_capi_CApi + * Method: sqlite3_result_subtype + * Signature: (Lorg/sqlite/jni/capi/sqlite3_context;I)V + */ +JNIEXPORT void JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1result_1subtype + (JNIEnv *, jclass, jobject, jint); + /* * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_result_value diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index ff5da01c65..d155060999 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -1462,10 +1462,6 @@ public final class CApi { @NotNull sqlite3_context cx, int c ); - public static native void sqlite3_result_null( - @NotNull sqlite3_context cx - ); - public static native void sqlite3_result_int( @NotNull sqlite3_context cx, int v ); @@ -1494,6 +1490,10 @@ public final class CApi { @NotNull sqlite3_context cx, @NotNull Object o ); + public static native void sqlite3_result_null( + @NotNull sqlite3_context cx + ); + public static void sqlite3_result_set( @NotNull sqlite3_context cx, @NotNull Boolean v ){ @@ -1554,6 +1554,10 @@ public final class CApi { else sqlite3_result_blob(cx, blob, blob.length); } + public static native void sqlite3_result_subtype( + @NotNull sqlite3_context cx, int val + ); + public static native void sqlite3_result_value( @NotNull sqlite3_context cx, @NotNull sqlite3_value v ); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 311fdcff0e..2d0ebfaf32 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -108,6 +108,7 @@ public interface SqlFunction { public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} public void resultNull(){CApi.sqlite3_result_null(cx);} public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} + public void resultSubtype(int subtype){CApi.sqlite3_result_subtype(cx, subtype);} public void resultZeroBlob(long n){ // Throw on error? If n is too big, // sqlite3_result_error_toobig() is automatically called. diff --git a/manifest b/manifest index 173d2bbaa7..d8a1fb48cd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smany\smore\shigh-level\swrappers\sto\sthe\sJNI\swrapper1\sAPI.\sCorrect\sthe\sJNI\sbindings\sof\ssqlite3_strglob/strlike()\sto\scompare\sas\sthe\score\slib\sdoes\sif\stheir\sglob\sargument\sis\sNULL\sand\sthe\sother\sis\snot. -D 2023-10-23T01:34:17.318 +C Add\smissing\sJNI\ssqlite3_result_subtype()\sbinding. +D 2023-10-23T02:06:27.564 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -239,8 +239,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 21a218f50cfae116c5dbe780fd14181338e5b608dd6d52751e4a982c1b41c877 -F ext/jni/src/c/sqlite3-jni.h e839090f5ec35aa96983a5621659e55ef897dc0522242fd00f107028ef5e7dd5 +F ext/jni/src/c/sqlite3-jni.c d6a71910c41f6de49fdd7b769b1b814e5ccdccc8bbda2897dcf61ff5fccf1f32 +F ext/jni/src/c/sqlite3-jni.h 1c45fd4689cec42f3d84d2fee41bb494016a12fcb5fd80291095590666a14015 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca @@ -249,7 +249,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java f23e8139cdb1d9c850f28ccf95384e37239cee47fd683bfb199f50aa7ce011fc +F ext/jni/src/org/sqlite/jni/capi/CApi.java 23d4073b34b5c07dd412d18395c9db79779bab059164316e14a60b33ec473cff F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -293,7 +293,7 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ad F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 585309311ffce6f39626024bf2ea3add91339f6a146b674720165c1955efbe68 +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 9be20f3ba6edbe63285224d5d640dbfb0d84fb8cf5134084e3ae40004ec9d6d9 F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java fae71b7454fa3d9243ad26c80e55b590c044a0f0a23d18cae21f0cfa3a92a969 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 13008f8d3c34c1dd55c3afe6dd18dcf94316874cde893ab0661a973fc51a87a4 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a27e7471231a24864cbd04b77cbc4b336ce180d738a36ce4318543e2666ed708 -R ba0772b5db9c34b23be02455e60dfd03 +P 55c4b1dc402b358d53d65fa1f6ec063e9e38e95c81a05d98dae3cb58c52ef55c +R c2c51077b7eb5ed8cd8afa840132d8db U stephan -Z eac6f822004436c39a1705e9823cdae5 +Z 977f0702c9741cb2cb4a8926563a23c6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f6f9688333..fe7e4a2469 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -55c4b1dc402b358d53d65fa1f6ec063e9e38e95c81a05d98dae3cb58c52ef55c \ No newline at end of file +ac920b5386db525c794f4cae332dedcc709cac356f6fb85f3e92bc0a34602511 \ No newline at end of file From 06700d77c2987e980d649f60c925f8df7c44fcf6 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Oct 2023 11:18:13 +0000 Subject: [PATCH 148/242] Add missing test file fts3fault3.test. Should have been part of [7f41d700]. FossilOrigin-Name: 92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622 --- manifest | 13 ++++++----- manifest.uuid | 2 +- test/fts3fault3.test | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 test/fts3fault3.test diff --git a/manifest b/manifest index 9901165e1c..efb09d6e24 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sfixes\sfor\sexpert\shandling\sof\sUDFs\sand\sother\sUD-whatevers. -D 2023-10-23T02:08:34.799 +C Add\smissing\stest\sfile\sfts3fault3.test.\sShould\shave\sbeen\spart\sof\s[7f41d700]. +D 2023-10-23T11:18:13.682 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1150,6 +1150,7 @@ F test/fts3expr5.test a5b9a053becbdb8e973fbf4d6d3abaabeb42d511d1848bd57931f3e0a1 F test/fts3f.test 8c438d5e1cab526b0021988fb1dc70cf3597b006a33ffd6c955ee89929077fe3 F test/fts3fault.test f4e1342acfe6d216a001490e8cd52afac1f9ffe4a11bbcdcb296129a45c5df45 F test/fts3fault2.test 7b2741e5095367238380b0fcdb837f36c24484c7a5f353659b387df63cf039ec +F test/fts3fault3.test 4a39a1618546776255dc1de306213b600aef87eca589ca8428a70c00fd11961b F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 F test/fts3fuzz001.test c78afcd8ad712ea0b8d2ed50851a8aab3bc9dc52c64a536291e07112f519357c F test/fts3join.test 1a4d786539b2b79a41c28ef2ac22cacd92a8ee830249b68a7dee4a020848e3bb @@ -2136,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0db82b4281a0e0d5e365553df11e0347f60c00c861c0fb96227059edff3a0ef6 ee58425904b36319e016dc69bb5f141bb3565b1723a97490a4b2cfa16b89fbdf -R 497c96bcdfec23801dbf799e41e8e8f5 -U larrybr -Z f8a399cf107edbbf201bf5694e7c8852 +P b5d7d07df58bb8e4013b4047e4019b96e506e8ef03ca0abfc9aae06a122b353a +R cfb6e8366d27e8293453bd6489d915e1 +U dan +Z b2609257b784631be668163408c57885 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ca3f0886fe..e15d4879b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b5d7d07df58bb8e4013b4047e4019b96e506e8ef03ca0abfc9aae06a122b353a \ No newline at end of file +92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622 \ No newline at end of file diff --git a/test/fts3fault3.test b/test/fts3fault3.test new file mode 100644 index 0000000000..6e1c0cd672 --- /dev/null +++ b/test/fts3fault3.test @@ -0,0 +1,54 @@ +# 2023 October 23 +# +# 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 + +set ::testprefix fts3fault + +# If SQLITE_ENABLE_FTS3 is not defined, omit this file. +ifcapable !fts3 { finish_test ; return } + +set ::TMPDBERROR [list 1 \ + {unable to open a temporary database file for storing temporary tables} +] + + +# Test error handling in an "ALTER TABLE ... RENAME TO" statement on an +# FTS3 table. Specifically, test renaming the table within a transaction +# after it has been written to. +# +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE t1 USING fts3(a); + INSERT INTO t1 VALUES('test renaming the table'); + INSERT INTO t1 VALUES(' after it has been written'); + INSERT INTO t1 VALUES(' actually other stuff instead'); +} +faultsim_save_and_close +do_faultsim_test 1 -faults oom* -prep { + faultsim_restore_and_reopen + execsql { + BEGIN; + DELETE FROM t1 WHERE rowid=2; + } +} -body { + execsql { + DELETE FROM t1; + } +} -test { + catchsql { COMMIT } + faultsim_integrity_check + faultsim_test_result {0 {}} +} + + +finish_test From 3f81c3264ac8e97575e8aac919d89f43415d6c58 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Oct 2023 11:34:24 +0000 Subject: [PATCH 149/242] Add an SQLITE_OMIT_VIRTUALTABLE block around the new vtab code in "PRAGMA integrity_check". FossilOrigin-Name: ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pragma.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index efb09d6e24..e5f976fc2e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\stest\sfile\sfts3fault3.test.\sShould\shave\sbeen\spart\sof\s[7f41d700]. -D 2023-10-23T11:18:13.682 +C Add\san\sSQLITE_OMIT_VIRTUALTABLE\sblock\saround\sthe\snew\svtab\scode\sin\s"PRAGMA\sintegrity_check". +D 2023-10-23T11:34:24.647 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -714,7 +714,7 @@ F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c 10dae0459c38201427c4550607f58ec0c865092f26e7966fd637e7e2b5156c82 +F src/pragma.c 2c44dca04a9970d0174da30f1dcd227541deb9e0269378d15bb2fc58d6fff88e F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b5d7d07df58bb8e4013b4047e4019b96e506e8ef03ca0abfc9aae06a122b353a -R cfb6e8366d27e8293453bd6489d915e1 +P 92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622 +R bd57be722eb36635558b9e45da1bb396 U dan -Z b2609257b784631be668163408c57885 +Z 17888697ec5bfb90bbb2dbaf482be5b0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e15d4879b3..af0fe4fd79 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622 \ No newline at end of file +ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index cbf5b0b455..d310b83a34 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1763,6 +1763,7 @@ void sqlite3Pragma( if( pObjTab && pObjTab!=pTab ) continue; if( !IsOrdinaryTable(pTab) ){ +#ifndef SQLITE_OMIT_VIRTUALTABLE sqlite3_vtab *pVTab; int a1; if( !IsVirtual(pTab) ) continue; @@ -1782,6 +1783,7 @@ void sqlite3Pragma( a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v); integrityCheckResultRow(v); sqlite3VdbeJumpHere(v, a1); +#endif continue; } if( isQuick || HasRowid(pTab) ){ From f49d52d6426a29e529da3f8960233c0ada29a61f Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 11:41:41 +0000 Subject: [PATCH 150/242] Temporarily disable the ext/expert/expert1-6.0 test, which does not work on my configurations. FossilOrigin-Name: a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16 --- ext/expert/expert1.test | 2 ++ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ext/expert/expert1.test b/ext/expert/expert1.test index 516a1f7584..453334234d 100644 --- a/ext/expert/expert1.test +++ b/ext/expert/expert1.test @@ -464,6 +464,7 @@ do_execsql_test 5.3 { t2 t2_idx_0001295b {100 20 5} } +if 0 { do_test expert1-6.0 { catchcmd :memory: { .expert @@ -480,5 +481,6 @@ SCAN CONSTANT ROW SCAN pragma_collation_list VIRTUAL TABLE INDEX 0: USE TEMP B-TREE FOR ORDER BY }} +} finish_test diff --git a/manifest b/manifest index e5f976fc2e..701ed10411 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sSQLITE_OMIT_VIRTUALTABLE\sblock\saround\sthe\snew\svtab\scode\sin\s"PRAGMA\sintegrity_check". -D 2023-10-23T11:34:24.647 +C Temporarily\sdisable\sthe\sext/expert/expert1-6.0\stest,\swhich\sdoes\snot\swork\non\smy\sconfigurations. +D 2023-10-23T11:41:41.346 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -52,7 +52,7 @@ F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 -F ext/expert/expert1.test 77eaa3efd906e245a8948cb496174724b867b43b5c0fd9bb4fe7f77f27c64517 +F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6 F ext/expert/sqlite3expert.c 4255c8e53da9f777ba9222897a5e4b33a750564d61a66d72fba9c2bdc392ccf5 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 92e64ab63a78445fe20863f9679c55a630a2295ff10c4ce33eab6dfaeef09622 -R bd57be722eb36635558b9e45da1bb396 -U dan -Z 17888697ec5bfb90bbb2dbaf482be5b0 +P ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00 +R 8fb8ba2b5293d9042556f4f7040fe6f2 +U drh +Z d2f9eb87d22e80eb87d655fc23c56455 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index af0fe4fd79..0f7ff2d0ad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00 \ No newline at end of file +a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16 \ No newline at end of file From bd8941a4f8f08b12d1ec463cd236fc3644958f74 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 12:16:27 +0000 Subject: [PATCH 151/242] Fix sqlite3ExprDup() alignment assertions so that they work on 32-bit platforms. FossilOrigin-Name: 143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/expr.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 701ed10411..12227cf848 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Temporarily\sdisable\sthe\sext/expert/expert1-6.0\stest,\swhich\sdoes\snot\swork\non\smy\sconfigurations. -D 2023-10-23T11:41:41.346 +C Fix\ssqlite3ExprDup()\salignment\sassertions\sso\sthat\sthey\swork\son\s32-bit\nplatforms. +D 2023-10-23T12:16:27.460 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -671,7 +671,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 0a499c92bef5129e516c229fb305a6345be24ccb5ae6d63eaff91705ec06fa7e +F src/expr.c 072dc4029ccfb4be3d227b559d6d531c46c5fc95cd89f2db17a2e154a3144d71 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00 F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ab99eb2b6c50f4f0bb42918b9bdda37e2ef9316bed07de18fa4bd373c49a8b00 -R 8fb8ba2b5293d9042556f4f7040fe6f2 +P a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16 +R e0765559e351b53aa91cbdf72b53d175 U drh -Z d2f9eb87d22e80eb87d655fc23c56455 +Z 6584dbcb9c003dd886e6e044516719d0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0f7ff2d0ad..d8ab30ae95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16 \ No newline at end of file +143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 3eb2c03ac5..010c8ce6ab 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1601,10 +1601,10 @@ static Expr *exprDup( nAlloc = dupedExprSize(p); }else if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ nToken = sqlite3Strlen30NN(p->u.zToken)+1; - nAlloc = EXPR_FULLSIZE + ROUND8(nToken); + nAlloc = ROUND8(EXPR_FULLSIZE + nToken); }else{ nToken = 0; - nAlloc = EXPR_FULLSIZE; + nAlloc = ROUND8(EXPR_FULLSIZE); } assert( nAlloc==ROUND8(nAlloc) ); sEdupBuf.zAlloc = sqlite3DbMallocRawNN(db, nAlloc); From 45b2e946ccf0ec8fbcc245201b1e05412c1e782d Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 13:46:22 +0000 Subject: [PATCH 152/242] Improved error messages for the xIntegrity method in FTS3/4 and FTS5. FossilOrigin-Name: df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255 --- ext/fts3/fts3.c | 14 +++++++++++--- ext/fts5/fts5_main.c | 13 +++++++++---- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 491a658871..6f8668534f 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -4010,18 +4010,26 @@ static int fts3Integrity(sqlite3_vtab *pVtab, char **pzErr){ Fts3Table *p = (Fts3Table*)pVtab; char *zSql; int rc; + char *zErr = 0; zSql = sqlite3_mprintf( "INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');", p->zDb, p->zName, p->zName); - rc = sqlite3_exec(p->db, zSql, 0, 0, 0); + if( zSql==0 ){ + return SQLITE_NOMEM; + } + rc = sqlite3_exec(p->db, zSql, 0, 0, &zErr); sqlite3_free(zSql); if( (rc&0xff)==SQLITE_CORRUPT ){ *pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s", p->bFts4 ? 4 : 3, p->zDb, p->zName); - rc = SQLITE_OK; + }else if( rc!=SQLITE_OK ){ + *pzErr = sqlite3_mprintf("unable to validate the inverted index for" + " FTS%d table %s.%s: %s", + p->bFts4 ? 4 : 3, p->zDb, p->zName, zErr); } - return rc; + sqlite3_free(zErr); + return SQLITE_OK; } diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index d4a36a22aa..c78af28b61 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -2918,19 +2918,24 @@ static int fts5Integrity(sqlite3_vtab *pVtab, char **pzErr){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; Fts5Config *pConfig = pTab->p.pConfig; char *zSql; + char *zErr = 0; int rc; zSql = sqlite3_mprintf( "INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');", pConfig->zDb, pConfig->zName, pConfig->zName); - rc = sqlite3_exec(pConfig->db, zSql, 0, 0, 0); + if( zSql==0 ) return SQLITE_NOMEM; + rc = sqlite3_exec(pConfig->db, zSql, 0, 0, &zErr); sqlite3_free(zSql); if( (rc&0xff)==SQLITE_CORRUPT ){ *pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s", pConfig->zDb, pConfig->zName); - rc = SQLITE_OK; + }else if( rc!=SQLITE_OK ){ + *pzErr = sqlite3_mprintf("unable to validate the inverted index for" + " FTS5 table %s.%s: %s", + pConfig->zDb, pConfig->zName, zErr); } - return rc; - + sqlite3_free(zErr); + return SQLITE_OK; } static int fts5Init(sqlite3 *db){ diff --git a/manifest b/manifest index 12227cf848..3a61ce457f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssqlite3ExprDup()\salignment\sassertions\sso\sthat\sthey\swork\son\s32-bit\nplatforms. -D 2023-10-23T12:16:27.460 +C Improved\serror\smessages\sfor\sthe\sxIntegrity\smethod\sin\sFTS3/4\sand\sFTS5. +D 2023-10-23T13:46:22.734 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -60,7 +60,7 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c c409b5f9211dbe9336210435ef3bc936e54c4f2ad9b92c9a7cd5442cbbbf1411 +F ext/fts3/fts3.c 7e23ea4675ed55b54d33aeb6227da6fb19f072a81a93230a8866f3803e33f35a F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h be688580701d41340de73384e3acc8c55be12a438583207444bd5e20f9ef426c F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 @@ -95,7 +95,7 @@ F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d F ext/fts5/fts5_index.c 730c9c32ada18ce1eb7ff847b36507f4b005d88d47af7b47db521e695a8ea4c7 -F ext/fts5/fts5_main.c 1ce6c8f446afbaaf22f4e1ccc0ec46d653168545b89a53bdbba0beddda820bec +F ext/fts5/fts5_main.c 0a0ddd6c6d1d790bacbba838efd7882e1986a283915cce9097c6e6513ccd8fb5 F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca56d6601426d F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a41b903d0fe489d20c4a7118a2c91f7c8a78568ce552225f64c2945bb811ea16 -R e0765559e351b53aa91cbdf72b53d175 +P 143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8 +R e88ffdcda9c30f44a46dd8d1f3420363 U drh -Z 6584dbcb9c003dd886e6e044516719d0 +Z 143e40da451b35005514a48e6a805b55 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8ab30ae95..0422e95939 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8 \ No newline at end of file +df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255 \ No newline at end of file From fd05978a1ebe7d732d9e9deab6acb759b8c45a7e Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Oct 2023 14:24:09 +0000 Subject: [PATCH 153/242] Fix mutex1.test to take into account that the prng mutex is not (as of [c84e4483cb4]) taken when writing a header to an in-memory journal. FossilOrigin-Name: c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/mutex1.test | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 3a61ce457f..daca3bfe5c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\serror\smessages\sfor\sthe\sxIntegrity\smethod\sin\sFTS3/4\sand\sFTS5. -D 2023-10-23T13:46:22.734 +C Fix\smutex1.test\sto\stake\sinto\saccount\sthat\sthe\sprng\smutex\sis\snot\s(as\sof\s[c84e4483cb4])\staken\swhen\swriting\sa\sheader\sto\san\sin-memory\sjournal. +D 2023-10-23T14:24:09.506 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1404,7 +1404,7 @@ F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4d F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a F test/multiplex3.test fac575e0b1b852025575a6a8357701d80933e98b5d2fe6d35ddaa68f92f6a1f7 F test/multiplex4.test e8ae4c4bd70606a5727743241f13b5701990abe4 -F test/mutex1.test 4d7ecb155ae5ba9ca6f1817c1c74d51b5bb284d7f599de1859a9f2c9a1ca0d38 +F test/mutex1.test 42cb5e244c3a77bb0ef2b967e06fa5e7ba7d32d90a9b20bed98f6f5ede185a25 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test 437d40e6d0778b050d7750726c0cbd2c9936b81962926e8f8c48ca698f00f4d1 F test/nockpt.test 8c43b25af63b0bd620cf1b003529e37b6f1dc53bd22690e96a1bd73f78dde53a @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 143f95efc7114455b1920f1d2f9a867392740f608d1dda4306005f01238103f8 -R e88ffdcda9c30f44a46dd8d1f3420363 -U drh -Z 143e40da451b35005514a48e6a805b55 +P df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255 +R 611df081e24061644e6f30e57e810029 +U dan +Z 7831d77f323d5adc3ceef85612180a2c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0422e95939..e6dcde12ff 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255 \ No newline at end of file +c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18 \ No newline at end of file diff --git a/test/mutex1.test b/test/mutex1.test index 0fc8368f76..cb189a7a8a 100644 --- a/test/mutex1.test +++ b/test/mutex1.test @@ -115,6 +115,14 @@ ifcapable threadsafe1&&shared_cache { } } { + # For journal_mode=memory, the static_prng mutex is not required. This + # is because the header of an in-memory journal does not contain + # any random bytes, and so no call to sqlite3_randomness() is made. + if {[permutation]=="inmemory_journal"} { + set idx [lsearch $mutexes static_prng] + if {$idx>=0} { set mutexes [lreplace $mutexes $idx $idx] } + } + do_test mutex1.2.$mode.1 { catch {db close} sqlite3_shutdown From 8c86f56e9013dc7702640fe83b9388984c464b4f Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 15:23:10 +0000 Subject: [PATCH 154/242] New test cases for PRAGMA integrity_check against FTS4 and FTS5 tables. FossilOrigin-Name: 3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8 --- ext/fts5/test/fts5integrity.test | 38 +++++++++++++++++++++ manifest | 15 +++++---- manifest.uuid | 2 +- test/fts4intck1.test | 58 ++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 test/fts4intck1.test diff --git a/ext/fts5/test/fts5integrity.test b/ext/fts5/test/fts5integrity.test index 4038830861..f9851dc15a 100644 --- a/ext/fts5/test/fts5integrity.test +++ b/ext/fts5/test/fts5integrity.test @@ -77,6 +77,9 @@ do_catchsql_test 4.2 { UPDATE aa_docsize SET sz = X'44' WHERE rowid = 3; INSERT INTO aa(aa) VALUES('integrity-check'); } {1 {database disk image is malformed}} +do_execsql_test 4.2.1 { + PRAGMA integrity_check(aa); +} {{malformed inverted index for FTS5 table main.aa}} do_catchsql_test 4.3 { ROLLBACK; @@ -317,4 +320,39 @@ do_catchsql_test 10.5.3 { INSERT INTO vt0(vt0) VALUES('integrity-check'); } {0 {}} +reset_db +proc slang {in} {return [string map {th d e eh} $in]} +db function slang -deterministic -innocuous slang +do_execsql_test 11.0 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c TEXT AS (slang(b))); + INSERT INTO t1(b) VALUES('the quick fox jumps over the lazy brown dog'); + SELECT c FROM t1; +} {{deh quick fox jumps ovehr deh lazy brown dog}} + +do_execsql_test 11.1 { + CREATE VIRTUAL TABLE t2 USING fts5(content="t1", c); + INSERT INTO t2(t2) VALUES('rebuild'); + SELECT rowid FROM t2 WHERE t2 MATCH 'deh'; +} {1} + +do_execsql_test 11.2 { + PRAGMA integrity_check(t2); +} {ok} +db close +sqlite3 db test.db + +# FIX ME? +# +# FTS5 integrity-check does not care if the content table is unreadable or +# does not exist. It only looks for internal inconsistencies in the +# inverted index. +# +do_execsql_test 11.3 { + PRAGMA integrity_check(t2); +} {ok} +do_execsql_test 11.4 { + DROP TABLE t1; + PRAGMA integrity_check(t2); +} {ok} + finish_test diff --git a/manifest b/manifest index daca3bfe5c..a1ea2363da 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\smutex1.test\sto\stake\sinto\saccount\sthat\sthe\sprng\smutex\sis\snot\s(as\sof\s[c84e4483cb4])\staken\swhen\swriting\sa\sheader\sto\san\sin-memory\sjournal. -D 2023-10-23T14:24:09.506 +C New\stest\scases\sfor\sPRAGMA\sintegrity_check\sagainst\sFTS4\sand\sFTS5\stables. +D 2023-10-23T15:23:10.612 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -172,7 +172,7 @@ F ext/fts5/test/fts5first.test 3fcf2365c00a15fc9704233674789a3b95131d12de18a9b99 F ext/fts5/test/fts5full.test e1701a112354e0ff9a1fdffb0c940c576530c33732ee20ac5e8361777070d717 F ext/fts5/test/fts5fuzz1.test 238d8c45f3b81342aa384de3e581ff2fa330bf922a7b69e484bbc06051a1080e F ext/fts5/test/fts5hash.test dc7bc7e0cdeb42cfce31294ad2f8fcf43192bfd0145bb7f3ecc5465d8c72696f -F ext/fts5/test/fts5integrity.test 62147a1e85405b986691177e0312be5a64ec9e67b17994e83892d9afa6247600 +F ext/fts5/test/fts5integrity.test 0d249d351163e17e2227aa9850e68193f88a7813d16cc7d51287e554bf915b3d F ext/fts5/test/fts5interrupt.test 09613247b273a99889808ef852898177e671406fe71fdde7ea00e78ea283d227 F ext/fts5/test/fts5lastrowid.test be98fe3e03235296585b72daad7aed5717ba0062bae5e5c18dd6e04e194c6b28 F ext/fts5/test/fts5leftjoin.test c0b4cafb9661379e576dc4405c0891d8fcc2782680740513c4d1fc114b43d4ad @@ -1179,6 +1179,7 @@ F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01 F test/fts4growth.test 289833c34ad45a5e6e6133b53b6a71647231fb89d36ddcb8d9c87211b6721d7f F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269 F test/fts4incr.test 4e353a0bd886ea984e56fce9e77724fc923b8d0d +F test/fts4intck1.test 43774c641fdf6607c6ee90c3db8af065a37434d55d6eaf13bafe515e8b0c5729 w test/fts3intck1.test F test/fts4langid.test 4be912f42454998e239a2e877600263e0394afbaba03e06cedcc5a08693a345a F test/fts4lastrowid.test 185835895948d5325c7710649824042373b2203149abe8024a9319d25234dfd7 F test/fts4merge.test 57d093660a5093ae6e9fbd2d17592a88b45bbd66db2703c4b640b28828dbe38b @@ -2137,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P df69abc0823f4dd9c051f8d5993d2f447ee0dadab5cef73d670107b1071db255 -R 611df081e24061644e6f30e57e810029 -U dan -Z 7831d77f323d5adc3ceef85612180a2c +P c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18 +R ba3d69ad06944bd91d6a7d5a800b7cbd +U drh +Z 3f6a89abc7bdbc780a8926e481872b03 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e6dcde12ff..31e54dd8f2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18 \ No newline at end of file +3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8 \ No newline at end of file diff --git a/test/fts4intck1.test b/test/fts4intck1.test new file mode 100644 index 0000000000..abdc46bf52 --- /dev/null +++ b/test/fts4intck1.test @@ -0,0 +1,58 @@ +# 2023-10-23 +# +# 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. +# +#*********************************************************************** +# +# Test PRAGMA integrity_check against and FTS3/FTS4 table. +# + + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable !fts3 { finish_test ; return } + +set ::testprefix fts4intck1 + +proc slang {in} { + return [string map {th d e eh} $in] +} + +db function slang -deterministic -innocuous slang +do_execsql_test 1.0 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c TEXT AS (slang(b))); + INSERT INTO t1(b) VALUES('the quick fox jumps over the lazy brown dog'); + SELECT c FROM t1; +} {{deh quick fox jumps ovehr deh lazy brown dog}} + +do_execsql_test 1.1 { + CREATE VIRTUAL TABLE t2 USING fts4(content="t1", c); + INSERT INTO t2(t2) VALUES('rebuild'); + SELECT docid FROM t2 WHERE t2 MATCH 'deh'; +} {1} + +do_execsql_test 1.2 { + PRAGMA integrity_check(t2); +} {ok} + +db close +sqlite3 db test.db +do_execsql_test 2.1 { + PRAGMA integrity_check(t2); +} {{unable to validate the inverted index for FTS4 table main.t2: SQL logic error}} + +db function slang -deterministic -innocuous slang +do_execsql_test 2.2 { + PRAGMA integrity_check(t2); +} {ok} + +proc slang {in} {return $in} +do_execsql_test 2.3 { + PRAGMA integrity_check(t2); +} {{malformed inverted index for FTS4 table main.t2}} + + +finish_test From 2db02ec2453caec841ccd5a179500ed48df038d4 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Oct 2023 15:24:44 +0000 Subject: [PATCH 155/242] Revert an earlier change that considered passing a NULL callback to sqlite3_preupdate_hook() to be a misuse. This is required to clear the preupdate hook altogether. FossilOrigin-Name: 1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/main.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index a1ea2363da..cb0af460ae 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\stest\scases\sfor\sPRAGMA\sintegrity_check\sagainst\sFTS4\sand\sFTS5\stables. -D 2023-10-23T15:23:10.612 +C Revert\san\searlier\schange\sthat\sconsidered\spassing\sa\sNULL\scallback\sto\ssqlite3_preupdate_hook()\sto\sbe\sa\smisuse.\sThis\sis\srequired\sto\sclear\sthe\spreupdate\shook\saltogether. +D 2023-10-23T15:24:44.415 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -684,7 +684,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c db12d1e572b6bbb617bcc6686f18aba30b49a6c257bacbabcb81320653029b23 +F src/main.c e3166de468267c7d2888af536b8a9454a8e13c39700fdd9560213a6cf00b714a F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -1179,7 +1179,7 @@ F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01 F test/fts4growth.test 289833c34ad45a5e6e6133b53b6a71647231fb89d36ddcb8d9c87211b6721d7f F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269 F test/fts4incr.test 4e353a0bd886ea984e56fce9e77724fc923b8d0d -F test/fts4intck1.test 43774c641fdf6607c6ee90c3db8af065a37434d55d6eaf13bafe515e8b0c5729 w test/fts3intck1.test +F test/fts4intck1.test 43774c641fdf6607c6ee90c3db8af065a37434d55d6eaf13bafe515e8b0c5729 F test/fts4langid.test 4be912f42454998e239a2e877600263e0394afbaba03e06cedcc5a08693a345a F test/fts4lastrowid.test 185835895948d5325c7710649824042373b2203149abe8024a9319d25234dfd7 F test/fts4merge.test 57d093660a5093ae6e9fbd2d17592a88b45bbd66db2703c4b640b28828dbe38b @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c9e37417fcc41f1e975290bf583113ff8f4144c056e8fcd9fafcb432c1a26b18 -R ba3d69ad06944bd91d6a7d5a800b7cbd -U drh -Z 3f6a89abc7bdbc780a8926e481872b03 +P 3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8 +R 35a9f1472a813719ed2779397275dbb2 +U dan +Z 587a9ef13d2a017742d60776adaab2de # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 31e54dd8f2..4dd623854d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8 \ No newline at end of file +1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 030b725b1e..de9e248d11 100644 --- a/src/main.c +++ b/src/main.c @@ -2371,7 +2371,7 @@ void *sqlite3_preupdate_hook( void *pRet; #ifdef SQLITE_ENABLE_API_ARMOR - if( db==0 || xCallback==0 ){ + if( db==0 ){ return 0; } #endif From 4fecc81e206be1bf166a5219247e20d4956ee214 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Oct 2023 15:30:38 +0000 Subject: [PATCH 156/242] Avoid attempting to delete a file while it is open in test script sessionalter.test. FossilOrigin-Name: f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6 --- ext/session/sessionalter.test | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/session/sessionalter.test b/ext/session/sessionalter.test index 96a810d8c7..34424cf275 100644 --- a/ext/session/sessionalter.test +++ b/ext/session/sessionalter.test @@ -66,6 +66,7 @@ do_execsql_test -db db2 1.4 { 2 four 1234 } +db2 close #-------------------------------------------------------------------------- reset_db diff --git a/manifest b/manifest index cb0af460ae..5ea46fb833 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revert\san\searlier\schange\sthat\sconsidered\spassing\sa\sNULL\scallback\sto\ssqlite3_preupdate_hook()\sto\sbe\sa\smisuse.\sThis\sis\srequired\sto\sclear\sthe\spreupdate\shook\saltogether. -D 2023-10-23T15:24:44.415 +C Avoid\sattempting\sto\sdelete\sa\sfile\swhile\sit\sis\sopen\sin\stest\sscript\ssessionalter.test. +D 2023-10-23T15:30:38.377 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -537,7 +537,7 @@ F ext/session/sessionG.test 3efe388282d641b65485b5462e67851002cd91a282dc95b685d0 F ext/session/sessionH.test 71bbff6b1abb2c4ac62b84dee53273c37e0b21e5fde3aed80929403e091ef859 F ext/session/session_common.tcl e5598096425486b363718e2cda48ee85d660c96b4f8ea9d9d7a4c3ef514769da F ext/session/session_speed_test.c dcf0ef58d76b70c8fbd9eab3be77cf9deb8bc1638fed8be518b62d6cbdef88b3 -F ext/session/sessionalter.test 72722f6f971c7cb6302a1a3c43ff256c0db1aaf19ae625ecdf710d53f08b1237 +F ext/session/sessionalter.test 460bdac2832a550519f6bc32e5db2c0cee94f335870aaf25a3a403a81ab20e17 F ext/session/sessionat.test 00c8badb35e43a2f12a716d2734a44d614ff62361979b6b85419035bc04b45ee F ext/session/sessionbig.test 47c381e7acfabeef17d98519a3080d69151723354d220afa2053852182ca7adf F ext/session/sessiondiff.test ad13dd65664bae26744e1f18eb3cbd5588349b7e9118851d8f9364248d67bcec @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3950d20c3a4433543546ce4495ae07aab3d6cefb163b1f30813a9776c5b962e8 -R 35a9f1472a813719ed2779397275dbb2 +P 1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397 +R 0a5571c089d9d726fca8373411c5f8ab U dan -Z 587a9ef13d2a017742d60776adaab2de +Z 9f6b2b6d9a63c678025f17f7bd377abf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4dd623854d..f8263d1132 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397 \ No newline at end of file +f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6 \ No newline at end of file From 811bece3f7eb9d4bf8cdc3ad78404e1f80957dd4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 19:51:16 +0000 Subject: [PATCH 157/242] Add the sqlite3res file to the Windows build of sqldiff.exe so that the resulting binary shows the SQLite icon. FossilOrigin-Name: c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea --- Makefile.msc | 4 ++-- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 8ef8bd13b1..d0ca0e76a6 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1820,8 +1820,8 @@ $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLIT /link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS) # <> -sqldiff.exe: $(TOP)\tool\sqldiff.c $(SQLITE3C) $(SQLITE3H) - $(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) +sqldiff.exe: $(TOP)\tool\sqldiff.c $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS) + $(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(LIBRESOBJS) dbhash.exe: $(TOP)\tool\dbhash.c $(SQLITE3C) $(SQLITE3H) $(LTLINK) $(NO_WARN) $(TOP)\tool\dbhash.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) diff --git a/manifest b/manifest index 5ea46fb833..b50e573781 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Avoid\sattempting\sto\sdelete\sa\sfile\swhile\sit\sis\sopen\sin\stest\sscript\ssessionalter.test. -D 2023-10-23T15:30:38.377 +C Add\sthe\ssqlite3res\sfile\sto\sthe\sWindows\sbuild\sof\ssqldiff.exe\sso\sthat\sthe\nresulting\sbinary\sshows\sthe\sSQLite\sicon. +D 2023-10-23T19:51:16.905 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 2ea4105b72561483befe0a18a37f94ca3adbc2324bad3770f99555d95fb9b0ea F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc e5c93ed28696ab0065e72ce352c7ec766c8b9e91f93fd1bb15000c6e35dfe58c +F Makefile.msc 0e088e4fc718668e640aafe148f4d6bf9131d63ba91d85253478a20cd37a4a80 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1bf6f0f3bb54933e4e6c730554144934f73a7fac87c97a916b275afd7379f397 -R 0a5571c089d9d726fca8373411c5f8ab -U dan -Z 9f6b2b6d9a63c678025f17f7bd377abf +P f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6 +R 249d9631460bc3a44c3fdfd22aa9b706 +U drh +Z 64d0e0dfaea30cc947f8f792dbf1bb4a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f8263d1132..52441ba107 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6 \ No newline at end of file +c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea \ No newline at end of file From 043768ce5a8bc1742a7089504e8c489354100297 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 23:34:24 +0000 Subject: [PATCH 158/242] Add notes on how to build a statically linked version of sqlite3_analyzer.exe. FossilOrigin-Name: 99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce --- doc/compile-for-windows.md | 53 +++++++++++++++++++++++++++++++++++++- manifest | 12 ++++----- manifest.uuid | 2 +- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/doc/compile-for-windows.md b/doc/compile-for-windows.md index 0bd39d21f1..55e1f8e41c 100644 --- a/doc/compile-for-windows.md +++ b/doc/compile-for-windows.md @@ -16,7 +16,7 @@ canonical source on a new Windows 11 PC, as of 2023-08-16: a 32-bit build.) The subsequent steps will not work in a vanilla DOS prompt. Nor will they work in PowerShell. - 3. Install TCL development libraries. This note assumes that you wil + 3. Install TCL development libraries. This note assumes that you will install the TCL development libraries in the "`c:\Tcl`" directory. Make adjustments if you want TCL installed somewhere else. SQLite needs both the @@ -83,3 +83,54 @@ following minor changes:

    • `set PATH=c:\tcl32\bin;%PATH%`
    + +## Statically Linking The TCL Library + +Some utility programs associated with SQLite need to be linked +with TCL in order to function. The [sqlite3_analyzer.exe program](https://sqlite.org/sqlanalyze.html) +is an example. You can build as described above, and then +enter: + +> ~~~~ +nmake /f Makefile.msc sqlite3_analyzer.exe +~~~~ + +And you will end up with a working executable. However, that executable +will depend on having the "tcl86.dll" library somewhere on your %PATH%. +Use the following steps to build an executable that has the TCL library +statically linked so that it does not depend on separate DLL: + + 1. Use the appropriate "Command Prompt" window - either x86 or + x64, depending on whether you want a 32-bit or 64-bit executable. + + 2. Untar the TCL source tarball into a fresh directory. CD into + the "win/" subfolder. + + 3. Run: `nmake /f makefile.vc OPTS=nothreads,static shell` + + + 4. CD into the "Release*" subfolder that is created (note the + wildcard - the full name of the directory might vary). There + you will find the "tcl86s.lib" file. Copy this file into the + same directory that you put the "tcl86.lib" on your initial + installation. (In this document, that directory is + "`C:\Tcl32\lib`" for 32-bit builds and + "`C:\Tcl\lib`" for 64-bit builds. + + 5. CD into your SQLite source code directory and build the desired + utility program, but add the following extra arguments to the + nmake command line: +
    +      CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl86s.lib netapi32.lib user32.lib"
    +      
    +

    So, for example, to build a statically linked version of + sqlite3_analyzer.exe, you might type: +

    +      nmake /f Makefile.msc CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl86s.lib netapi32.lib user32.lib" sqlite3_analyzer.exe
    +      
    + + 6. After your executable is built, you can verify that it does not + depend on the TCL DLL by running: +
    +      dumpbin /dependents sqlite3_analyzer.exe
    +      
    diff --git a/manifest b/manifest index b50e573781..88e45d03bb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3res\sfile\sto\sthe\sWindows\sbuild\sof\ssqldiff.exe\sso\sthat\sthe\nresulting\sbinary\sshows\sthe\sSQLite\sicon. -D 2023-10-23T19:51:16.905 +C Add\snotes\son\show\sto\sbuild\sa\sstatically\slinked\sversion\sof\ssqlite3_analyzer.exe. +D 2023-10-23T23:34:24.214 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -37,7 +37,7 @@ F configure 1d9cbcb416cb5387b3f750ae6db63cfedb703a2e46bf8ca61daecff31d208252 x F configure.ac de31fea7d975bb7ebafbe0e2190a855cc80d48558bf0c9a6578a1836daf1cd3a F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd -F doc/compile-for-windows.md c52f2903f1cb11b2308798feecca2e44701b037b78f467a538ac5c46c28ee250 +F doc/compile-for-windows.md 3fbda59bea9219e7b88fac89747aaf8c74b77de53d76a5abefd2570bf2bc6ca2 F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f F doc/lemon.html 44a53a1d2b42d7751f7b2f478efb23c978e258d794bfd172442307a755b9fa44 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f20b4a96f747adeb2ed486f06dd7d911f0f24b37df87dcd32d2c3e4b687da9a6 -R 249d9631460bc3a44c3fdfd22aa9b706 +P c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea +R 63bc65d093cd6c883a355f795496cb92 U drh -Z 64d0e0dfaea30cc947f8f792dbf1bb4a +Z 23c997e26716c966c8277eb8fd0c7c2b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 52441ba107..cbe6cf319c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea \ No newline at end of file +99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce \ No newline at end of file From 13e69440fba91886f34d7976dcf9c95c4b5b9e0e Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 23 Oct 2023 23:34:53 +0000 Subject: [PATCH 159/242] Fix a minor typo in the previous. FossilOrigin-Name: 9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 --- doc/compile-for-windows.md | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/compile-for-windows.md b/doc/compile-for-windows.md index 55e1f8e41c..20f79afa93 100644 --- a/doc/compile-for-windows.md +++ b/doc/compile-for-windows.md @@ -115,7 +115,7 @@ statically linked so that it does not depend on separate DLL: same directory that you put the "tcl86.lib" on your initial installation. (In this document, that directory is "`C:\Tcl32\lib`" for 32-bit builds and - "`C:\Tcl\lib`" for 64-bit builds. + "`C:\Tcl\lib`" for 64-bit builds.) 5. CD into your SQLite source code directory and build the desired utility program, but add the following extra arguments to the diff --git a/manifest b/manifest index 88e45d03bb..779e9daa92 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\snotes\son\show\sto\sbuild\sa\sstatically\slinked\sversion\sof\ssqlite3_analyzer.exe. -D 2023-10-23T23:34:24.214 +C Fix\sa\sminor\stypo\sin\sthe\sprevious. +D 2023-10-23T23:34:53.502 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -37,7 +37,7 @@ F configure 1d9cbcb416cb5387b3f750ae6db63cfedb703a2e46bf8ca61daecff31d208252 x F configure.ac de31fea7d975bb7ebafbe0e2190a855cc80d48558bf0c9a6578a1836daf1cd3a F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd -F doc/compile-for-windows.md 3fbda59bea9219e7b88fac89747aaf8c74b77de53d76a5abefd2570bf2bc6ca2 +F doc/compile-for-windows.md 922ba580d210a1f1bd3ef9d0413121556f9b5714fb5c01e664d980f85fa4ac8c F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f F doc/lemon.html 44a53a1d2b42d7751f7b2f478efb23c978e258d794bfd172442307a755b9fa44 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c696a4963bdd010c8161acbf7601078313e7da5ebb3f60381a489a70e5728dea -R 63bc65d093cd6c883a355f795496cb92 +P 99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce +R f32ae66a46d5a68b60c31d8f75cc7635 U drh -Z 23c997e26716c966c8277eb8fd0c7c2b +Z bbd6d4c6c0e8c3badc3185a6c900116d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cbe6cf319c..9270bb485b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce \ No newline at end of file +9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 \ No newline at end of file From eb9882d7d144ab6f4ab9078ca9eb62251801be19 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 24 Oct 2023 09:57:54 +0000 Subject: [PATCH 160/242] Fix a harmless compiler warning in the expert extension. FossilOrigin-Name: 0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 --- ext/expert/sqlite3expert.c | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index 57baf1ffc1..861cc869a8 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -1873,9 +1873,9 @@ int registerUDFs(sqlite3 *dbSrc, sqlite3 *dbDst){ if( name==0 || type==0 || enc==0 ) rc = SQLITE_NOMEM; else{ int ienc = SQLITE_UTF8; + int rcf = SQLITE_ERROR; if( strcmp(enc,"utf16le")==0 ) ienc = SQLITE_UTF16LE; else if( strcmp(enc,"utf16be")==0 ) ienc = SQLITE_UTF16BE; - int rcf = SQLITE_ERROR; ienc |= (flags & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY)); if( strcmp(type,"w")==0 ){ rcf = sqlite3_create_window_function(dbDst,name,nargs,ienc,0, diff --git a/manifest b/manifest index 779e9daa92..478fdfd714 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sminor\stypo\sin\sthe\sprevious. -D 2023-10-23T23:34:53.502 +C Fix\sa\sharmless\scompiler\swarning\sin\sthe\sexpert\sextension. +D 2023-10-24T09:57:54.656 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6 -F ext/expert/sqlite3expert.c 4255c8e53da9f777ba9222897a5e4b33a750564d61a66d72fba9c2bdc392ccf5 +F ext/expert/sqlite3expert.c 295ca3b9bd09e857820a7c86b71b25c7c763c68402de7061741ccacff21a5bb2 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 99ce9939c861ecc07877e640f75d395afb6502130bf4b5ccea8b98a80a1569ce -R f32ae66a46d5a68b60c31d8f75cc7635 +P 9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 +R c93c65b4d457eea3e32fda50bd8711c7 U drh -Z bbd6d4c6c0e8c3badc3185a6c900116d +Z 3370819568316647d482b2f4e035059a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9270bb485b..0939b5868b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 \ No newline at end of file +0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 \ No newline at end of file From c0ba6a97ec377aee55b671721291d517a08ff21d Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 24 Oct 2023 11:06:44 +0000 Subject: [PATCH 161/242] Fix various harmless scan-build warnings. FossilOrigin-Name: 54be9af4469d7e31ee852f67e5aa32996557c10de654a60103fd165d2fedf311 --- ext/expert/sqlite3expert.c | 5 +++-- ext/fts3/fts3_write.c | 2 ++ ext/session/sqlite3session.c | 5 ++++- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/btree.c | 2 ++ 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ext/expert/sqlite3expert.c b/ext/expert/sqlite3expert.c index 861cc869a8..33d62226f0 100644 --- a/ext/expert/sqlite3expert.c +++ b/ext/expert/sqlite3expert.c @@ -1870,8 +1870,9 @@ int registerUDFs(sqlite3 *dbSrc, sqlite3 *dbDst){ const char *name = (char*)sqlite3_column_text(pStmt,0); const char *type = (char*)sqlite3_column_text(pStmt,1); const char *enc = (char*)sqlite3_column_text(pStmt,2); - if( name==0 || type==0 || enc==0 ) rc = SQLITE_NOMEM; - else{ + if( name==0 || type==0 || enc==0 ){ + /* no-op. Only happens on OOM */ + }else{ int ienc = SQLITE_UTF8; int rcf = SQLITE_ERROR; if( strcmp(enc,"utf16le")==0 ) ienc = SQLITE_UTF16LE; diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 08884a1b1b..0f894943dd 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -3981,6 +3981,8 @@ static int fts3AppendToNode( blobGrowBuffer(pPrev, nTerm, &rc); if( rc!=SQLITE_OK ) return rc; + assert( pPrev!=0 ); + assert( pPrev->a!=0 ); nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm); nSuffix = nTerm - nPrefix; diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index e7459b1af9..a5538ddacf 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -603,8 +603,10 @@ static int sessionPreupdateHash( ** the type byte). */ static int sessionSerialLen(const u8 *a){ - int e = *a; + int e; int n; + assert( a!=0 ); + e = *a; if( e==0 || e==0xFF ) return 1; if( e==SQLITE_NULL ) return 1; if( e==SQLITE_INTEGER || e==SQLITE_FLOAT ) return 9; @@ -5450,6 +5452,7 @@ static int sessionChangeMerge( ){ SessionChange *pNew = 0; int rc = SQLITE_OK; + assert( aRec!=0 ); if( !pExist ){ pNew = (SessionChange *)sqlite3_malloc64(sizeof(SessionChange) + nRec); diff --git a/manifest b/manifest index 478fdfd714..7113776fb9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\sthe\sexpert\sextension. -D 2023-10-24T09:57:54.656 +C Fix\svarious\sharmless\sscan-build\swarnings. +D 2023-10-24T11:06:44.828 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -53,7 +53,7 @@ F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a4980828 F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3 F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4 F ext/expert/expert1.test 0dd5cb096d66bed593e33053a3b364f6ef52ed72064bf5cf298364636dbf3cd6 -F ext/expert/sqlite3expert.c 295ca3b9bd09e857820a7c86b71b25c7c763c68402de7061741ccacff21a5bb2 +F ext/expert/sqlite3expert.c 90446bb1183429308c68ceb23e00cb8252f43b8886cf5efa3fc7e833b5fa24c8 F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b F ext/expert/test_expert.c d56c194b769bdc90cf829a14c9ecbc1edca9c850b837a4d0b13be14095c32a72 F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee @@ -78,7 +78,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154 F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226 F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f -F ext/fts3/fts3_write.c 16df5ea9ff3634821003ac71a0275e3af030517b8768680062f425a347aab5f0 +F ext/fts3/fts3_write.c 5bb4721330ca589f906e72bb824dd4080b313c6d4c4231fa541e9db32dc67982 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73 F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674 @@ -554,7 +554,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c a0694a23f9c72f25e98b7c3a1bc8cfa7e5903d4edafe31efec47de7cd54f5df9 +F ext/session/sqlite3session.c 3e8aa4bd7136b5504952b5d3ab0b2e75f2ab50c7fc2f9915ef980d382dabbf51 F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e F ext/session/test_session.c 73e9921205633a08c1497770beecf3dcbc9b826dd4358f7f8152f706eaac5d71 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -660,7 +660,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c 58f5cca2aced6888824ed69d19a0c398d288d0840b1c72c0834525e82b10c076 +F src/btree.c f6c8512a0db0851877683e41936aac0f8927bc31630cbb1bc87ccccf79c06944 F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15 F src/build.c 1a9061ab67987cfa9c7f9d52ccc862a31d37ad2b05faaf0d72eeb4b4b5ee37cf @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 -R c93c65b4d457eea3e32fda50bd8711c7 +P 0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 +R 3b16c84fa7541a0bf70d90782b9e7ac2 U drh -Z 3370819568316647d482b2f4e035059a +Z 5ec383f1783155e9b83d1659c374bbaa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0939b5868b..cfc515ad63 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 \ No newline at end of file +54be9af4469d7e31ee852f67e5aa32996557c10de654a60103fd165d2fedf311 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index ec4d02d195..7e340f5e5e 100644 --- a/src/btree.c +++ b/src/btree.c @@ -10459,6 +10459,7 @@ static void checkAppendMsg( ** corresponds to page iPg is already set. */ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ + assert( pCheck->aPgRef!=0 ); assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07))); } @@ -10467,6 +10468,7 @@ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ ** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. */ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ + assert( pCheck->aPgRef!=0 ); assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07)); } From da67619d97fa031bd45ff8671cfed6e412ccaee3 Mon Sep 17 00:00:00 2001 From: larrybr Date: Tue, 24 Oct 2023 15:07:28 +0000 Subject: [PATCH 162/242] Spelling improvements, in comments only FossilOrigin-Name: 65bcc583784476f8cc52dfe72ecc52df93d0ec5817c313ad7a83905c0047dd8c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 7113776fb9..e835acc8d2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\svarious\sharmless\sscan-build\swarnings. -D 2023-10-24T11:06:44.828 +C Spelling\simprovements,\sin\scomments\sonly +D 2023-10-24T15:07:28.933 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 F src/shell.c.in 66995332610ed7d47483152c4c78810519ca9ac8b2f93ee884127ce330ca12e8 -F src/sqlite.h.in b37b3df6fb0684929446c095e81287fbdffd64f55481e4195ee7768f2f0ae72e +F src/sqlite.h.in cd71e0cc6a301796c47d7944222b82cb75ac82fa9ed8879bc647c5bb85e07052 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 -R 3b16c84fa7541a0bf70d90782b9e7ac2 -U drh -Z 5ec383f1783155e9b83d1659c374bbaa +P 54be9af4469d7e31ee852f67e5aa32996557c10de654a60103fd165d2fedf311 +R 4534a93cc60bc9b01f38eb8cc54ed3a2 +U larrybr +Z bbcec0ff0072931f8df68fe4f02cd0b5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cfc515ad63..9fa7c19753 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -54be9af4469d7e31ee852f67e5aa32996557c10de654a60103fd165d2fedf311 \ No newline at end of file +65bcc583784476f8cc52dfe72ecc52df93d0ec5817c313ad7a83905c0047dd8c \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index b915ef4fb7..23a8162ae2 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2127,7 +2127,7 @@ struct sqlite3_mem_methods { ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a -** negative value for this option restores the default behaviour. +** negative value for this option restores the default behavior. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** @@ -5960,7 +5960,7 @@ void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); **
  • The database connection closes. SQLite does not make any guarantees ** about the order in which destructors are called, only that all ** destructors will be called exactly once at some point during the -** database connection closingi process. +** database connection closing process. ** ** ** SQLite does not do anything with client data other than invoke @@ -6756,7 +6756,7 @@ void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all ** previous invocations for that database connection. ^If the callback ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, -** then the autovacuum steps callback is cancelled. The return value +** then the autovacuum steps callback is canceled. The return value ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might ** be some other error code if something goes wrong. The current ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other From bdcae89358b5cfdc303ddd4b85ef95fb52dc6ba7 Mon Sep 17 00:00:00 2001 From: larrybr Date: Tue, 24 Oct 2023 15:11:55 +0000 Subject: [PATCH 163/242] Spelling improvements, in comments only FossilOrigin-Name: 9ee25eeaf17124dbe34b961384e74c1ae239ee1798bb01907938600ed6b4066f --- manifest | 10 +++++----- manifest.uuid | 2 +- src/sqlite.h.in | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index e835acc8d2..3c9098773b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ C Spelling\simprovements,\sin\scomments\sonly -D 2023-10-24T15:07:28.933 +D 2023-10-24T15:11:55.292 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 F src/shell.c.in 66995332610ed7d47483152c4c78810519ca9ac8b2f93ee884127ce330ca12e8 -F src/sqlite.h.in cd71e0cc6a301796c47d7944222b82cb75ac82fa9ed8879bc647c5bb85e07052 +F src/sqlite.h.in e9047d63745272ebe5c91bf994f9bbc608edfbc3b0be9873062e9a69657bf984 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 54be9af4469d7e31ee852f67e5aa32996557c10de654a60103fd165d2fedf311 -R 4534a93cc60bc9b01f38eb8cc54ed3a2 +P 65bcc583784476f8cc52dfe72ecc52df93d0ec5817c313ad7a83905c0047dd8c +R c8334cab1fcc469c9751c0c187d23f95 U larrybr -Z bbcec0ff0072931f8df68fe4f02cd0b5 +Z 39c62f83179e0f32d38df3d4da9ac443 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9fa7c19753..1f637be117 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65bcc583784476f8cc52dfe72ecc52df93d0ec5817c313ad7a83905c0047dd8c \ No newline at end of file +9ee25eeaf17124dbe34b961384e74c1ae239ee1798bb01907938600ed6b4066f \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 23a8162ae2..43a1d524d1 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2302,7 +2302,7 @@ struct sqlite3_mem_methods { ** database handle, SQLite checks if this will mean that there are now no ** connections at all to the database. If so, it performs a checkpoint ** operation before closing the connection. This option may be used to -** override this behaviour. The first parameter passed to this operation +** override this behavior. The first parameter passed to this operation ** is an integer - positive to disable checkpoints-on-close, or zero (the ** default) to enable them, and negative to leave the setting unchanged. ** The second parameter is a pointer to an integer @@ -7765,7 +7765,7 @@ int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); ** code is returned and the transaction rolled back. ** ** Calling this function with an argument that is not a NULL pointer or an -** open blob handle results in undefined behaviour. ^Calling this routine +** open blob handle results in undefined behavior. ^Calling this routine ** with a null pointer (such as would be returned by a failed call to ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function ** is passed a valid open blob handle, the values returned by the @@ -9307,8 +9307,8 @@ int sqlite3_backup_pagecount(sqlite3_backup *p); ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is cancelled. ^The blocked connections -** unlock-notify callback may also be cancelled by closing the blocked +** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes From d548f7402477840b4f3abc0da5ef86799eaaca28 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 24 Oct 2023 15:53:02 +0000 Subject: [PATCH 164/242] Fix a problem with the fts5 highlight() and snippet() functions when used with tokenizers like "trigram" that output overlapping tokens. Forum post [forum:/forumpost/63735293ec|63735293ec]. FossilOrigin-Name: d570aa02f79b1d7d3889e33f9eebab1b7edcf5231b1357451eed9a538607de54 --- ext/fts5/fts5_aux.c | 51 ++++++++++++++++++++++++++-------- ext/fts5/test/fts5trigram.test | 38 +++++++++++++++++++++++++ manifest | 19 +++++++------ manifest.uuid | 2 +- 4 files changed, 89 insertions(+), 21 deletions(-) diff --git a/ext/fts5/fts5_aux.c b/ext/fts5/fts5_aux.c index b178f47334..fa58b9aac3 100644 --- a/ext/fts5/fts5_aux.c +++ b/ext/fts5/fts5_aux.c @@ -110,15 +110,19 @@ static int fts5CInstIterInit( */ typedef struct HighlightContext HighlightContext; struct HighlightContext { - CInstIter iter; /* Coalesced Instance Iterator */ - int iPos; /* Current token offset in zIn[] */ + /* Constant parameters to fts5HighlightCb() */ int iRangeStart; /* First token to include */ int iRangeEnd; /* If non-zero, last token to include */ const char *zOpen; /* Opening highlight */ const char *zClose; /* Closing highlight */ const char *zIn; /* Input text */ int nIn; /* Size of input text in bytes */ - int iOff; /* Current offset within zIn[] */ + + /* Variables modified by fts5HighlightCb() */ + CInstIter iter; /* Coalesced Instance Iterator */ + int iPos; /* Current token offset in zIn[] */ + int iOff; /* Have copied up to this offset in zIn[] */ + int bOpen; /* True if highlight is open */ char *zOut; /* Output value */ }; @@ -151,8 +155,8 @@ static int fts5HighlightCb( int tflags, /* Mask of FTS5_TOKEN_* flags */ const char *pToken, /* Buffer containing token */ int nToken, /* Size of token in bytes */ - int iStartOff, /* Start offset of token */ - int iEndOff /* End offset of token */ + int iStartOff, /* Start byte offset of token */ + int iEndOff /* End byte offset of token */ ){ HighlightContext *p = (HighlightContext*)pContext; int rc = SQLITE_OK; @@ -168,30 +172,47 @@ static int fts5HighlightCb( if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff; } - if( iPos==p->iter.iStart ){ + /* If the parenthesis is open, and this token is not part of the current + ** phrase, and the starting byte offset of this token is past the point + ** that has currently been copied into the output buffer, close the + ** parenthesis. */ + if( p->bOpen + && (iPos<=p->iter.iStart || p->iter.iStart<0) + && iStartOff>p->iOff + ){ + fts5HighlightAppend(&rc, p, p->zClose, -1); + p->bOpen = 0; + } + + /* If this is the start of a new phrase, and the highlight is not open: + ** + ** * copy text from the input up to the start of the phrase, and + ** * open the highlight. + */ + if( iPos==p->iter.iStart && p->bOpen==0 ){ fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iStartOff - p->iOff); fts5HighlightAppend(&rc, p, p->zOpen, -1); p->iOff = iStartOff; + p->bOpen = 1; } if( iPos==p->iter.iEnd ){ - if( p->iRangeEnd>=0 && p->iter.iStartiRangeStart ){ + if( p->bOpen==0 ){ + assert( p->iRangeEnd>=0 ); fts5HighlightAppend(&rc, p, p->zOpen, -1); + p->bOpen = 1; } fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); - fts5HighlightAppend(&rc, p, p->zClose, -1); p->iOff = iEndOff; + if( rc==SQLITE_OK ){ rc = fts5CInstIterNext(&p->iter); } } - if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){ + if( iPos==p->iRangeEnd ){ fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); p->iOff = iEndOff; - if( iPos>=p->iter.iStart && iPositer.iEnd ){ - fts5HighlightAppend(&rc, p, p->zClose, -1); - } } return rc; @@ -232,6 +253,9 @@ static void fts5HighlightFunction( if( rc==SQLITE_OK ){ rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb); } + if( ctx.bOpen ){ + fts5HighlightAppend(&rc, &ctx, ctx.zClose, -1); + } fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); if( rc==SQLITE_OK ){ @@ -510,6 +534,9 @@ static void fts5SnippetFunction( if( rc==SQLITE_OK ){ rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb); } + if( ctx.bOpen ){ + fts5HighlightAppend(&rc, &ctx, ctx.zClose, -1); + } if( ctx.iRangeEnd>=(nColSize-1) ){ fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); }else{ diff --git a/ext/fts5/test/fts5trigram.test b/ext/fts5/test/fts5trigram.test index 951daf1440..351c059bf5 100644 --- a/ext/fts5/test/fts5trigram.test +++ b/ext/fts5/test/fts5trigram.test @@ -215,4 +215,42 @@ do_execsql_test 7.2 { SELECT rowid FROM f WHERE filename GLOB '*ир*'; } {20} + +#------------------------------------------------------------------------- +reset_db +do_execsql_test 8.0 { + CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize=trigram); + INSERT INTO t1 VALUES('abcdefghijklm'); +} + +foreach {tn match res} { + 1 "abc ghi" "(abc)def(ghi)jklm" + 2 "def ghi" "abc(defghi)jklm" + 3 "efg ghi" "abcd(efghi)jklm" + 4 "efghi" "abcd(efghi)jklm" + 5 "abcd jklm" "(abcd)efghi(jklm)" + 6 "ijkl jklm" "abcdefgh(ijklm)" + 7 "ijk ijkl hijk" "abcdefg(hijkl)m" + +} { + do_execsql_test 8.1.$tn { + SELECT highlight(t1, 0, '(', ')') FROM t1($match) + } $res +} + +do_execsql_test 8.2 { + CREATE VIRTUAL TABLE ft2 USING fts5(a, tokenize="trigram"); + INSERT INTO ft2 VALUES('abc x cde'); + INSERT INTO ft2 VALUES('abc cde'); + INSERT INTO ft2 VALUES('abcde'); +} + +do_execsql_test 8.3 { + SELECT highlight(ft2, 0, '[', ']') FROM ft2 WHERE ft2 MATCH 'abc AND cde'; +} { + {[abc] x [cde]} + {[abc] [cde]} + {[abcde]} +} + finish_test diff --git a/manifest b/manifest index 478fdfd714..5cbda42c7c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sharmless\scompiler\swarning\sin\sthe\sexpert\sextension. -D 2023-10-24T09:57:54.656 +C Fix\sa\sproblem\swith\sthe\sfts5\shighlight()\sand\ssnippet()\sfunctions\swhen\sused\swith\stokenizers\slike\s"trigram"\sthat\soutput\soverlapping\stokens.\sForum\spost\s[forum:/forumpost/63735293ec|63735293ec]. +D 2023-10-24T15:53:02.462 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -89,7 +89,7 @@ F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a0 F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0 F ext/fts5/fts5.h 05501612cc655504c5dce8ba765ab621d50fc478490089beaa0d75e00b23e520 F ext/fts5/fts5Int.h 78a63cc0795186cde5384816a9403a68c65774b35d952e05b81a1b4b158e07c8 -F ext/fts5/fts5_aux.c 572d5ec92ba7301df2fea3258576332f2f4d2dfd66d8263afd157d9deceac480 +F ext/fts5/fts5_aux.c 35c4101613eff86902877a4dedd9400b07922e412cbdd637b45041dce2fd5388 F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b729225eeaf6a5 F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081 F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 @@ -216,7 +216,7 @@ F ext/fts5/test/fts5synonym2.test 8f891fc49cc1e8daed727051e77e1f42849c784a6a54be F ext/fts5/test/fts5tok1.test 1f7817499f5971450d8c4a652114b3d833393c8134e32422d0af27884ffe9cef F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2 F ext/fts5/test/fts5tokenizer.test ac3c9112b263a639fb0508ae73a3ee886bf4866d2153771a8e8a20c721305a43 -F ext/fts5/test/fts5trigram.test c76acc1913a06182e791a0dfdae285b9cdd67327a1a35b34cabf0a6aa09cf05e +F ext/fts5/test/fts5trigram.test 6c4e37864f3e7d90673db5563d9736d7e40080ab94d10ebdffa94c1b77941da0 F ext/fts5/test/fts5ubsan.test 783d5a8d13ebfa169e634940228db54540780e3ba7a87ad1e4510e61440bf64b F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602 F ext/fts5/test/fts5unicode.test 17056f4efe6b0a5d4f41fdf7a7dc9af2873004562eaa899d40633b93dc95f5a9 @@ -2138,8 +2138,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9d388267e4e6724e2df333fe09d509e87defcfe984c5c2ebe031152d320812d0 -R c93c65b4d457eea3e32fda50bd8711c7 -U drh -Z 3370819568316647d482b2f4e035059a +P 0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 +R 41175df0065ba91132d9e078adcc9517 +T *branch * fts5-trigram-snippet-fix +T *sym-fts5-trigram-snippet-fix * +T -sym-trunk * +U dan +Z fb6ef8c426c83834a5c6c815bfcd6614 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0939b5868b..3af9e01b11 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c4907ddf9abd1ebfef31c1a53d702c4dcaa015c0032b8b52774c9e260b6cfd7 \ No newline at end of file +d570aa02f79b1d7d3889e33f9eebab1b7edcf5231b1357451eed9a538607de54 \ No newline at end of file From 9d486435f116feb0ff3e46254fb51b0606082913 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 24 Oct 2023 16:16:27 +0000 Subject: [PATCH 165/242] New #ifdefs to fix certain compile-time options. FossilOrigin-Name: 688c6279ef1d4ff8d58e83a1c73ca0221ab8570a7cd89459946a86afdad6ec1c --- manifest | 17 ++++++++--------- manifest.uuid | 2 +- src/main.c | 2 ++ src/vdbe.c | 8 ++++++++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f72955b93a..8c2d2c043e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sthe\sfts5\shighlight()\sand\ssnippet()\sfunctions\swhen\sused\swith\stokenizers\slike\s"trigram"\sthat\soutput\soverlapping\stokens.\sForum\spost\s[forum:/forumpost/63735293ec|63735293ec]. -D 2023-10-24T16:06:56.794 +C New\s#ifdefs\sto\sfix\scertain\scompile-time\soptions. +D 2023-10-24T16:16:27.059 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -684,7 +684,7 @@ F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a -F src/main.c e3166de468267c7d2888af536b8a9454a8e13c39700fdd9560213a6cf00b714a +F src/main.c e1bc8864834697503d370d94613be945d05ca1c5ebdda43e7d5c8ee8c48d433c F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -791,7 +791,7 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677 F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c 300b1ac9339a5b7db9ccd48c1a13c3d71722da13352a38ee042ca0a399b4dd7e +F src/vdbe.c af7eace744ec425f7f0c3c298b3471f6144b2648b15882f285a6852b3bd2fe83 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 @@ -2138,9 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9ee25eeaf17124dbe34b961384e74c1ae239ee1798bb01907938600ed6b4066f d570aa02f79b1d7d3889e33f9eebab1b7edcf5231b1357451eed9a538607de54 -R 4c04974dbac2d5b02e9db5f09d63c22c -T +closed d570aa02f79b1d7d3889e33f9eebab1b7edcf5231b1357451eed9a538607de54 -U dan -Z 7a83bdd07c56b465bbc46bd2267d0f1f +P e952db86faaafd2ef8558175ebcae6834d0b0002813cc78c7ae7da713604cbec +R 235d95e16d499ec1c60f3973e144465a +U drh +Z b1a1ae289b7963d5b110e3f6be1d2e73 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 200a4a1138..9c840ba0ce 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e952db86faaafd2ef8558175ebcae6834d0b0002813cc78c7ae7da713604cbec \ No newline at end of file +688c6279ef1d4ff8d58e83a1c73ca0221ab8570a7cd89459946a86afdad6ec1c \ No newline at end of file diff --git a/src/main.c b/src/main.c index de9e248d11..fbe00f5fa9 100644 --- a/src/main.c +++ b/src/main.c @@ -382,7 +382,9 @@ int sqlite3_initialize(void){ /* Experimentally determine if high-precision floating point is ** available. */ +#ifndef SQLITE_OMIT_WSD sqlite3Config.bUseLongDouble = hasHighPrecisionDouble(rc); +#endif return rc; } diff --git a/src/vdbe.c b/src/vdbe.c index b7bf8c0ec7..3a5c70d696 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -6911,21 +6911,29 @@ case OP_CreateBtree: { /* out2 */ */ case OP_SqlExec: { char *zErr; +#ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth; +#endif u8 mTrace; sqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; zErr = 0; +#ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; +#endif mTrace = db->mTrace; if( pOp->p1 ){ +#ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = 0; +#endif db->mTrace = 0; } rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr); db->nSqlExec--; +#ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; +#endif db->mTrace = mTrace; if( zErr || rc ){ sqlite3VdbeError(p, "%s", zErr); From 85b1f5c2f6a05ba151496122fc62b10d560498ca Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 24 Oct 2023 17:45:11 +0000 Subject: [PATCH 166/242] Test cases for COLLATE and NULLS FIRST/LAST in the ORDER BY for an aggregate function. FossilOrigin-Name: 641f928feb8b6cfd64cb03992bc18c1653960b6eaeb35145d17df494727c7a11 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/aggorderby.test | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 8c2d2c043e..9af5eb1bf6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C New\s#ifdefs\sto\sfix\scertain\scompile-time\soptions. -D 2023-10-24T16:16:27.059 +C Test\scases\sfor\sCOLLATE\sand\sNULLS\sFIRST/LAST\sin\sthe\sORDER\sBY\sfor\san\naggregate\sfunction. +D 2023-10-24T17:45:11.642 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -817,7 +817,7 @@ F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 F test/aggnested.test 2e738bfe2980df301a782f6e7bbf9459266f64f7e72f58f3b5c843bf897c568c -F test/aggorderby.test d110490c62d29318fa56831cd67bc49b07789592f1cdd7881725735ecd05308a +F test/aggorderby.test 4a4b2d49532124fbb799a2c014e5134d0e6db2345b19286d027e227e0f383dfa F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e952db86faaafd2ef8558175ebcae6834d0b0002813cc78c7ae7da713604cbec -R 235d95e16d499ec1c60f3973e144465a +P 688c6279ef1d4ff8d58e83a1c73ca0221ab8570a7cd89459946a86afdad6ec1c +R 3064fd7ebff205f56ff9b901509432de U drh -Z b1a1ae289b7963d5b110e3f6be1d2e73 +Z 43199bfadf9e01e03c769a5bbfeebed2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9c840ba0ce..bcf1742392 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -688c6279ef1d4ff8d58e83a1c73ca0221ab8570a7cd89459946a86afdad6ec1c \ No newline at end of file +641f928feb8b6cfd64cb03992bc18c1653960b6eaeb35145d17df494727c7a11 \ No newline at end of file diff --git a/test/aggorderby.test b/test/aggorderby.test index bf77a7d4cf..61adb9ae14 100644 --- a/test/aggorderby.test +++ b/test/aggorderby.test @@ -76,4 +76,30 @@ do_execsql_test aggorderby-5.3 { SELECT (SELECT string_agg(a,'#' ORDER BY d) FROM t3) FROM t1; } {aaa#aaa bbb#bbb} +# COLLATE works on the ORDER BY. +# +do_execsql_test aggorderby-6.0 { + WITH c(x) AS (VALUES('abc'),('DEF'),('xyz'),('ABC'),('XYZ')) + SELECT string_agg(x,',' ORDER BY x COLLATE nocase), + string_agg(x,',' ORDER BY x) FROM c; +} {abc,ABC,DEF,xyz,XYZ ABC,DEF,XYZ,abc,xyz} +do_execsql_test aggorderby-6.1 { + WITH c(x,y) AS (VALUES(1,'a'),(2,'B'),(3,'c'),(4,'D')) + SELECT group_concat(x ORDER BY y COLLATE nocase), + group_concat(x ORDER BY y COLLATE binary) FROM c; +} {1,2,3,4 2,4,1,3} + +# NULLS FIRST and NULLS LAST work on the ORDER BY +# +do_execsql_test aggorderby-7.0 { + WITH c(x) AS (VALUES(1),(NULL),(2.5),(NULL),('three')) + SELECT json_group_array(x ORDER BY x NULLS FIRST), + json_group_array(x ORDER BY x NULLS LAST) FROM c; +} {[null,null,1,2.5,"three"] [1,2.5,"three",null,null]} +do_execsql_test aggorderby-7.1 { + WITH c(x,y) AS (VALUES(1,9),(2,null),(3,5),(4,null),(5,1)) + SELECT json_group_array(x ORDER BY y NULLS FIRST, x), + json_group_array(x ORDER BY y NULLS LAST, x) FROM c; +} {[2,4,5,3,1] [5,3,1,2,4]} + finish_test From f4154879ebb84fc0875d553e2de60d8ed4864da9 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 24 Oct 2023 19:56:57 +0000 Subject: [PATCH 167/242] Implement check-in [477577120b897bf1] differently, so as not to disrupt non-standard build configuration. See [forum:/forumpost/c11523ca2df50293|forum post c11523ca2df50293]. FossilOrigin-Name: 50448fe4fdc8fd93303fe26bdcd885ecc606080c8e66e69d5be8dac28a77492b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 9af5eb1bf6..b9774f5769 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\scases\sfor\sCOLLATE\sand\sNULLS\sFIRST/LAST\sin\sthe\sORDER\sBY\sfor\san\naggregate\sfunction. -D 2023-10-24T17:45:11.642 +C Implement\scheck-in\s[477577120b897bf1]\sdifferently,\sso\sas\snot\sto\sdisrupt\nnon-standard\sbuild\sconfiguration.\sSee\n[forum:/forumpost/c11523ca2df50293|forum\spost\sc11523ca2df50293]. +D 2023-10-24T19:56:57.182 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 -F src/shell.c.in 66995332610ed7d47483152c4c78810519ca9ac8b2f93ee884127ce330ca12e8 +F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed F src/sqlite.h.in e9047d63745272ebe5c91bf994f9bbc608edfbc3b0be9873062e9a69657bf984 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 688c6279ef1d4ff8d58e83a1c73ca0221ab8570a7cd89459946a86afdad6ec1c -R 3064fd7ebff205f56ff9b901509432de +P 641f928feb8b6cfd64cb03992bc18c1653960b6eaeb35145d17df494727c7a11 +R 07cab3cfe441872ad8db93a7e61dc6f3 U drh -Z 43199bfadf9e01e03c769a5bbfeebed2 +Z 7ea3a838c923da816dd181b561116bed # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bcf1742392..b418b289bf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -641f928feb8b6cfd64cb03992bc18c1653960b6eaeb35145d17df494727c7a11 \ No newline at end of file +50448fe4fdc8fd93303fe26bdcd885ecc606080c8e66e69d5be8dac28a77492b \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 50f78acca8..b78759c002 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -454,6 +454,7 @@ static int stdin_is_interactive = 1; # define SHELL_WIN_UTF8_OPT 1 static int console_utf8 = sizeof(char*)/4 - 1; #else +# define console_utf8 0 # define SHELL_WIN_UTF8_OPT 0 #endif From 9f20bde65a26e13b512ec521421c7b892ad6eadd Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 10:37:11 +0000 Subject: [PATCH 168/242] Enhance the new xIntegrity method of the sqlite3_module object with new parameters that provide the name of the table being checked and a flag to indicate a "quick_check". Based on feedback in [forum:/forumpost/965c0d02ea|forum post 965c0d02ea]. FossilOrigin-Name: bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05 --- ext/fts3/fts3.c | 17 +++++++++++++---- ext/fts5/fts5_main.c | 16 ++++++++++++---- ext/rtree/rtree.c | 14 ++++++++++++-- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/pragma.c | 2 +- src/sqlite.h.in | 2 +- src/vdbe.c | 17 ++++++++++------- 8 files changed, 61 insertions(+), 31 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 6f8668534f..65852804a1 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -4006,15 +4006,24 @@ static int fts3ShadowName(const char *zName){ ** Implementation of the xIntegrity() method on the FTS3/FTS4 virtual ** table. */ -static int fts3Integrity(sqlite3_vtab *pVtab, char **pzErr){ +static int fts3Integrity( + sqlite3_vtab *pVtab, /* The virtual table to be checked */ + const char *zSchema, /* Name of schema in which pVtab lives */ + const char *zTabname, /* Name of the pVTab table */ + int isQuick, /* True if this is a quick_check */ + char **pzErr /* Write error message here */ +){ Fts3Table *p = (Fts3Table*)pVtab; char *zSql; int rc; char *zErr = 0; + assert( pzErr!=0 ); + assert( *pzErr==0 ); + UNUSED_PARAMETER(isQuick); zSql = sqlite3_mprintf( "INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');", - p->zDb, p->zName, p->zName); + zSchema, zTabname, zTabname); if( zSql==0 ){ return SQLITE_NOMEM; } @@ -4022,11 +4031,11 @@ static int fts3Integrity(sqlite3_vtab *pVtab, char **pzErr){ sqlite3_free(zSql); if( (rc&0xff)==SQLITE_CORRUPT ){ *pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s", - p->bFts4 ? 4 : 3, p->zDb, p->zName); + p->bFts4 ? 4 : 3, zSchema, zTabname); }else if( rc!=SQLITE_OK ){ *pzErr = sqlite3_mprintf("unable to validate the inverted index for" " FTS%d table %s.%s: %s", - p->bFts4 ? 4 : 3, p->zDb, p->zName, zErr); + p->bFts4 ? 4 : 3, zSchema, zTabname, zErr); } sqlite3_free(zErr); return SQLITE_OK; diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index c78af28b61..6e86ca5951 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -2914,25 +2914,33 @@ static int fts5ShadowName(const char *zName){ ** if anything is found amiss. Return a NULL pointer if everything is ** OK. */ -static int fts5Integrity(sqlite3_vtab *pVtab, char **pzErr){ +static int fts5Integrity( + sqlite3_vtab *pVtab, /* the FTS5 virtual table to check */ + const char *zSchema, /* Name of schema in which this table lives */ + const char *zTabname, /* Name of the table itself */ + int isQuick, /* True if this is a quick-check */ + char **pzErr /* Write error message here */ +){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; Fts5Config *pConfig = pTab->p.pConfig; char *zSql; char *zErr = 0; int rc; + assert( pzErr!=0 && *pzErr==0 ); + UNUSED_PARAM(isQuick); zSql = sqlite3_mprintf( "INSERT INTO \"%w\".\"%w\"(\"%w\") VALUES('integrity-check');", - pConfig->zDb, pConfig->zName, pConfig->zName); + zSchema, zTabname, pConfig->zName); if( zSql==0 ) return SQLITE_NOMEM; rc = sqlite3_exec(pConfig->db, zSql, 0, 0, &zErr); sqlite3_free(zSql); if( (rc&0xff)==SQLITE_CORRUPT ){ *pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s", - pConfig->zDb, pConfig->zName); + zSchema, zTabname); }else if( rc!=SQLITE_OK ){ *pzErr = sqlite3_mprintf("unable to validate the inverted index for" " FTS5 table %s.%s: %s", - pConfig->zDb, pConfig->zName, zErr); + zSchema, zTabname, zErr); } sqlite3_free(zErr); return SQLITE_OK; diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index 682c052c56..1705abd51c 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -3332,7 +3332,7 @@ static int rtreeShadowName(const char *zName){ } /* Forward declaration */ -static int rtreeIntegrity(sqlite3_vtab*, char**); +static int rtreeIntegrity(sqlite3_vtab*, const char*, const char*, int, char**); static sqlite3_module rtreeModule = { 4, /* iVersion */ @@ -4187,9 +4187,19 @@ static int rtreeCheckTable( /* ** Implementation of the xIntegrity method for Rtree. */ -static int rtreeIntegrity(sqlite3_vtab *pVtab, char **pzErr){ +static int rtreeIntegrity( + sqlite3_vtab *pVtab, /* The virtual table to check */ + const char *zSchema, /* Schema in which the virtual table lives */ + const char *zName, /* Name of the virtual table */ + int isQuick, /* True for a quick_check */ + char **pzErr /* Write results here */ +){ Rtree *pRtree = (Rtree*)pVtab; int rc; + assert( pzErr!=0 && *pzErr==0 ); + UNUSED_PARAMETER(zSchema); + UNUSED_PARAMETER(zName); + UNUSED_PARAMETER(isQuick); rc = rtreeCheckTable(pRtree->db, pRtree->zDb, pRtree->zName, pzErr); if( rc==SQLITE_OK && *pzErr ){ *pzErr = sqlite3_mprintf("In RTree %s.%s:\n%z", diff --git a/manifest b/manifest index b9774f5769..90799478a8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Implement\scheck-in\s[477577120b897bf1]\sdifferently,\sso\sas\snot\sto\sdisrupt\nnon-standard\sbuild\sconfiguration.\sSee\n[forum:/forumpost/c11523ca2df50293|forum\spost\sc11523ca2df50293]. -D 2023-10-24T19:56:57.182 +C Enhance\sthe\snew\sxIntegrity\smethod\sof\sthe\ssqlite3_module\sobject\swith\snew\nparameters\sthat\sprovide\sthe\sname\sof\sthe\stable\sbeing\schecked\sand\na\sflag\sto\sindicate\sa\s"quick_check".\s\sBased\son\sfeedback\sin\n[forum:/forumpost/965c0d02ea|forum\spost\s965c0d02ea]. +D 2023-10-25T10:37:11.394 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -60,7 +60,7 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 7e23ea4675ed55b54d33aeb6227da6fb19f072a81a93230a8866f3803e33f35a +F ext/fts3/fts3.c d01dfb641fc04efeeadcb94d7a8342eb07d71c1a3a3852ec8ab5e64c1fcdfff9 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h be688580701d41340de73384e3acc8c55be12a438583207444bd5e20f9ef426c F ext/fts3/fts3_aux.c 7eab82a9cf0830f6551ba3abfdbe73ed39e322a4d3940ee82fbf723674ecd9f3 @@ -95,7 +95,7 @@ F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 F ext/fts5/fts5_hash.c 65e7707bc8774706574346d18c20218facf87de3599b995963c3e6d6809f203d F ext/fts5/fts5_index.c 730c9c32ada18ce1eb7ff847b36507f4b005d88d47af7b47db521e695a8ea4c7 -F ext/fts5/fts5_main.c 0a0ddd6c6d1d790bacbba838efd7882e1986a283915cce9097c6e6513ccd8fb5 +F ext/fts5/fts5_main.c a07ed863b8bd9e6fefb62db2fd40a3518eb30a5f7dcfda5be915dd2db45efa2f F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca56d6601426d F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee @@ -481,7 +481,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350 F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca -F ext/rtree/rtree.c da842644466b84391e9fa1b1d5a17f461b475b8e36f1217117d1d98ad5f437e3 +F ext/rtree/rtree.c 2e1452a9338fe4db057fa677277bed86b65c667ed48b9b59144adae99f85a7cb F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree1.test ecc881fdd1bc10fc390faa988ad93343739af84384e4cf3619fed7afada66a30 F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d @@ -714,7 +714,7 @@ F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5 F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00 -F src/pragma.c 2c44dca04a9970d0174da30f1dcd227541deb9e0269378d15bb2fc58d6fff88e +F src/pragma.c b3b4ad9c0298d63098a067acca613c21a5f56b4d176d5842922bcd0b07b7164e F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed -F src/sqlite.h.in e9047d63745272ebe5c91bf994f9bbc608edfbc3b0be9873062e9a69657bf984 +F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef @@ -791,7 +791,7 @@ F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c b22cc9f203a8c0b9ee5338a67f8860347d14845864c10248bebe84518a781677 F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 -F src/vdbe.c af7eace744ec425f7f0c3c298b3471f6144b2648b15882f285a6852b3bd2fe83 +F src/vdbe.c 14479441337135eed8e290fb1d4abb7db657d93217a3b1ea8a2f031d3895536a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 641f928feb8b6cfd64cb03992bc18c1653960b6eaeb35145d17df494727c7a11 -R 07cab3cfe441872ad8db93a7e61dc6f3 +P 50448fe4fdc8fd93303fe26bdcd885ecc606080c8e66e69d5be8dac28a77492b +R 30ef2af5a58be5aa899fd43e3a6be25e U drh -Z 7ea3a838c923da816dd181b561116bed +Z aefb39a97493c6e3bdb1f5a57cd2f3c5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b418b289bf..9bbe515f93 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -50448fe4fdc8fd93303fe26bdcd885ecc606080c8e66e69d5be8dac28a77492b \ No newline at end of file +bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index d310b83a34..90076b0c26 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1778,7 +1778,7 @@ void sqlite3Pragma( if( NEVER(pVTab->pModule==0) ) continue; if( pVTab->pModule->iVersion<4 ) continue; if( pVTab->pModule->xIntegrity==0 ) continue; - sqlite3VdbeAddOp2(v, OP_VCheck, 0, 3); + sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick); sqlite3VdbeAppendP4(v, pTab, P4_TABLE); a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v); integrityCheckResultRow(v); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 43a1d524d1..f3db71dea9 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -7277,7 +7277,7 @@ struct sqlite3_module { int (*xShadowName)(const char*); /* The methods above are in versions 1 through 3 of the sqlite_module object. ** Those below are for version 4 and greater. */ - int (*xIntegrity)(sqlite3_vtab *pVTab, char**); + int (*xIntegrity)(sqlite3_vtab *pVTab, const char*, const char*, int, char**); }; /* diff --git a/src/vdbe.c b/src/vdbe.c index 3a5c70d696..221e8847db 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -8162,13 +8162,14 @@ case OP_VOpen: { /* ncycle */ #endif /* SQLITE_OMIT_VIRTUALTABLE */ #ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VCheck * P2 * P4 * +/* Opcode: VCheck P1 P2 P3 P4 * ** -** P4 is a pointer to a Table object that is a virtual table that -** supports the xIntegrity() method. This opcode runs the xIntegrity() -** method for that virtual table. If an error is reported back, the error -** message is stored in register P2. If no errors are seen, register P2 -** is set to NULL. +** P4 is a pointer to a Table object that is a virtual table in schema P1 +** that supports the xIntegrity() method. This opcode runs the xIntegrity() +** method for that virtual table, using P3 as the integer argument. If +** an error is reported back, the table name is prepended to the error +** message and that message is stored in P2. If no errors are seen, +** register P2 is set to NULL. */ case OP_VCheck: { /* out2 */ Table *pTab; @@ -8191,7 +8192,9 @@ case OP_VCheck: { /* out2 */ assert( pModule->xIntegrity!=0 ); pTab->nTabRef++; sqlite3VtabLock(pTab->u.vtab.p); - rc = pModule->xIntegrity(pVtab, &zErr); + assert( pOp->p1>=0 && pOp->p1nDb ); + rc = pModule->xIntegrity(pVtab, db->aDb[pOp->p1].zDbSName, pTab->zName, + pOp->p3, &zErr); sqlite3VtabUnlock(pTab->u.vtab.p); sqlite3DeleteTable(db, pTab); if( rc ){ From a9a7d118f68d0209f99b03a5f6754f0218ea6019 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 12:58:06 +0000 Subject: [PATCH 169/242] Fix the amalgamation generator so that when it is reporting the Fossil version number in the header comment of the amalgamation, it does not elide the first hex digit of the version hash. FossilOrigin-Name: cc66f526bd58c110cac027583f636099fa05b2b56d7ea9807b554cd950c1bf3c --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/mksqlite3c.tcl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 90799478a8..6d4c13160e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\snew\sxIntegrity\smethod\sof\sthe\ssqlite3_module\sobject\swith\snew\nparameters\sthat\sprovide\sthe\sname\sof\sthe\stable\sbeing\schecked\sand\na\sflag\sto\sindicate\sa\s"quick_check".\s\sBased\son\sfeedback\sin\n[forum:/forumpost/965c0d02ea|forum\spost\s965c0d02ea]. -D 2023-10-25T10:37:11.394 +C Fix\sthe\samalgamation\sgenerator\sso\sthat\swhen\sit\sis\sreporting\sthe\sFossil\nversion\snumber\sin\sthe\sheader\scomment\sof\sthe\samalgamation,\sit\sdoes\snot\nelide\sthe\sfirst\shex\sdigit\sof\sthe\sversion\shash. +D 2023-10-25T12:58:06.512 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2069,7 +2069,7 @@ F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f -F tool/mksqlite3c.tcl 49e39b1e616abc92fd8c24445f2b0a38881825f764541e0026f72371f0d84b65 +F tool/mksqlite3c.tcl 2c760ab786cb509b47f00c96fea82994866cb99f5e046df81c768288f57897b4 F tool/mksqlite3h.tcl d391cff7cad0a372ee1406faee9ccc7dad9cb80a0c95cae0f73d10dd26e06762 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mktoolzip.tcl 6e17f53eb924c76ea5f290cf7b8f554cc245ad6299e46928419abcd2de691663 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 50448fe4fdc8fd93303fe26bdcd885ecc606080c8e66e69d5be8dac28a77492b -R 30ef2af5a58be5aa899fd43e3a6be25e +P bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05 +R 6ec86e3a31586d43a486c38d42879355 U drh -Z aefb39a97493c6e3bdb1f5a57cd2f3c5 +Z 0c4d685f28f353f462c813fc0dbcad7d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9bbe515f93..83cc6773bf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05 \ No newline at end of file +cc66f526bd58c110cac027583f636099fa05b2b56d7ea9807b554cd950c1bf3c \ No newline at end of file diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 6def8fa447..53fa59ac7a 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -116,7 +116,7 @@ if {$tcl_platform(platform)=="windows"} { if {[file executable $vsrcprog] && [file readable $srcroot/manifest]} { set res [string trim [split [exec $vsrcprog -x $srcroot]] \n] puts $out "** The content in this amalgamation comes from Fossil check-in" - puts -nonewline $out "** [string range [lindex $res 0] 1 35]" + puts -nonewline $out "** [string range [lindex $res 0] 0 35]" if {[llength $res]==1} { puts $out "." } else { From 8f99cb9ad69c8d423c4760fe67b78a0c01a1cff6 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 14:54:16 +0000 Subject: [PATCH 170/242] When doing a DISTINCT aggregate that contains an ORDER BY, only the arguments to the aggregate need to be distinct, not the ORDER BY terms. FossilOrigin-Name: d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/expr.c | 3 ++- src/select.c | 8 ++++++-- test/aggorderby.test | 17 +++++++++++++++++ 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 6d4c13160e..1fc4f1f48b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\samalgamation\sgenerator\sso\sthat\swhen\sit\sis\sreporting\sthe\sFossil\nversion\snumber\sin\sthe\sheader\scomment\sof\sthe\samalgamation,\sit\sdoes\snot\nelide\sthe\sfirst\shex\sdigit\sof\sthe\sversion\shash. -D 2023-10-25T12:58:06.512 +C When\sdoing\sa\sDISTINCT\saggregate\sthat\scontains\san\sORDER\sBY,\sonly\sthe\narguments\sto\sthe\saggregate\sneed\sto\sbe\sdistinct,\snot\sthe\sORDER\sBY\sterms. +D 2023-10-25T14:54:16.468 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -671,7 +671,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 072dc4029ccfb4be3d227b559d6d531c46c5fc95cd89f2db17a2e154a3144d71 +F src/expr.c 2ad50ae13cc6402973593eebd1f9af2c0915d5f7cc2c2f4f2f3472a9a7aeddce F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00 F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 @@ -721,7 +721,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c f9d8ece7f0742d7b835efa9590ccda4eccee5b9def7581ec94f556e3c52efe51 +F src/select.c 845936a85dd39be43a7b76aa0a5c1e68105bf0b98e4986124f78052254e3fe5b F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -817,7 +817,7 @@ F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 F test/aggnested.test 2e738bfe2980df301a782f6e7bbf9459266f64f7e72f58f3b5c843bf897c568c -F test/aggorderby.test 4a4b2d49532124fbb799a2c014e5134d0e6db2345b19286d027e227e0f383dfa +F test/aggorderby.test e6b98dbbf3ababa96892435d387de2dcf602ef02c2b848d2d817473066f154ba F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 F test/alter.test 403a7f8842457044a994d0ffb42963d6e84fcfbf5e8f54556063b25d966cd454 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P bc8afa3f15954bb35f65dbf940bf069de5e14d333036676c24430cf17b658d05 -R 6ec86e3a31586d43a486c38d42879355 +P cc66f526bd58c110cac027583f636099fa05b2b56d7ea9807b554cd950c1bf3c +R 2001118bd227fdbabf4cf18d4c63742c U drh -Z 0c4d685f28f353f462c813fc0dbcad7d +Z 9e38892552611c3668b16789a65f9f49 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 83cc6773bf..2a3eea65c3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cc66f526bd58c110cac027583f636099fa05b2b56d7ea9807b554cd950c1bf3c \ No newline at end of file +d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 010c8ce6ab..e071c96908 100644 --- a/src/expr.c +++ b/src/expr.c @@ -6806,16 +6806,17 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ pItem->iOBTab = pParse->nTab++; pOBList = pExpr->pLeft->x.pList; assert( pOBList->nExpr>0 ); + assert( pItem->bOBUnique==0 ); if( pOBList->nExpr==1 && nArg==1 && sqlite3ExprCompare(0,pOBList->a[0].pExpr, pExpr->x.pList->a[0].pExpr,0)==0 ){ pItem->bOBPayload = 0; + pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); }else{ pItem->bOBPayload = 1; } - pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); }else{ pItem->iOBTab = -1; } diff --git a/src/select.c b/src/select.c index 29df3325f3..5530321744 100644 --- a/src/select.c +++ b/src/select.c @@ -6771,6 +6771,7 @@ static void updateAccumulator( int addrNext = 0; int regAgg; int regAggSz = 0; + int regDistinct = 0; ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); assert( !IsWindowFunc(pF->pFExpr) ); @@ -6820,6 +6821,7 @@ static void updateAccumulator( } regAggSz++; /* One extra register to hold result of MakeRecord */ regAgg = sqlite3GetTempRange(pParse, regAggSz); + regDistinct = regAgg; sqlite3ExprCodeExprList(pParse, pOBList, regAgg, 0, SQLITE_ECEL_DUP); jj = pOBList->nExpr; if( !pF->bOBUnique ){ @@ -6827,11 +6829,13 @@ static void updateAccumulator( jj++; } if( pF->bOBPayload ){ - sqlite3ExprCodeExprList(pParse, pList, regAgg+jj, 0, SQLITE_ECEL_DUP); + regDistinct = regAgg+jj; + sqlite3ExprCodeExprList(pParse, pList, regDistinct, 0, SQLITE_ECEL_DUP); } }else if( pList ){ nArg = pList->nExpr; regAgg = sqlite3GetTempRange(pParse, nArg); + regDistinct = regAgg; sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP); }else{ nArg = 0; @@ -6842,7 +6846,7 @@ static void updateAccumulator( addrNext = sqlite3VdbeMakeLabel(pParse); } pF->iDistinct = codeDistinct(pParse, eDistinctType, - pF->iDistinct, addrNext, pList, regAgg); + pF->iDistinct, addrNext, pList, regDistinct); } if( pF->iOBTab>=0 ){ /* Insert a new record into the ORDER BY table */ diff --git a/test/aggorderby.test b/test/aggorderby.test index 61adb9ae14..f94c5ec898 100644 --- a/test/aggorderby.test +++ b/test/aggorderby.test @@ -102,4 +102,21 @@ do_execsql_test aggorderby-7.1 { json_group_array(x ORDER BY y NULLS LAST, x) FROM c; } {[2,4,5,3,1] [5,3,1,2,4]} +# The DISTINCT only applies to the function arguments, not to the +# ORDER BY arguments. +# +do_execsql_test aggorderby-8.0 { + WITH c(x,y,z) AS (VALUES('a',4,5),('b',3,6),('c',2,7),('c',1,8)) + SELECT group_concat(DISTINCT x ORDER BY y, z) FROM c; +} {c,b,a} +do_execsql_test aggorderby-8.1 { + WITH c(x,y,z) AS (VALUES('a',4,5),('b',3,6),('b',2,7),('c',1,8)) + SELECT group_concat(DISTINCT x ORDER BY y, z) FROM c; +} {c,b,a} +do_execsql_test aggorderby-8.2 { + WITH c(x,y) AS (VALUES(1,1),(2,2),(3,3),(3,4),(3,5),(3,6)) + SELECT sum(DISTINCT x ORDER BY y) FROM c; +} 6 + + finish_test From 47a484d8ed62b7455a915575c7311e878fb3bec6 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 15:30:11 +0000 Subject: [PATCH 171/242] Add an ALWAYS on branch that was made always-true by the DISTINCT ORDER BY fix. FossilOrigin-Name: c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 1fc4f1f48b..8ad88c1414 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\sdoing\sa\sDISTINCT\saggregate\sthat\scontains\san\sORDER\sBY,\sonly\sthe\narguments\sto\sthe\saggregate\sneed\sto\sbe\sdistinct,\snot\sthe\sORDER\sBY\sterms. -D 2023-10-25T14:54:16.468 +C Add\san\sALWAYS\son\sbranch\sthat\swas\smade\salways-true\sby\sthe\sDISTINCT\sORDER\sBY\nfix. +D 2023-10-25T15:30:11.779 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,7 +721,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 845936a85dd39be43a7b76aa0a5c1e68105bf0b98e4986124f78052254e3fe5b +F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cc66f526bd58c110cac027583f636099fa05b2b56d7ea9807b554cd950c1bf3c -R 2001118bd227fdbabf4cf18d4c63742c +P d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 +R 69224f49fd227efd4871d1e294714787 U drh -Z 9e38892552611c3668b16789a65f9f49 +Z 09c12c04ae80362f6524540f0fd3a848 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2a3eea65c3..d996fb461a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 \ No newline at end of file +c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d \ No newline at end of file diff --git a/src/select.c b/src/select.c index 5530321744..0dac37b10c 100644 --- a/src/select.c +++ b/src/select.c @@ -6715,7 +6715,7 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ assert( ExprUseXList(pF->pFExpr->pLeft) ); assert( pF->pFExpr->pLeft->x.pList!=0 ); nKey = pF->pFExpr->pLeft->x.pList->nExpr; - if( !pF->bOBUnique ) nKey++; + if( ALWAYS(!pF->bOBUnique) ) nKey++; } iTop = sqlite3VdbeAddOp1(v, OP_Rewind, pF->iOBTab); VdbeCoverage(v); for(j=nArg-1; j>=0; j--){ From b7086c48b68ca57ee6048e7d770b029b37336e56 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 17:26:11 +0000 Subject: [PATCH 172/242] Test module altermalloc3.test requires DQS_DDL to be turned on. FossilOrigin-Name: c4d02f4b0761a2836aa34f204e725f49478a19b02160e694e01042e6e7766167 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/altermalloc3.test | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 8ad88c1414..11a7a1493b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sALWAYS\son\sbranch\sthat\swas\smade\salways-true\sby\sthe\sDISTINCT\sORDER\sBY\nfix. -D 2023-10-25T15:30:11.779 +C Test\smodule\saltermalloc3.test\srequires\sDQS_DDL\sto\sbe\sturned\son. +D 2023-10-25T17:26:11.573 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -834,7 +834,7 @@ F test/alterfault.test 289067108947bedca27534edd4ff251bcd298cf84402d7b24eaa37493 F test/alterlegacy.test f38c6d06cda39e1f7b955bbce57f2e3ef5b7cb566d3d1234502093e228c15811 F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74a3fb80c9 F test/altermalloc2.test 17fb3724c4b004c469c27dc4ef181608aa644555fbd3f3236767584f73747c81 -F test/altermalloc3.test 8531b3086f0a7889f43971a579a8c81832d5123f4703d8c86b89ba1136c63b9a +F test/altermalloc3.test 8040e486368403f2fdd6fc3998258b499bd4cc2f3ddbb5f8f874cd436f076e81 F test/alterqf.test 8ec03d776de9c391daa0078ea8f838903bdcfb11dfae4ba3576b48436834ccba F test/altertab.test 8a2712f9076da5012a002d0b5cc0a421398a5bf61c25bab41b77c427586a7a27 F test/altertab2.test 62597b6fd08feaba1b6bfe7d31dac6117c67e06dc9ce9c478a3abe75b5926de0 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 -R 69224f49fd227efd4871d1e294714787 +P c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d +R 1801e0da56e4876ff07eaa2fbc6ddd00 U drh -Z 09c12c04ae80362f6524540f0fd3a848 +Z 79a4773e545153772af92c625c1e9ce1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d996fb461a..ffa1fbbd6e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d \ No newline at end of file +c4d02f4b0761a2836aa34f204e725f49478a19b02160e694e01042e6e7766167 \ No newline at end of file diff --git a/test/altermalloc3.test b/test/altermalloc3.test index 2dc0b46f29..47efebe228 100644 --- a/test/altermalloc3.test +++ b/test/altermalloc3.test @@ -26,6 +26,7 @@ set ::TMPDBERROR [list 1 \ {unable to open a temporary database file for storing temporary tables} ] +sqlite3_db_config db SQLITE_DBCONFIG_DQS_DDL 1 do_execsql_test 1.0 { CREATE TABLE x1( one, two, three, PRIMARY KEY(one), From 1d91f8619b8c82c0603977b4cb95f8fcc4aeafa1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 18:35:48 +0000 Subject: [PATCH 173/242] Fix minor problems with the "showwal" utility program. Add a missing header to the zipfile.c extension. FossilOrigin-Name: 7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6 --- ext/misc/zipfile.c | 1 + manifest | 14 +++++++------- manifest.uuid | 2 +- tool/showwal.c | 23 +++++++++++++++++------ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ext/misc/zipfile.c b/ext/misc/zipfile.c index 416a49443b..db327809f8 100644 --- a/ext/misc/zipfile.c +++ b/ext/misc/zipfile.c @@ -29,6 +29,7 @@ SQLITE_EXTENSION_INIT1 #include #include #include +#include #include diff --git a/manifest b/manifest index 11a7a1493b..9f37b1635c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Test\smodule\saltermalloc3.test\srequires\sDQS_DDL\sto\sbe\sturned\son. -D 2023-10-25T17:26:11.573 +C Fix\sminor\sproblems\swith\sthe\s"showwal"\sutility\sprogram.\s\sAdd\sa\smissing\sheader\nto\sthe\szipfile.c\sextension. +D 2023-10-25T18:35:48.042 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -404,7 +404,7 @@ F ext/misc/vfsstat.c a85df08654743922a19410d7b1e3111de41bb7cd07d20dd16eda4e2b808 F ext/misc/vtablog.c f2c9d41afe00b51b2c8307b79f508eb0c2dcd57bae074807944e73376fcf15b7 F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668 -F ext/misc/zipfile.c 59af123b4595801d495f55167523b68e840b8e5bfcbbb73f84cbc6a65a994ac2 +F ext/misc/zipfile.c 64cb3d98b6316586e6056d182051aa9d28fdedfbf4b908e6b7a7d70209b1db11 F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64 F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8 F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255 @@ -2088,7 +2088,7 @@ F tool/showjournal.c 5bad7ae8784a43d2b270d953060423b8bd480818 F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/showshm.c a0ab6ec32dd1f11218ca2a4018f8fb875b59414801ab8ceed8b2e69b7b45a809 F tool/showstat4.c 0682ebea7abf4d3657f53c4a243f2e7eab48eab344ed36a94bb75dcd19a5c2a1 -F tool/showwal.c 65ecabae3a2dcff4116301d5a8dbb8c4964814da1b2aff6d85c806a88b71fa4e +F tool/showwal.c 11eca547980a066b081f512636151233350ac679f29ecf4ebfce7f4530230b3d F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/spaceanal.tcl 70c87c04cfd2e77b3e6f21c33ca768296aa8f67d4ab4874786ac8fbb28433477 F tool/speed-check.sh 72dc85b2c0484af971ee3e7d10775f72b4e771e27e162c2099b3bf25517c25fb @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d -R 1801e0da56e4876ff07eaa2fbc6ddd00 +P c4d02f4b0761a2836aa34f204e725f49478a19b02160e694e01042e6e7766167 +R 0b8f4aebc898107714a7e5d3cf2077d1 U drh -Z 79a4773e545153772af92c625c1e9ce1 +Z 420ad20bfbeee1b4c84bf5501f995f57 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ffa1fbbd6e..bb1906f202 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c4d02f4b0761a2836aa34f204e725f49478a19b02160e694e01042e6e7766167 \ No newline at end of file +7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6 \ No newline at end of file diff --git a/tool/showwal.c b/tool/showwal.c index a8e9b53b32..7e6c0e17cd 100644 --- a/tool/showwal.c +++ b/tool/showwal.c @@ -543,15 +543,26 @@ int main(int argc, char **argv){ } zPgSz[0] = 0; zPgSz[1] = 0; - lseek(fd, 8, SEEK_SET); - read(fd, zPgSz, 4); + fstat(fd, &sbuf); + if( sbuf.st_size<32 ){ + printf("%s: file too small to be a WAL - only %d bytes\n", + argv[1], (int)sbuf.st_size); + return 0; + } + if( lseek(fd, 8, SEEK_SET)!=8 ){ + printf("\"%s\" seems to not be a valid WAL file\n", argv[1]); + return 1; + } + if( read(fd, zPgSz, 4)!=4 ){ + printf("\"%s\": cannot read the page size\n", argv[1]); + return 1; + } pagesize = zPgSz[1]*65536 + zPgSz[2]*256 + zPgSz[3]; if( pagesize==0 ) pagesize = 1024; printf("Pagesize: %d\n", pagesize); - fstat(fd, &sbuf); - if( sbuf.st_size<32 ){ - printf("file too small to be a WAL\n"); - return 0; + if( (pagesize & (pagesize-1))!=0 || pagesize<512 || pagesize>65536 ){ + printf("\"%s\": invalid page size.\n", argv[1]); + return 1; } mxFrame = (sbuf.st_size - 32)/(pagesize + 24); printf("Available pages: 1..%d\n", mxFrame); From d91884586a773b72f6fbaa46a86c56797fa24282 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 18:53:00 +0000 Subject: [PATCH 174/242] Provide dummy parameter names in the prototype for the new xIntegrity method of the sqlite3_module object. FossilOrigin-Name: 131374d720a365cbbe3031a2bc0a34ba1c74e751e39c66e484dbce07ab49fb62 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9f37b1635c..1e5e13f419 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sminor\sproblems\swith\sthe\s"showwal"\sutility\sprogram.\s\sAdd\sa\smissing\sheader\nto\sthe\szipfile.c\sextension. -D 2023-10-25T18:35:48.042 +C Provide\sdummy\sparameter\snames\sin\sthe\sprototype\sfor\sthe\snew\sxIntegrity\smethod\nof\sthe\ssqlite3_module\sobject. +D 2023-10-25T18:53:00.881 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed -F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e +F src/sqlite.h.in 428948ef39b3ef7b675ec12bd4853619bad77279b5fa38e3a51c5b9656ae16ff F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c4d02f4b0761a2836aa34f204e725f49478a19b02160e694e01042e6e7766167 -R 0b8f4aebc898107714a7e5d3cf2077d1 +P 7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6 +R 6d9977d57ab2d179650d1da7f78d796f U drh -Z 420ad20bfbeee1b4c84bf5501f995f57 +Z 667356e5303058006da752293bd2707e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index bb1906f202..ac5295a4da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6 \ No newline at end of file +131374d720a365cbbe3031a2bc0a34ba1c74e751e39c66e484dbce07ab49fb62 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f3db71dea9..d8caf81067 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -7277,7 +7277,8 @@ struct sqlite3_module { int (*xShadowName)(const char*); /* The methods above are in versions 1 through 3 of the sqlite_module object. ** Those below are for version 4 and greater. */ - int (*xIntegrity)(sqlite3_vtab *pVTab, const char*, const char*, int, char**); + int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema, + const char *zTabName, int mFlags, char **pzErr); }; /* From 208f5c65d4d97b7257bd13adcf2bcb07a34352b2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 25 Oct 2023 19:06:23 +0000 Subject: [PATCH 175/242] Fix harmless compiler warnings. FossilOrigin-Name: cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680 --- ext/misc/mmapwarm.c | 7 ++++--- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 9 --------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/ext/misc/mmapwarm.c b/ext/misc/mmapwarm.c index 5afa47bf7a..851f8b0eb7 100644 --- a/ext/misc/mmapwarm.c +++ b/ext/misc/mmapwarm.c @@ -38,7 +38,7 @@ int sqlite3_mmap_warm(sqlite3 *db, const char *zDb){ int rc = SQLITE_OK; char *zSql = 0; int pgsz = 0; - int nTotal = 0; + unsigned int nTotal = 0; if( 0==sqlite3_get_autocommit(db) ) return SQLITE_MISUSE; @@ -86,8 +86,8 @@ int sqlite3_mmap_warm(sqlite3 *db, const char *zDb){ rc = p->xFetch(pFd, pgsz*iPg, pgsz, (void**)&pMap); if( rc!=SQLITE_OK || pMap==0 ) break; - nTotal += pMap[0]; - nTotal += pMap[pgsz-1]; + nTotal += (unsigned int)pMap[0]; + nTotal += (unsigned int)pMap[pgsz-1]; rc = p->xUnfetch(pFd, pgsz*iPg, (void*)pMap); if( rc!=SQLITE_OK ) break; @@ -103,5 +103,6 @@ int sqlite3_mmap_warm(sqlite3 *db, const char *zDb){ if( rc==SQLITE_OK ) rc = rc2; } + (void)nTotal; return rc; } diff --git a/manifest b/manifest index 1e5e13f419..5075245d48 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Provide\sdummy\sparameter\snames\sin\sthe\sprototype\sfor\sthe\snew\sxIntegrity\smethod\nof\sthe\ssqlite3_module\sobject. -D 2023-10-25T18:53:00.881 +C Fix\sharmless\scompiler\swarnings. +D 2023-10-25T19:06:23.319 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -373,7 +373,7 @@ F ext/misc/ieee754.c 62a90978204d2c956d5036eb89e548e736ca5fac0e965912867ddd7bb83 F ext/misc/memstat.c 5b284b78be431c1f5fa154b18eade2407e42c65ed32ec9e9fbf195d114778d7d F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b F ext/misc/memvfs.c 7dffa8cc89c7f2d73da4bd4ccea1bcbd2bd283e3bb4cea398df7c372a197291b -F ext/misc/mmapwarm.c 347caa99915fb254e8949ec131667b7fae99e2a9ce91bd468efb6dc372d9b7a9 +F ext/misc/mmapwarm.c a81af4aaec00f24f308e2f4c19bf1d88f3ac3ce848c36daa7a4cd38145c4080d F ext/misc/nextchar.c 7877914c2a80c2f181dd04c3dbef550dfb54c93495dc03da2403b5dd58f34edd F ext/misc/noop.c 81efe4cad9ec740e64388b14281cb983e6e2c223fed43eb77ab3e34946e0c1ab F ext/misc/normalize.c bd84355c118e297522aba74de34a4fd286fc775524e0499b14473918d09ea61f @@ -705,7 +705,7 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 -F src/os_unix.c 2e8b12107f75d1bd16412f312b4c5d5103191807a37836d3b81beb26436ad81b +F src/os_unix.c cb116fde9e3ca3c1bbfdf89d6928f776a2a34da168e2667426523a4db353b271 F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 2188897e1102a776dcb1bbe8b2eb70ac7de8863c9cb95ef09d35e9bad406cf45 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7b3f866e619c2b781b613493727cd111335ceec690d984408725c756feff26e6 -R 6d9977d57ab2d179650d1da7f78d796f +P 131374d720a365cbbe3031a2bc0a34ba1c74e751e39c66e484dbce07ab49fb62 +R c0de33bff3e5c117952aa74ec280fe09 U drh -Z 667356e5303058006da752293bd2707e +Z 32e645354aeb54c909684a4b4c583e71 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ac5295a4da..535cf914a1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -131374d720a365cbbe3031a2bc0a34ba1c74e751e39c66e484dbce07ab49fb62 \ No newline at end of file +cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 59f67d142a..a33e6f4dff 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3150,9 +3150,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { unixInodeInfo *pInode; afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; int skipShared = 0; -#ifdef SQLITE_TEST - int h = pFile->h; -#endif assert( pFile ); OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock, @@ -3168,9 +3165,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); #ifdef SQLITE_DEBUG /* When reducing a lock such that other processes can start @@ -3219,9 +3213,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte; pInode->nShared--; if( pInode->nShared==0 ){ - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); if( !skipShared ){ rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0); } From 799e7433331d2c9f19914ba21cac2570b6cc10c0 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 25 Oct 2023 20:08:21 +0000 Subject: [PATCH 176/242] Updates to the mktoolzip.tcl to work on win32. FossilOrigin-Name: 166b775bb523362ffe17722ce175278726303c319fbe7e4a1e9291736db38a5d --- Makefile.msc | 2 +- manifest | 19 +++++++++++-------- manifest.uuid | 2 +- tool/mktoolzip.tcl | 18 ++++++++++++++---- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index d0ca0e76a6..4adbbee2a5 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -2467,7 +2467,7 @@ extensiontest: testfixture.exe testloadext.dll @set PATH=$(LIBTCLPATH);$(PATH) .\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS) -tool-zip: testfixture.exe sqlite3.exe sqldiff.exe sqlite3_analyzer.exe tool\mktoolzip.tcl +tool-zip: testfixture.exe sqlite3.exe sqldiff.exe sqlite3_analyzer.exe $(TOP)\tool\mktoolzip.tcl .\testfixture.exe $(TOP)\tool\mktoolzip.tcl coretestprogs: $(TESTPROGS) diff --git a/manifest b/manifest index 8ad88c1414..29386b9844 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Add\san\sALWAYS\son\sbranch\sthat\swas\smade\salways-true\sby\sthe\sDISTINCT\sORDER\sBY\nfix. -D 2023-10-25T15:30:11.779 +C Updates\sto\sthe\smktoolzip.tcl\sto\swork\son\swin32. +D 2023-10-25T20:08:21.183 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 2ea4105b72561483befe0a18a37f94ca3adbc2324bad3770f99555d95fb9b0ea F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc 0e088e4fc718668e640aafe148f4d6bf9131d63ba91d85253478a20cd37a4a80 +F Makefile.msc c1aa09e0212d8609df041d13da6ca63198d1c1e29846f33104beecf19917102b F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -2072,7 +2072,7 @@ F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6 F tool/mksqlite3c.tcl 2c760ab786cb509b47f00c96fea82994866cb99f5e046df81c768288f57897b4 F tool/mksqlite3h.tcl d391cff7cad0a372ee1406faee9ccc7dad9cb80a0c95cae0f73d10dd26e06762 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b -F tool/mktoolzip.tcl 6e17f53eb924c76ea5f290cf7b8f554cc245ad6299e46928419abcd2de691663 +F tool/mktoolzip.tcl c7a9b685f5131d755e7d941cec50cee7f34178b9e34c9a89811eeb08617f8423 F tool/mkvsix.tcl b9e0777a213c23156b6542842c238479e496ebf5 F tool/offsets.c 8ed2b344d33f06e71366a9b93ccedaa38c096cc1dbd4c3c26ad08c6115285845 F tool/omittest-msvc.tcl d6b8f501ac1d7798c4126065030f89812379012cad98a1735d6d7221492abc08 @@ -2138,8 +2138,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 -R 69224f49fd227efd4871d1e294714787 -U drh -Z 09c12c04ae80362f6524540f0fd3a848 +P c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d +R f15a5fdcd63b6841b7a7c9c0886fae2f +T *branch * win32-mktoolzip +T *sym-win32-mktoolzip * +T -sym-trunk * +U dan +Z f7ced12f7649f08d9657796243d67be4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d996fb461a..3d08a7357f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d \ No newline at end of file +166b775bb523362ffe17722ce175278726303c319fbe7e4a1e9291736db38a5d \ No newline at end of file diff --git a/tool/mktoolzip.tcl b/tool/mktoolzip.tcl index 0eb678825f..885bae960b 100644 --- a/tool/mktoolzip.tcl +++ b/tool/mktoolzip.tcl @@ -48,12 +48,22 @@ switch $tcl_platform(machine) { set ARCH unk } } -set in [open VERSION] +set in [open [file join [file dirname [file dirname [info script]]] VERSION]] set vers [read $in] close $in scan $vers %d.%d.%d v1 v2 v3 set v2 [format 3%02d%02d00 $v2 $v3] set name sqlite-tools-$OS-$ARCH-$v2.zip -puts "zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE" -puts [exec zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE] -puts [exec ls -l $name] + +if {$OS=="win32"} { + # The win32 tar.exe supports the -a ("auto-compress") option. This causes + # tar to create an archive type based on the extension of the output file. + # In this case, a zip file. + puts "tar -a -cf $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE" + puts [exec tar -a -cf $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE] + puts "$name: [file size $name] bytes" +} else { + puts "zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE" + puts [exec zip $name sqlite3$EXE sqldiff$EXE sqlite3_analyzer$EXE] + puts [exec ls -l $name] +} From 63aff62e697b46438004ac05fd6588e574e00f2f Mon Sep 17 00:00:00 2001 From: larrybr Date: Wed, 25 Oct 2023 20:27:18 +0000 Subject: [PATCH 177/242] In CLI for Windows builds, do MBCS/UTF-8 translation independently for input and output. (WIP) FossilOrigin-Name: 47b13e66e07be3a26cf7fa0b7b65ad8576c3b4be50fc422be8fe93be93d681ac --- manifest | 17 +++++---- manifest.uuid | 2 +- src/shell.c.in | 99 +++++++++++++++++++++++++++++--------------------- 3 files changed, 69 insertions(+), 49 deletions(-) diff --git a/manifest b/manifest index 8ad88c1414..dd27939d14 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sALWAYS\son\sbranch\sthat\swas\smade\salways-true\sby\sthe\sDISTINCT\sORDER\sBY\nfix. -D 2023-10-25T15:30:11.779 +C In\sCLI\sfor\sWindows\sbuilds,\sdo\sMBCS/UTF-8\stranslation\sindependently\sfor\sinput\sand\soutput.\s(WIP) +D 2023-10-25T20:27:18.335 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6ed +F src/shell.c.in 6b7662064d78025f0c68567971fe834840da8683972ac1ac7a02d6fbc9c166ef F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2138,8 +2138,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2dbbdf7194bab4e5e3b74d3dbffb012a335829824c775c72dd7347c013d2125 -R 69224f49fd227efd4871d1e294714787 -U drh -Z 09c12c04ae80362f6524540f0fd3a848 +P c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d +R 023b0809f9198b763f6cfba361f37800 +T *branch * win-utf8-io-split +T *sym-win-utf8-io-split * +T -sym-trunk * +U larrybr +Z 1eb3a8144b68660f3c58b794f51200b9 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d996fb461a..0e8e6f875b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d \ No newline at end of file +47b13e66e07be3a26cf7fa0b7b65ad8576c3b4be50fc422be8fe93be93d681ac \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index b78759c002..b970ce4799 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -449,12 +449,20 @@ static int bail_on_error = 0; */ static int stdin_is_interactive = 1; +/* +** If build is for Windows, without 3rd-party line editing, Console +** input and output may be done in a UTF-8 compatible way. This is +** determined by invocation option and OS installed capability. +*/ #if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \ && !defined(SHELL_OMIT_WIN_UTF8) # define SHELL_WIN_UTF8_OPT 1 - static int console_utf8 = sizeof(char*)/4 - 1; + static int console_utf8_in = 0; + static int console_utf8_out = 0; + static int mbcs_opted = 0; #else -# define console_utf8 0 +# define console_utf8_in 0 +# define console_utf8_out 0 # define SHELL_WIN_UTF8_OPT 0 #endif @@ -597,7 +605,7 @@ static struct ConsoleState { int infsMode; /* Input file stream mode upon shell start */ UINT inCodePage; /* Input code page upon shell start */ UINT outCodePage; /* Output code page upon shell start */ - HANDLE hConsoleIn; /* Console input handle */ + HANDLE hConsole; /* Console input or output handle */ DWORD consoleMode; /* Console mode upon shell start */ } conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 }; @@ -607,49 +615,59 @@ static struct ConsoleState { /* ** Prepare console, (if known to be a WIN32 console), for UTF-8 -** input (from either typing or suitable paste operations) and for +** input (from either typing or suitable paste operations) and/or for ** UTF-8 rendering. This may "fail" with a message to stderr, where ** the preparation is not done and common "code page" issues occur. */ -static void console_prepare(void){ +static void console_prepare_utf8(void){ HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE); + HANDLE hCO = GetStdHandle(STD_OUTPUT_HANDLE); + HANDLE hCC = INVALID_HANDLE_VALUE; DWORD consoleMode = 0; - if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR - && GetConsoleMode( hCI, &consoleMode) ){ - if( !IsValidCodePage(CP_UTF8) ){ - fprintf(stderr, "Cannot use UTF-8 code page.\n"); - console_utf8 = 0; - return; - } - conState.hConsoleIn = hCI; - conState.consoleMode = consoleMode; - conState.inCodePage = GetConsoleCP(); - conState.outCodePage = GetConsoleOutputCP(); + u8 conIO = 0; + + console_utf8_in = console_utf8_out = 0; + if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conIO = 1; + if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conIO |= 2; + if( conIO==0 || mbcs_opted ) return; + if( conIO & 1 ) hCC = hCI; + else hCC = hCO; + if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){ + fprintf(stderr, "Cannot use UTF-8 code page.\n"); + return; + } + conState.hConsole = hCC; + conState.consoleMode = consoleMode; + conState.inCodePage = GetConsoleCP(); + conState.outCodePage = GetConsoleOutputCP(); + if( conIO & 1 ){ + console_utf8_in = 1; SetConsoleCP(CP_UTF8); - SetConsoleOutputCP(CP_UTF8); consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; - SetConsoleMode(conState.hConsoleIn, consoleMode); + SetConsoleMode(conState.hConsole, consoleMode); conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); - console_utf8 = 1; - }else{ - console_utf8 = 0; + } + if( conIO & 2 ){ + console_utf8_out = 1; + SetConsoleOutputCP(CP_UTF8); } } /* -** Undo the effects of console_prepare(), if any. +** Undo the effects of console_prepare_utf8(), if any. */ static void SQLITE_CDECL console_restore(void){ - if( console_utf8 && conState.inCodePage!=0 - && conState.hConsoleIn!=INVALID_HANDLE_VALUE ){ + if( (console_utf8_in||console_utf8_out) && conState.inCodePage!=0 + && conState.hConsole!=INVALID_HANDLE_VALUE ){ _setmode(_fileno(stdin), conState.infsMode); SetConsoleCP(conState.inCodePage); SetConsoleOutputCP(conState.outCodePage); - SetConsoleMode(conState.hConsoleIn, conState.consoleMode); + SetConsoleMode(conState.hConsole, conState.consoleMode); /* Avoid multiple calls. */ - conState.hConsoleIn = INVALID_HANDLE_VALUE; + conState.hConsole = INVALID_HANDLE_VALUE; conState.consoleMode = 0; - console_utf8 = 0; + console_utf8_in = 0; + console_utf8_out = 0; } } @@ -657,11 +675,11 @@ static void SQLITE_CDECL console_restore(void){ ** Collect input like fgets(...) with special provisions for input ** from the Windows console to get around its strange coding issues. ** Defers to plain fgets() when input is not interactive or when the -** startup option, -utf8, has not been provided or taken effect. +** UTF-8 input is unavailable or opted out. */ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ if( fin==0 ) fin = stdin; - if( fin==stdin && stdin_is_interactive && console_utf8 ){ + if( fin==stdin && stdin_is_interactive && console_utf8_in ){ # define SQLITE_IALIM 150 wchar_t wbuf[SQLITE_IALIM]; int lend = 0; @@ -674,7 +692,7 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ ? SQLITE_IALIM : (ncmax-1 - noc)/4; # undef SQLITE_IALIM DWORD nbr = 0; - BOOL bRC = ReadConsoleW(conState.hConsoleIn, wbuf, na, &nbr, 0); + BOOL bRC = ReadConsoleW(conState.hConsole, wbuf, na, &nbr, 0); if( !bRC || (noc==0 && nbr==0) ) return 0; if( nbr > 0 ){ int nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR, @@ -720,8 +738,8 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ /* ** Render output like fprintf(). Except, if the output is going to the -** console and if this is running on a Windows machine, and if the -utf8 -** option is unavailable or (available and inactive), translate the +** console and if this is running on a Windows machine, and if UTF-8 +** output unavailable (or available but opted out), translate the ** output from UTF-8 into MBCS for output through 8-bit stdout stream. ** (With -utf8 active, no translation is needed and must not be done.) */ @@ -729,7 +747,7 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ void utf8_printf(FILE *out, const char *zFormat, ...){ va_list ap; va_start(ap, zFormat); - if( stdout_is_console && (out==stdout || out==stderr) && !console_utf8 ){ + if( stdout_is_console && (out==stdout || out==stderr) && !console_utf8_out ){ char *z1 = sqlite3_vmprintf(zFormat, ap); char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0); sqlite3_free(z1); @@ -942,8 +960,8 @@ static char *local_getline(char *zLine, FILE *in){ #if defined(_WIN32) || defined(WIN32) /* For interactive input on Windows systems, without -utf8, ** translate the multi-byte characterset characters into UTF-8. - ** This is the translation that predates the -utf8 option. */ - if( stdin_is_interactive && in==stdin && !console_utf8 ){ + ** This is the translation that predates console UTF-8 input. */ + if( stdin_is_interactive && in==stdin && !console_utf8_in ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ i64 nTrans = strlen(zTrans)+1; @@ -12503,11 +12521,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdin_is_interactive = 0; }else if( cli_strcmp(z,"-utf8")==0 ){ #if SHELL_WIN_UTF8_OPT - console_utf8 = 1; + mbcs_opted = 0; #endif /* SHELL_WIN_UTF8_OPT */ }else if( cli_strcmp(z,"-no-utf8")==0 ){ #if SHELL_WIN_UTF8_OPT - console_utf8 = 0; + mbcs_opted = 1; #endif /* SHELL_WIN_UTF8_OPT */ }else if( cli_strcmp(z,"-heap")==0 ){ i++; @@ -12591,11 +12609,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ data.cMode = data.mode; } #if SHELL_WIN_UTF8_OPT - if( console_utf8 && stdin_is_interactive ){ - console_prepare(); + if( stdin_is_interactive ){ + console_prepare_utf8(); }else{ setBinaryMode(stdin, 0); - console_utf8 = 0; } #endif @@ -12636,7 +12653,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ const char *zCharset = ""; int nHistory; #if SHELL_WIN_UTF8_OPT - if( console_utf8 ) zCharset = " (utf8)"; + if( console_utf8_in ) zCharset = " (utf8)"; #endif printf( "SQLite version %s %.19s%s\n" /*extra-version-info*/ From 634b037fa38c42d03cf67abea5a0e79e40df896b Mon Sep 17 00:00:00 2001 From: larrybr Date: Wed, 25 Oct 2023 20:44:01 +0000 Subject: [PATCH 178/242] Cure a harmless MSVC warning. (no other changes) FossilOrigin-Name: 02234ef85ed9349ddf6225f67b7e941b0b68cbd2e58c9d7d84a8324393349853 --- ext/session/sqlite3session.c | 2 +- manifest | 15 ++++++--------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index a5538ddacf..4f682a13d3 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -1268,7 +1268,7 @@ static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ } } - sqlite3_free(azCol); + sqlite3_free((char*)azCol); return pSession->rc; } diff --git a/manifest b/manifest index dd27939d14..64593c1910 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sCLI\sfor\sWindows\sbuilds,\sdo\sMBCS/UTF-8\stranslation\sindependently\sfor\sinput\sand\soutput.\s(WIP) -D 2023-10-25T20:27:18.335 +C Cure\sa\sharmless\sMSVC\swarning.\s(no\sother\schanges) +D 2023-10-25T20:44:01.155 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -554,7 +554,7 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795 F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb467ea7e12d0d0280c F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc -F ext/session/sqlite3session.c 3e8aa4bd7136b5504952b5d3ab0b2e75f2ab50c7fc2f9915ef980d382dabbf51 +F ext/session/sqlite3session.c 7b0f9bf6479aebd49e5f34cdaeb1479cde843cf5189bca6f32db4f36c130b414 F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e F ext/session/test_session.c 73e9921205633a08c1497770beecf3dcbc9b826dd4358f7f8152f706eaac5d71 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 @@ -2138,11 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c29ebcb0be8e969c359c077bd4ce752a9c952d2659062868f12efdd2cc77186d -R 023b0809f9198b763f6cfba361f37800 -T *branch * win-utf8-io-split -T *sym-win-utf8-io-split * -T -sym-trunk * +P 47b13e66e07be3a26cf7fa0b7b65ad8576c3b4be50fc422be8fe93be93d681ac +R b74c842dae72512c83feef833a3df3e2 U larrybr -Z 1eb3a8144b68660f3c58b794f51200b9 +Z 0170b741738e0aeb080b89c815bde8d0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0e8e6f875b..1fae80af8b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -47b13e66e07be3a26cf7fa0b7b65ad8576c3b4be50fc422be8fe93be93d681ac \ No newline at end of file +02234ef85ed9349ddf6225f67b7e941b0b68cbd2e58c9d7d84a8324393349853 \ No newline at end of file From 3c75a03615ec49cdad31983b1e6140d3d716f905 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 26 Oct 2023 12:59:41 +0000 Subject: [PATCH 179/242] Deal with the case of a reentrant INSERT on a virtual table where the outer INSERT has a RETURNING clause but the inner does not. dbsqlfuzz 3ac9a1e33f676254e02c0f297263b0a7aeb0c1a5. FossilOrigin-Name: 8aba78e4dbf5c196aa50a28579f4bcd7c96103661c5968d62b2fded075bc73e4 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/trigger.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 5075245d48..009e49e106 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings. -D 2023-10-25T19:06:23.319 +C Deal\swith\sthe\scase\sof\sa\sreentrant\sINSERT\son\sa\svirtual\stable\swhere\sthe\nouter\sINSERT\shas\sa\sRETURNING\sclause\sbut\sthe\sinner\sdoes\snot.\ndbsqlfuzz\s3ac9a1e33f676254e02c0f297263b0a7aeb0c1a5. +D 2023-10-26T12:59:41.136 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -785,7 +785,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 F src/treeview.c 62fafcd31eea60b718f8daf448116b7b19f90134ebc6c20777ddbb07f56a3d28 -F src/trigger.c 5286019b152f622a38900284109e4aae1e5f566deb7ad9ba7e931f0660771f32 +F src/trigger.c e8c460233d28e1cb291b08ffe00749d313f3686be79ac50f1af15f3087053449 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 131374d720a365cbbe3031a2bc0a34ba1c74e751e39c66e484dbce07ab49fb62 -R c0de33bff3e5c117952aa74ec280fe09 +P cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680 +R 9ba44fb9dc03b38d8120c04401aaff8f U drh -Z 32e645354aeb54c909684a4b4c583e71 +Z ab6f9f2ea52a3134056d677d31c255aa # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 535cf914a1..15e01cccdb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680 \ No newline at end of file +8aba78e4dbf5c196aa50a28579f4bcd7c96103661c5968d62b2fded075bc73e4 \ No newline at end of file diff --git a/src/trigger.c b/src/trigger.c index 2decea8206..c4f09a4866 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -970,7 +970,7 @@ static void codeReturningTrigger( SrcList sFrom; assert( v!=0 ); - assert( pParse->bReturning ); + if( !pParse->bReturning ) return; assert( db->pParse==pParse ); pReturning = pParse->u1.pReturning; assert( pTrigger == &(pReturning->retTrig) ); From 69d40f8e1f04ddcab9d78663693bd9b145830a3d Mon Sep 17 00:00:00 2001 From: larrybr Date: Thu, 26 Oct 2023 15:12:41 +0000 Subject: [PATCH 180/242] Ready for merge, but could use testing on some dusty old Windows machines. FossilOrigin-Name: 20220615621e01ff83fd26133840e2553a6087bcb56bbb8e9bf1408dd881cd9b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 23 ++++++++++++++--------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 64593c1910..e083c76ea0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cure\sa\sharmless\sMSVC\swarning.\s(no\sother\schanges) -D 2023-10-25T20:44:01.155 +C Ready\sfor\smerge,\sbut\scould\suse\stesting\son\ssome\sdusty\sold\sWindows\smachines. +D 2023-10-26T15:12:41.667 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 6b7662064d78025f0c68567971fe834840da8683972ac1ac7a02d6fbc9c166ef +F src/shell.c.in 14d70da4c678b2d9d8df105e113669ca956fad1d8538976e33fc8f878c17e84d F src/sqlite.h.in 81c70644aeef9c974f72c9cadeb505ebb9441d2f6db594c018604ae935a12e6e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2138,8 +2138,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 47b13e66e07be3a26cf7fa0b7b65ad8576c3b4be50fc422be8fe93be93d681ac -R b74c842dae72512c83feef833a3df3e2 +P 02234ef85ed9349ddf6225f67b7e941b0b68cbd2e58c9d7d84a8324393349853 +R 89654e88f6715a69f16578b67cbc1c07 U larrybr -Z 0170b741738e0aeb080b89c815bde8d0 +Z 1dcda7e82518a66f972beec27c9600f6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1fae80af8b..7e50ecd289 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -02234ef85ed9349ddf6225f67b7e941b0b68cbd2e58c9d7d84a8324393349853 \ No newline at end of file +20220615621e01ff83fd26133840e2553a6087bcb56bbb8e9bf1408dd881cd9b \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index b970ce4799..53d3551279 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -624,13 +624,13 @@ static void console_prepare_utf8(void){ HANDLE hCO = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hCC = INVALID_HANDLE_VALUE; DWORD consoleMode = 0; - u8 conIO = 0; + u8 conI = 0, conO = 0; console_utf8_in = console_utf8_out = 0; - if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conIO = 1; - if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conIO |= 2; - if( conIO==0 || mbcs_opted ) return; - if( conIO & 1 ) hCC = hCI; + if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conI = 1; + if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conO = 1; + if( (!conI && !conO) || mbcs_opted ) return; + if( conI ) hCC = hCI; else hCC = hCO; if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){ fprintf(stderr, "Cannot use UTF-8 code page.\n"); @@ -640,14 +640,14 @@ static void console_prepare_utf8(void){ conState.consoleMode = consoleMode; conState.inCodePage = GetConsoleCP(); conState.outCodePage = GetConsoleOutputCP(); - if( conIO & 1 ){ + if( conI ){ console_utf8_in = 1; SetConsoleCP(CP_UTF8); consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; SetConsoleMode(conState.hConsole, consoleMode); conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); } - if( conIO & 2 ){ + if( conO ){ console_utf8_out = 1; SetConsoleOutputCP(CP_UTF8); } @@ -657,7 +657,7 @@ static void console_prepare_utf8(void){ ** Undo the effects of console_prepare_utf8(), if any. */ static void SQLITE_CDECL console_restore(void){ - if( (console_utf8_in||console_utf8_out) && conState.inCodePage!=0 + if( (console_utf8_in||console_utf8_out) && conState.hConsole!=INVALID_HANDLE_VALUE ){ _setmode(_fileno(stdin), conState.infsMode); SetConsoleCP(conState.inCodePage); @@ -12653,7 +12653,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ const char *zCharset = ""; int nHistory; #if SHELL_WIN_UTF8_OPT - if( console_utf8_in ) zCharset = " (utf8)"; + switch( console_utf8_in+2*console_utf8_out ){ + default: case 0: break; + case 1: zCharset = " (utf8 in)"; break; + case 2: zCharset = " (utf8 out)"; break; + case 3: zCharset = " (utf8 I/O)"; break; + } #endif printf( "SQLite version %s %.19s%s\n" /*extra-version-info*/ From 94331d406a9549f5dd795a8f6a805a23aefed729 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 26 Oct 2023 16:05:57 +0000 Subject: [PATCH 181/242] Handle the case where a virtual table xBestIndex method called while coding a trigger fired by a top-level statement with a RETURNING clause prepares a statement that also contains a RETURNING clause. FossilOrigin-Name: ec6bffa3b0fbf7cdee852cb0208de1f5869dafd88e2ee64c23cec89634219adc --- manifest | 17 +++++---- manifest.uuid | 2 +- src/build.c | 17 +++------ src/sqliteInt.h | 1 + test/bestindexB.test | 87 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 20 deletions(-) create mode 100644 test/bestindexB.test diff --git a/manifest b/manifest index 009e49e106..70aeaa22c5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Deal\swith\sthe\scase\sof\sa\sreentrant\sINSERT\son\sa\svirtual\stable\swhere\sthe\nouter\sINSERT\shas\sa\sRETURNING\sclause\sbut\sthe\sinner\sdoes\snot.\ndbsqlfuzz\s3ac9a1e33f676254e02c0f297263b0a7aeb0c1a5. -D 2023-10-26T12:59:41.136 +C Handle\sthe\scase\swhere\sa\svirtual\stable\sxBestIndex\smethod\scalled\swhile\scoding\sa\strigger\sfired\sby\sa\stop-level\sstatement\swith\sa\sRETURNING\sclause\sprepares\sa\sstatement\sthat\salso\scontains\sa\sRETURNING\sclause. +D 2023-10-26T16:05:57.832 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -663,7 +663,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 F src/btree.c f6c8512a0db0851877683e41936aac0f8927bc31630cbb1bc87ccccf79c06944 F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15 -F src/build.c 1a9061ab67987cfa9c7f9d52ccc862a31d37ad2b05faaf0d72eeb4b4b5ee37cf +F src/build.c 189e4517d67f09f0a3e0d8e1faa6e2ef0c2e95f6ac82e33c912cb7efa2a359cc F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b @@ -726,7 +726,7 @@ F src/shell.c.in acc452c414fddd10289d165be3c89a7a2c36c919def04c93fb7dd11ac022e6e F src/sqlite.h.in 428948ef39b3ef7b675ec12bd4853619bad77279b5fa38e3a51c5b9656ae16ff F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac -F src/sqliteInt.h cf6646e8694a63749096e1f086767a2c1920dca9848ec2dbe9f7bfb961d322ef +F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -905,6 +905,7 @@ F test/bestindex7.test f094c669a6400777f4d2ddc3ed28e39169f1adb5be3d59b55f22ccf8c F test/bestindex8.test 333ad8c6a554b885a49b68c019166eda92b05f493a92b36b0acdf7f766d04dad F test/bestindex9.test 1a4b93db117fd8abe74ae9be982f86aa72f01e60cd4ac541e6ede39673a451a0 F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572eef44c7f +F test/bestindexB.test 328b97b69cd1a20928d5997f9ecb04d2e00f1d18e19ab27f9e9adb44d7bc51ce F test/between.test b9a65fb065391980119e8a781a7409d3fcf059d89968279c750e190a9a1d5263 F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59 F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc @@ -2138,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680 -R 9ba44fb9dc03b38d8120c04401aaff8f -U drh -Z ab6f9f2ea52a3134056d677d31c255aa +P 8aba78e4dbf5c196aa50a28579f4bcd7c96103661c5968d62b2fded075bc73e4 +R 3f971dd192c77b68556855589625c95d +U dan +Z ef9839d8477bc114052377f752ca4da6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 15e01cccdb..edc06300fd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8aba78e4dbf5c196aa50a28579f4bcd7c96103661c5968d62b2fded075bc73e4 \ No newline at end of file +ec6bffa3b0fbf7cdee852cb0208de1f5869dafd88e2ee64c23cec89634219adc \ No newline at end of file diff --git a/src/build.c b/src/build.c index 24f5d3f96a..3d06792358 100644 --- a/src/build.c +++ b/src/build.c @@ -1407,20 +1407,13 @@ void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ } #endif -/* -** Name of the special TEMP trigger used to implement RETURNING. The -** name begins with "sqlite_" so that it is guaranteed not to collide -** with any application-generated triggers. -*/ -#define RETURNING_TRIGGER_NAME "sqlite_returning" - /* ** Clean up the data structures associated with the RETURNING clause. */ static void sqlite3DeleteReturning(sqlite3 *db, Returning *pRet){ Hash *pHash; pHash = &(db->aDb[1].pSchema->trigHash); - sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, 0); + sqlite3HashInsert(pHash, pRet->zName, 0); sqlite3ExprListDelete(db, pRet->pReturnEL); sqlite3DbFree(db, pRet); } @@ -1463,7 +1456,9 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){ (void(*)(sqlite3*,void*))sqlite3DeleteReturning, pRet); testcase( pParse->earlyCleanup ); if( db->mallocFailed ) return; - pRet->retTrig.zName = RETURNING_TRIGGER_NAME; + sqlite3_snprintf(sizeof(pRet->zName), pRet->zName, + "sqlite_returning_%p", pParse); + pRet->retTrig.zName = pRet->zName; pRet->retTrig.op = TK_RETURNING; pRet->retTrig.tr_tm = TRIGGER_AFTER; pRet->retTrig.bReturning = 1; @@ -1474,9 +1469,9 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){ pRet->retTStep.pTrig = &pRet->retTrig; pRet->retTStep.pExprList = pList; pHash = &(db->aDb[1].pSchema->trigHash); - assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 + assert( sqlite3HashFind(pHash, pRet->zName)==0 || pParse->nErr || pParse->ifNotExists ); - if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig) + if( sqlite3HashInsert(pHash, pRet->zName, &pRet->retTrig) ==&pRet->retTrig ){ sqlite3OomFault(db); } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index b6cc81fba1..dbf01dd139 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -4077,6 +4077,7 @@ struct Returning { 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" */ }; /* diff --git a/test/bestindexB.test b/test/bestindexB.test new file mode 100644 index 0000000000..b50e74fee3 --- /dev/null +++ b/test/bestindexB.test @@ -0,0 +1,87 @@ +# 2023-10-26 +# +# 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 +set testprefix bestindexB + +ifcapable !vtab { + finish_test + return +} + +register_tcl_module db + +proc vtab_command {method args} { + switch -- $method { + xConnect { + return "CREATE TABLE t1(a, b, c)" + } + + xBestIndex { + set hdl [lindex $args 0] + set clist [$hdl constraints] + set orderby [$hdl orderby] + + if {[info exists ::xbestindex_sql]} { + explain_i $::xbestindex_sql + set ::xbestindex_res [ execsql $::xbestindex_sql ] + } + + return "cost 1000000 rows 1000000 idxnum 0 idxstr hello" + } + + xFilter { + return "sql {SELECT 0, 1, 2, 3}" + } + } + + return {} +} + +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE x1 USING tcl(vtab_command); + CREATE TABLE y1(a, b); + CREATE TABLE y2(a, b); +} {} + +do_execsql_test 1.1 { + SELECT * FROM x1 +} {1 2 3} + +do_execsql_test 1.2 { + INSERT INTO y1 VALUES(1, 2) RETURNING rowid; +} {1} + +do_execsql_test 1.3 { + CREATE TRIGGER y1tr BEFORE INSERT ON y1 BEGIN + SELECT * FROM x1; + END; + INSERT INTO y1 VALUES(3, 4) RETURNING rowid; +} {2} + + +# This time, rig the xBestIndex() method of the vtab to invoke an SQL +# statement that uses RETURNING. +set ::xbestindex_sql { + INSERT INTO y2 VALUES(NULL, NULL) RETURNING rowid; +} +do_execsql_test 1.4 { + INSERT INTO y1 VALUES(5, 6) RETURNING rowid; +} {3} + +do_test 1.5 { + set ::xbestindex_res +} {1} + +finish_test From 113e15fbbe3422367f158a78f2d2452db1dcfff0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 26 Oct 2023 16:59:22 +0000 Subject: [PATCH 182/242] Further enhancements to make sure the correct returnning trigger is run when there are nested INSERT RETURNING statements. FossilOrigin-Name: d83405e870b071540b56e76291bdce1388db80b860afd68a34e4233f6ff2a3ab --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/trigger.c | 11 +++++++++-- test/vt02.c | 7 +++++-- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 70aeaa22c5..aa0307cf1b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Handle\sthe\scase\swhere\sa\svirtual\stable\sxBestIndex\smethod\scalled\swhile\scoding\sa\strigger\sfired\sby\sa\stop-level\sstatement\swith\sa\sRETURNING\sclause\sprepares\sa\sstatement\sthat\salso\scontains\sa\sRETURNING\sclause. -D 2023-10-26T16:05:57.832 +C Further\senhancements\sto\smake\ssure\sthe\scorrect\sreturnning\strigger\sis\srun\swhen\nthere\sare\snested\sINSERT\sRETURNING\sstatements. +D 2023-10-26T16:59:22.532 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -785,7 +785,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/tokenize.c 23d9f4539880b40226254ad9072f4ecf12eb1902e62aea47aac29928afafcfd5 F src/treeview.c 62fafcd31eea60b718f8daf448116b7b19f90134ebc6c20777ddbb07f56a3d28 -F src/trigger.c e8c460233d28e1cb291b08ffe00749d313f3686be79ac50f1af15f3087053449 +F src/trigger.c 0905b96b04bb6658509f711a8207287f1315cdbc3df1a1b13ba6483c8e341c81 F src/update.c 6904814dd62a7a93bbb86d9f1419c7f134a9119582645854ab02b36b676d9f92 F src/upsert.c fa125a8d3410ce9a97b02cb50f7ae68a2476c405c76aa692d3acf6b8586e9242 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 @@ -1886,7 +1886,7 @@ F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 F test/view.test d4c4281e1679245829db35597817282f60dc513fc39cc5439078f009bd118487 F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679 F test/view3.test ad8a8290ee2b55ff6ce66c9ef1ce3f1e47926273a3814e1c425293e128a95456 -F test/vt02.c 9f098d11920c832900959d7a2545fd67476d76ea6d4147e0b8ff70e915794e5b +F test/vt02.c 5b44ac67b1a283fedecf2d6e2ceda61e7a157f01d44dcb4490dcb1e87d057060 F test/vtab1.test 09a72330d0f31eda2ffaa828b06a6b917fb86250ee72de0301570af725774c07 F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082 F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8aba78e4dbf5c196aa50a28579f4bcd7c96103661c5968d62b2fded075bc73e4 -R 3f971dd192c77b68556855589625c95d -U dan -Z ef9839d8477bc114052377f752ca4da6 +P ec6bffa3b0fbf7cdee852cb0208de1f5869dafd88e2ee64c23cec89634219adc +R b477c0da03665873d8762d7870dd6ef6 +U drh +Z 2e58a9a8215340c7ff8b8940ddc39cbe # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index edc06300fd..378e98d271 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ec6bffa3b0fbf7cdee852cb0208de1f5869dafd88e2ee64c23cec89634219adc \ No newline at end of file +d83405e870b071540b56e76291bdce1388db80b860afd68a34e4233f6ff2a3ab \ No newline at end of file diff --git a/src/trigger.c b/src/trigger.c index c4f09a4866..97ca249be5 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -970,10 +970,17 @@ static void codeReturningTrigger( SrcList sFrom; assert( v!=0 ); - if( !pParse->bReturning ) return; + if( !pParse->bReturning ){ + /* This RETURNING trigger must be for a different statement as + ** this statement lacks a RETURNING clause. */ + return; + } assert( db->pParse==pParse ); pReturning = pParse->u1.pReturning; - assert( pTrigger == &(pReturning->retTrig) ); + if( pTrigger != &(pReturning->retTrig) ){ + /* This RETURNING trigger is for a different statement */ + return; + } memset(&sSelect, 0, sizeof(sSelect)); memset(&sFrom, 0, sizeof(sFrom)); sSelect.pEList = sqlite3ExprListDup(db, pReturning->pReturnEL, 0); diff --git a/test/vt02.c b/test/vt02.c index 350a0400e9..06fade0969 100644 --- a/test/vt02.c +++ b/test/vt02.c @@ -580,8 +580,11 @@ static void sqlite3BestIndexLog( sqlite3_finalize(pStmt); } sqlite3RunSql(db,pVTab, - "INSERT INTO temp.\"%w\"(bi,vn,ix) VALUES(%d,'nConstraint',%d)", - zLogTab, iBI, pInfo->nConstraint + "INSERT INTO temp.\"%w\"(bi,vn,ix) VALUES(%d,'nConstraint',%d)" + "RETURNING iif(bi=%d,'ok',RAISE(ABORT,'wrong trigger'))", + /* The RETURNING clause checks to see that the returning trigger fired + ** for the correct INSERT in the case of nested INSERT RETURNINGs. */ + zLogTab, iBI, pInfo->nConstraint, iBI ); for(i=0; inConstraint; i++){ sqlite3_value *pVal; From c42276f63e72b993e2b0ef8776d5d906a8e1dd7e Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 27 Oct 2023 10:49:17 +0000 Subject: [PATCH 183/242] Back out [2904fcbeebba9189], mostly. The page bitmap is needed even for a partial integrity_check in order to avoid an infinite loops while walking the database. FossilOrigin-Name: dd6e03b37356e2961abd97f636402c09744c98c3033f3435503958c6219f9121 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/btree.c | 14 ++++---------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 21b3b47224..b02b855491 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sCLI\sfor\sWindows\sbuilds,\sdo\sMBCS/UTF-8\stranslation\sindependently\sfor\sinput\sand\soutput.\s(And\scure\san\sMSVC\swarning.) -D 2023-10-26T18:41:13.465 +C Back\sout\s[2904fcbeebba9189],\smostly.\s\sThe\spage\sbitmap\sis\sneeded\seven\sfor\sa\npartial\sintegrity_check\sin\sorder\sto\savoid\san\sinfinite\sloops\swhile\swalking\sthe\ndatabase. +D 2023-10-27T10:49:17.477 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -660,7 +660,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c f6c8512a0db0851877683e41936aac0f8927bc31630cbb1bc87ccccf79c06944 +F src/btree.c f3b09c5414de3a11db73e11e1d66f4c5e53c9e89876ff3b531a887ab656ca303 F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15 F src/build.c 189e4517d67f09f0a3e0d8e1faa6e2ef0c2e95f6ac82e33c912cb7efa2a359cc @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2f2f9126562c24966b0e9bc3629b85950c20199c41250478ba1da68eb7a0046 59452e7c72de02c2b6d40974c91173d87fd5f6f2e28c0b1f6f53eb1a09693fb6 -R 1716e4fec6d2ad5fb1fb5737fb80f58b -U larrybr -Z 9ed808ed6c9d999a4b8724038afbe422 +P 80f0b6f9c76c049edaaaeedc1745978b9d5b02a9c34bbf64209266a154b2b0e3 +R 84d7c9418e41d2dbf6dd84433b9d6b54 +U drh +Z eb223c9086f97454e7586a05089e442c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a27d977737..3777dcf2b7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -80f0b6f9c76c049edaaaeedc1745978b9d5b02a9c34bbf64209266a154b2b0e3 \ No newline at end of file +dd6e03b37356e2961abd97f636402c09744c98c3033f3435503958c6219f9121 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 7e340f5e5e..5be30d562c 100644 --- a/src/btree.c +++ b/src/btree.c @@ -10484,7 +10484,6 @@ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ */ static int checkRef(IntegrityCk *pCheck, Pgno iPage){ if( iPage>pCheck->nCkPage || iPage==0 ){ - if( pCheck->nCkPage==0 ) return 0; /* omit reference counting */ checkAppendMsg(pCheck, "invalid page number %u", iPage); return 1; } @@ -10990,15 +10989,10 @@ int sqlite3BtreeIntegrityCheck( goto integrity_ck_cleanup; } - if( bPartial ){ - sCheck.nCkPage = 0; - sCheck.aPgRef = 0; - }else{ - sCheck.aPgRef = sqlite3MallocZero((sCheck.nCkPage / 8)+ 1); - if( !sCheck.aPgRef ){ - checkOom(&sCheck); - goto integrity_ck_cleanup; - } + sCheck.aPgRef = sqlite3MallocZero((sCheck.nCkPage / 8)+ 1); + if( !sCheck.aPgRef ){ + checkOom(&sCheck); + goto integrity_ck_cleanup; } sCheck.heap = (u32*)sqlite3PageMalloc( pBt->pageSize ); if( sCheck.heap==0 ){ From 1b2a93ea366a46d191376fc5b6db3f65e0bffe6c Mon Sep 17 00:00:00 2001 From: larrybr Date: Fri, 27 Oct 2023 13:59:05 +0000 Subject: [PATCH 184/242] Cleanup shell.c comments. Hide -utf8 option, as it is undocumented and accepted only for backward compatibility. No functional changes except for -help content. FossilOrigin-Name: 3a87995560b5acbebeb5af407aa9eddf4c37c6a27ec9429ece0ea931918f9d9c --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/btree.c | 0 src/shell.c.in | 15 ++++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) mode change 100644 => 100755 src/btree.c diff --git a/manifest b/manifest index b02b855491..cfc5de0f6e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Back\sout\s[2904fcbeebba9189],\smostly.\s\sThe\spage\sbitmap\sis\sneeded\seven\sfor\sa\npartial\sintegrity_check\sin\sorder\sto\savoid\san\sinfinite\sloops\swhile\swalking\sthe\ndatabase. -D 2023-10-27T10:49:17.477 +C Cleanup\sshell.c\scomments.\sHide\s-utf8\soption,\sas\sit\sis\sundocumented\sand\saccepted\sonly\sfor\sbackward\scompatibility.\sNo\sfunctional\schanges\sexcept\sfor\s-help\scontent. +D 2023-10-27T13:59:05.662 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -660,7 +660,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522 -F src/btree.c f3b09c5414de3a11db73e11e1d66f4c5e53c9e89876ff3b531a887ab656ca303 +F src/btree.c f3b09c5414de3a11db73e11e1d66f4c5e53c9e89876ff3b531a887ab656ca303 x F src/btree.h 03e3356f5208bcab8eed4e094240fdac4a7f9f5ddf5e91045ce589f67d47c240 F src/btreeInt.h ef12a72b708677e48d6bc8dcd66fed25434740568b89e2cfa368093cfc5b9d15 F src/build.c 189e4517d67f09f0a3e0d8e1faa6e2ef0c2e95f6ac82e33c912cb7efa2a359cc @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 93f5591ea14e087860801d98c0404ffb5948ccf4cd9b2e98938cfd836f48a932 +F src/shell.c.in 9b29276cb6447b4c608e77c08b49bd3315cdcb399801e08b2f15723aa5b733e8 F src/sqlite.h.in 428948ef39b3ef7b675ec12bd4853619bad77279b5fa38e3a51c5b9656ae16ff F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 80f0b6f9c76c049edaaaeedc1745978b9d5b02a9c34bbf64209266a154b2b0e3 -R 84d7c9418e41d2dbf6dd84433b9d6b54 -U drh -Z eb223c9086f97454e7586a05089e442c +P dd6e03b37356e2961abd97f636402c09744c98c3033f3435503958c6219f9121 +R b4f027e64bba8f896523d3874bfe956c +U larrybr +Z 9d578a0ee37bec1d8a1793330bcc1208 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3777dcf2b7..5fa722c205 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dd6e03b37356e2961abd97f636402c09744c98c3033f3435503958c6219f9121 \ No newline at end of file +3a87995560b5acbebeb5af407aa9eddf4c37c6a27ec9429ece0ea931918f9d9c \ No newline at end of file diff --git a/src/btree.c b/src/btree.c old mode 100644 new mode 100755 diff --git a/src/shell.c.in b/src/shell.c.in index 395cbd035d..f1362d613d 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -599,7 +599,7 @@ static char *dynamicContinuePrompt(void){ #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */ #if SHELL_WIN_UTF8_OPT -/* Following struct is used for -utf8 operation. */ +/* Following struct is used for UTF-8 operation. */ static struct ConsoleState { int stdinEof; /* EOF has been seen on console input */ int infsMode; /* Input file stream mode upon shell start */ @@ -743,7 +743,7 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ ** console and if this is running on a Windows machine, and if UTF-8 ** output unavailable (or available but opted out), translate the ** output from UTF-8 into MBCS for output through 8-bit stdout stream. -** (With -utf8 active, no translation is needed and must not be done.) +** (Without -no-utf8, no translation is needed and must not be done.) */ #if defined(_WIN32) || defined(WIN32) void utf8_printf(FILE *out, const char *zFormat, ...){ @@ -960,7 +960,7 @@ static char *local_getline(char *zLine, FILE *in){ } } #if defined(_WIN32) || defined(WIN32) - /* For interactive input on Windows systems, without -utf8, + /* For interactive input on Windows systems, with -no-utf8, ** translate the multi-byte characterset characters into UTF-8. ** This is the translation that predates console UTF-8 input. */ if( stdin_is_interactive && in==stdin && !console_utf8_in ){ @@ -11957,7 +11957,7 @@ static const char zOptions[] = " -newline SEP set output row separator. Default: '\\n'\n" #if SHELL_WIN_UTF8_OPT " -no-utf8 do not try to set up UTF-8 output (for legacy)\n" -#endif +#endif " -nofollow refuse to open symbolic links to database files\n" " -nonce STRING set the safe-mode escape nonce\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" @@ -11974,7 +11974,7 @@ static const char zOptions[] = " -table set output mode to 'table'\n" " -tabs set output mode to 'tabs'\n" " -unsafe-testing allow unsafe commands and modes for testing\n" -#if SHELL_WIN_UTF8_OPT +#if SHELL_WIN_UTF8_OPT && 0 /* Option is accepted, but is now the default. */ " -utf8 setup interactive console code page for UTF-8\n" #endif " -version show SQLite version\n" @@ -12212,8 +12212,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, - ** the size of the alternative malloc heap, - ** and the first command to execute. + ** the size of the alternative malloc heap, options affecting commands + ** or SQL run from the command line, and the first command to execute. */ #ifndef SQLITE_SHELL_FIDDLE verify_uninitialized(); @@ -12260,6 +12260,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdin_is_interactive = 0; }else if( cli_strcmp(z,"-utf8")==0 ){ #if SHELL_WIN_UTF8_OPT + /* Option accepted, but just specifies default UTF-8 console I/O. */ mbcs_opted = 0; #endif /* SHELL_WIN_UTF8_OPT */ }else if( cli_strcmp(z,"-no-utf8")==0 ){ From a03932a790a62aef66282d8090f25cec462065cc Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 27 Oct 2023 15:31:44 +0000 Subject: [PATCH 185/242] Fix to Makefile.in so that the "tool-zip" target can be run from outside the source tree. FossilOrigin-Name: cd118da9db0680fab8761ff44384639b9d564b67a5dfb1280ab72e44ff57714d --- Makefile.in | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0287915717..bdbfdd7e5d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1486,7 +1486,7 @@ snapshot-tarball: sqlite3.c sqlite3rc.h # Build a ZIP archive containing various command-line tools. # -tool-zip: testfixture sqlite3 sqldiff sqlite3_analyzer tool/mktoolzip.tcl +tool-zip: testfixture sqlite3 sqldiff sqlite3_analyzer $(TOP)/tool/mktoolzip.tcl ./testfixture $(TOP)/tool/mktoolzip.tcl # The next two rules are used to support the "threadtest" target. Building diff --git a/manifest b/manifest index cfc5de0f6e..2f73120ab7 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Cleanup\sshell.c\scomments.\sHide\s-utf8\soption,\sas\sit\sis\sundocumented\sand\saccepted\sonly\sfor\sbackward\scompatibility.\sNo\sfunctional\schanges\sexcept\sfor\s-help\scontent. -D 2023-10-27T13:59:05.662 +C Fix\sto\sMakefile.in\sso\sthat\sthe\s"tool-zip"\starget\scan\sbe\srun\sfrom\soutside\sthe\ssource\stree. +D 2023-10-27T15:31:44.997 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 2ea4105b72561483befe0a18a37f94ca3adbc2324bad3770f99555d95fb9b0ea +F Makefile.in ab9045ee4781caaf92d7f9262768dcbb35e463aead30df4aa2d0c4e38ee0d2f6 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc c1aa09e0212d8609df041d13da6ca63198d1c1e29846f33104beecf19917102b F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dd6e03b37356e2961abd97f636402c09744c98c3033f3435503958c6219f9121 -R b4f027e64bba8f896523d3874bfe956c -U larrybr -Z 9d578a0ee37bec1d8a1793330bcc1208 +P 3a87995560b5acbebeb5af407aa9eddf4c37c6a27ec9429ece0ea931918f9d9c +R 0efb00b52520b1614c5871063698f7c2 +U dan +Z 057c60122b3365185e9a7fdd1b36a1c0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5fa722c205..ed2689bce5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3a87995560b5acbebeb5af407aa9eddf4c37c6a27ec9429ece0ea931918f9d9c \ No newline at end of file +cd118da9db0680fab8761ff44384639b9d564b67a5dfb1280ab72e44ff57714d \ No newline at end of file From 2e0d7b28c19895d74aec85e3f47398bfd554f190 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 27 Oct 2023 17:40:46 +0000 Subject: [PATCH 186/242] Add makefile targets for fuzzcheck-asan and fuzzcheck-ubsan. FossilOrigin-Name: 27fc14303a0c6942e8cf5017d66c7ff5fcbc700a6109a93768263370f608397e --- Makefile.in | 3 +++ main.mk | 12 +++++++++++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index bdbfdd7e5d..c521586a14 100644 --- a/Makefile.in +++ b/Makefile.in @@ -707,6 +707,9 @@ fuzzcheck$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP) fuzzcheck-asan$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP) $(LTLINK) -o $@ -fsanitize=address $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS) +fuzzcheck-ubsan$(TEXE): $(FUZZCHECK_SRC) sqlite3.c sqlite3.h $(FUZZCHECK_DEP) + $(LTLINK) -o $@ -fsanitize=undefined $(FUZZCHECK_OPT) $(FUZZCHECK_SRC) sqlite3.c $(TLIBS) + ossshell$(TEXE): $(TOP)/test/ossfuzz.c $(TOP)/test/ossshell.c sqlite3.c sqlite3.h $(LTLINK) -o $@ $(FUZZCHECK_OPT) $(TOP)/test/ossshell.c \ $(TOP)/test/ossfuzz.c sqlite3.c $(TLIBS) diff --git a/main.mk b/main.mk index d8c372430e..fdfdb75291 100644 --- a/main.mk +++ b/main.mk @@ -597,7 +597,17 @@ dbfuzz2$(EXE): $(TOP)/test/dbfuzz2.c sqlite3.c sqlite3.h $(DBFUZZ2_OPTS) $(TOP)/test/dbfuzz2.c sqlite3.c $(TLIBS) $(THREADLIB) fuzzcheck$(EXE): $(FUZZSRC) sqlite3.c sqlite3.h $(FUZZDEP) - $(TCCX) -o fuzzcheck$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ + $(TCCX) -o $@ -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ + -DSQLITE_ENABLE_MEMSYS5 $(FUZZCHECK_OPT) -DSQLITE_OSS_FUZZ \ + $(FUZZSRC) sqlite3.c $(TLIBS) $(THREADLIB) + +fuzzcheck-asan$(EXE): $(FUZZSRC) sqlite3.c sqlite3.h $(FUZZDEP) + $(TCCX) -fsanitize=address -o $W -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ + -DSQLITE_ENABLE_MEMSYS5 $(FUZZCHECK_OPT) -DSQLITE_OSS_FUZZ \ + $(FUZZSRC) sqlite3.c $(TLIBS) $(THREADLIB) + +fuzzcheck-ubsan$(EXE): $(FUZZSRC) sqlite3.c sqlite3.h $(FUZZDEP) + $(TCCX) -fsanitize=undefined -o $@ -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_ENABLE_MEMSYS5 $(FUZZCHECK_OPT) -DSQLITE_OSS_FUZZ \ $(FUZZSRC) sqlite3.c $(TLIBS) $(THREADLIB) diff --git a/manifest b/manifest index 2f73120ab7..7a3c310a45 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sto\sMakefile.in\sso\sthat\sthe\s"tool-zip"\starget\scan\sbe\srun\sfrom\soutside\sthe\ssource\stree. -D 2023-10-27T15:31:44.997 +C Add\smakefile\stargets\sfor\sfuzzcheck-asan\sand\sfuzzcheck-ubsan. +D 2023-10-27T17:40:46.550 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in ab9045ee4781caaf92d7f9262768dcbb35e463aead30df4aa2d0c4e38ee0d2f6 +F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc c1aa09e0212d8609df041d13da6ca63198d1c1e29846f33104beecf19917102b F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 @@ -641,7 +641,7 @@ F ext/wasm/wasmfs.make 8a4955882aaa0783b3f60a9484a1f0f3d8b6f775c0fcd17c082f31966 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 5536159f62058714c972b5bd325c8d5ecd5c9b00b385dd2e1cbc17da70a711b2 +F main.mk 51fd5fc8565007266e6bfd9e299199c752b171707a667b8914a204b38258e1b1 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3a87995560b5acbebeb5af407aa9eddf4c37c6a27ec9429ece0ea931918f9d9c -R 0efb00b52520b1614c5871063698f7c2 -U dan -Z 057c60122b3365185e9a7fdd1b36a1c0 +P cd118da9db0680fab8761ff44384639b9d564b67a5dfb1280ab72e44ff57714d +R 803f05028bcb0911d31da2c38e3126c9 +U drh +Z 66eee725aa902aff9f760f94dee7a24e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ed2689bce5..c773092b8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cd118da9db0680fab8761ff44384639b9d564b67a5dfb1280ab72e44ff57714d \ No newline at end of file +27fc14303a0c6942e8cf5017d66c7ff5fcbc700a6109a93768263370f608397e \ No newline at end of file From 6572f7799ca10bfc257a5c6b452b10b0b91450d1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 27 Oct 2023 18:16:15 +0000 Subject: [PATCH 187/242] Disable two rtree test cases for Linux-i686. We do not have that platform available for testing. The test cases work on all other 64-bit and 32-bit platforms that we have at hand. So there is no way for us to debug this problem. Better to disable the test. [forum:/forumpost/ffcbf789b5386573|forum post ffcbf789b5386573]. FossilOrigin-Name: fed4d6e90baecca716429f95e1fab7930297afa2a191a87a0a87cb93910d1bce --- ext/rtree/rtree1.test | 20 +++++++++++--------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ext/rtree/rtree1.test b/ext/rtree/rtree1.test index 2d8458a538..61664e1529 100644 --- a/ext/rtree/rtree1.test +++ b/ext/rtree/rtree1.test @@ -774,15 +774,17 @@ do_execsql_test 21.1 { # Round-off error associated with using large integer constraints on # a rtree search. # -reset_db -do_execsql_test 22.0 { - CREATE VIRTUAL TABLE t1 USING rtree ( id, x0, x1 ); - INSERT INTO t1 VALUES (123, 9223372036854775799, 9223372036854775800); - SELECT id FROM t1 WHERE x0 > 9223372036854775807; -} {123} -do_execsql_test 22.1 { - SELECT id, x0 > 9223372036854775807 AS 'a0' FROM t1; -} {123 1} +if {$tcl_platform(machine)!="i686" || $tcl_platform(os)!="Linux"} { + reset_db + do_execsql_test 22.0 { + CREATE VIRTUAL TABLE t1 USING rtree ( id, x0, x1 ); + INSERT INTO t1 VALUES (123, 9223372036854775799, 9223372036854775800); + SELECT id FROM t1 WHERE x0 > 9223372036854775807; + } {123} + do_execsql_test 22.1 { + SELECT id, x0 > 9223372036854775807 AS 'a0' FROM t1; + } {123 1} +} # 2023-10-14 dbsqlfuzz --sql-fuzz find. rtreecheck() should not call # BEGIN/COMMIT because that causes problems with statement transactions, diff --git a/manifest b/manifest index 7a3c310a45..901c67f8b7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smakefile\stargets\sfor\sfuzzcheck-asan\sand\sfuzzcheck-ubsan. -D 2023-10-27T17:40:46.550 +C Disable\stwo\srtree\stest\scases\sfor\sLinux-i686.\s\sWe\sdo\snot\shave\sthat\splatform\navailable\sfor\stesting.\s\sThe\stest\scases\swork\son\sall\sother\s64-bit\sand\s32-bit\nplatforms\sthat\swe\shave\sat\shand.\s\sSo\sthere\sis\sno\sway\sfor\sus\sto\sdebug\sthis\nproblem.\s\sBetter\sto\sdisable\sthe\stest.\n[forum:/forumpost/ffcbf789b5386573|forum\spost\sffcbf789b5386573]. +D 2023-10-27T18:16:15.021 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -483,7 +483,7 @@ F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/geopoly.c 0dd4775e896cee6067979d67aff7c998e75c2c9d9cd8d62a1a790c09cde7adca F ext/rtree/rtree.c 2e1452a9338fe4db057fa677277bed86b65c667ed48b9b59144adae99f85a7cb F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 -F ext/rtree/rtree1.test ecc881fdd1bc10fc390faa988ad93343739af84384e4cf3619fed7afada66a30 +F ext/rtree/rtree1.test 2b5b8c719c6a4abe377f57766f428a49af36a93061cb146cccfdc3b30000c0a4 F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d F ext/rtree/rtree3.test 272594f88c344e973864008bbe4c71fd3a41a264c097d568593ee7886d83d409 F ext/rtree/rtree4.test 304de65d484540111b896827e4261815e5dca4ce28eeecd58be648cd73452c4b @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P cd118da9db0680fab8761ff44384639b9d564b67a5dfb1280ab72e44ff57714d -R 803f05028bcb0911d31da2c38e3126c9 +P 27fc14303a0c6942e8cf5017d66c7ff5fcbc700a6109a93768263370f608397e +R 71d72cb40c4b26196886d1c5a851d0e7 U drh -Z 66eee725aa902aff9f760f94dee7a24e +Z b23e32d3e4b66b7a3031ae330eecd039 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c773092b8c..b4e00d9b15 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -27fc14303a0c6942e8cf5017d66c7ff5fcbc700a6109a93768263370f608397e \ No newline at end of file +fed4d6e90baecca716429f95e1fab7930297afa2a191a87a0a87cb93910d1bce \ No newline at end of file From 26422f823fe813d45543a43412e98ddab16360a5 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Oct 2023 21:05:50 +0000 Subject: [PATCH 188/242] Export sqlite3_get_autocommit() to WASM and add tests for it. FossilOrigin-Name: 7cb6d3cd3926882240c91a4b90fdf237b931653295d8d94b05ed885dcae59608 --- ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api | 1 + ext/wasm/api/sqlite3-api-glue.js | 1 + ext/wasm/tester1.c-pp.js | 6 +++++- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api b/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api index ad2872d839..57cd61eb9d 100644 --- a/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api +++ b/ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api @@ -63,6 +63,7 @@ _sqlite3_file_control _sqlite3_finalize _sqlite3_free _sqlite3_get_auxdata +_sqlite3_get_autocommit _sqlite3_initialize _sqlite3_keyword_count _sqlite3_keyword_name diff --git a/ext/wasm/api/sqlite3-api-glue.js b/ext/wasm/api/sqlite3-api-glue.js index f23a02366b..29efb3e07b 100644 --- a/ext/wasm/api/sqlite3-api-glue.js +++ b/ext/wasm/api/sqlite3-api-glue.js @@ -188,6 +188,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ ["sqlite3_file_control", "int", "sqlite3*", "string", "int", "*"], ["sqlite3_finalize", "int", "sqlite3_stmt*"], ["sqlite3_free", undefined,"*"], + ["sqlite3_get_autocommit", "int", "sqlite3*"], ["sqlite3_get_auxdata", "*", "sqlite3_context*", "int"], ["sqlite3_initialize", undefined], /*["sqlite3_interrupt", undefined, "sqlite3*" diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index 92d763f1ba..c26bce25be 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -2644,13 +2644,17 @@ globalThis.sqlite3InitModule = sqlite3InitModule; T.assert( 0 === rc /*void pointer*/ ); // Commit hook... + T.assert( 0!=capi.sqlite3_get_autocommit(db) ); db.exec("BEGIN; SELECT 1; COMMIT"); T.assert(0 === countCommit, "No-op transactions (mostly) do not trigger commit hook."); db.exec("BEGIN EXCLUSIVE; SELECT 1; COMMIT"); T.assert(1 === countCommit, "But EXCLUSIVE transactions do."); - db.transaction((d)=>{d.exec("create table t(a)");}); + db.transaction((d)=>{ + T.assert( 0==capi.sqlite3_get_autocommit(db) ); + d.exec("create table t(a)"); + }); T.assert(2 === countCommit); // Rollback hook: diff --git a/manifest b/manifest index d8a1fb48cd..dbfd82067a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smissing\sJNI\ssqlite3_result_subtype()\sbinding. -D 2023-10-23T02:06:27.564 +C Export\ssqlite3_get_autocommit()\sto\sWASM\sand\sadd\stests\sfor\sit. +D 2023-10-27T21:05:50.750 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -570,7 +570,7 @@ F ext/wasm/SQLTester/SQLTester.mjs ec2f6ba63a0f2f0562941a0fb8e46b7dc55589711513f F ext/wasm/SQLTester/SQLTester.run.mjs c72b7fe2072d05992f7a3d8c6a1d34e95712513ceabe40849784e24e41c84638 F ext/wasm/SQLTester/index.html 3f8a016df0776be76605abf20e815ecaafbe055abac0e1fe5ea080e7846b760d F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536 -F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab +F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api f442460ed9a109e637dd3ea1caa4489553ad9414e8988118b208bb7a4bbece6b F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 F ext/wasm/api/README.md 5eb44fa02e9c693a1884a3692428647894b0380b24bca120866b7a24c8786134 @@ -580,7 +580,7 @@ F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62 F ext/wasm/api/pre-js.c-pp.js ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057afb08161d7511219 F ext/wasm/api/sqlite3-api-cleanup.js d235ad237df6954145404305040991c72ef8b1881715d2a650dda7b3c2576d0e -F ext/wasm/api/sqlite3-api-glue.js 26aedfb27915f4f316f6eac84078443e4f0d2dfe5f012310014923ed4b77b2b6 +F ext/wasm/api/sqlite3-api-glue.js 119b91c8a7ce6648679eb66fcdd1ed07ef7fd892eb501d658fbfefcc962012d9 F ext/wasm/api/sqlite3-api-oo1.js 9678dc4d9a5d39632b6ffe6ea94a023119260815bf32f265bf5f6c36c9516db8 F ext/wasm/api/sqlite3-api-prologue.js 9aeba7b45cf41b3a26d34d7fb2525633cd1adfc544888c1ea8dbb077496f4ce9 F ext/wasm/api/sqlite3-api-worker1.js f941382f21006b4a817754184e2661b0a63ce650201f3419cd60f4758b6fd60e @@ -634,7 +634,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555 F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2 -F ext/wasm/tester1.c-pp.js fb20d9e1c308ea34a29d8afdda1a6c5edc406241b5560fa23c19c14747ee41bc +F ext/wasm/tester1.c-pp.js d628826e936bd143d64e0fa3089752abeeeea38a34a7e2b18d364f090d4e99c6 F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1 F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 55c4b1dc402b358d53d65fa1f6ec063e9e38e95c81a05d98dae3cb58c52ef55c -R c2c51077b7eb5ed8cd8afa840132d8db +P ac920b5386db525c794f4cae332dedcc709cac356f6fb85f3e92bc0a34602511 +R 7ff5dd75150e8cac0c211f64ca609fc2 U stephan -Z 977f0702c9741cb2cb4a8926563a23c6 +Z 90696a3c18b398d4eb36aae7078d8581 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fe7e4a2469..4cd797eb12 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ac920b5386db525c794f4cae332dedcc709cac356f6fb85f3e92bc0a34602511 \ No newline at end of file +7cb6d3cd3926882240c91a4b90fdf237b931653295d8d94b05ed885dcae59608 \ No newline at end of file From 4b8010a8ee0fec09de4114e1ed381386b53ac425 Mon Sep 17 00:00:00 2001 From: larrybr Date: Fri, 27 Oct 2023 21:44:53 +0000 Subject: [PATCH 189/242] Fix cosmetic flaw in SQLITE_TXN_* doc. (no code change) FossilOrigin-Name: 72d7c18f80f41529811f74855ac198681a0cfe7634225233ec4b8df219c2e73b --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqlite.h.in | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 901c67f8b7..278bae0248 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Disable\stwo\srtree\stest\scases\sfor\sLinux-i686.\s\sWe\sdo\snot\shave\sthat\splatform\navailable\sfor\stesting.\s\sThe\stest\scases\swork\son\sall\sother\s64-bit\sand\s32-bit\nplatforms\sthat\swe\shave\sat\shand.\s\sSo\sthere\sis\sno\sway\sfor\sus\sto\sdebug\sthis\nproblem.\s\sBetter\sto\sdisable\sthe\stest.\n[forum:/forumpost/ffcbf789b5386573|forum\spost\sffcbf789b5386573]. -D 2023-10-27T18:16:15.021 +C Fix\scosmetic\sflaw\sin\sSQLITE_TXN_*\sdoc.\s(no\scode\schange) +D 2023-10-27T21:44:53.875 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 F src/shell.c.in 9b29276cb6447b4c608e77c08b49bd3315cdcb399801e08b2f15723aa5b733e8 -F src/sqlite.h.in 428948ef39b3ef7b675ec12bd4853619bad77279b5fa38e3a51c5b9656ae16ff +F src/sqlite.h.in c782ba48253f503a2c56898477a5b4ec42ce959147ff6209f51828d0fedff563 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 27fc14303a0c6942e8cf5017d66c7ff5fcbc700a6109a93768263370f608397e -R 71d72cb40c4b26196886d1c5a851d0e7 -U drh -Z b23e32d3e4b66b7a3031ae330eecd039 +P fed4d6e90baecca716429f95e1fab7930297afa2a191a87a0a87cb93910d1bce +R 57fc96011aead4e5ab340c284590ec27 +U larrybr +Z ba99082b6fa40ef9d4b3d6125771df22 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b4e00d9b15..e4f911fcad 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fed4d6e90baecca716429f95e1fab7930297afa2a191a87a0a87cb93910d1bce \ No newline at end of file +72d7c18f80f41529811f74855ac198681a0cfe7634225233ec4b8df219c2e73b \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index d8caf81067..e29f2ab605 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -6624,7 +6624,7 @@ int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); int sqlite3_txn_state(sqlite3*,const char *zSchema); /* -** CAPI3REF: Allowed return values from [sqlite3_txn_state()] +** CAPI3REF: Allowed return values from sqlite3_txn_state() ** KEYWORDS: {transaction state} ** ** These constants define the current transaction state of a database file. From 95c11b1158b43a3e0661e47334d0e371b70e879d Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Oct 2023 23:02:01 +0000 Subject: [PATCH 190/242] Add missing docs for the JS Worker1 export method, as pointed out in [forum:75524f7342|forum post 75524f7342]. FossilOrigin-Name: a7b267bd11216ee990cdd855044fbc18c300dff07cf25b317f27c1bbbc340dcc --- ext/wasm/api/sqlite3-api-worker1.js | 33 ++++++++++++++++++++++++++++- manifest | 12 +++++------ manifest.uuid | 2 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-worker1.js b/ext/wasm/api/sqlite3-api-worker1.js index 29f7d2be63..7c65dd1d3e 100644 --- a/ext/wasm/api/sqlite3-api-worker1.js +++ b/ext/wasm/api/sqlite3-api-worker1.js @@ -62,7 +62,7 @@ ``` { - type: string, // one of: 'open', 'close', 'exec', 'config-get' + type: string, // one of: 'open', 'close', 'exec', 'export', 'config-get' messageId: OPTIONAL arbitrary value. The worker will copy it as-is into response messages to assist in client-side dispatching. @@ -325,6 +325,37 @@ passed only a string), noting that options.resultRows and options.columnNames may be populated by the call to db.exec(). + + ==================================================================== + "export" the current db + + To export the underlying database as a byte array... + + Message format: + + ``` + { + type: "export", + messageId: ...as above..., + dbId: ...as above... + } + ``` + + Response: + + ``` + { + type: "export", + messageId: ...as above..., + dbId: ...as above... + result: { + byteArray: Uint8Array (as per sqlite3_js_db_export()), + filename: the db filename, + mimetype: "application/x-sqlite3" + } + } + ``` + */ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ sqlite3.initWorker1API = function(){ diff --git a/manifest b/manifest index dbfd82067a..9a4dde3ead 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Export\ssqlite3_get_autocommit()\sto\sWASM\sand\sadd\stests\sfor\sit. -D 2023-10-27T21:05:50.750 +C Add\smissing\sdocs\sfor\sthe\sJS\sWorker1\sexport\smethod,\sas\spointed\sout\sin\s[forum:75524f7342|forum\spost\s75524f7342]. +D 2023-10-27T23:02:01.291 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -583,7 +583,7 @@ F ext/wasm/api/sqlite3-api-cleanup.js d235ad237df6954145404305040991c72ef8b18817 F ext/wasm/api/sqlite3-api-glue.js 119b91c8a7ce6648679eb66fcdd1ed07ef7fd892eb501d658fbfefcc962012d9 F ext/wasm/api/sqlite3-api-oo1.js 9678dc4d9a5d39632b6ffe6ea94a023119260815bf32f265bf5f6c36c9516db8 F ext/wasm/api/sqlite3-api-prologue.js 9aeba7b45cf41b3a26d34d7fb2525633cd1adfc544888c1ea8dbb077496f4ce9 -F ext/wasm/api/sqlite3-api-worker1.js f941382f21006b4a817754184e2661b0a63ce650201f3419cd60f4758b6fd60e +F ext/wasm/api/sqlite3-api-worker1.js 88770ac01fc756f89a3e060eec17111d6c1688e89ebfd34cb9d9e54d25affbb9 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89 F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 @@ -2137,8 +2137,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ac920b5386db525c794f4cae332dedcc709cac356f6fb85f3e92bc0a34602511 -R 7ff5dd75150e8cac0c211f64ca609fc2 +P 7cb6d3cd3926882240c91a4b90fdf237b931653295d8d94b05ed885dcae59608 +R 53009930e6bc65b4da12fb26b9e7e080 U stephan -Z 90696a3c18b398d4eb36aae7078d8581 +Z 6e447e009637f07735108793303337a5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4cd797eb12..cddb3f9f7d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7cb6d3cd3926882240c91a4b90fdf237b931653295d8d94b05ed885dcae59608 \ No newline at end of file +a7b267bd11216ee990cdd855044fbc18c300dff07cf25b317f27c1bbbc340dcc \ No newline at end of file From a9fea287610298a7748a01cb423fa1263ed8f428 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 28 Oct 2023 03:54:28 +0000 Subject: [PATCH 191/242] Remove the SQLITE_MAX_ALLOCATION_SIZE flag (set to 536mb) from the WASM and JNI builds because it can unduly limit db exports via sqlite3_serialize(), as reported in [forum:75524f7342c1ba45|forum post 75524f7342c1ba45]. It now defaults to whatever sqlite3.c uses, which is currently just shy of 2gb. FossilOrigin-Name: f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b --- ext/wasm/api/sqlite3-wasm.c | 6 ------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c index 88a679c518..18d27bdf0c 100644 --- a/ext/wasm/api/sqlite3-wasm.c +++ b/ext/wasm/api/sqlite3-wasm.c @@ -129,12 +129,6 @@ # define SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION #endif -/**********************************************************************/ -/* SQLITE_M... */ -#ifndef SQLITE_MAX_ALLOCATION_SIZE -# define SQLITE_MAX_ALLOCATION_SIZE 0x1fffffff -#endif - /**********************************************************************/ /* SQLITE_O... */ #ifndef SQLITE_OMIT_DEPRECATED diff --git a/manifest b/manifest index 278bae0248..7ee959d342 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scosmetic\sflaw\sin\sSQLITE_TXN_*\sdoc.\s(no\scode\schange) -D 2023-10-27T21:44:53.875 +C Remove\sthe\sSQLITE_MAX_ALLOCATION_SIZE\sflag\s(set\sto\s536mb)\sfrom\sthe\sWASM\sand\sJNI\sbuilds\sbecause\sit\scan\sunduly\slimit\sdb\sexports\svia\ssqlite3_serialize(),\sas\sreported\sin\s[forum:75524f7342c1ba45|forum\spost\s75524f7342c1ba45].\sIt\snow\sdefaults\sto\swhatever\ssqlite3.c\suses,\swhich\sis\scurrently\sjust\sshy\sof\s2gb. +D 2023-10-28T03:54:28.627 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -588,7 +588,7 @@ F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256 F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25 F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 595953994aa3ae2287c889c4da39ab3d6f17b6461ecf4bec334b7a3faafddb02 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 46c4afa6c50d7369252c104f274ad977a97e91ccfafc38b400fe36e90bdda88e -F ext/wasm/api/sqlite3-wasm.c c8c5b81b838cef2053b1eb6e7a79c44a2caedcf0c9e6b0d12a45d73ce0617be0 +F ext/wasm/api/sqlite3-wasm.c 038de1b6d40b2cc0f41a143a0451db60b2a6f1b5bc06de67da255c54ea1661b7 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f F ext/wasm/api/sqlite3-worker1.c-pp.js a541112aa51e16705f13a99bb943c64efe178aa28c86704a955f8fd9afe4ba37 F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fed4d6e90baecca716429f95e1fab7930297afa2a191a87a0a87cb93910d1bce -R 57fc96011aead4e5ab340c284590ec27 -U larrybr -Z ba99082b6fa40ef9d4b3d6125771df22 +P 72d7c18f80f41529811f74855ac198681a0cfe7634225233ec4b8df219c2e73b +R bf08c39748b4512d96281328ee8f10df +U stephan +Z 7196c1c2248d91eedb16eedfc74c5151 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e4f911fcad..b2dd4e2f35 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -72d7c18f80f41529811f74855ac198681a0cfe7634225233ec4b8df219c2e73b \ No newline at end of file +f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b \ No newline at end of file From 1b772cae2d7d7285d6ceea480c21e0ffaf3a4e0d Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 28 Oct 2023 11:40:33 +0000 Subject: [PATCH 192/242] Since SQLite considers NaN to be like NULL and NULL sorts before any integer, make sure the sqlite3IntFloatCompare() routine reports that the integer argument is larger if the floating-point argument is NaN. FossilOrigin-Name: de1cf31a34b0f21288e7e30434a06baf25ee579929107c22e65c57236577fc4a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/vdbeaux.c | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 7ee959d342..dc69b709fb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\sSQLITE_MAX_ALLOCATION_SIZE\sflag\s(set\sto\s536mb)\sfrom\sthe\sWASM\sand\sJNI\sbuilds\sbecause\sit\scan\sunduly\slimit\sdb\sexports\svia\ssqlite3_serialize(),\sas\sreported\sin\s[forum:75524f7342c1ba45|forum\spost\s75524f7342c1ba45].\sIt\snow\sdefaults\sto\swhatever\ssqlite3.c\suses,\swhich\sis\scurrently\sjust\sshy\sof\s2gb. -D 2023-10-28T03:54:28.627 +C Since\sSQLite\sconsiders\sNaN\sto\sbe\slike\sNULL\sand\sNULL\ssorts\sbefore\sany\sinteger,\nmake\ssure\sthe\ssqlite3IntFloatCompare()\sroutine\sreports\sthat\sthe\sinteger\nargument\sis\slarger\sif\sthe\sfloating-point\sargument\sis\sNaN. +D 2023-10-28T11:40:33.874 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -795,7 +795,7 @@ F src/vdbe.c 14479441337135eed8e290fb1d4abb7db657d93217a3b1ea8a2f031d3895536a F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 F src/vdbeInt.h 949669dfd8a41550d27dcb905b494f2ccde9a2e6c1b0b04daa1227e2e74c2b2c F src/vdbeapi.c fe654b1f54e1feebcaed6c2ae3ed035cc65bfeb9a1169bed866abc42bfc63ff6 -F src/vdbeaux.c 929a4edecf9845fb063b47b23b9d187473a648470d915521cf72419f5219c4b7 +F src/vdbeaux.c dffcf79e7e415fcd6e4c8ac1ec7124cae5257018443adf09551c807655b04993 F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe5 F src/vdbemem.c c936e9002af4993b84c4eb7133d6b1190efe46d391cc86117ecd67ba17b1a04b F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 72d7c18f80f41529811f74855ac198681a0cfe7634225233ec4b8df219c2e73b -R bf08c39748b4512d96281328ee8f10df -U stephan -Z 7196c1c2248d91eedb16eedfc74c5151 +P f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b +R a6a0caaaeaf258d62d251b7e0c096200 +U drh +Z e4297a009a5cb0d7d92fe890e604c55c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b2dd4e2f35..9520cf2269 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b \ No newline at end of file +de1cf31a34b0f21288e7e30434a06baf25ee579929107c22e65c57236577fc4a \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 27be95a6b5..54317b816f 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -4481,6 +4481,11 @@ static int SQLITE_NOINLINE doubleEq(double a, double b){ return a==b; } ** equal to, or greater than the second (double). */ int sqlite3IntFloatCompare(i64 i, double r){ + if( sqlite3IsNaN(r) ){ + /* SQLite considers NaN to be a NULL. And all integer values are greater + ** than NULL */ + return 1; + } if( sqlite3Config.bUseLongDouble ){ LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; testcase( x Date: Sat, 28 Oct 2023 11:53:14 +0000 Subject: [PATCH 193/242] Update documentation for sqlite3_errmsg() to try to make it clear that if the schema of a database contains table names or similar with invalid UTF, then the error message generated by SQLite might also contain invalid UTF. No changes to code. FossilOrigin-Name: 33ba13c7c4b6f9c5e64ea30c819718f2caea214afca945c9ed7075864f4aaa40 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqlite.h.in | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index dc69b709fb..274fb7e24c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Since\sSQLite\sconsiders\sNaN\sto\sbe\slike\sNULL\sand\sNULL\ssorts\sbefore\sany\sinteger,\nmake\ssure\sthe\ssqlite3IntFloatCompare()\sroutine\sreports\sthat\sthe\sinteger\nargument\sis\slarger\sif\sthe\sfloating-point\sargument\sis\sNaN. -D 2023-10-28T11:40:33.874 +C Update\sdocumentation\sfor\ssqlite3_errmsg()\sto\stry\sto\smake\sit\sclear\sthat\sif\nthe\sschema\sof\sa\sdatabase\scontains\stable\snames\sor\ssimilar\swith\sinvalid\sUTF,\nthen\sthe\serror\smessage\sgenerated\sby\sSQLite\smight\salso\scontain\sinvalid\sUTF.\nNo\schanges\sto\scode. +D 2023-10-28T11:53:14.116 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 F src/shell.c.in 9b29276cb6447b4c608e77c08b49bd3315cdcb399801e08b2f15723aa5b733e8 -F src/sqlite.h.in c782ba48253f503a2c56898477a5b4ec42ce959147ff6209f51828d0fedff563 +F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b -R a6a0caaaeaf258d62d251b7e0c096200 +P de1cf31a34b0f21288e7e30434a06baf25ee579929107c22e65c57236577fc4a +R ce627b31c8a7f399b0e12cf71b754a64 U drh -Z e4297a009a5cb0d7d92fe890e604c55c +Z 86353e9fa0a68bc2fae9ca0e76a0a632 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9520cf2269..6590c170a6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de1cf31a34b0f21288e7e30434a06baf25ee579929107c22e65c57236577fc4a \ No newline at end of file +33ba13c7c4b6f9c5e64ea30c819718f2caea214afca945c9ed7075864f4aaa40 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e29f2ab605..01a7f4d4e0 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -3955,6 +3955,7 @@ void sqlite3_free_filename(sqlite3_filename); ** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. +** (See how SQLite handles [invalid UTF] for exceptions to this rule.) ** ^(Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by From 5269e846dc9b4e6c20b90c368a6be79c4d29da20 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 28 Oct 2023 16:19:21 +0000 Subject: [PATCH 194/242] Limit the range of integer unix timestamps in date4.test, since some systems (RaspberryPI) cannot deal with timestamp values that exceed pow(2,31). FossilOrigin-Name: 765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/date4.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 274fb7e24c..d2d1aeb7ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sdocumentation\sfor\ssqlite3_errmsg()\sto\stry\sto\smake\sit\sclear\sthat\sif\nthe\sschema\sof\sa\sdatabase\scontains\stable\snames\sor\ssimilar\swith\sinvalid\sUTF,\nthen\sthe\serror\smessage\sgenerated\sby\sSQLite\smight\salso\scontain\sinvalid\sUTF.\nNo\schanges\sto\scode. -D 2023-10-28T11:53:14.116 +C Limit\sthe\srange\sof\sinteger\sunix\stimestamps\sin\sdate4.test,\ssince\ssome\ssystems\n(RaspberryPI)\scannot\sdeal\swith\stimestamp\svalues\sthat\sexceed\spow(2,31). +D 2023-10-28T16:19:21.185 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1016,7 +1016,7 @@ F test/dataversion1.test 6e5e86ac681f0782e766ebcb56c019ae001522d114e0e111e5ebf68 F test/date.test c0d17cdfd89395bc78087b131e3538d96f864b5029c335318011accc7c0d0934 F test/date2.test 7e12ec14aaf4d5e6294b4ba140445b0eca06ea50062a9c3a69c4ee13d0b6f8b1 F test/date3.test a1b77abf05c6772fe5ca2337cac1398892f2a41e62bce7e6be0f4a08a0e64ae5 -F test/date4.test db9e5760cf6f480fcf36bb7ca8e215880ff44354a31be6fb3d7e58f9d2e057e9 +F test/date4.test 8aeb3de5b5e9fda968baa9357e4c0fae573724b7904943410195a19e96e31b6a F test/dbdata.test 042f49acff3438f940eeba5868d3af080ae64ddf26ae78f80c92bec3ca7d8603 F test/dbfuzz.c 73047c920d6210e5912c87cdffd9a1c281d4252e F test/dbfuzz001.test 6c9a4622029d69dc38926f115864b055cb2f39badd25ec22cbfb130c8ba8e9c3 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P de1cf31a34b0f21288e7e30434a06baf25ee579929107c22e65c57236577fc4a -R ce627b31c8a7f399b0e12cf71b754a64 +P 33ba13c7c4b6f9c5e64ea30c819718f2caea214afca945c9ed7075864f4aaa40 +R 1be0f0e552da136234a76c43155a60a1 U drh -Z 86353e9fa0a68bc2fae9ca0e76a0a632 +Z 9c40aed2a8cf9df874dfb316aa86c044 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6590c170a6..4d8f453cfa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -33ba13c7c4b6f9c5e64ea30c819718f2caea214afca945c9ed7075864f4aaa40 \ No newline at end of file +765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca \ No newline at end of file diff --git a/test/date4.test b/test/date4.test index 5da9906bf2..0d820a0a40 100644 --- a/test/date4.test +++ b/test/date4.test @@ -28,7 +28,7 @@ if {$tcl_platform(os)=="Linux"} { } else { set FMT {%d,%e,%F,%H,%I,%j,%p,%R,%u,%w,%W,%%} } -for {set i 0} {$i<=86400} {incr i} { +for {set i 0} {$i<=24854} {incr i} { set TS [expr {$i*86401}] do_execsql_test date4-$i { SELECT strftime($::FMT,$::TS,'unixepoch'); From 3017a6851ffabfbff536d233d922f2335f46a8af Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 29 Oct 2023 00:24:22 +0000 Subject: [PATCH 195/242] Condition default UTF-8 console I/O for Windows builds on OS version 10 or more. This is to accomodate an IsValidCodePage() API which may happily report CP_UTF8 as a valid code page when the stock console cannot, in fact, do UTF-8 I/O. FossilOrigin-Name: 6b9b2a886fd4d239c2e87c3f3809c011f77c0f60e0c279bbe4e1d1b53c609e2d --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/shell.c.in | 40 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d2d1aeb7ec..1eba221ff9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Limit\sthe\srange\sof\sinteger\sunix\stimestamps\sin\sdate4.test,\ssince\ssome\ssystems\n(RaspberryPI)\scannot\sdeal\swith\stimestamp\svalues\sthat\sexceed\spow(2,31). -D 2023-10-28T16:19:21.185 +C Condition\sdefault\sUTF-8\sconsole\sI/O\sfor\sWindows\sbuilds\son\sOS\sversion\s10\sor\smore.\sThis\sis\sto\saccomodate\san\sIsValidCodePage()\sAPI\swhich\smay\shappily\sreport\sCP_UTF8\sas\sa\svalid\scode\spage\swhen\sthe\sstock\sconsole\scannot,\sin\sfact,\sdo\sUTF-8\sI/O. +D 2023-10-29T00:24:22.936 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 9b29276cb6447b4c608e77c08b49bd3315cdcb399801e08b2f15723aa5b733e8 +F src/shell.c.in 29b2abb039ddff7b512960a5396cecbaee6ab236537de36f4f972adbfc4467c1 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2139,8 +2139,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 33ba13c7c4b6f9c5e64ea30c819718f2caea214afca945c9ed7075864f4aaa40 -R 1be0f0e552da136234a76c43155a60a1 -U drh -Z 9c40aed2a8cf9df874dfb316aa86c044 +P 765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca +R 06beefd7b5a601159ef2b90a69791f5c +T *branch * win-utf8-io-split +T *sym-win-utf8-io-split * +T -sym-trunk * +U larrybr +Z 8b9699cbbd0e4aa806c0f866919f402f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4d8f453cfa..d8f3ed59bf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca \ No newline at end of file +6b9b2a886fd4d239c2e87c3f3809c011f77c0f60e0c279bbe4e1d1b53c609e2d \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index f1362d613d..e61887bc62 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -613,6 +613,40 @@ static struct ConsoleState { # define _O_U16TEXT 0x20000 #endif + +#if !SQLITE_OS_WINRT +static int CheckAtLeastWin10(void){ + typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); + typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD, + LPDWORD,PVOID,LPDWORD); + typedef LSTATUS (WINAPI *REG_UNLOAD)(HKEY,LPCSTR); + int rv = 0; + HINSTANCE hLib = LoadLibrary(TEXT("Advapi32.dll")); + if( NULL != hLib ){ + REG_OPEN rkOpen = (REG_OPEN)GetProcAddress(hLib, "RegOpenKeyExA"); + REG_READ rkRead = (REG_READ)GetProcAddress(hLib, "RegGetValueA"); + REG_UNLOAD rkFree = (REG_UNLOAD)GetProcAddress(hLib, "RegUnLoadKeyA"); + if( rkOpen != NULL && rkRead != NULL && rkFree != NULL ){ + HKEY hk; + const char *zsk = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; + if( ERROR_SUCCESS == rkOpen(HKEY_LOCAL_MACHINE, zsk, 0, KEY_READ, &hk) ){ + DWORD kv = 0, kvsize = sizeof(kv); + if( ERROR_SUCCESS == rkRead(hk, 0, "CurrentMajorVersionNumber", + RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){ + rv = (kv >= 10); + } + rkFree(hk, 0); + } + } + FreeLibrary(hLib); + } + return rv; +} +# define IS_WIN10_OR_LATER() CheckAtLeastWin10() +#else /* defined(SQLITE_OS_WINRT) */ +# define IS_WIN10_OR_LATER() 0 +#endif + /* ** Prepare console, (if known to be a WIN32 console), for UTF-8 ** input (from either typing or suitable paste operations) and/or for @@ -12210,6 +12244,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } #endif +#if SHELL_WIN_UTF8_OPT + /* If Windows build and not RT, set*/ + mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1; +#endif + /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, ** the size of the alternative malloc heap, options affecting commands @@ -12405,7 +12444,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ exit(1); } } - #if SHELL_WIN_UTF8_OPT /* Get indicated Windows console setup done before running invocation commands. */ if( stdin_is_interactive || stdout_is_console ){ From 060c097e0d2f947ad77ce12f6781320aec6088f9 Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 29 Oct 2023 16:26:12 +0000 Subject: [PATCH 196/242] Properly close a handle. Use a putatively effective runtime test for UTF-8 console I/O capability. (This makes the version test useful mainly for avoiding a warning that UTF-8 console I/O could not be setup.) FossilOrigin-Name: dc91eb91725f3db65c73725f1fbcf18a711cafb65b4fea3277aa0905a24df353 --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/shell.c.in | 30 +++++++++++++++++++----------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 1eba221ff9..431c97d07b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Condition\sdefault\sUTF-8\sconsole\sI/O\sfor\sWindows\sbuilds\son\sOS\sversion\s10\sor\smore.\sThis\sis\sto\saccomodate\san\sIsValidCodePage()\sAPI\swhich\smay\shappily\sreport\sCP_UTF8\sas\sa\svalid\scode\spage\swhen\sthe\sstock\sconsole\scannot,\sin\sfact,\sdo\sUTF-8\sI/O. -D 2023-10-29T00:24:22.936 +C Properly\sclose\sa\shandle.\sUse\sa\sputatively\seffective\sruntime\stest\sfor\sUTF-8\sconsole\sI/O\scapability.\s(This\smakes\sthe\sversion\stest\suseful\smainly\sfor\savoiding\sa\swarning\sthat\sUTF-8\sconsole\sI/O\scould\snot\sbe\ssetup.) +D 2023-10-29T16:26:12.664 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 29b2abb039ddff7b512960a5396cecbaee6ab236537de36f4f972adbfc4467c1 +F src/shell.c.in 6c7a4481b776a2d568816344597d0481359b4a20f465ce1c3033004fa9fa4a72 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2139,11 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca -R 06beefd7b5a601159ef2b90a69791f5c -T *branch * win-utf8-io-split -T *sym-win-utf8-io-split * -T -sym-trunk * +P 6b9b2a886fd4d239c2e87c3f3809c011f77c0f60e0c279bbe4e1d1b53c609e2d +R bab24205be6731c553860e9beeba6fcf U larrybr -Z 8b9699cbbd0e4aa806c0f866919f402f +Z a3328aae66d1d54e0b613e1b32590aa3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d8f3ed59bf..dd7ecada55 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6b9b2a886fd4d239c2e87c3f3809c011f77c0f60e0c279bbe4e1d1b53c609e2d \ No newline at end of file +dc91eb91725f3db65c73725f1fbcf18a711cafb65b4fea3277aa0905a24df353 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index e61887bc62..7041b7d693 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -619,13 +619,13 @@ static int CheckAtLeastWin10(void){ typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD, LPDWORD,PVOID,LPDWORD); - typedef LSTATUS (WINAPI *REG_UNLOAD)(HKEY,LPCSTR); + typedef LSTATUS (WINAPI *REG_CLOSE)(HKEY); int rv = 0; HINSTANCE hLib = LoadLibrary(TEXT("Advapi32.dll")); if( NULL != hLib ){ REG_OPEN rkOpen = (REG_OPEN)GetProcAddress(hLib, "RegOpenKeyExA"); REG_READ rkRead = (REG_READ)GetProcAddress(hLib, "RegGetValueA"); - REG_UNLOAD rkFree = (REG_UNLOAD)GetProcAddress(hLib, "RegUnLoadKeyA"); + REG_CLOSE rkFree = (REG_CLOSE)GetProcAddress(hLib, "RegCloseKey"); if( rkOpen != NULL && rkRead != NULL && rkFree != NULL ){ HKEY hk; const char *zsk = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; @@ -635,7 +635,7 @@ static int CheckAtLeastWin10(void){ RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){ rv = (kv >= 10); } - rkFree(hk, 0); + rkFree(hk); } } FreeLibrary(hLib); @@ -659,6 +659,7 @@ static void console_prepare_utf8(void){ HANDLE hCC = INVALID_HANDLE_VALUE; DWORD consoleMode = 0; u8 conI = 0, conO = 0; + struct ConsoleState csWork = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 }; console_utf8_in = console_utf8_out = 0; if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conI = 1; @@ -667,24 +668,28 @@ static void console_prepare_utf8(void){ if( conI ) hCC = hCI; else hCC = hCO; if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){ + bail: fprintf(stderr, "Cannot use UTF-8 code page.\n"); return; } - conState.hConsole = hCC; - conState.consoleMode = consoleMode; - conState.inCodePage = GetConsoleCP(); - conState.outCodePage = GetConsoleOutputCP(); + csWork.hConsole = hCC; + csWork.consoleMode = consoleMode; + csWork.inCodePage = GetConsoleCP(); + csWork.outCodePage = GetConsoleOutputCP(); if( conI ){ + if( !SetConsoleCP(CP_UTF8) ) goto bail; console_utf8_in = 1; - SetConsoleCP(CP_UTF8); consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; SetConsoleMode(conState.hConsole, consoleMode); - conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); + csWork.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); } if( conO ){ + /* Here, it is assumed that if conI is true, this call will + ** also succeed, so there is no need to undo above setup. */ + if( !SetConsoleOutputCP(CP_UTF8) ) goto bail; console_utf8_out = 1; - SetConsoleOutputCP(CP_UTF8); } + conState = csWork; } /* @@ -12245,7 +12250,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ #endif #if SHELL_WIN_UTF8_OPT - /* If Windows build and not RT, set*/ + /* If Windows build and not RT, set default MBCS/UTF-8 translation + ** for console according to detected Windows version. This default + ** may be overridden by the -utf8 or -no-utf8 invocation options. + */ mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1; #endif From 84eab13df95c3dcaaf3a2fd789d0002efc9989e3 Mon Sep 17 00:00:00 2001 From: larrybr Date: Sun, 29 Oct 2023 19:55:22 +0000 Subject: [PATCH 197/242] Simplify code slightly. Improve comments on added code and its use. FossilOrigin-Name: 046c84296627382ee416f64b02b77a937b368e30b32e6b800de5a854810766f6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c.in | 51 +++++++++++++++++++++++++++++++++++++------------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index 431c97d07b..3dddd587af 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Properly\sclose\sa\shandle.\sUse\sa\sputatively\seffective\sruntime\stest\sfor\sUTF-8\sconsole\sI/O\scapability.\s(This\smakes\sthe\sversion\stest\suseful\smainly\sfor\savoiding\sa\swarning\sthat\sUTF-8\sconsole\sI/O\scould\snot\sbe\ssetup.) -D 2023-10-29T16:26:12.664 +C Simplify\scode\sslightly.\sImprove\scomments\son\sadded\scode\sand\sits\suse. +D 2023-10-29T19:55:22.809 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 6c7a4481b776a2d568816344597d0481359b4a20f465ce1c3033004fa9fa4a72 +F src/shell.c.in 9e234ec61ce462b63ce37b29d875d0a716878f049ad50f13f55b859d01c919ad F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6b9b2a886fd4d239c2e87c3f3809c011f77c0f60e0c279bbe4e1d1b53c609e2d -R bab24205be6731c553860e9beeba6fcf +P dc91eb91725f3db65c73725f1fbcf18a711cafb65b4fea3277aa0905a24df353 +R 21d5e98541aed894e5aa957e7e737a78 U larrybr -Z a3328aae66d1d54e0b613e1b32590aa3 +Z 84338a34602261108f59c503d896ebcf # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dd7ecada55..219a9cc027 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dc91eb91725f3db65c73725f1fbcf18a711cafb65b4fea3277aa0905a24df353 \ No newline at end of file +046c84296627382ee416f64b02b77a937b368e30b32e6b800de5a854810766f6 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 7041b7d693..3d9b46db0b 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -615,7 +615,24 @@ static struct ConsoleState { #if !SQLITE_OS_WINRT -static int CheckAtLeastWin10(void){ +/* +** Check Windows major version against given value, returning +** 1 if the OS major version is no less than the argument. +** This check uses very late binding to the registry access +** API so that it can operate gracefully on OS versions that +** do not have that API. The Windows NT registry, for versions +** through Windows 11 (at least, as of October 2023), keeps +** the actual major version number at registry key/value +** HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentMajorVersionNumber +** where it can be read more reliably than allowed by various +** version info APIs which "process" the result in a manner +** incompatible with the purpose of the CLI's version check. +** +** If the registry API is unavailable, or the location of +** the above registry value changes, or the OS major version +** is less than the argument, this function returns 0. +*/ +static int CheckAtLeastWinX(DWORD major_version){ typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD, LPDWORD,PVOID,LPDWORD); @@ -633,7 +650,7 @@ static int CheckAtLeastWin10(void){ DWORD kv = 0, kvsize = sizeof(kv); if( ERROR_SUCCESS == rkRead(hk, 0, "CurrentMajorVersionNumber", RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){ - rv = (kv >= 10); + rv = (kv >= major_version); } rkFree(hk); } @@ -642,16 +659,22 @@ static int CheckAtLeastWin10(void){ } return rv; } -# define IS_WIN10_OR_LATER() CheckAtLeastWin10() +# define IS_WIN10_OR_LATER() CheckAtLeastWinX(10) #else /* defined(SQLITE_OS_WINRT) */ # define IS_WIN10_OR_LATER() 0 #endif /* -** Prepare console, (if known to be a WIN32 console), for UTF-8 -** input (from either typing or suitable paste operations) and/or for -** UTF-8 rendering. This may "fail" with a message to stderr, where +** Prepare console, (if known to be a WIN32 console), for UTF-8 input +** (from either typing or suitable paste operations) and/or for UTF-8 +** output rendering. This may "fail" with a message to stderr, where ** the preparation is not done and common "code page" issues occur. +** +** The console state upon entry is preserved, in conState, so that +** console_restore() can later restore the same console state. +** +** The globals console_utf8_in and console_utf8_out are set, for +** later use in selecting UTF-8 or MBCS console I/O translations. */ static void console_prepare_utf8(void){ HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE); @@ -678,17 +701,17 @@ static void console_prepare_utf8(void){ csWork.outCodePage = GetConsoleOutputCP(); if( conI ){ if( !SetConsoleCP(CP_UTF8) ) goto bail; - console_utf8_in = 1; consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; SetConsoleMode(conState.hConsole, consoleMode); csWork.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); } if( conO ){ - /* Here, it is assumed that if conI is true, this call will - ** also succeed, so there is no need to undo above setup. */ + /* Here, it is assumed that if conI is true, this call will also + ** succeed, so there is no need to undo above setup upon failure. */ if( !SetConsoleOutputCP(CP_UTF8) ) goto bail; - console_utf8_out = 1; } + console_utf8_in = conI; + console_utf8_out = conO; conState = csWork; } @@ -12250,9 +12273,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ #endif #if SHELL_WIN_UTF8_OPT - /* If Windows build and not RT, set default MBCS/UTF-8 translation - ** for console according to detected Windows version. This default - ** may be overridden by the -utf8 or -no-utf8 invocation options. + /* If Windows build and not RT, set default MBCS/UTF-8 translation for + ** console according to detected Windows version. This default may be + ** overridden by a -no-utf8 or (undocumented) -utf8 invocation option. + ** If a runtime check for UTF-8 console I/O capability is devised, + ** that should be preferred over this version check. */ mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1; #endif From d2147bd32b0bb2e6cc4dc0306a834d7355932ba1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 12:09:48 +0000 Subject: [PATCH 198/242] With SQLITE_ENABLE_BLOCK_ATOMIC_WRITE enabled, if a transaction is committing and there is a new freelist page at the end of the database file which would cause the database file size to grow, ensure that page is written and the file size grows before the block-atomic-write commits. Fix for the problem identified by [forum:/forumpost/3bd8d497b2|forum post 3bd8d497b2] FossilOrigin-Name: c9fdd6805df04f05ef347e5a43506fd37a729c5924abb6e1103e871c4ac2d6dc --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 7 +++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b00c6fb942..482e9ce639 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C For\sWindows\sCLI,\sinstitute\sa\sversion\scheck\sto\sdetermine\sdefault\sMBCS\sor\sUTF-8\stranslation\son\sconsole\sI/O.\s(Default\sto\sUTF-8\swhere\sknown\spossible.) -D 2023-10-29T20:05:18.263 +C With\sSQLITE_ENABLE_BLOCK_ATOMIC_WRITE\senabled,\sif\sa\stransaction\sis\scommitting\nand\sthere\sis\sa\snew\sfreelist\spage\sat\sthe\send\sof\sthe\sdatabase\sfile\swhich\swould\ncause\sthe\sdatabase\sfile\ssize\sto\sgrow,\sensure\sthat\spage\sis\swritten\sand\sthe\nfile\ssize\sgrows\sbefore\sthe\sblock-atomic-write\scommits.\s\sFix\sfor\sthe\nproblem\sidentified\sby\s[forum:/forumpost/3bd8d497b2|forum\spost\s3bd8d497b2] +D 2023-10-30T12:09:48.933 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -708,7 +708,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c cb116fde9e3ca3c1bbfdf89d6928f776a2a34da168e2667426523a4db353b271 F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 2188897e1102a776dcb1bbe8b2eb70ac7de8863c9cb95ef09d35e9bad406cf45 +F src/pager.c 9c9343d9ff407fb9e01f8c22e9babbe42807ab53aa1c7d747da77bb2b2f74629 F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 765290663b28e90a0494997baf023f9610a4ed32f0ff0099bf9fc3d485733fca 046c84296627382ee416f64b02b77a937b368e30b32e6b800de5a854810766f6 -R 21d5e98541aed894e5aa957e7e737a78 -U larrybr -Z 388b78b418fa51ea2b695e5b2ab587f8 +P ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1 +R d568eda5a52aecc6980b1f18605b773c +U drh +Z 6faa5f859e86aecdc04ddabbaa63c135 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index cec26a520d..127b422d23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ddc6ead6453e0f98943bd07aedd90d47bc2e9e9e27b008d493491168bea2b3f1 \ No newline at end of file +c9fdd6805df04f05ef347e5a43506fd37a729c5924abb6e1103e871c4ac2d6dc \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 5c2d556b3e..826e90f137 100644 --- a/src/pager.c +++ b/src/pager.c @@ -6588,6 +6588,13 @@ int sqlite3PagerCommitPhaseOne( rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0); if( rc==SQLITE_OK ){ rc = pager_write_pagelist(pPager, pList); + if( rc==SQLITE_OK && pPager->dbSize>pPager->dbFileSize ){ + char *pTmp = pPager->pTmpSpace; + int szPage = (int)pPager->pageSize; + memset(pTmp, 0, szPage); + rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, + (pPager->dbSize*pPager->pageSize)-szPage); + } if( rc==SQLITE_OK ){ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0); } From 8a95e92af95e9ab247ba72d2b22ac2515b317ef6 Mon Sep 17 00:00:00 2001 From: larrybr Date: Mon, 30 Oct 2023 13:56:50 +0000 Subject: [PATCH 199/242] Predicate Windows CLI UTF-8 console I/O on a runtime capability check rather than an OS version check. FossilOrigin-Name: f89d062f8890fffc957a354e966784031d561d0f8f5c174c1ccdcf77e66c32bd --- manifest | 12 +-- manifest.uuid | 2 +- src/shell.c.in | 193 +++++++++++++++++++++++-------------------------- 3 files changed, 98 insertions(+), 109 deletions(-) diff --git a/manifest b/manifest index 3dddd587af..280b948327 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\scode\sslightly.\sImprove\scomments\son\sadded\scode\sand\sits\suse. -D 2023-10-29T19:55:22.809 +C Predicate\sWindows\sCLI\sUTF-8\sconsole\sI/O\son\sa\sruntime\scapability\scheck\srather\sthan\san\sOS\sversion\scheck. +D 2023-10-30T13:56:50.918 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 -F src/shell.c.in 9e234ec61ce462b63ce37b29d875d0a716878f049ad50f13f55b859d01c919ad +F src/shell.c.in 3826827be22545318865b0c387a8b9208b0a0f5d849d68440a63488ea9c275c8 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dc91eb91725f3db65c73725f1fbcf18a711cafb65b4fea3277aa0905a24df353 -R 21d5e98541aed894e5aa957e7e737a78 +P 046c84296627382ee416f64b02b77a937b368e30b32e6b800de5a854810766f6 +R 3cdce76f5cb17ac317716fdc83d39d50 U larrybr -Z 84338a34602261108f59c503d896ebcf +Z 39db1e0ea2a35c1c7711150de7a00b37 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 219a9cc027..194f81ce32 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -046c84296627382ee416f64b02b77a937b368e30b32e6b800de5a854810766f6 \ No newline at end of file +f89d062f8890fffc957a354e966784031d561d0f8f5c174c1ccdcf77e66c32bd \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index 3d9b46db0b..cf8e4f0611 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -450,16 +450,18 @@ static int bail_on_error = 0; static int stdin_is_interactive = 1; /* -** If build is for Windows, without 3rd-party line editing, Console -** input and output may be done in a UTF-8 compatible way. This is -** determined by invocation option and OS installed capability. +** If build is for non-RT Windows, without 3rd-party line editing, +** console input and output may be done in a UTF-8 compatible way, +** if the OS is capable of it and the --no-utf8 option is not seen. */ #if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \ - && !defined(SHELL_OMIT_WIN_UTF8) + && !defined(SHELL_OMIT_WIN_UTF8) && !SQLITE_OS_WINRT # define SHELL_WIN_UTF8_OPT 1 +/* Record whether to do UTF-8 console I/O translation per stream. */ static int console_utf8_in = 0; static int console_utf8_out = 0; - static int mbcs_opted = 0; +/* Record whether can do UTF-8 or --no-utf8 seen in invocation. */ + static int mbcs_opted = 1; /* Assume cannot do until shown otherwise. */ #else # define console_utf8_in 0 # define console_utf8_out 0 @@ -599,7 +601,7 @@ static char *dynamicContinuePrompt(void){ #endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */ #if SHELL_WIN_UTF8_OPT -/* Following struct is used for UTF-8 operation. */ +/* Following struct is used for UTF-8 console I/O. */ static struct ConsoleState { int stdinEof; /* EOF has been seen on console input */ int infsMode; /* Input file stream mode upon shell start */ @@ -613,106 +615,102 @@ static struct ConsoleState { # define _O_U16TEXT 0x20000 #endif - -#if !SQLITE_OS_WINRT /* -** Check Windows major version against given value, returning -** 1 if the OS major version is no less than the argument. -** This check uses very late binding to the registry access -** API so that it can operate gracefully on OS versions that -** do not have that API. The Windows NT registry, for versions -** through Windows 11 (at least, as of October 2023), keeps -** the actual major version number at registry key/value -** HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentMajorVersionNumber -** where it can be read more reliably than allowed by various -** version info APIs which "process" the result in a manner -** incompatible with the purpose of the CLI's version check. -** -** If the registry API is unavailable, or the location of -** the above registry value changes, or the OS major version -** is less than the argument, this function returns 0. +** If given stream number is a console, return 1 and get some attributes, +** else return 0 and set the output attributes to invalid values. */ -static int CheckAtLeastWinX(DWORD major_version){ - typedef LONG (WINAPI *REG_OPEN)(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); - typedef LSTATUS (WINAPI *REG_READ)(HKEY,LPCSTR,LPCSTR,DWORD, - LPDWORD,PVOID,LPDWORD); - typedef LSTATUS (WINAPI *REG_CLOSE)(HKEY); - int rv = 0; - HINSTANCE hLib = LoadLibrary(TEXT("Advapi32.dll")); - if( NULL != hLib ){ - REG_OPEN rkOpen = (REG_OPEN)GetProcAddress(hLib, "RegOpenKeyExA"); - REG_READ rkRead = (REG_READ)GetProcAddress(hLib, "RegGetValueA"); - REG_CLOSE rkFree = (REG_CLOSE)GetProcAddress(hLib, "RegCloseKey"); - if( rkOpen != NULL && rkRead != NULL && rkFree != NULL ){ - HKEY hk; - const char *zsk = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; - if( ERROR_SUCCESS == rkOpen(HKEY_LOCAL_MACHINE, zsk, 0, KEY_READ, &hk) ){ - DWORD kv = 0, kvsize = sizeof(kv); - if( ERROR_SUCCESS == rkRead(hk, 0, "CurrentMajorVersionNumber", - RRF_RT_REG_DWORD, 0, &kv, &kvsize) ){ - rv = (kv >= major_version); - } - rkFree(hk); - } - } - FreeLibrary(hLib); +static short console_attrs(unsigned stnum, HANDLE *pH, DWORD *pConsMode){ + static int stid[3] = { STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE }; + HANDLE h; + *pH = INVALID_HANDLE_VALUE; + *pConsMode = 0; + if( stnum > 2 ) return 0; + h = GetStdHandle(stid[stnum]); + if( h!=*pH && GetFileType(h)==FILE_TYPE_CHAR && GetConsoleMode(h,pConsMode) ){ + *pH = h; + return 1; } - return rv; + return 0; } -# define IS_WIN10_OR_LATER() CheckAtLeastWinX(10) -#else /* defined(SQLITE_OS_WINRT) */ -# define IS_WIN10_OR_LATER() 0 -#endif /* -** Prepare console, (if known to be a WIN32 console), for UTF-8 input -** (from either typing or suitable paste operations) and/or for UTF-8 -** output rendering. This may "fail" with a message to stderr, where -** the preparation is not done and common "code page" issues occur. +** Perform a runtime test of Windows console to determine if it can +** do char-stream I/O correctly when the code page is set to CP_UTF8. +** Returns are: 1 => yes it can, 0 => no it cannot +** +** The console's output code page is momentarily set, then restored. +** So this should only be run when the process is given use of the +** console for either input or output. +*/ +static short ConsoleDoesUTF8(void){ + UINT ocp = GetConsoleOutputCP(); + CONSOLE_SCREEN_BUFFER_INFO csbInfo = {0}; + /* Create an inactive screen buffer with which to do the experiment. */ + HANDLE hCSB = CreateConsoleScreenBuffer(GENERIC_READ|GENERIC_WRITE, 0, 0, + CONSOLE_TEXTMODE_BUFFER, NULL); + if( hCSB!=INVALID_HANDLE_VALUE ){ + const char TrialUtf8[] = { '\xC8', '\xAB' }; /* "È«" or 2 MBCS characters */ + COORD cpos = {0,0}; + SetConsoleCursorPosition(hCSB, cpos); + SetConsoleOutputCP(CP_UTF8); + /* Write 2 chars which are a single character in UTF-8 but more in MBCS. */ + WriteConsoleA(hCSB, TrialUtf8, sizeof(TrialUtf8), NULL, NULL); + GetConsoleScreenBufferInfo(hCSB, &csbInfo); + SetConsoleOutputCP(ocp); + CloseHandle(hCSB); + } + /* Return 1 if cursor advanced by 1 position, else 0. */ + return (short)(csbInfo.dwCursorPosition.X == 1); +} + +static short in_console = 0; +static short out_console = 0; + +/* +** Determine whether either normal I/O stream is the console, +** and whether it can do UTF-8 translation, setting globals +** in_console, out_console and mbcs_opted accordingly. +*/ +static void probe_console(void){ + HANDLE h; + DWORD cMode; + in_console = console_attrs(0, &h, &cMode); + out_console = console_attrs(1, &h, &cMode); + if( in_console || out_console ) mbcs_opted = !ConsoleDoesUTF8(); +} + +/* +** If console is used for normal I/O, absent a --no-utf8 option, +** prepare console for UTF-8 input (from either typing or suitable +** paste operations) and/or for UTF-8 output rendering. ** ** The console state upon entry is preserved, in conState, so that ** console_restore() can later restore the same console state. ** ** The globals console_utf8_in and console_utf8_out are set, for ** later use in selecting UTF-8 or MBCS console I/O translations. +** This routine depends upon globals set by probe_console(). */ static void console_prepare_utf8(void){ - HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE); - HANDLE hCO = GetStdHandle(STD_OUTPUT_HANDLE); - HANDLE hCC = INVALID_HANDLE_VALUE; - DWORD consoleMode = 0; - u8 conI = 0, conO = 0; struct ConsoleState csWork = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 }; console_utf8_in = console_utf8_out = 0; - if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR ) conI = 1; - if( isatty(1) && GetFileType(hCO)==FILE_TYPE_CHAR ) conO = 1; - if( (!conI && !conO) || mbcs_opted ) return; - if( conI ) hCC = hCI; - else hCC = hCO; - if( !IsValidCodePage(CP_UTF8) || !GetConsoleMode( hCC, &consoleMode) ){ - bail: - fprintf(stderr, "Cannot use UTF-8 code page.\n"); - return; + if( (!in_console && !out_console) || mbcs_opted ) return; + console_attrs((in_console)? 0 : 1, &conState.hConsole, &conState.consoleMode); + conState.inCodePage = GetConsoleCP(); + conState.outCodePage = GetConsoleOutputCP(); + if( in_console ){ + SetConsoleCP(CP_UTF8); + DWORD newConsoleMode = conState.consoleMode + | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; + SetConsoleMode(conState.hConsole, newConsoleMode); + conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); + console_utf8_in = 1; } - csWork.hConsole = hCC; - csWork.consoleMode = consoleMode; - csWork.inCodePage = GetConsoleCP(); - csWork.outCodePage = GetConsoleOutputCP(); - if( conI ){ - if( !SetConsoleCP(CP_UTF8) ) goto bail; - consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; - SetConsoleMode(conState.hConsole, consoleMode); - csWork.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); + if( out_console ){ + SetConsoleOutputCP(CP_UTF8); + console_utf8_out = 1; } - if( conO ){ - /* Here, it is assumed that if conI is true, this call will also - ** succeed, so there is no need to undo above setup upon failure. */ - if( !SetConsoleOutputCP(CP_UTF8) ) goto bail; - } - console_utf8_in = conI; - console_utf8_out = conO; - conState = csWork; } /* @@ -12187,7 +12185,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdout_is_console = isatty(1); #endif #if SHELL_WIN_UTF8_OPT - atexit(console_restore); /* Needs revision for CLI as library call */ + probe_console(); /* Check for console I/O and UTF-8 capability. */ + if( !mbcs_opted ) atexit(console_restore); #endif atexit(sayAbnormalExit); #ifdef SQLITE_DEBUG @@ -12272,16 +12271,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } #endif -#if SHELL_WIN_UTF8_OPT - /* If Windows build and not RT, set default MBCS/UTF-8 translation for - ** console according to detected Windows version. This default may be - ** overridden by a -no-utf8 or (undocumented) -utf8 invocation option. - ** If a runtime check for UTF-8 console I/O capability is devised, - ** that should be preferred over this version check. - */ - mbcs_opted = (IS_WIN10_OR_LATER())? 0 : 1; -#endif - /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, ** the size of the alternative malloc heap, options affecting commands @@ -12332,8 +12321,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdin_is_interactive = 0; }else if( cli_strcmp(z,"-utf8")==0 ){ #if SHELL_WIN_UTF8_OPT - /* Option accepted, but just specifies default UTF-8 console I/O. */ - mbcs_opted = 0; + /* Option accepted, but is ignored except for this diagnostic. */ + if( mbcs_opted ) fprintf(stderr, "Cannot do UTF-8 at this console.\n"); #endif /* SHELL_WIN_UTF8_OPT */ }else if( cli_strcmp(z,"-no-utf8")==0 ){ #if SHELL_WIN_UTF8_OPT @@ -12479,10 +12468,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } #if SHELL_WIN_UTF8_OPT /* Get indicated Windows console setup done before running invocation commands. */ - if( stdin_is_interactive || stdout_is_console ){ + if( in_console || out_console ){ console_prepare_utf8(); } - if( !stdin_is_interactive ){ + if( !in_console ){ setBinaryMode(stdin, 0); } #endif From 23e8f976ddde5e9bcda20d8934eb8984b9c5d1f0 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 30 Oct 2023 17:13:12 +0000 Subject: [PATCH 200/242] Add FTS5 to default Makefile.msc builds. And UNKNOWN_SQL_FUNCTION and STMT_SCANSTATUS to default Makefile.msc shell builds. FossilOrigin-Name: bf99ebba23b6a72a0c02c5542574f409828343e89501cbe2112596ced063c6ab --- Makefile.msc | 3 +++ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 4adbbee2a5..16635f0196 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -374,6 +374,7 @@ SQLITE_TCL_DEP = !IFNDEF OPT_FEATURE_FLAGS !IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 @@ -1689,6 +1690,8 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1 !ENDIF # <> diff --git a/manifest b/manifest index 74e0b30b35..45e738cf92 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Predicate\sWindows\sCLI\sUTF-8\sconsole\sI/O\son\sa\sruntime\scapability\scheck\srather\sthan\san\sOS\sversion\scheck. -D 2023-10-30T16:38:05.798 +C Add\sFTS5\sto\sdefault\sMakefile.msc\sbuilds.\sAnd\sUNKNOWN_SQL_FUNCTION\sand\sSTMT_SCANSTATUS\sto\sdefault\sMakefile.msc\sshell\sbuilds. +D 2023-10-30T17:13:12.161 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc c1aa09e0212d8609df041d13da6ca63198d1c1e29846f33104beecf19917102b +F Makefile.msc 23bd95afb445537aba610eaec45cd3848bdeb591d4350c21831f1a714754f339 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c9fdd6805df04f05ef347e5a43506fd37a729c5924abb6e1103e871c4ac2d6dc f89d062f8890fffc957a354e966784031d561d0f8f5c174c1ccdcf77e66c32bd -R 43d0ce4e57a74fef184c4e525ab03183 -U larrybr -Z 1a3e09d8f095a721c300f93b0f338e98 +P 0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d +R 841dad75dbd2b5725c477d5302bf71ff +U dan +Z bcdddb47387f655ace8d6b5a5dfbcdc4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d0f08ad018..f13c72172c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d \ No newline at end of file +bf99ebba23b6a72a0c02c5542574f409828343e89501cbe2112596ced063c6ab \ No newline at end of file From 30c9aca83eb25acf69faa5f1ba0eb92d116efed1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 17:56:27 +0000 Subject: [PATCH 201/242] Fix typo in a comment. No code changes. FossilOrigin-Name: 424ef9550abaab32f745dc955e8996d51836eaed737e24c4b4db811aa118ce5d --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 74e0b30b35..635c711fca 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Predicate\sWindows\sCLI\sUTF-8\sconsole\sI/O\son\sa\sruntime\scapability\scheck\srather\sthan\san\sOS\sversion\scheck. -D 2023-10-30T16:38:05.798 +C Fix\stypo\sin\sa\scomment.\s\sNo\scode\schanges. +D 2023-10-30T17:56:27.807 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,7 +721,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 64c9bc7494f3d220a27498137551762c25458282388ea9ac0a710dd6d5dc1510 +F src/select.c 7753615c837fa6828a12035e9806cb89c63cef7d23f6ed20259b0569fb9a9787 F src/shell.c.in 3826827be22545318865b0c387a8b9208b0a0f5d849d68440a63488ea9c275c8 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c9fdd6805df04f05ef347e5a43506fd37a729c5924abb6e1103e871c4ac2d6dc f89d062f8890fffc957a354e966784031d561d0f8f5c174c1ccdcf77e66c32bd -R 43d0ce4e57a74fef184c4e525ab03183 -U larrybr -Z 1a3e09d8f095a721c300f93b0f338e98 +P 0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d +R f33ecf41a934a4fccd6ae4bb30c5c099 +U drh +Z aa23cad2bd7d24584bbb58137cf46214 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d0f08ad018..5a1c5bf9da 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d \ No newline at end of file +424ef9550abaab32f745dc955e8996d51836eaed737e24c4b4db811aa118ce5d \ No newline at end of file diff --git a/src/select.c b/src/select.c index 0dac37b10c..d7106f6eec 100644 --- a/src/select.c +++ b/src/select.c @@ -6743,7 +6743,7 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ** registers if register regAcc contains 0. The caller will take care ** of setting and clearing regAcc. ** -** For an ORDER BY aggregate, the actually accumulator memory cell update +** For an ORDER BY aggregate, the actual accumulator memory cell update ** is deferred until after all input rows have been received, so that they ** can be run in the requested order. In that case, instead of invoking ** OP_AggStep to update accumulator, just add the arguments that would From a238c57eb83e6337fe36bfc51b5bd98b0b8e9779 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 30 Oct 2023 18:07:18 +0000 Subject: [PATCH 202/242] Fix problems with previous commit on Makefile.msc. Also some win32-specific test failures in fts5misc.test. FossilOrigin-Name: 527f2237a6fb5e2ac97afddd7c65c0afa971efc616cb3b738e7245ee0b8d9570 --- Makefile.msc | 3 +-- ext/fts5/test/fts5misc.test | 6 +++++- manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 16635f0196..cb83f9c4b7 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1594,8 +1594,7 @@ TESTEXT = \ $(TOP)\ext\rtree\test_rtreedoc.c \ $(TOP)\ext\recover\sqlite3recover.c \ $(TOP)\ext\recover\test_recover.c \ - $(TOP)\ext\recover\dbdata.c \ - fts5.c + $(TOP)\ext\recover\dbdata.c # If use of zlib is enabled, add the "zipfile.c" source file. # diff --git a/ext/fts5/test/fts5misc.test b/ext/fts5/test/fts5misc.test index adab157809..d67d79e29f 100644 --- a/ext/fts5/test/fts5misc.test +++ b/ext/fts5/test/fts5misc.test @@ -424,10 +424,12 @@ do_execsql_test -db db2 15.3 { SAVEPOINT one; } {} do_execsql_test 15.4 END -do_test 15.4 { +do_test 15.5 { list [catch { db2 eval COMMIT } msg] $msg } {0 {}} +db2 close + #------------------------------------------------------------------------- reset_db forcedelete test.db2 @@ -469,6 +471,8 @@ do_execsql_test -db db2 16.6 { SELECT * FROM x1 } {abc def} +db2 close + #------------------------------------------------------------------------- reset_db do_execsql_test 17.1 { diff --git a/manifest b/manifest index 45e738cf92..6b08f6005f 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Add\sFTS5\sto\sdefault\sMakefile.msc\sbuilds.\sAnd\sUNKNOWN_SQL_FUNCTION\sand\sSTMT_SCANSTATUS\sto\sdefault\sMakefile.msc\sshell\sbuilds. -D 2023-10-30T17:13:12.161 +C Fix\sproblems\swith\sprevious\scommit\son\sMakefile.msc.\sAlso\ssome\swin32-specific\stest\sfailures\sin\sfts5misc.test. +D 2023-10-30T18:07:18.983 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc 23bd95afb445537aba610eaec45cd3848bdeb591d4350c21831f1a714754f339 +F Makefile.msc 2309c96119271c76f25c5a1bb012b7b8d6716ff47918fc172eed84ab386f0897 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -180,7 +180,7 @@ F ext/fts5/test/fts5limits.test 8ab67cf5d311c124b6ceb0062d0297767176df4572d955fc F ext/fts5/test/fts5matchinfo.test 10c9a6f7fe61fb132299c4183c012770b10c4d5c2f2edb6df0b6607f683d737a F ext/fts5/test/fts5merge.test e92a8db28b45931e7a9c7b1bbd36101692759d00274df74d83fd29d25d53b3a6 F ext/fts5/test/fts5merge2.test 3ebad1a59d6ad3fb66eff6523a09e95dc6367cbefb3cd73196801dea0425c8e2 -F ext/fts5/test/fts5misc.test 3947a481486156536f417a015343f05f9f367a17f282a4e02bdb95bb5bd43293 +F ext/fts5/test/fts5misc.test 5ca82f2a5ee016b0842043155d1382f98a34d0d86b2791165a44d7807f6e0f54 F ext/fts5/test/fts5multi.test a15bc91cdb717492e6e1b66fec1c356cb57386b980c7ba5af1915f97fe878581 F ext/fts5/test/fts5multiclient.test 5ff811c028d6108045ffef737f1e9f05028af2458e456c0937c1d1b8dea56d45 F ext/fts5/test/fts5near.test 211477940142d733ac04fad97cb24095513ab2507073a99c2765c3ddd2ef58bd @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d -R 841dad75dbd2b5725c477d5302bf71ff +P bf99ebba23b6a72a0c02c5542574f409828343e89501cbe2112596ced063c6ab +R beb66a8ff59ba764fca9e805da3860cc U dan -Z bcdddb47387f655ace8d6b5a5dfbcdc4 +Z a0b45d69600175e4b62a4e35aa5b9b82 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f13c72172c..1deb37cdf8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bf99ebba23b6a72a0c02c5542574f409828343e89501cbe2112596ced063c6ab \ No newline at end of file +527f2237a6fb5e2ac97afddd7c65c0afa971efc616cb3b738e7245ee0b8d9570 \ No newline at end of file From aa36dcf074f7c1c29d74b6a83707ceb2bef2056f Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 18:09:14 +0000 Subject: [PATCH 203/242] Make the new sqlite3_get_clientdata() and sqlite3_set_clientdata() interfaces available to run-time loaded extensions. FossilOrigin-Name: 8fc9aa0f896a2676b73c41cefbff74c822a7106b56324558862dd0a2a1877eaf --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/loadext.c | 5 ++++- src/sqlite3ext.h | 6 ++++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 635c711fca..db47df879c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\sa\scomment.\s\sNo\scode\schanges. -D 2023-10-30T17:56:27.807 +C Make\sthe\snew\ssqlite3_get_clientdata()\sand\ssqlite3_set_clientdata()\sinterfaces\navailable\sto\srun-time\sloaded\sextensions. +D 2023-10-30T18:09:14.202 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -683,7 +683,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 F src/json.c d69c6e28ff7b602877bda68cd20583b8487c059759aa4d154dd21b3fd99c6238 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa -F src/loadext.c 7d56c6f28aaf9b42e2772289e0d0a12a77b57c2baed021dbfd1fcafec69c156a +F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c e1bc8864834697503d370d94613be945d05ca1c5ebdda43e7d5c8ee8c48d433c F src/malloc.c f016922435dc7d1f1f5083a03338a3e91f8c67ce2c5bdcfa4cdef62e612f5fcc F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 @@ -725,7 +725,7 @@ F src/select.c 7753615c837fa6828a12035e9806cb89c63cef7d23f6ed20259b0569fb9a9787 F src/shell.c.in 3826827be22545318865b0c387a8b9208b0a0f5d849d68440a63488ea9c275c8 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 -F src/sqlite3ext.h 2f30b2671f4c03cd27a43f039e11251391066c97d11385f5f963bb40b03038ac +F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0058ea6a69103c1442bf5090553ce9bf77e06011a4960df754eb96144ced497d -R f33ecf41a934a4fccd6ae4bb30c5c099 +P 424ef9550abaab32f745dc955e8996d51836eaed737e24c4b4db811aa118ce5d +R b67ddbe02a61e56d8935630c18f88ea9 U drh -Z aa23cad2bd7d24584bbb58137cf46214 +Z d18de580e8444772fc3fb4710376591e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5a1c5bf9da..fccd04489e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -424ef9550abaab32f745dc955e8996d51836eaed737e24c4b4db811aa118ce5d \ No newline at end of file +8fc9aa0f896a2676b73c41cefbff74c822a7106b56324558862dd0a2a1877eaf \ No newline at end of file diff --git a/src/loadext.c b/src/loadext.c index cfa8ba4ca8..7e0ae25437 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -514,7 +514,10 @@ static const sqlite3_api_routines sqlite3Apis = { /* Version 3.41.0 and later */ sqlite3_is_interrupted, /* Version 3.43.0 and later */ - sqlite3_stmt_explain + sqlite3_stmt_explain, + /* Version 3.44.0 and later */ + sqlite3_get_clientdata, + sqlite3_set_clientdata }; /* True if x is the directory separator character diff --git a/src/sqlite3ext.h b/src/sqlite3ext.h index 7116380992..ae0949baf7 100644 --- a/src/sqlite3ext.h +++ b/src/sqlite3ext.h @@ -363,6 +363,9 @@ struct sqlite3_api_routines { int (*is_interrupted)(sqlite3*); /* Version 3.43.0 and later */ int (*stmt_explain)(sqlite3_stmt*,int); + /* Version 3.44.0 and later */ + void *(*get_clientdata)(sqlite3*,const char*); + int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*)); }; /* @@ -693,6 +696,9 @@ typedef int (*sqlite3_loadext_entry)( #define sqlite3_is_interrupted sqlite3_api->is_interrupted /* Version 3.43.0 and later */ #define sqlite3_stmt_explain sqlite3_api->stmt_explain +/* Version 3.44.0 and later */ +#define sqlite3_get_clientdata sqlite3_api->get_clientdata +#define sqlite3_set_clientdata sqlite3_api->set_clientdata #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) From 383295eb17072c4a88b73d4ff7963c1eb4ea2dcd Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 18:48:03 +0000 Subject: [PATCH 204/242] Fix another comment typo. No code changes. FossilOrigin-Name: 3203256c0285ef2fea810d59978603bfd7e38151cbc42e1baddf84b57c56f638 --- manifest | 15 +++++++-------- manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 686cbcb64c..a2ab42bfd3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sFTS5\sto\sdefault\sMakefile.msc\sbuilds.\sAnd\sUNKNOWN_SQL_FUNCTION\sand\sSTMT_SCANSTATUS\sto\sdefault\sMakefile.msc\sshell\sbuilds. -D 2023-10-30T18:17:29.237 +C Fix\sanother\scomment\stypo.\s\sNo\scode\schanges. +D 2023-10-30T18:48:03.095 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,7 +721,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 7753615c837fa6828a12035e9806cb89c63cef7d23f6ed20259b0569fb9a9787 +F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 F src/shell.c.in 3826827be22545318865b0c387a8b9208b0a0f5d849d68440a63488ea9c275c8 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2139,9 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8fc9aa0f896a2676b73c41cefbff74c822a7106b56324558862dd0a2a1877eaf 527f2237a6fb5e2ac97afddd7c65c0afa971efc616cb3b738e7245ee0b8d9570 -R 924fb849b3424780285acb2e9a121568 -T +closed 527f2237a6fb5e2ac97afddd7c65c0afa971efc616cb3b738e7245ee0b8d9570 -U dan -Z 3a8d30a63ed084f341d01d17623ea50e +P e41fde2fdb999b430561ac6d6ba150666ad1858e99c973f8dcd04a6934991032 +R 0419b51896081f56de024f9efaca85b4 +U drh +Z 85228b44c3864b12cba540f8b7c26125 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 03b4038491..d219d13ac0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e41fde2fdb999b430561ac6d6ba150666ad1858e99c973f8dcd04a6934991032 \ No newline at end of file +3203256c0285ef2fea810d59978603bfd7e38151cbc42e1baddf84b57c56f638 \ No newline at end of file diff --git a/src/select.c b/src/select.c index d7106f6eec..7a79385e0b 100644 --- a/src/select.c +++ b/src/select.c @@ -6746,7 +6746,7 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ** For an ORDER BY aggregate, the actual accumulator memory cell update ** is deferred until after all input rows have been received, so that they ** can be run in the requested order. In that case, instead of invoking -** OP_AggStep to update accumulator, just add the arguments that would +** OP_AggStep to update the accumulator, just add the arguments that would ** have been passed into OP_AggStep into the sorting ephemeral table ** (along with the appropriate sort key). */ From f3f0bd2155d2200b5a3d4975ddbde94d44164ba1 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 19:03:17 +0000 Subject: [PATCH 205/242] Add a cast to i64 for an integer in an sqlite3OsWrite() offset calculation. The cast is not strictly necessary, but it helps human readers see that the code is correct. FossilOrigin-Name: 7564ff1ba2c2fba89106d1aa06cc5379e752f119f22370f2f155f24cc698dec6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pager.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index a2ab42bfd3..a6fdab9375 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sanother\scomment\stypo.\s\sNo\scode\schanges. -D 2023-10-30T18:48:03.095 +C Add\sa\scast\sto\si64\sfor\san\sinteger\sin\san\ssqlite3OsWrite()\soffset\ncalculation.\s\sThe\scast\sis\snot\sstrictly\snecessary,\sbut\sit\shelps\shuman\sreaders\nsee\sthat\sthe\scode\sis\scorrect. +D 2023-10-30T19:03:17.274 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -708,7 +708,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c cb116fde9e3ca3c1bbfdf89d6928f776a2a34da168e2667426523a4db353b271 F src/os_win.c 4a50a154aeebc66a1f8fb79c1ff6dd5fe3d005556533361e0d460d41cb6a45a8 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c 9c9343d9ff407fb9e01f8c22e9babbe42807ab53aa1c7d747da77bb2b2f74629 +F src/pager.c 699aab8dfc88056d796b03b40c0ab979040d58dfc3ae9db207f1be91e4880bbf F src/pager.h f4d33fec8052603758792045493423b8871a996da2d0973927b7d36cd6070473 F src/parse.y 020d80386eb216ec9520549106353c517d2bbc89be28752ffdca649a9eaf56ec F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e41fde2fdb999b430561ac6d6ba150666ad1858e99c973f8dcd04a6934991032 -R 0419b51896081f56de024f9efaca85b4 +P 3203256c0285ef2fea810d59978603bfd7e38151cbc42e1baddf84b57c56f638 +R bc4d33b10898224fed6a435408a265f0 U drh -Z 85228b44c3864b12cba540f8b7c26125 +Z dd8b500ddcc44fefafb6cf0d50166aea # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d219d13ac0..805d975e44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3203256c0285ef2fea810d59978603bfd7e38151cbc42e1baddf84b57c56f638 \ No newline at end of file +7564ff1ba2c2fba89106d1aa06cc5379e752f119f22370f2f155f24cc698dec6 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 826e90f137..e547504243 100644 --- a/src/pager.c +++ b/src/pager.c @@ -6593,7 +6593,7 @@ int sqlite3PagerCommitPhaseOne( int szPage = (int)pPager->pageSize; memset(pTmp, 0, szPage); rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, - (pPager->dbSize*pPager->pageSize)-szPage); + ((i64)pPager->dbSize*pPager->pageSize)-szPage); } if( rc==SQLITE_OK ){ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0); From cc2af7e68a6bb318a8cee8ab282ade96841c626e Mon Sep 17 00:00:00 2001 From: larrybr Date: Mon, 30 Oct 2023 19:50:20 +0000 Subject: [PATCH 206/242] Dodge a nuisance warning from MSVC in CLI use of Prepared Statement Scan Status. (Yes, C rules are fine.) FossilOrigin-Name: 166c96d91dcc8c500a084d5703db103176ed5ec7d5f1334050cd66b3f1cd0e4f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index a6fdab9375..498079075b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\scast\sto\si64\sfor\san\sinteger\sin\san\ssqlite3OsWrite()\soffset\ncalculation.\s\sThe\scast\sis\snot\sstrictly\snecessary,\sbut\sit\shelps\shuman\sreaders\nsee\sthat\sthe\scode\sis\scorrect. -D 2023-10-30T19:03:17.274 +C Dodge\sa\snuisance\swarning\sfrom\sMSVC\sin\sCLI\suse\sof\sPrepared\sStatement\sScan\sStatus.\s(Yes,\sC\srules\sare\sfine.) +D 2023-10-30T19:50:20.447 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 -F src/shell.c.in 3826827be22545318865b0c387a8b9208b0a0f5d849d68440a63488ea9c275c8 +F src/shell.c.in fbb0ff59cd62e1103221f655a9b3357edec4f89bd6c6d3350f6bddc1ff855357 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3203256c0285ef2fea810d59978603bfd7e38151cbc42e1baddf84b57c56f638 -R bc4d33b10898224fed6a435408a265f0 -U drh -Z dd8b500ddcc44fefafb6cf0d50166aea +P 7564ff1ba2c2fba89106d1aa06cc5379e752f119f22370f2f155f24cc698dec6 +R 592cb591ccb42176be22bbcd43e1bb22 +U larrybr +Z f318336f9f4c56ad4c0496d33e161662 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 805d975e44..5009919aa8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7564ff1ba2c2fba89106d1aa06cc5379e752f119f22370f2f155f24cc698dec6 \ No newline at end of file +166c96d91dcc8c500a084d5703db103176ed5ec7d5f1334050cd66b3f1cd0e4f \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index cf8e4f0611..88bb8c0868 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -3438,7 +3438,7 @@ static void display_explain_scanstats( if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){ break; } - n = strlen(z) + scanStatsHeight(p, ii)*3; + n = (int)strlen(z) + scanStatsHeight(p, ii)*3; if( n>nWidth ) nWidth = n; } nWidth += 4; @@ -3450,12 +3450,12 @@ static void display_explain_scanstats( i64 nCycle = 0; int iId = 0; int iPid = 0; - const char *z = 0; + const char *zo = 0; const char *zName = 0; char *zText = 0; double rEst = 0.0; - if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){ + if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&zo) ){ break; } sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst); @@ -3466,7 +3466,7 @@ static void display_explain_scanstats( sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid); sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName); - zText = sqlite3_mprintf("%s", z); + zText = sqlite3_mprintf("%s", zo); if( nCycle>=0 || nLoop>=0 || nRow>=0 ){ char *z = 0; if( nCycle>=0 && nTotal>0 ){ From 23f5f62d41339fbe246cf7860a713ac419b2a253 Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 30 Oct 2023 20:35:33 +0000 Subject: [PATCH 207/242] Update the autoconf/Makefile.msc so that it aligns with Makefile.msc. FossilOrigin-Name: c4f724de279dae1afd10d435ad61ed07c1e4658288457c50e4f9b2f4521bbe12 --- autoconf/Makefile.msc | 3 +++ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autoconf/Makefile.msc b/autoconf/Makefile.msc index 8a64e8f46f..280bb95deb 100644 --- a/autoconf/Makefile.msc +++ b/autoconf/Makefile.msc @@ -296,6 +296,7 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !IFNDEF OPT_FEATURE_FLAGS !IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 @@ -987,6 +988,8 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1 !ENDIF diff --git a/manifest b/manifest index 498079075b..4c9859dc5c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Dodge\sa\snuisance\swarning\sfrom\sMSVC\sin\sCLI\suse\sof\sPrepared\sStatement\sScan\sStatus.\s(Yes,\sC\srules\sare\sfine.) -D 2023-10-30T19:50:20.447 +C Update\sthe\sautoconf/Makefile.msc\sso\sthat\sit\saligns\swith\sMakefile.msc. +D 2023-10-30T20:35:33.577 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.msc 3dfe7dc4677569256724e4988db59521f10b1d8b8fba393ea8a255eb038b9825 +F autoconf/Makefile.msc 34f8c222846db1b354720c8a78a4fa7dec9176ea447c0fffdf442b7f74e8b1df F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/README.txt 42cfd21d0b19dc7d5d85fb5c405c5f3c6a4c923021c39128f6ba685355d8fd56 F autoconf/configure.ac ec7fa914c5e74ff212fe879f9bb6918e1234497e05facfb641f30c4d5893b277 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7564ff1ba2c2fba89106d1aa06cc5379e752f119f22370f2f155f24cc698dec6 -R 592cb591ccb42176be22bbcd43e1bb22 -U larrybr -Z f318336f9f4c56ad4c0496d33e161662 +P 166c96d91dcc8c500a084d5703db103176ed5ec7d5f1334050cd66b3f1cd0e4f +R a40397540ae65bc3266dad738379719e +U drh +Z fc1d61aea6975cccbcf8186ffc5ca0c5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5009919aa8..ad98d6629a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -166c96d91dcc8c500a084d5703db103176ed5ec7d5f1334050cd66b3f1cd0e4f \ No newline at end of file +c4f724de279dae1afd10d435ad61ed07c1e4658288457c50e4f9b2f4521bbe12 \ No newline at end of file From ddd1c97500a1292faec06b836890046a330f627b Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 31 Oct 2023 17:39:10 +0000 Subject: [PATCH 208/242] Fix a problem with SQLITE_ENABLE_FTS5 builds of the non-amalgamation testfixture.exe in Makefile.msc. FossilOrigin-Name: 544091cc0f5b7395a89226629267c858ec53f18095aadb3e9307ef8ea718176e --- Makefile.msc | 3 ++- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index cb83f9c4b7..4339be891f 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1610,7 +1610,8 @@ TESTSRC2 = \ $(SRC01) \ $(SRC07) \ $(SRC10) \ - $(TOP)\ext\async\sqlite3async.c + $(TOP)\ext\async\sqlite3async.c \ + fts5.c # Header files used by all library source files. # diff --git a/manifest b/manifest index 9ba2b2622e..9a1d67e413 100644 --- a/manifest +++ b/manifest @@ -1,11 +1,11 @@ -C Remedy\sCLI\snon-UTF8\shandling\sdetection\sflaw\s[forum:/forumpost/fa0e00d36db5fe0a|noted\sin\sa\sforum\spost]. -D 2023-10-30T23:20:45.871 +C Fix\sa\sproblem\swith\sSQLITE_ENABLE_FTS5\sbuilds\sof\sthe\snon-amalgamation\stestfixture.exe\sin\sMakefile.msc. +D 2023-10-31T17:39:10.235 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 -F Makefile.msc 2309c96119271c76f25c5a1bb012b7b8d6716ff47918fc172eed84ab386f0897 +F Makefile.msc f0cf219350d9af4fba411b4f6306dce2adc897484e8f446de1fb4f40de674d00 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c4f724de279dae1afd10d435ad61ed07c1e4658288457c50e4f9b2f4521bbe12 2666b80d2cf64a14d0482ee1ce0e8b2ff9e0c5bb21cd626470241a73a6555a3a -R de3e0925c6135d51477a234fbf85975c -U larrybr -Z 9a6dfd708910ab0dd64bc1873f0fddcf +P a4c7954b9380dfd3599e521f7fd40b8b556a7d0268198b302146311d20c3b162 +R 1f98e93a0b159109a29312639e89cb20 +U dan +Z 4f0457ef6cd8b07186691a33db44ec44 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 26c255f499..69a62557e4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a4c7954b9380dfd3599e521f7fd40b8b556a7d0268198b302146311d20c3b162 \ No newline at end of file +544091cc0f5b7395a89226629267c858ec53f18095aadb3e9307ef8ea718176e \ No newline at end of file From 5ba99da869063bed1c5ae3a18acbfe546d5998e4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 31 Oct 2023 17:40:30 +0000 Subject: [PATCH 209/242] Fix harmless compiler warnings in test code. FossilOrigin-Name: d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510 --- ext/session/test_session.c | 1 - manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/expr.c | 3 ++- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/session/test_session.c b/ext/session/test_session.c index 7931f08526..af42351ba7 100644 --- a/ext/session/test_session.c +++ b/ext/session/test_session.c @@ -392,7 +392,6 @@ static int SQLITE_TCLAPI test_session_cmd( }; size_t sz = sizeof(aOpt[0]); - int rc; int iArg; int iOpt; if( Tcl_GetIndexFromObjStruct(interp,objv[2],aOpt,sz,"option",0,&iOpt) ){ diff --git a/manifest b/manifest index 9a1d67e413..1e849b5a8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sSQLITE_ENABLE_FTS5\sbuilds\sof\sthe\snon-amalgamation\stestfixture.exe\sin\sMakefile.msc. -D 2023-10-31T17:39:10.235 +C Fix\sharmless\scompiler\swarnings\sin\stest\scode. +D 2023-10-31T17:40:30.223 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -556,7 +556,7 @@ F ext/session/sessionstat1.test b039e38e2ba83767b464baf39b297cc0b1cc6f3292255cb4 F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc F ext/session/sqlite3session.c 7b0f9bf6479aebd49e5f34cdaeb1479cde843cf5189bca6f32db4f36c130b414 F ext/session/sqlite3session.h 4cf19a51975746d7cff2fdd74db8b769c570958e1c3639ac150d824ac1553b3e -F ext/session/test_session.c 73e9921205633a08c1497770beecf3dcbc9b826dd4358f7f8152f706eaac5d71 +F ext/session/test_session.c 7b94ad945cd4afe6c73ee935aeb3d44b4446186e1729362af616c7695a5283d9 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb @@ -671,7 +671,7 @@ F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 -F src/expr.c 2ad50ae13cc6402973593eebd1f9af2c0915d5f7cc2c2f4f2f3472a9a7aeddce +F src/expr.c 433f12e1237524482b0b2681c07da3cd54ddada2a625237cecde419f3e3a2553 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c a47610f0a5c6cb0ad79f8fcef039c01833dec0c751bb695f28dc0ec6a4c3ba00 F src/func.c 472f6dcfa39cf54f89a6aec76c79c225fb880a6c14469c15d361331662b9bf43 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a4c7954b9380dfd3599e521f7fd40b8b556a7d0268198b302146311d20c3b162 -R 1f98e93a0b159109a29312639e89cb20 -U dan -Z 4f0457ef6cd8b07186691a33db44ec44 +P 544091cc0f5b7395a89226629267c858ec53f18095aadb3e9307ef8ea718176e +R 06db090922d30265c1e1381238ea6702 +U drh +Z de4fb7d4bf4b116e9ab6edba7e5b4842 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 69a62557e4..037b6e2c41 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -544091cc0f5b7395a89226629267c858ec53f18095aadb3e9307ef8ea718176e \ No newline at end of file +d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index e071c96908..0a975ae2e5 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1638,7 +1638,8 @@ static Expr *exprDup( memcpy(sEdupBuf.zAlloc, p, nNewSize); }else{ u32 nSize = (u32)exprStructSize(p); - assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= EXPR_FULLSIZE+nToken ); + assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= + (int)EXPR_FULLSIZE+nToken ); memcpy(sEdupBuf.zAlloc, p, nSize); if( nSize Date: Wed, 1 Nov 2023 11:23:50 +0000 Subject: [PATCH 210/242] Version 3.44.0 FossilOrigin-Name: 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 1e849b5a8a..603321be0f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings\sin\stest\scode. -D 2023-10-31T17:40:30.223 +C Version\s3.44.0 +D 2023-11-01T11:23:50.173 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2139,8 +2139,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 544091cc0f5b7395a89226629267c858ec53f18095aadb3e9307ef8ea718176e +P d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510 R 06db090922d30265c1e1381238ea6702 +T +sym-major-release * +T +sym-release * +T +sym-version-3.44.0 * U drh -Z de4fb7d4bf4b116e9ab6edba7e5b4842 +Z 14f36413d8197ea0c35026cb3842c9f7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 037b6e2c41..1cefea455e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510 \ No newline at end of file +17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 \ No newline at end of file From 54e7a0f360f73799f4b4d91c8a72dd08c52668b5 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 1 Nov 2023 14:33:44 +0000 Subject: [PATCH 211/242] Fix testrunner.tcl so that it accepts a relative path as an argument to the --zipvfs switch. FossilOrigin-Name: c1ed7ed02269e5b26142eb307e7889fc636672f101ea7fc192a2445e16a7dd6f --- manifest | 17 +++++++---------- manifest.uuid | 2 +- test/testrunner.tcl | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 603321be0f..ca82d7d002 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.44.0 -D 2023-11-01T11:23:50.173 +C Fix\stestrunner.tcl\sso\sthat\sit\saccepts\sa\srelative\spath\sas\san\sargument\sto\sthe\s--zipvfs\sswitch. +D 2023-11-01T14:33:44.381 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1647,7 +1647,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/tester.tcl 68454ef88508c196d19e8694daa27bff7107a91857799eaa12f417188ae53ede -F test/testrunner.tcl 14c8b8ece841b1dd17516a0dc9c7ad9b5f4d4db7987974d3fdf66ae56b2a71fa +F test/testrunner.tcl 8a6721213bce1cfd3b33e1588cc6431143d96b98819206bf91f5a205fbb150d4 F test/testrunner_data.tcl 7f73f93634d32dafc857ed491b840f371113d09fde6a8bfb9e47b938d47b8c85 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 @@ -2139,11 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d1895dd8f5757a339f619f22b29c8a739398ded673bb9c93f1b8eb8a4b38f510 -R 06db090922d30265c1e1381238ea6702 -T +sym-major-release * -T +sym-release * -T +sym-version-3.44.0 * -U drh -Z 14f36413d8197ea0c35026cb3842c9f7 +P 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 +R 95342b1e9b6483a07de6e1272f8f583b +U dan +Z ad9ef3268962ff3bfef4d4d0ad2ec6f3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1cefea455e..a8db7ce6b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 \ No newline at end of file +c1ed7ed02269e5b26142eb307e7889fc636672f101ea7fc192a2445e16a7dd6f \ No newline at end of file diff --git a/test/testrunner.tcl b/test/testrunner.tcl index 1f1862ffdd..025f2ecdb4 100644 --- a/test/testrunner.tcl +++ b/test/testrunner.tcl @@ -425,7 +425,7 @@ for {set ii 0} {$ii < [llength $argv]} {incr ii} { if {$isLast} { usage } } elseif {($n>2 && [string match "$a*" --zipvfs]) || $a=="-z"} { incr ii - set TRG(zipvfs) [lindex $argv $ii] + set TRG(zipvfs) [file normalize [lindex $argv $ii]] if {$isLast} { usage } } else { usage From 0577cdec5fc2b654096da49a733c68a594a3a0eb Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 1 Nov 2023 19:35:15 +0000 Subject: [PATCH 212/242] Update the windows build documentation to provide the exact command used to build the DLLs that appear on the download page. FossilOrigin-Name: 3524a8914c62f7987d948e5ef50cfdcb07254489e80e2257f38d0050c4baf450 --- doc/compile-for-windows.md | 14 +++++++++++++- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/doc/compile-for-windows.md b/doc/compile-for-windows.md index 20f79afa93..b8a50afb32 100644 --- a/doc/compile-for-windows.md +++ b/doc/compile-for-windows.md @@ -1,7 +1,7 @@ # Notes On Compiling SQLite On Windows 11 Here are step-by-step instructions on how to build SQLite from -canonical source on a new Windows 11 PC, as of 2023-08-16: +canonical source on a new Windows 11 PC, as of 2023-11-01: 1. Install Microsoft Visual Studio. The free "community edition" will work fine. Do a standard install for C++ development. @@ -84,6 +84,18 @@ following minor changes:
  • `set PATH=c:\tcl32\bin;%PATH%` +## Building a DLL + +The command the developers use for building the deliverable DLL on the +[download page](https://sqlite.org/download.html) is as follows: + +> ~~~~ +nmake /f Makefile.msc sqlite3.dll USE_NATIVE_LIBPATHS=1 "OPTS=-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SERIALIZE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1" +~~~~ + +That command generates both the sqlite3.dll and sqlite3.def files. The same +command works for both 32-bit and 64-bit builds. + ## Statically Linking The TCL Library Some utility programs associated with SQLite need to be linked diff --git a/manifest b/manifest index ca82d7d002..e07f83e557 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stestrunner.tcl\sso\sthat\sit\saccepts\sa\srelative\spath\sas\san\sargument\sto\sthe\s--zipvfs\sswitch. -D 2023-11-01T14:33:44.381 +C Update\sthe\swindows\sbuild\sdocumentation\sto\sprovide\sthe\sexact\scommand\sused\nto\sbuild\sthe\sDLLs\sthat\sappear\son\sthe\sdownload\spage. +D 2023-11-01T19:35:15.525 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -37,7 +37,7 @@ F configure 1d9cbcb416cb5387b3f750ae6db63cfedb703a2e46bf8ca61daecff31d208252 x F configure.ac de31fea7d975bb7ebafbe0e2190a855cc80d48558bf0c9a6578a1836daf1cd3a F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd -F doc/compile-for-windows.md 922ba580d210a1f1bd3ef9d0413121556f9b5714fb5c01e664d980f85fa4ac8c +F doc/compile-for-windows.md 50b27d77be96195c66031a3181cb8684ed822327ea834e07f9c014213e5e3bcf F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f F doc/lemon.html 44a53a1d2b42d7751f7b2f478efb23c978e258d794bfd172442307a755b9fa44 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301 -R 95342b1e9b6483a07de6e1272f8f583b -U dan -Z ad9ef3268962ff3bfef4d4d0ad2ec6f3 +P c1ed7ed02269e5b26142eb307e7889fc636672f101ea7fc192a2445e16a7dd6f +R 9f52bda73840b08593c0a2719141f789 +U drh +Z 0993941d7491a4e53ffe83c0d4aa911d # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a8db7ce6b3..3178ed16a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c1ed7ed02269e5b26142eb307e7889fc636672f101ea7fc192a2445e16a7dd6f \ No newline at end of file +3524a8914c62f7987d948e5ef50cfdcb07254489e80e2257f38d0050c4baf450 \ No newline at end of file From 7d522628896b4bcf6d077bd9088b0d19d4e55bda Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 1 Nov 2023 20:09:02 +0000 Subject: [PATCH 213/242] Remove some outdated JNI docs. FossilOrigin-Name: 52aef3d015bad12c4bd9334ec795276a68a0dabdc6fd0ff2a1068f640171eb77 --- ext/jni/src/org/sqlite/jni/capi/CApi.java | 9 --------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index d155060999..6eeeb29a24 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -32,15 +32,6 @@ import java.util.Arrays;

    The C-side part can be found in sqlite3-jni.c. -

    This class is package-private in order to keep Java clients from - having direct access to the low-level C-style APIs, a design - decision made by Java developers based on the C-style API being - riddled with opportunities for Java developers to proverbially shoot - themselves in the foot with. Third-party copies of this code may - eliminate that guard by simply changing this class from - package-private to public. Its methods which are intended to be - exposed that way are all public. -

    Only functions which materially differ from their C counterparts are documented here, and only those material differences are documented. The C documentation is otherwise applicable for these diff --git a/manifest b/manifest index 2040c8baa6..1ad5acd831 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk\sinto\sjni-post-3.44\sbranch. -D 2023-10-28T03:56:14.902 +C Remove\ssome\soutdated\sJNI\sdocs. +D 2023-11-01T20:09:02.325 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -249,7 +249,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 23d4073b34b5c07dd412d18395c9db79779bab059164316e14a60b33ec473cff +F ext/jni/src/org/sqlite/jni/capi/CApi.java 24aba7b14b11da52cd47083608d37c186122c2e2072e75b2ff923d1f15bfb9e5 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -2140,8 +2140,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a7b267bd11216ee990cdd855044fbc18c300dff07cf25b317f27c1bbbc340dcc f6e1137919243c5ce86725df64b40b7e12e82cbceaff210ca41616d620f0dd1b -R 624bf302e62c1cc32ad38a47599efaea +P 9670eb2496b4005cf718d9fd12dbd11733f7cf6704a967ebb316504ea6a51e82 +R 97a2b4ce6a38c0f0d2c6b5ea82f2a285 U stephan -Z e297eea85124209717df39b3b4767cd9 +Z 679d5351cf0eeba3692c3f5d2e6b7df2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4d5592d9bf..56e74409bd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9670eb2496b4005cf718d9fd12dbd11733f7cf6704a967ebb316504ea6a51e82 \ No newline at end of file +52aef3d015bad12c4bd9334ec795276a68a0dabdc6fd0ff2a1068f640171eb77 \ No newline at end of file From 57a7fdd81487846e1e73074bdcc152a6c7dc85b0 Mon Sep 17 00:00:00 2001 From: larrybr Date: Thu, 2 Nov 2023 11:04:37 +0000 Subject: [PATCH 214/242] CLI to compile with older MSVC compiler. FossilOrigin-Name: c89f75f8eef449f6869bda423593f7e14080e805f8ed192aff9463460f11b1a9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index e07f83e557..2076e838b1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\swindows\sbuild\sdocumentation\sto\sprovide\sthe\sexact\scommand\sused\nto\sbuild\sthe\sDLLs\sthat\sappear\son\sthe\sdownload\spage. -D 2023-11-01T19:35:15.525 +C CLI\sto\scompile\swith\solder\sMSVC\scompiler. +D 2023-11-02T11:04:37.702 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -722,7 +722,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 -F src/shell.c.in 3e9371ca6a93294931a8ed8b098bc3cb15d57567aa9a1f2ade72db7f5c572795 +F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c1ed7ed02269e5b26142eb307e7889fc636672f101ea7fc192a2445e16a7dd6f -R 9f52bda73840b08593c0a2719141f789 -U drh -Z 0993941d7491a4e53ffe83c0d4aa911d +P 3524a8914c62f7987d948e5ef50cfdcb07254489e80e2257f38d0050c4baf450 +R 1426ab6e5bb9ef707c7806f924ffe51a +U larrybr +Z 3840fc65c1d88cda0ad731f26c553ff7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3178ed16a3..3c06af71c9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3524a8914c62f7987d948e5ef50cfdcb07254489e80e2257f38d0050c4baf450 \ No newline at end of file +c89f75f8eef449f6869bda423593f7e14080e805f8ed192aff9463460f11b1a9 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index ad16d72044..3cfe1a94a4 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -704,9 +704,8 @@ static void console_prepare_utf8(void){ conState.outCodePage = GetConsoleOutputCP(); if( in_console ){ SetConsoleCP(CP_UTF8); - DWORD newConsoleMode = conState.consoleMode - | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; - SetConsoleMode(conState.hConsole, newConsoleMode); + SetConsoleMode(conState.hConsole, conState.consoleMode + | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT); conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); console_utf8_in = 1; } From 8a93ce7458f85a3ab7849f588853852e38c99abd Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 2 Nov 2023 12:05:55 +0000 Subject: [PATCH 215/242] Update the srctree-check.tcl script and child script so that they can be run on a read-only source tree and so that if any inconsistencies are found, the script returns a non-zero exit code and thus halts the build. FossilOrigin-Name: 58eb5440d75fb13c1a089cb935de6fb94b4322e10e349db8f11f37b9a2fda2fc --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- tool/mkctimec.tcl | 18 +++++++++++++++--- tool/mkpragmatab.tcl | 16 ++++++++++++++-- tool/srctree-check.tcl | 38 +++++++++++++++++++++++++------------- 5 files changed, 64 insertions(+), 28 deletions(-) diff --git a/manifest b/manifest index 2076e838b1..bcc42ebe99 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C CLI\sto\scompile\swith\solder\sMSVC\scompiler. -D 2023-11-02T11:04:37.702 +C Update\sthe\ssrctree-check.tcl\sscript\sand\schild\sscript\sso\sthat\sthey\scan\sbe\srun\non\sa\sread-only\ssource\stree\sand\sso\sthat\sif\sany\sinconsistencies\sare\sfound,\sthe\nscript\sreturns\sa\snon-zero\sexit\scode\sand\sthus\shalts\sthe\sbuild. +D 2023-11-02T12:05:55.199 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2059,13 +2059,13 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439 F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176 F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x -F tool/mkctimec.tcl 372452e24267dfe1b496eec3992d10c6e5e7d7870a152560cdcfe5404bc8cc04 x +F tool/mkctimec.tcl a16682eae5f01f85e5861b2aa215ca0d46b4230658ee25977e02b4508566fb75 x F tool/mkkeywordhash.c b9faa0ae7e14e4dbbcd951cddd786bf46b8a65bb07b129ba8c0cfade723aaffd F tool/mkmsvcmin.tcl 8897d515ef7f94772322db95a3b6fce6c614d84fe0bdd06ba5a1c786351d5a1d F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef F tool/mkopcodeh.tcl 769d9e6a8b462323150dc13a8539d6064664b72974f7894befe2491cc73e05cd F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa -F tool/mkpragmatab.tcl bd07bd59d45d0f3448e123d6937e9811195f9908a51e09d774609883055bfd3d +F tool/mkpragmatab.tcl 32e359ccb21011958a821955254bd7a5fa7915d01a8c16fed91ffc8b40cb4adf F tool/mkshellc.tcl b7adf08b82de60811d2cb6af05ff59fc17e5cd6f3e98743c14eaaa3f8971fed0 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 @@ -2106,7 +2106,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 41c586dee84d0b190ad13e0282ed83d4a65ec9fefde9adf4943efdf6558eea7f F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl cef630bc4ff21a460d72479c43a42bf1c1ed61897659305c35c8d72e91bcb176 +F tool/srctree-check.tcl 32712f58821aa224ff3f6401ff985f5f24fa8b9a75250443ed70c5a51a13d84c F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3524a8914c62f7987d948e5ef50cfdcb07254489e80e2257f38d0050c4baf450 -R 1426ab6e5bb9ef707c7806f924ffe51a -U larrybr -Z 3840fc65c1d88cda0ad731f26c553ff7 +P c89f75f8eef449f6869bda423593f7e14080e805f8ed192aff9463460f11b1a9 +R 6b4fbbc7f44186f715baaef1e0827b96 +U drh +Z 1f35d6921bfbf38634fcb89e7db9b288 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3c06af71c9..0ece8ea040 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c89f75f8eef449f6869bda423593f7e14080e805f8ed192aff9463460f11b1a9 \ No newline at end of file +58eb5440d75fb13c1a089cb935de6fb94b4322e10e349db8f11f37b9a2fda2fc \ No newline at end of file diff --git a/tool/mkctimec.tcl b/tool/mkctimec.tcl index 098bf16e3b..9e425c0fdc 100755 --- a/tool/mkctimec.tcl +++ b/tool/mkctimec.tcl @@ -7,6 +7,13 @@ # definition used in src/ctime.c, run this script from # the checkout root. It generates src/ctime.c . # +# Results are normally written into src/ctime.c. But if an argument is +# provided, results are written there instead. Examples: +# +# tclsh tool/mkctimec.tcl ;# <-- results to src/ctime.c +# +# tclsh tool/mkctimec.tcl /dev/tty ;# <-- results to the terminal +# set ::headWarning {/* DO NOT EDIT! @@ -429,10 +436,15 @@ foreach v $value2_options { }] } -set ctime_c "src/ctime.c" +if {$argc>0} { + set destfile [lindex $argv 0] +} else { + set destfile "[file dir [file dir [file normal $argv0]]]/src/ctime.c" + puts "Overwriting $destfile..." +} -if {[catch {set cfd [open $ctime_c w]}]!=0} { - puts stderr "File '$ctime_c' unwritable." +if {[catch {set cfd [open $destfile w]}]!=0} { + puts stderr "File '$destfile' unwritable." exit 1; } diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 5c36df0497..2b5b6fdcdb 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -9,6 +9,14 @@ # Then add the extra "case PragTyp_XXXXX:" and subsequent code for the # new pragma in ../src/pragma.c. # +# The results are normally written into the ../src/pragma.h file. However, +# if an alternative output file name is provided as an argument, then +# results are written into the alternative. For example: +# +# tclsh tool/mkpragmatab.tcl ;# <--- Results to src/pragma.h +# +# tclsh tool/mkpragmatab.tcl /dev/tty ;# <-- results to terminal +# # Flag meanings: set flagMeaning(NeedSchema) {Force schema load before running} @@ -402,8 +410,12 @@ set pragma_def { # Open the output file # -set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h" -puts "Overwriting $destfile with new pragma table..." +if {$argc>0} { + set destfile [lindex $argv 0] +} else { + set destfile "[file dir [file dir [file normal $argv0]]]/src/pragma.h" + puts "Overwriting $destfile with new pragma table..." +} set fd [open $destfile wb] puts $fd {/* DO NOT EDIT! ** This file is automatically generated by the script at diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index 234e70fae9..5327e63930 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -33,6 +33,10 @@ cd $ROOT # set TCLSH [info nameofexe] +# Number of errors seen. +# +set NERR 0 + ######################### autoconf/tea/configure.ac ########################### set confac [readfile $ROOT/autoconf/tea/configure.ac] @@ -42,38 +46,46 @@ append pattern [string trim $vers] append pattern {])} if {[string first $pattern $confac]<=0} { puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION" - exit 1 + puts "...... Fix: manually edit ./autoconf/tea/configure.ac to" + incr NERR } ######################### autoconf/Makefile.msc ############################### set f1 [readfile $ROOT/autoconf/Makefile.msc] -exec mv $ROOT/autoconf/Makefile.msc $ROOT/autoconf/Makefile.msc.tmp -exec $TCLSH $ROOT/tool/mkmsvcmin.tcl -set f2 [readfile $ROOT/autoconf/Makefile.msc] -exec mv $ROOT/autoconf/Makefile.msc.tmp $ROOT/autoconf/Makefile.msc +exec $TCLSH $ROOT/tool/mkmsvcmin.tcl $ROOT/Makefile.msc tmp1.txt +set f2 [readfile tmp1.txt] +file delete tmp1.txt if {$f1 != $f2} { puts "ERROR: ./autoconf/Makefile.msc does not agree with ./Makefile.msc" + puts "...... Fix: tclsh tool/mkmsvcmin.tcl" + incr NERR } ######################### src/pragma.h ######################################## set f1 [readfile $ROOT/src/pragma.h] -exec mv $ROOT/src/pragma.h $ROOT/src/pragma.h.tmp -exec $TCLSH $ROOT/tool/mkpragmatab.tcl -set f2 [readfile $ROOT/src/pragma.h] -exec mv $ROOT/src/pragma.h.tmp $ROOT/src/pragma.h +exec $TCLSH $ROOT/tool/mkpragmatab.tcl tmp2.txt +set f2 [readfile tmp2.txt] +file delete tmp2.txt if {$f1 != $f2} { puts "ERROR: ./src/pragma.h does not agree with ./tool/mkpragmatab.tcl" + puts "...... Fix: tclsh tool/mkpragmatab.tcl" + incr NERR } ######################### src/ctime.c ######################################## set f1 [readfile $ROOT/src/ctime.c] -exec mv $ROOT/src/ctime.c $ROOT/src/ctime.c.tmp -exec $TCLSH $ROOT/tool/mkctimec.tcl -set f2 [readfile $ROOT/src/ctime.c] -exec mv $ROOT/src/ctime.c.tmp $ROOT/src/ctime.c +exec $TCLSH $ROOT/tool/mkctimec.tcl tmp3.txt +set f2 [readfile tmp3.txt] +file delete tmp3.txt if {$f1 != $f2} { puts "ERROR: ./src/ctime.c does not agree with ./tool/mkctimec.tcl" + puts "..... Fix: tclsh tool/mkctimec.tcl" + incr NERR } + +# If any errors are seen, exit 1 so that the build will fail. +# +if {$NERR>0} {exit 1} From 845a2e0cc246a80c99509e7319f2d506ce0528fa Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 2 Nov 2023 13:10:16 +0000 Subject: [PATCH 216/242] One more tweak to tool/srctree-check.tcl so that a complete build can be accomplished from a read-only source tree. FossilOrigin-Name: cba9f0601ca995ac6952aa3a83f7264f6d25aaaa2ea36b19e90cbf591077de72 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/srctree-check.tcl | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index bcc42ebe99..df7a5eb535 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\ssrctree-check.tcl\sscript\sand\schild\sscript\sso\sthat\sthey\scan\sbe\srun\non\sa\sread-only\ssource\stree\sand\sso\sthat\sif\sany\sinconsistencies\sare\sfound,\sthe\nscript\sreturns\sa\snon-zero\sexit\scode\sand\sthus\shalts\sthe\sbuild. -D 2023-11-02T12:05:55.199 +C One\smore\stweak\sto\stool/srctree-check.tcl\sso\sthat\sa\scomplete\sbuild\scan\sbe\naccomplished\sfrom\sa\sread-only\ssource\stree. +D 2023-11-02T13:10:16.285 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2106,7 +2106,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 41c586dee84d0b190ad13e0282ed83d4a65ec9fefde9adf4943efdf6558eea7f F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 32712f58821aa224ff3f6401ff985f5f24fa8b9a75250443ed70c5a51a13d84c +F tool/srctree-check.tcl 9f1098d439159692ece45cc9e701b35df4956269399fe0c770e41f235d1ce5e6 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2139,8 +2139,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c89f75f8eef449f6869bda423593f7e14080e805f8ed192aff9463460f11b1a9 -R 6b4fbbc7f44186f715baaef1e0827b96 +P 58eb5440d75fb13c1a089cb935de6fb94b4322e10e349db8f11f37b9a2fda2fc +R 18054cea9bc23d801f864db646273e7d U drh -Z 1f35d6921bfbf38634fcb89e7db9b288 +Z 72328c40506425c913ea7fab75e23b19 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0ece8ea040..7142949e45 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -58eb5440d75fb13c1a089cb935de6fb94b4322e10e349db8f11f37b9a2fda2fc \ No newline at end of file +cba9f0601ca995ac6952aa3a83f7264f6d25aaaa2ea36b19e90cbf591077de72 \ No newline at end of file diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index 5327e63930..f44e3ceec5 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -27,7 +27,6 @@ proc readfile {filename} { # Find the root of the tree. # set ROOT [file dir [file dir [file normalize $argv0]]] -cd $ROOT # Name of the TCL interpreter # From e186fe20f5bddfd9f4d209f354dd6f5efa8e9c85 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 2 Nov 2023 17:31:06 +0000 Subject: [PATCH 217/242] Add the "remove_diacritics" option to the fts5 trigram tokenizer. FossilOrigin-Name: 83da80135b6105f47d1de560232449562ae8ac176c8011a6f75589f62bc9b1db --- ext/fts5/fts5_tokenize.c | 96 ++++++++++++++++++++-------- ext/fts5/test/fts5trigram2.test | 109 ++++++++++++++++++++++++++++++++ manifest | 15 +++-- manifest.uuid | 2 +- 4 files changed, 187 insertions(+), 35 deletions(-) create mode 100644 ext/fts5/test/fts5trigram2.test diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index e61d6b1edd..098d0c86b7 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -227,6 +227,12 @@ static const unsigned char sqlite3Utf8Trans1[] = { } \ } +#define SKIP_UTF8(zIn) { \ + if( ((unsigned char)(*(zIn++)))>=0xc0 ){ \ + while( (((unsigned char)*zIn) & 0xc0)==0x80 ){ zIn++; } \ + } \ +} + #endif /* ifndef SQLITE_AMALGAMATION */ typedef struct Unicode61Tokenizer Unicode61Tokenizer; @@ -1264,6 +1270,7 @@ static int fts5PorterTokenize( typedef struct TrigramTokenizer TrigramTokenizer; struct TrigramTokenizer { int bFold; /* True to fold to lower-case */ + int iFoldParam; /* Parameter to pass to Fts5UnicodeFold() */ }; /* @@ -1298,10 +1305,21 @@ static int fts5TriCreate( }else{ pNew->bFold = (zArg[0]=='0'); } + }else if( 0==sqlite3_stricmp(azArg[i], "remove_diacritics") ){ + if( (zArg[0]!='0' && zArg[0]!='1' && zArg[0]!='2') || zArg[1] ){ + rc = SQLITE_ERROR; + }else{ + pNew->iFoldParam = (zArg[0]!='0') ? 2 : 0; + } }else{ rc = SQLITE_ERROR; } } + + if( pNew->iFoldParam!=0 && pNew->bFold==0 ){ + rc = SQLITE_ERROR; + } + if( rc!=SQLITE_OK ){ fts5TriDelete((Fts5Tokenizer*)pNew); pNew = 0; @@ -1324,40 +1342,62 @@ static int fts5TriTokenize( TrigramTokenizer *p = (TrigramTokenizer*)pTok; int rc = SQLITE_OK; char aBuf[32]; + char *zOut = aBuf; + int ii; const unsigned char *zIn = (const unsigned char*)pText; const unsigned char *zEof = &zIn[nText]; u32 iCode; + int aStart[3]; /* Input offset of each character in aBuf[] */ UNUSED_PARAM(unusedFlags); - while( 1 ){ - char *zOut = aBuf; - int iStart = zIn - (const unsigned char*)pText; - const unsigned char *zNext; - READ_UTF8(zIn, zEof, iCode); - if( iCode==0 ) break; - zNext = zIn; - if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); + /* Populate aBuf[] with the characters for the first trigram. */ + for(ii=0; ii<3; ii++){ + do { + aStart[ii] = zIn - (const unsigned char*)pText; + READ_UTF8(zIn, zEof, iCode); + if( iCode==0 ) return SQLITE_OK; + if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam); + }while( iCode==0 ); + WRITE_UTF8(zOut, iCode); + } + + /* At the start of each iteration of this loop: + ** + ** aBuf: Contains 3 characters. The 3 characters of the next trigram. + ** zOut: Points to the byte following the last character in aBuf. + ** aStart[3]: Contains the byte offset in the input text corresponding + ** to the start of each of the three characters in the buffer. + */ + assert( zIn<=zEof ); + while( 1 ){ + int iNext; /* Start of character following current tri */ + const char *z1; + + /* Read characters from the input up until the first non-diacritic */ + do { + iNext = zIn - (const unsigned char*)pText; READ_UTF8(zIn, zEof, iCode); if( iCode==0 ) break; - }else{ - break; - } - if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); - READ_UTF8(zIn, zEof, iCode); - if( iCode==0 ) break; - if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); - }else{ - break; - } - rc = xToken(pCtx, 0, aBuf, zOut-aBuf, iStart, iStart + zOut-aBuf); - if( rc!=SQLITE_OK ) break; - zIn = zNext; + if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam); + }while( iCode==0 ); + + /* Pass the current trigram back to fts5 */ + rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext); + if( iCode==0 || rc!=SQLITE_OK ) break; + + /* Remove the first character from buffer aBuf[]. Append the character + ** with codepoint iCode. */ + z1 = aBuf; + SKIP_UTF8(z1); + memmove(aBuf, z1, zOut - z1); + zOut -= (z1 - aBuf); + WRITE_UTF8(zOut, iCode); + + /* Update the aStart[] array */ + aStart[0] = aStart[1]; + aStart[1] = aStart[2]; + aStart[2] = iNext; } return rc; @@ -1380,7 +1420,9 @@ int sqlite3Fts5TokenizerPattern( ){ if( xCreate==fts5TriCreate ){ TrigramTokenizer *p = (TrigramTokenizer*)pTok; - return p->bFold ? FTS5_PATTERN_LIKE : FTS5_PATTERN_GLOB; + if( p->iFoldParam==0 ){ + return p->bFold ? FTS5_PATTERN_LIKE : FTS5_PATTERN_GLOB; + } } return FTS5_PATTERN_NONE; } diff --git a/ext/fts5/test/fts5trigram2.test b/ext/fts5/test/fts5trigram2.test new file mode 100644 index 0000000000..f5beae5b28 --- /dev/null +++ b/ext/fts5/test/fts5trigram2.test @@ -0,0 +1,109 @@ +# 2023 October 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 for the fts5 "trigram" tokenizer. +# + +source [file join [file dirname [info script]] fts5_common.tcl] +ifcapable !fts5 { finish_test ; return } +set ::testprefix fts5trigram2 + +do_execsql_test 1.0 " + CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize='trigram remove_diacritics 1'); + INSERT INTO t1 VALUES('abc\u0303defghijklm'); + INSERT INTO t1 VALUES('a\u0303b\u0303c\u0303defghijklm'); +" + +do_execsql_test 1.1 { + SELECT highlight(t1, 0, '(', ')') FROM t1('abc'); +} [list \ + "(abc\u0303)defghijklm" \ + "(a\u0303b\u0303c\u0303)defghijklm" \ +] + +do_execsql_test 1.2 { + SELECT highlight(t1, 0, '(', ')') FROM t1('bcde'); +} [list \ + "a(bc\u0303de)fghijklm" \ + "a\u0303(b\u0303c\u0303de)fghijklm" \ +] + +do_execsql_test 1.3 { + SELECT highlight(t1, 0, '(', ')') FROM t1('cdef'); +} [list \ + "ab(c\u0303def)ghijklm" \ + "a\u0303b\u0303(c\u0303def)ghijklm" \ +] + +do_execsql_test 1.4 { + SELECT highlight(t1, 0, '(', ')') FROM t1('def'); +} [list \ + "abc\u0303(def)ghijklm" \ + "a\u0303b\u0303c\u0303(def)ghijklm" \ +] + + +#------------------------------------------------------------------------- +do_catchsql_test 2.0 { + CREATE VIRTUAL TABLE t2 USING fts5( + z, tokenize='trigram case_sensitive 1 remove_diacritics 1' + ); +} {1 {error in tokenizer constructor}} + +do_execsql_test 2.1 { + CREATE VIRTUAL TABLE t2 USING fts5( + z, tokenize='trigram case_sensitive 0 remove_diacritics 1' + ); +} +do_execsql_test 2.2 " + INSERT INTO t2 VALUES('\u00E3bcdef'); + INSERT INTO t2 VALUES('b\u00E3cdef'); + INSERT INTO t2 VALUES('bc\u00E3def'); + INSERT INTO t2 VALUES('bcd\u00E3ef'); +" + +do_execsql_test 2.3 { + SELECT highlight(t2, 0, '(', ')') FROM t2('abc'); +} "(\u00E3bc)def" +do_execsql_test 2.4 { + SELECT highlight(t2, 0, '(', ')') FROM t2('bac'); +} "(b\u00E3c)def" +do_execsql_test 2.5 { + SELECT highlight(t2, 0, '(', ')') FROM t2('bca'); +} "(bc\u00E3)def" +do_execsql_test 2.6 " + SELECT highlight(t2, 0, '(', ')') FROM t2('\u00E3bc'); +" "(\u00E3bc)def" + +#------------------------------------------------------------------------- +do_execsql_test 3.0 { + CREATE VIRTUAL TABLE t3 USING fts5( + z, tokenize='trigram remove_diacritics 1' + ); +} {} +do_execsql_test 3.1 " + INSERT INTO t3 VALUES ('\u0303abc\u0303'); +" +do_execsql_test 3.2 { + SELECT highlight(t3, 0, '(', ')') FROM t3('abc'); +} "\u0303(abc\u0303)" + +#------------------------------------------------------------------------- +do_execsql_test 4.0 { + CREATE VIRTUAL TABLE t4 USING fts5(z, tokenize=trigram); +} {} + +breakpoint +do_execsql_test 4.1 { + INSERT INTO t4 VALUES('ABCD'); +} {} + +finish_test diff --git a/manifest b/manifest index df7a5eb535..ad9b0ea28f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C One\smore\stweak\sto\stool/srctree-check.tcl\sso\sthat\sa\scomplete\sbuild\scan\sbe\naccomplished\sfrom\sa\sread-only\ssource\stree. -D 2023-11-02T13:10:16.285 +C Add\sthe\s"remove_diacritics"\soption\sto\sthe\sfts5\strigram\stokenizer. +D 2023-11-02T17:31:06.153 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -100,7 +100,7 @@ F ext/fts5/fts5_storage.c 5d10b9bdcce5b90656cad13c7d12ad4148677d4b9e3fca0481fca5 F ext/fts5/fts5_tcl.c b1445cbe69908c411df8084a10b2485500ac70a9c747cdc8cda175a3da59d8ae F ext/fts5/fts5_test_mi.c 08c11ec968148d4cb4119d96d819f8c1f329812c568bac3684f5464be177d3ee F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a9aa85d36f3b -F ext/fts5/fts5_tokenize.c 5e251efb0f1af99a25ed50010ba6b1ad1250aca5921af1988fdcabe5ebc3cb43 +F ext/fts5/fts5_tokenize.c 5a895f3bf366a87cb8c0812445736248c236e7ea664a10125021662acd6b0ba4 F ext/fts5/fts5_unicode2.c eca63dbc797f8ff0572e97caf4631389c0ab900d6364861b915bdd4735973f00 F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80 F ext/fts5/fts5_vocab.c aed56169ae5c1aa9b8189c779ffeef04ed516d3c712c06914e6d91a6759f4e4a @@ -217,6 +217,7 @@ F ext/fts5/test/fts5tok1.test 1f7817499f5971450d8c4a652114b3d833393c8134e32422d0 F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2 F ext/fts5/test/fts5tokenizer.test ac3c9112b263a639fb0508ae73a3ee886bf4866d2153771a8e8a20c721305a43 F ext/fts5/test/fts5trigram.test 6c4e37864f3e7d90673db5563d9736d7e40080ab94d10ebdffa94c1b77941da0 +F ext/fts5/test/fts5trigram2.test 9fe4207f8a4241747aff1005258b564958588d21bfd240d6cd4c2e955d31c156 F ext/fts5/test/fts5ubsan.test 783d5a8d13ebfa169e634940228db54540780e3ba7a87ad1e4510e61440bf64b F ext/fts5/test/fts5umlaut.test a42fe2fe6387c40c49ab27ccbd070e1ae38e07f38d05926482cc0bccac9ad602 F ext/fts5/test/fts5unicode.test 17056f4efe6b0a5d4f41fdf7a7dc9af2873004562eaa899d40633b93dc95f5a9 @@ -2139,8 +2140,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 58eb5440d75fb13c1a089cb935de6fb94b4322e10e349db8f11f37b9a2fda2fc -R 18054cea9bc23d801f864db646273e7d -U drh -Z 72328c40506425c913ea7fab75e23b19 +P cba9f0601ca995ac6952aa3a83f7264f6d25aaaa2ea36b19e90cbf591077de72 +R 91c6db43050bc1c48384df29a062813f +U dan +Z e9e46724e46ba97d1a7a1bb71106fcd0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7142949e45..c9ea7d6610 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cba9f0601ca995ac6952aa3a83f7264f6d25aaaa2ea36b19e90cbf591077de72 \ No newline at end of file +83da80135b6105f47d1de560232449562ae8ac176c8011a6f75589f62bc9b1db \ No newline at end of file From 7b0fd0c5644f77a44dc915611aa1213cb4c8c99a Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 2 Nov 2023 18:10:22 +0000 Subject: [PATCH 218/242] Fix a problem with amalgamation builds on this branch. FossilOrigin-Name: 8f046c82c9cf51fc349674577c68d3d2499ee37009deacbf937d711d9930fd49 --- ext/fts5/fts5_tokenize.c | 9 +++++---- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ext/fts5/fts5_tokenize.c b/ext/fts5/fts5_tokenize.c index 098d0c86b7..f12056170f 100644 --- a/ext/fts5/fts5_tokenize.c +++ b/ext/fts5/fts5_tokenize.c @@ -227,14 +227,14 @@ static const unsigned char sqlite3Utf8Trans1[] = { } \ } -#define SKIP_UTF8(zIn) { \ +#endif /* ifndef SQLITE_AMALGAMATION */ + +#define FTS5_SKIP_UTF8(zIn) { \ if( ((unsigned char)(*(zIn++)))>=0xc0 ){ \ while( (((unsigned char)*zIn) & 0xc0)==0x80 ){ zIn++; } \ } \ } -#endif /* ifndef SQLITE_AMALGAMATION */ - typedef struct Unicode61Tokenizer Unicode61Tokenizer; struct Unicode61Tokenizer { unsigned char aTokenChar[128]; /* ASCII range token characters */ @@ -1297,6 +1297,7 @@ static int fts5TriCreate( }else{ int i; pNew->bFold = 1; + pNew->iFoldParam = 0; for(i=0; rc==SQLITE_OK && i Date: Thu, 2 Nov 2023 21:02:53 +0000 Subject: [PATCH 219/242] Fix a spurious "misuse of aggregate function" error that could occur when an aggregate function was used within the FROM clause of a sub-select of the select that owns the aggregate. e.g. "SELECT (SELECT x FROM (SELECT sum(t1.a) AS x)) FROM t1". [forum:/forumpost/c9970a37ed | Forum post c9970a37ed]. FossilOrigin-Name: 4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11 --- manifest | 19 ++++++++-------- manifest.uuid | 2 +- src/resolve.c | 5 ++++- src/sqliteInt.h | 1 + test/aggnested.test | 54 +++++++++++++++++++++++++++++++++++++++++++++ test/window1.test | 2 +- 6 files changed, 70 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 362a98e526..d29835ad88 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"remove_diacritics"\soption\sto\sthe\sfts5\strigram\stokenizer. -D 2023-11-02T18:22:35.452 +C Fix\sa\sspurious\s"misuse\sof\saggregate\sfunction"\serror\sthat\scould\soccur\swhen\san\saggregate\sfunction\swas\sused\swithin\sthe\sFROM\sclause\sof\sa\ssub-select\sof\sthe\sselect\sthat\sowns\sthe\saggregate.\se.g.\s"SELECT\s(SELECT\sx\sFROM\s(SELECT\ssum(t1.a)\sAS\sx))\sFROM\st1".\s[forum:/forumpost/c9970a37ed\s|\sForum\spost\sc9970a37ed]. +D 2023-11-02T21:02:53.455 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,14 +721,14 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c 31229276a8eb5b5de1428cd2d80f6f1cf8ffc5248be25e47cf575df12f1b8f23 +F src/resolve.c c74f10e6adf35e2b60e63cba7306a07f976cf119fc29a57845a1ddf3c35ddc68 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h 567e317f8631883897b7d3da43fce778b7c30dd0dd7f714558c9725fc1c1196c +F src/sqliteInt.h f0185af5bbc434fd047c01e8ddd81c9b093fd304b5abb08547301fca70788b8b F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -818,7 +818,7 @@ F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867d F test/affinity3.test f094773025eddf31135c7ad4cde722b7696f8eb07b97511f98585addf2a510a9 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggfault.test 777f269d0da5b0c2524c7ff6d99ae9a93db4f1b1839a914dd2a12e3035c29829 -F test/aggnested.test 2e738bfe2980df301a782f6e7bbf9459266f64f7e72f58f3b5c843bf897c568c +F test/aggnested.test 7929208e173f5dbdbe8f67afbc59c07db99199d39ba5ce2d8a16be2c63600f53 F test/aggorderby.test e6b98dbbf3ababa96892435d387de2dcf602ef02c2b848d2d817473066f154ba F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 @@ -1984,7 +1984,7 @@ F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2 F test/win32lock.test e0924eb8daac02bf80e9da88930747bd44dd9b230b7759fed927b1655b467c9c F test/win32longpath.test 4baffc3acb2e5188a5e3a895b2b543ed09e62f7c72d713c1feebf76222fe9976 F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc -F test/window1.test ccfeaf116afc6a8f748a8122a4f1ee6b69e6bbc5acee61197d3c17167338b100 +F test/window1.test 5e8abe56a7d667eeddbba6de180086dcf69ed528d046447a25464f945ece101f F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476 F test/window2.test e466a88bd626d66edc3d352d7d7e1d5531e0079b549ba44efb029d1fbff9fd3c F test/window3.tcl acea6e86a4324a210fd608d06741010ca83ded9fde438341cb978c49928faf03 @@ -2141,9 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e8c97faec339430fa2d1a7e915050d9b363bdba606a4419397cb099141da254d 8f046c82c9cf51fc349674577c68d3d2499ee37009deacbf937d711d9930fd49 -R e431cbffcb397fe64b4dba15715dbe90 -T +closed 8f046c82c9cf51fc349674577c68d3d2499ee37009deacbf937d711d9930fd49 +P 0d50172477064dce3f7c61641d88aa15d8a1edea9872adaffcc1a7a1c9ab0e93 +R b1c591059f07d73b87055d331d542a79 U dan -Z a985144f5adb4bfbc320c60d16272d9c +Z b418469e6326d7ed346db9d2f8a70c19 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f8430c08fd..652d910b8f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0d50172477064dce3f7c61641d88aa15d8a1edea9872adaffcc1a7a1c9ab0e93 \ No newline at end of file +4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11 \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index 0072f6b6aa..a0134fd57c 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1249,11 +1249,12 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ while( pNC2 && sqlite3ReferencesSrcList(pParse, pExpr, pNC2->pSrcList)==0 ){ - pExpr->op2++; + pExpr->op2 += (1 + pNC2->nNestedSelect); pNC2 = pNC2->pNext; } assert( pDef!=0 || IN_RENAME_OBJECT ); if( pNC2 && pDef ){ + pExpr->op2 += pNC2->nNestedSelect; assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg ); assert( SQLITE_FUNC_ANYORDER==NC_OrderAgg ); testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 ); @@ -1812,6 +1813,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ /* Recursively resolve names in all subqueries in the FROM clause */ + if( pOuterNC ) pOuterNC->nNestedSelect++; for(i=0; ipSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ @@ -1836,6 +1838,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } } + if( pOuterNC ) pOuterNC->nNestedSelect--; /* Set up the local name-context to pass to sqlite3ResolveExprNames() to ** resolve the result-set expression list. diff --git a/src/sqliteInt.h b/src/sqliteInt.h index dbf01dd139..c8288736b3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3397,6 +3397,7 @@ struct NameContext { int nRef; /* Number of names resolved by this context */ int nNcErr; /* Number of errors encountered while resolving names */ int ncFlags; /* Zero or more NC_* flags defined below */ + int nNestedSelect; /* Number of nested selects using this NC */ Select *pWinSelect; /* SELECT statement for any window functions */ }; diff --git a/test/aggnested.test b/test/aggnested.test index 5f033a246c..933df06ce0 100644 --- a/test/aggnested.test +++ b/test/aggnested.test @@ -358,6 +358,60 @@ do_execsql_test 6.2.2 { FROM t2 GROUP BY 'constant_string'; } {{}} +#------------------------------------------------------------------------- +reset_db + +do_execsql_test 7.0 { + CREATE TABLE invoice ( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + amount DOUBLE PRECISION DEFAULT NULL, + name VARCHAR(100) DEFAULT NULL + ); + + INSERT INTO invoice (amount, name) VALUES + (4.0, 'Michael'), (15.0, 'Bara'), (4.0, 'Michael'), (6.0, 'John'); +} + +do_execsql_test 7.1 { + SELECT sum(amount), name + from invoice + group by name + having (select v > 6 from (select sum(amount) v) t) +} { + 15.0 Bara + 8.0 Michael +} + +do_execsql_test 7.2 { + SELECT (select 1 from (select sum(amount))) FROM invoice +} {1} + +do_execsql_test 8.0 { + CREATE TABLE t1(x INT); + INSERT INTO t1 VALUES(100); + INSERT INTO t1 VALUES(20); + INSERT INTO t1 VALUES(3); + SELECT (SELECT y FROM (SELECT sum(x) AS y) AS t2 ) FROM t1; +} {123} + +do_execsql_test 8.1 { + SELECT ( + SELECT y FROM ( + SELECT z AS y FROM (SELECT sum(x) AS z) AS t2 + ) + ) FROM t1; +} {123} + +do_execsql_test 8.2 { + SELECT ( + SELECT a FROM ( + SELECT y AS a FROM ( + SELECT z AS y FROM (SELECT sum(x) AS z) AS t2 + ) + ) + ) FROM t1; +} {123} + diff --git a/test/window1.test b/test/window1.test index c9bbae3ee0..d8348a8980 100644 --- a/test/window1.test +++ b/test/window1.test @@ -1881,7 +1881,7 @@ do_catchsql_test 57.3 { SELECT max(y) OVER( ORDER BY (SELECT x FROM (SELECT sum(y) AS x FROM t1))) ) FROM t3; -} {1 {misuse of aggregate: sum()}} +} {0 5} # 2020-06-06 ticket 1f6f353b684fc708 reset_db From 792103a0f2f805d5682ae443d50d6f731a9e3bfc Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 2 Nov 2023 22:11:35 +0000 Subject: [PATCH 220/242] In the previous check-in, use a u32 instead of an int, to make it easier to prove that the integer will never overflow. FossilOrigin-Name: 51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/resolve.c | 4 +++- src/sqliteInt.h | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index d29835ad88..b820b0b5e0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sspurious\s"misuse\sof\saggregate\sfunction"\serror\sthat\scould\soccur\swhen\san\saggregate\sfunction\swas\sused\swithin\sthe\sFROM\sclause\sof\sa\ssub-select\sof\sthe\sselect\sthat\sowns\sthe\saggregate.\se.g.\s"SELECT\s(SELECT\sx\sFROM\s(SELECT\ssum(t1.a)\sAS\sx))\sFROM\st1".\s[forum:/forumpost/c9970a37ed\s|\sForum\spost\sc9970a37ed]. -D 2023-11-02T21:02:53.455 +C In\sthe\sprevious\scheck-in,\suse\sa\su32\sinstead\sof\san\sint,\sto\smake\sit\seasier\sto\nprove\sthat\sthe\sinteger\swill\snever\soverflow. +D 2023-11-02T22:11:35.443 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -721,14 +721,14 @@ F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7 F src/prepare.c bde74add20fc0e8ce0c4e937a1f70a36d17413afe4f71d3e103f5cb74b17c8d9 F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c -F src/resolve.c c74f10e6adf35e2b60e63cba7306a07f976cf119fc29a57845a1ddf3c35ddc68 +F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h f0185af5bbc434fd047c01e8ddd81c9b093fd304b5abb08547301fca70788b8b +F src/sqliteInt.h 707095a0591e02f4866ed9798cbdd97a8ae8cf4d98f061808944c2cd1c95d1a9 F src/sqliteLimit.h 33b1c9baba578d34efe7dfdb43193b366111cdf41476b1e82699e14c11ee1fb6 F src/status.c 160c445d7d28c984a0eae38c144f6419311ed3eace59b44ac6dafc20db4af749 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0d50172477064dce3f7c61641d88aa15d8a1edea9872adaffcc1a7a1c9ab0e93 -R b1c591059f07d73b87055d331d542a79 -U dan -Z b418469e6326d7ed346db9d2f8a70c19 +P 4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11 +R 79c60d9c26c18e4bd3eb97f7d6131505 +U drh +Z b5e2ca2c6ff3e7234971fa445deb54ad # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 652d910b8f..1eec801737 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11 \ No newline at end of file +51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87 \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index a0134fd57c..5f675c1d2d 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1838,7 +1838,9 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } } - if( pOuterNC ) pOuterNC->nNestedSelect--; + if( pOuterNC && ALWAYS(pOuterNC->nNestedSelect>0) ){ + pOuterNC->nNestedSelect--; + } /* Set up the local name-context to pass to sqlite3ResolveExprNames() to ** resolve the result-set expression list. diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c8288736b3..23beb48de3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3397,7 +3397,7 @@ struct NameContext { int nRef; /* Number of names resolved by this context */ int nNcErr; /* Number of errors encountered while resolving names */ int ncFlags; /* Zero or more NC_* flags defined below */ - int nNestedSelect; /* Number of nested selects using this NC */ + u32 nNestedSelect; /* Number of nested selects using this NC */ Select *pWinSelect; /* SELECT statement for any window functions */ }; From dcd6d21fe90ba7cf11649211719000894dd86925 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 2 Nov 2023 22:39:11 +0000 Subject: [PATCH 221/242] Mark a branch made always-true by the penultimate check-in with ALWAYS(). FossilOrigin-Name: 268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b820b0b5e0..a19fbf6d2d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sprevious\scheck-in,\suse\sa\su32\sinstead\sof\san\sint,\sto\smake\sit\seasier\sto\nprove\sthat\sthe\sinteger\swill\snever\soverflow. -D 2023-11-02T22:11:35.443 +C Mark\sa\sbranch\smade\salways-true\sby\sthe\spenultimate\scheck-in\swith\sALWAYS(). +D 2023-11-02T22:39:11.206 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -723,7 +723,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 +F src/select.c 8ebbc67478e2d43f0b24c79258597646e526c5001d07801bba7d4059088c8b12 F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11 -R 79c60d9c26c18e4bd3eb97f7d6131505 +P 51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87 +R 9d50cc29331e7855a28167bfb1447137 U drh -Z b5e2ca2c6ff3e7234971fa445deb54ad +Z 2c58aac6deeb8398d0c95f4c1cc7c832 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1eec801737..d1709e346a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87 \ No newline at end of file +268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f \ No newline at end of file diff --git a/src/select.c b/src/select.c index 7a79385e0b..e97a5afb74 100644 --- a/src/select.c +++ b/src/select.c @@ -8472,7 +8472,7 @@ int sqlite3Select( updateAccumulator(pParse, regAcc, pAggInfo, eDist); if( eDist!=WHERE_DISTINCT_NOOP ){ struct AggInfo_func *pF = pAggInfo->aFunc; - if( pF ){ + if( ALWAYS(pF) ){ fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr); } } From d706adba48766b93197e5dea7ba64c0ce7776e3d Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 3 Nov 2023 10:15:16 +0000 Subject: [PATCH 222/242] Update the version number to 3.45.0 to begin the next development cycle. FossilOrigin-Name: 15b618e92a2708cc83256947736de8c494a9985a77e38bd5efc7e51e72cba344 --- VERSION | 2 +- autoconf/tea/configure.ac | 2 +- configure | 18 +++++++++--------- configure.ac | 2 +- manifest | 18 +++++++++--------- manifest.uuid | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/VERSION b/VERSION index faf0dcbb0e..ff3ff28f6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.44.0 +3.45.0 diff --git a/autoconf/tea/configure.ac b/autoconf/tea/configure.ac index e34bda9f2e..4df57344be 100644 --- a/autoconf/tea/configure.ac +++ b/autoconf/tea/configure.ac @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([sqlite],[3.44.0]) +AC_INIT([sqlite],[3.45.0]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/configure b/configure index 7b31f6f7e8..6a47c4dcc8 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.44.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.45.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -726,8 +726,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.44.0' -PACKAGE_STRING='sqlite 3.44.0' +PACKAGE_VERSION='3.45.0' +PACKAGE_STRING='sqlite 3.45.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1472,7 +1472,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.44.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.45.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.44.0:";; + short | recursive ) echo "Configuration of sqlite 3.45.0:";; esac cat <<\_ACEOF @@ -1668,7 +1668,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.44.0 +sqlite configure 3.45.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2087,7 +2087,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.44.0, which was +It was created by sqlite $as_me 3.45.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -12481,7 +12481,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.44.0, which was +This file was extended by sqlite $as_me 3.45.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12547,7 +12547,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.44.0 +sqlite config.status 3.45.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 837d2fb015..54f985fd70 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ # you don't need (for example BLT) by erasing or commenting out # the corresponding code. # -AC_INIT([sqlite],[m4_esyscmd(cat VERSION | tr -d '\n')]) +AC_INIT([sqlite],m4_esyscmd(cat VERSION | tr -d '\n')) dnl Make sure the local VERSION file matches this configure script sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'` diff --git a/manifest b/manifest index a19fbf6d2d..030821495e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Mark\sa\sbranch\smade\salways-true\sby\sthe\spenultimate\scheck-in\swith\sALWAYS(). -D 2023-11-02T22:39:11.206 +C Update\sthe\sversion\snumber\sto\s3.45.0\sto\sbegin\sthe\snext\sdevelopment\scycle. +D 2023-11-03T10:15:16.434 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -7,7 +7,7 @@ F Makefile.in 8b59912fc1538f96a08555605c5886cdcc733696ae7f22e374b2a4752196ca20 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc f0cf219350d9af4fba411b4f6306dce2adc897484e8f446de1fb4f40de674d00 F README.md 963d30019abf0cc06b263cd2824bce022893f3f93a531758f6f04ff2194a16a8 -F VERSION 4c09b629c03b8ae32317cb336a32f3aa3252841d6dcd51184cecc4278d08f21e +F VERSION 73573d4545343f001bf5dc5461173a7c78c203dd046cabcf99153878cf25d3a6 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 @@ -22,7 +22,7 @@ F autoconf/configure.ac ec7fa914c5e74ff212fe879f9bb6918e1234497e05facfb641f30c4d F autoconf/tea/Makefile.in 106a96f2f745d41a0f6193f1de98d7355830b65d45032c18cd7c90295ec24196 F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 -F autoconf/tea/configure.ac 1ee185f2f8c2e9bed69d0113222724202f962d04eafd57197e65c662d2d9b180 +F autoconf/tea/configure.ac 4c32b08691a5b296206b38422b53b92b65be3d3f6b3dd6552a50981a61f5acda F autoconf/tea/doc/sqlite3.n e1fe45d4f5286ee3d0ccc877aca2a0def488e9bb F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523 F autoconf/tea/pkgIndex.tcl.in b9eb6dd37f64e08e637d576b3c83259814b9cddd78bec4af2e5abfc6c5c750ce @@ -33,8 +33,8 @@ F autoconf/tea/win/nmakehlp.c b01f822eabbe1ed2b64e70882d97d48402b42d2689a1ea0034 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 883205ddf25b46f10c181818bf42c09da9888884af96f79e1719264345053bd6 F config.sub c2d0260f17f3e4bc0b6808fccf1b291cb5e9126c14fc5890efc77b9fd0175559 -F configure 1d9cbcb416cb5387b3f750ae6db63cfedb703a2e46bf8ca61daecff31d208252 x -F configure.ac de31fea7d975bb7ebafbe0e2190a855cc80d48558bf0c9a6578a1836daf1cd3a +F configure bcb1042e92775424a1021d2f4c89c78a699a6225df01fa8c593df7df0be6ad10 x +F configure.ac f25bd7843120f2c2b8bc9db5a92b0502bbdd28e68907415c3d42fc8e57c657b9 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/compile-for-windows.md 50b27d77be96195c66031a3181cb8684ed822327ea834e07f9c014213e5e3bcf @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87 -R 9d50cc29331e7855a28167bfb1447137 +P 268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f +R dd1ef45ff2a5ccfd075e4867f283d51c U drh -Z 2c58aac6deeb8398d0c95f4c1cc7c832 +Z b80b47952b8aa2091fd6d596beedfe43 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d1709e346a..c98a1f3b06 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f \ No newline at end of file +15b618e92a2708cc83256947736de8c494a9985a77e38bd5efc7e51e72cba344 \ No newline at end of file From 1d5f2af063863713a874be9e885006fa9e76b278 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 3 Nov 2023 11:41:24 +0000 Subject: [PATCH 223/242] Update the tool/srctree-check.tcl script so that it verifies that autoconf has been run following edits to VERSION. FossilOrigin-Name: 52ab3deba4d26ca0e9a84a6dff254195b4a0e2cc6cf948cf7a66bb11117e7002 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/srctree-check.tcl | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 030821495e..8d752c5796 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sversion\snumber\sto\s3.45.0\sto\sbegin\sthe\snext\sdevelopment\scycle. -D 2023-11-03T10:15:16.434 +C Update\sthe\stool/srctree-check.tcl\sscript\sso\sthat\sit\sverifies\sthat\sautoconf\nhas\sbeen\srun\sfollowing\sedits\sto\sVERSION. +D 2023-11-03T11:41:24.817 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2108,7 +2108,7 @@ F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaa F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 41c586dee84d0b190ad13e0282ed83d4a65ec9fefde9adf4943efdf6558eea7f F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f -F tool/srctree-check.tcl 9f1098d439159692ece45cc9e701b35df4956269399fe0c770e41f235d1ce5e6 +F tool/srctree-check.tcl c15f860a3c97d5f7b4c14b60392d9466af29dd006c4ef18127f502641e2977a8 F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f -R dd1ef45ff2a5ccfd075e4867f283d51c +P 15b618e92a2708cc83256947736de8c494a9985a77e38bd5efc7e51e72cba344 +R 341d9b485cad2a5cb5b07c2f4f98a2ae U drh -Z b80b47952b8aa2091fd6d596beedfe43 +Z 90bfecd59f7685a9235e07a588127673 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c98a1f3b06..877f63d98b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -15b618e92a2708cc83256947736de8c494a9985a77e38bd5efc7e51e72cba344 \ No newline at end of file +52ab3deba4d26ca0e9a84a6dff254195b4a0e2cc6cf948cf7a66bb11117e7002 \ No newline at end of file diff --git a/tool/srctree-check.tcl b/tool/srctree-check.tcl index f44e3ceec5..51226cda46 100644 --- a/tool/srctree-check.tcl +++ b/tool/srctree-check.tcl @@ -36,6 +36,17 @@ set TCLSH [info nameofexe] # set NERR 0 +######################### configure ########################################### + +set conf [readfile $ROOT/configure] +set vers [readfile $ROOT/VERSION] +if {[string first $vers $conf]<=0} { + puts "ERROR: ./configure does not agree with ./VERSION" + puts "...... Fix: run autoconf" + incr NERR +} +unset conf + ######################### autoconf/tea/configure.ac ########################### set confac [readfile $ROOT/autoconf/tea/configure.ac] @@ -45,9 +56,11 @@ append pattern [string trim $vers] append pattern {])} if {[string first $pattern $confac]<=0} { puts "ERROR: ./autoconf/tea/configure.ac does not agree with ./VERSION" - puts "...... Fix: manually edit ./autoconf/tea/configure.ac to" + puts "...... Fix: manually edit ./autoconf/tea/configure.ac and put the" + puts "...... correct version number in AC_INIT()" incr NERR } +unset confac ######################### autoconf/Makefile.msc ############################### From 073f8f54581a6303c2c6ef140fe76557a805a240 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 3 Nov 2023 11:53:13 +0000 Subject: [PATCH 224/242] Bind the sqlite3_keyword_...() and sqlite3_compileoption_...() family of functions to the JNI wrapper1 API. FossilOrigin-Name: b27242414d6023eac7e62cf6120e1f02b0ddc7b8f0a1e4c48111cfe88d197cbd --- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 41 +++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 12 +++++- manifest | 16 ++++---- manifest.uuid | 2 +- 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index b464bd7d5c..6bb87cc392 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -137,6 +137,47 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_threadsafe(); } + /** + Analog to sqlite3_compileoption_get(). + */ + public static String compileOptionGet(int n){ + return CApi.sqlite3_compileoption_get(n); + } + + /** + Analog to sqlite3_compileoption_used(). + */ + public static boolean compileOptionUsed(String optName){ + return CApi.sqlite3_compileoption_used(optName); + } + + /** + Analog to sqlite3_complete(). + */ + public static boolean isCompleteStatement(String sql){ + switch(CApi.sqlite3_complete(sql)){ + case 0: return false; + case CApi.SQLITE_MISUSE: + throw new IllegalArgumentException("Input may not be null."); + case CApi.SQLITE_NOMEM: + throw new OutOfMemoryError(); + default: + return true; + } + } + + public static int keywordCount(){ + return CApi.sqlite3_keyword_count(); + } + + public static boolean keywordCheck(String word){ + return CApi.sqlite3_keyword_check(word); + } + + public static String keywordName(int index){ + return CApi.sqlite3_keyword_name(index); + } + public static boolean strglob(String glob, String txt){ return 0==CApi.sqlite3_strglob(glob, txt); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index ca4e6d0521..e6de9ab018 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -412,6 +412,16 @@ public class Tester2 implements Runnable { db.close(); } + private void testKeyword(){ + final int n = Sqlite.keywordCount(); + affirm( n>0 ); + affirm( !Sqlite.keywordCheck("_nope_") ); + affirm( Sqlite.keywordCheck("seLect") ); + affirm( null!=Sqlite.keywordName(0) ); + affirm( null!=Sqlite.keywordName(n-1) ); + affirm( null==Sqlite.keywordName(n) ); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); @@ -529,7 +539,7 @@ public class Tester2 implements Runnable { } if( sqlLog ){ - if( CApi.sqlite3_compileoption_used("ENABLE_SQLLOG") ){ + if( Sqlite.compileOptionUsed("ENABLE_SQLLOG") ){ final ConfigSqllogCallback log = new ConfigSqllogCallback() { @Override public void call(sqlite3 db, String msg, int op){ switch(op){ diff --git a/manifest b/manifest index 8d752c5796..a27a5977bc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\stool/srctree-check.tcl\sscript\sso\sthat\sit\sverifies\sthat\sautoconf\nhas\sbeen\srun\sfollowing\sedits\sto\sVERSION. -D 2023-11-03T11:41:24.817 +C Bind\sthe\ssqlite3_keyword_...()\sand\ssqlite3_compileoption_...()\sfamily\sof\sfunctions\sto\sthe\sJNI\swrapper1\sAPI. +D 2023-11-03T11:53:13.823 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -295,9 +295,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 9be20f3ba6edbe63285224d5d640dbfb0d84fb8cf5134084e3ae40004ec9d6d9 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java fae71b7454fa3d9243ad26c80e55b590c044a0f0a23d18cae21f0cfa3a92a969 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 698fd699dd113fa2bceb78d3565f3d4578dee86150fb86e1838ec915994aa57b F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 13008f8d3c34c1dd55c3afe6dd18dcf94316874cde893ab0661a973fc51a87a4 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java f74b9000cc24d415cfdd9fd77234aa6ab0549871f495529993cee6176cad0329 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 15b618e92a2708cc83256947736de8c494a9985a77e38bd5efc7e51e72cba344 -R 341d9b485cad2a5cb5b07c2f4f98a2ae -U drh -Z 90bfecd59f7685a9235e07a588127673 +P 52ab3deba4d26ca0e9a84a6dff254195b4a0e2cc6cf948cf7a66bb11117e7002 +R 713111c1d3b2b5aa68a4fe22b929906b +U stephan +Z 5f0fb960919ed3f05e59594d37935544 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 877f63d98b..0a15fa2c89 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -52ab3deba4d26ca0e9a84a6dff254195b4a0e2cc6cf948cf7a66bb11117e7002 \ No newline at end of file +b27242414d6023eac7e62cf6120e1f02b0ddc7b8f0a1e4c48111cfe88d197cbd \ No newline at end of file From b94518319572c478982c0ebc5a39dbe3e7cadca7 Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 3 Nov 2023 13:00:51 +0000 Subject: [PATCH 225/242] Wrap more of the stmt API behind the JNI wrapper1 API. FossilOrigin-Name: 8fea23dc3af023ccf2909f1b4c6f91e7df0ffaac875b15f1fb3e264fba169b6a --- .../org/sqlite/jni/capi/CallbackProxy.java | 5 +- .../src/org/sqlite/jni/capi/ValueHolder.java | 5 +- .../org/sqlite/jni/wrapper1/SqlFunction.java | 15 ++++ .../src/org/sqlite/jni/wrapper1/Sqlite.java | 69 +++++++++++++++++-- .../src/org/sqlite/jni/wrapper1/Tester2.java | 22 ++++++ manifest | 20 +++--- manifest.uuid | 2 +- 7 files changed, 117 insertions(+), 21 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java index 0495702561..7df748e8d8 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java +++ b/ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java @@ -24,8 +24,9 @@ package org.sqlite.jni.capi; propagated. For callback interfaces which support returning error info to the core, the JNI binding will convert any exceptions to C-level error information. For callback interfaces which do not - support, all exceptions will necessarily be suppressed in order to - retain the C-style no-throw semantics. + support returning error information, all exceptions will + necessarily be suppressed in order to retain the C-style no-throw + semantics and avoid invoking undefined behavior in the C layer.

    Callbacks of this style follow a common naming convention: diff --git a/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java b/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java index b3f03ac867..6d5db3f669 100644 --- a/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java +++ b/ext/jni/src/org/sqlite/jni/capi/ValueHolder.java @@ -9,14 +9,15 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains a set of tests for the sqlite3 JNI bindings. +** This file holds utility code for the sqlite3 JNI bindings. */ package org.sqlite.jni.capi; /** A helper class which simply holds a single value. Its primary use is for communicating values out of anonymous classes, as doing so - requires a "final" reference. + requires a "final" reference, as well as communicating aggregate + SQL function state across calls to such functions. */ public class ValueHolder { public T value; diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 2d0ebfaf32..5bcb3bd5fa 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -121,6 +121,17 @@ public interface SqlFunction { public void resultText16(byte[] utf16){CApi.sqlite3_result_text16(cx, utf16);} public void resultText16(String txt){CApi.sqlite3_result_text16(cx, txt);} + /** + Callbacks should invoke this on OOM errors, instead of throwing + OutOfMemoryError, because the latter cannot be propagated + through the C API. + */ + public void resultNoMem(){CApi.sqlite3_result_error_nomem(cx);} + + /** + Analog to sqlite3_set_auxdata() but throws if argNdx is out of + range. + */ public void setAuxData(int argNdx, Object o){ /* From the API docs: https://www.sqlite.org/c3ref/get_auxdata.html @@ -132,6 +143,10 @@ public interface SqlFunction { CApi.sqlite3_set_auxdata(cx, argNdx, o); } + /** + Analog to sqlite3_get_auxdata() but throws if argNdx is out of + range. + */ public Object getAuxData(int argNdx){ valueAt(argNdx); return CApi.sqlite3_get_auxdata(cx, argNdx); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 6bb87cc392..907755d99a 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -210,11 +210,19 @@ public final class Sqlite implements AutoCloseable { extracted from it, else only the string form of rc is used. It is the caller's responsibility to filter out non-error codes such as SQLITE_ROW and SQLITE_DONE before calling this. + + As a special case, if rc is SQLITE_NOMEM, an OutOfMemoryError is + thrown. */ private void checkRc(int rc){ if( 0!=rc ){ - if( null==db || 0==sqlite3_errcode(db)) throw new SqliteException(rc); - else throw new SqliteException(db); + if( CApi.SQLITE_NOMEM==rc ){ + throw new OutOfMemoryError(); + }else if( null==db || 0==sqlite3_errcode(db)){ + throw new SqliteException(rc); + }else{ + throw new SqliteException(db); + } } } @@ -470,8 +478,11 @@ public final class Sqlite implements AutoCloseable { We save the result column count in order to prevent having to call into C to fetch that value every time we need to check that value for the columnXyz() methods. + + Design note: if this is final then we cannot zero it in + finalizeStmt(). */ - private final int resultColCount; + private int resultColCount; /** Only called by the prepare() factory functions. */ Stmt(Sqlite db, sqlite3_stmt stmt){ @@ -509,13 +520,17 @@ public final class Sqlite implements AutoCloseable { name finalize() here because this one requires a different signature. It does not throw on error here because "destructors do not throw." If it returns non-0, the object is still - finalized. + finalized, but the result code is an indication that something + went wrong in a prior call into the statement's API, as + documented for sqlite3_finalize(). */ public int finalizeStmt(){ int rc = 0; if( null!=stmt ){ sqlite3_finalize(stmt); stmt = null; + _db = null; + resultColCount = 0; } return rc; } @@ -565,6 +580,10 @@ public final class Sqlite implements AutoCloseable { */ } + /** + Returns the Sqlite which prepared this statement, or null if + this statement has been finalized. + */ public Sqlite db(){ return this._db; } /** @@ -574,6 +593,44 @@ public final class Sqlite implements AutoCloseable { checkRc(CApi.sqlite3_reset(thisStmt())); } + public boolean isBusy(){ + return CApi.sqlite3_stmt_busy(thisStmt()); + } + + public boolean isReadOnly(){ + return CApi.sqlite3_stmt_readonly(thisStmt()); + } + + public String sql(){ + return CApi.sqlite3_sql(thisStmt()); + } + + public String expandedSql(){ + return CApi.sqlite3_expanded_sql(thisStmt()); + } + + /** + Analog to sqlite3_stmt_explain() but throws if op is invalid. + */ + public void explain(int op){ + checkRc(CApi.sqlite3_stmt_explain(thisStmt(), op)); + } + + /** + Analog to sqlite3_stmt_isexplain(). + */ + public int isExplain(){ + return CApi.sqlite3_stmt_isexplain(thisStmt()); + } + + /** + Analog to sqlite3_normalized_sql(), returning null if the + library is built without the SQLITE_ENABLE_NORMALIZE flag. + */ + public String normalizedSql(){ + return CApi.sqlite3_normalized_sql(thisStmt()); + } + public void clearBindings(){ CApi.sqlite3_clear_bindings( thisStmt() ); } @@ -610,8 +667,8 @@ public final class Sqlite implements AutoCloseable { public void bindText16(int ndx, byte[] utf16){ checkRc(CApi.sqlite3_bind_text16(thisStmt(), ndx, utf16)); } - public void bindText16(int ndx, String txt){ - checkRc(CApi.sqlite3_bind_text16(thisStmt(), ndx, txt)); + public void bindText16(int ndx, String asUtf16){ + checkRc(CApi.sqlite3_bind_text16(thisStmt(), ndx, asUtf16)); } public void bindZeroBlob(int ndx, int n){ checkRc(CApi.sqlite3_bind_zeroblob(thisStmt(), ndx, n)); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index e6de9ab018..d24551ebf1 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -422,6 +422,28 @@ public class Tester2 implements Runnable { affirm( null==Sqlite.keywordName(n) ); } + + private void testExplain(){ + final Sqlite db = openDb(); + Sqlite.Stmt q = db.prepare("SELECT 1"); + affirm( 0 == q.isExplain() ); + q.explain(0); + affirm( 0 == q.isExplain() ); + q.explain(1); + affirm( 1 == q.isExplain() ); + q.explain(2); + affirm( 2 == q.isExplain() ); + Exception ex = null; + try{ + q.explain(-1); + }catch(Exception e){ + ex = e; + } + affirm( ex instanceof SqliteException ); + q.finalizeStmt(); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index a27a5977bc..0a014ab96c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\sthe\ssqlite3_keyword_...()\sand\ssqlite3_compileoption_...()\sfamily\sof\sfunctions\sto\sthe\sJNI\swrapper1\sAPI. -D 2023-11-03T11:53:13.823 +C Wrap\smore\sof\sthe\sstmt\sAPI\sbehind\sthe\sJNI\swrapper1\sAPI. +D 2023-11-03T13:00:51.184 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca F ext/jni/src/org/sqlite/jni/capi/CApi.java 24aba7b14b11da52cd47083608d37c186122c2e2072e75b2ff923d1f15bfb9e5 -F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 0bfd6e56e8265c2f05c9207665707285534d78f8466ef0e0430c65677f00943d +F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 @@ -271,7 +271,7 @@ F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff22 F ext/jni/src/org/sqlite/jni/capi/Tester1.java b6b2f3354ba68956a6bcd1c586b8eb25a0bd66eed2b58b340405e1129da15de9 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 -F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 9f9e151f1da017b706c0ee5f40f4c86b54e773d6ae4339723e0cc85a456251ab +F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e @@ -294,10 +294,10 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ad F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 9be20f3ba6edbe63285224d5d640dbfb0d84fb8cf5134084e3ae40004ec9d6d9 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 698fd699dd113fa2bceb78d3565f3d4578dee86150fb86e1838ec915994aa57b +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 0b01b9058ef6737c85b505c6aa2490fb1dc1d974fb39d88a93269fed09553f9f +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 1c95f5e0f872aeb9cdd174cbb2e254d158df1f8b2fee9f0e6ec82c348602a7bd F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java f74b9000cc24d415cfdd9fd77234aa6ab0549871f495529993cee6176cad0329 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 9ab7e38e6741842f8e3b74cd3ecb4953e2f1957f5229bd32663df7331245ce95 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2141,8 +2141,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 52ab3deba4d26ca0e9a84a6dff254195b4a0e2cc6cf948cf7a66bb11117e7002 -R 713111c1d3b2b5aa68a4fe22b929906b +P b27242414d6023eac7e62cf6120e1f02b0ddc7b8f0a1e4c48111cfe88d197cbd +R 05c1b264db19fc6b766555a4fdb5a28d U stephan -Z 5f0fb960919ed3f05e59594d37935544 +Z 7009b77b29804732443dad34d2696167 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0a15fa2c89..88247987ba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b27242414d6023eac7e62cf6120e1f02b0ddc7b8f0a1e4c48111cfe88d197cbd \ No newline at end of file +8fea23dc3af023ccf2909f1b4c6f91e7df0ffaac875b15f1fb3e264fba169b6a \ No newline at end of file From ab8a4b2bb04750942009346c6267a3d72dea5e60 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 3 Nov 2023 17:20:20 +0000 Subject: [PATCH 226/242] Fix a case where adjacent tokens are handled incorrectly by the fts5 snippet() function. FossilOrigin-Name: 8f5e9c192ff2820d8cfb076ab28f30697d10c22710583d6c7fd7019c4a0ea795 --- ext/fts5/fts5_aux.c | 8 +++ ext/fts5/test/fts5tokenizer2.test | 89 +++++++++++++++++++++++++++++++ manifest | 15 +++--- manifest.uuid | 2 +- 4 files changed, 106 insertions(+), 8 deletions(-) create mode 100644 ext/fts5/test/fts5tokenizer2.test diff --git a/ext/fts5/fts5_aux.c b/ext/fts5/fts5_aux.c index fa58b9aac3..b6919fc9cc 100644 --- a/ext/fts5/fts5_aux.c +++ b/ext/fts5/fts5_aux.c @@ -211,6 +211,14 @@ static int fts5HighlightCb( } if( iPos==p->iRangeEnd ){ + if( p->bOpen ){ + if( p->iter.iStart>=0 && iPos>=p->iter.iStart ){ + fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); + p->iOff = iEndOff; + } + fts5HighlightAppend(&rc, p, p->zClose, -1); + p->bOpen = 0; + } fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); p->iOff = iEndOff; } diff --git a/ext/fts5/test/fts5tokenizer2.test b/ext/fts5/test/fts5tokenizer2.test new file mode 100644 index 0000000000..bdabd53127 --- /dev/null +++ b/ext/fts5/test/fts5tokenizer2.test @@ -0,0 +1,89 @@ +# 2023 Nov 03 +# +# 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 built-in fts5 tokenizers. +# + +source [file join [file dirname [info script]] fts5_common.tcl] +set testprefix fts5tokenizer2 + +# If SQLITE_ENABLE_FTS5 is defined, omit this file. +ifcapable !fts5 { + finish_test + return +} + +sqlite3_fts5_create_tokenizer db tst get_tst_tokenizer +proc get_tst_tokenizer {args} { + return "tst_tokenizer" +} +proc tst_tokenizer {flags txt} { + set token "" + set lTok [list] + + foreach c [split $txt {}] { + if {$token==""} { + append token $c + } else { + set t1 [string is upper $token] + set t2 [string is upper $c] + + if {$t1!=$t2} { + lappend lTok $token + set token "" + } + append token $c + } + } + if {$token!=""} { lappend lTok $token } + + set iOff 0 + foreach t $lTok { + set n [string length $t] + sqlite3_fts5_token $t $iOff [expr $iOff+$n] + incr iOff $n + } +} + +do_execsql_test 1.0 { + CREATE VIRTUAL TABLE t1 USING fts5(t, tokenize=tst); +} + +do_execsql_test 1.1 { + INSERT INTO t1 VALUES('AAdontBBmess'); +} + +do_execsql_test 1.2 { + SELECT snippet(t1, 0, '>', '<', '...', 4) FROM t1('BB'); +} {AAdont>BB', '<') FROM t1('BB'); +} {AAdont>BB', '<') FROM t1('AA'); +} {>AA', '<') FROM t1('dont'); +} {AA>dont', '<') FROM t1('mess'); +} {AAdontBB>mess<} + +do_execsql_test 1.7 { + SELECT highlight(t1, 0, '>', '<') FROM t1('BB mess'); +} {AAdont>BBmess<} + + +finish_test diff --git a/manifest b/manifest index 0a014ab96c..300e384233 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Wrap\smore\sof\sthe\sstmt\sAPI\sbehind\sthe\sJNI\swrapper1\sAPI. -D 2023-11-03T13:00:51.184 +C Fix\sa\scase\swhere\sadjacent\stokens\sare\shandled\sincorrectly\sby\sthe\sfts5\ssnippet()\sfunction. +D 2023-11-03T17:20:20.721 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -89,7 +89,7 @@ F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a0 F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0 F ext/fts5/fts5.h 05501612cc655504c5dce8ba765ab621d50fc478490089beaa0d75e00b23e520 F ext/fts5/fts5Int.h 78a63cc0795186cde5384816a9403a68c65774b35d952e05b81a1b4b158e07c8 -F ext/fts5/fts5_aux.c 35c4101613eff86902877a4dedd9400b07922e412cbdd637b45041dce2fd5388 +F ext/fts5/fts5_aux.c ee770eec0af8646db9e18fc01a0dad7345b5f5e8cbba236704cfae2d777022ad F ext/fts5/fts5_buffer.c 3001fbabb585d6de52947b44b455235072b741038391f830d6b729225eeaf6a5 F ext/fts5/fts5_config.c 054359543566cbff1ba65a188330660a5457299513ac71c53b3a07d934c7b081 F ext/fts5/fts5_expr.c bd3b81ce669c4104e34ffe66570af1999a317b142c15fccb112de9fb0caa57a6 @@ -216,6 +216,7 @@ F ext/fts5/test/fts5synonym2.test 8f891fc49cc1e8daed727051e77e1f42849c784a6a54be F ext/fts5/test/fts5tok1.test 1f7817499f5971450d8c4a652114b3d833393c8134e32422d0af27884ffe9cef F ext/fts5/test/fts5tok2.test dcacb32d4a2a3f0dd3215d4a3987f78ae4be21a2 F ext/fts5/test/fts5tokenizer.test ac3c9112b263a639fb0508ae73a3ee886bf4866d2153771a8e8a20c721305a43 +F ext/fts5/test/fts5tokenizer2.test cb5428c7cfb3b6a74b7adfcde65506e329112003e8dffa7501d01c2d18d02569 F ext/fts5/test/fts5trigram.test 6c4e37864f3e7d90673db5563d9736d7e40080ab94d10ebdffa94c1b77941da0 F ext/fts5/test/fts5trigram2.test 9fe4207f8a4241747aff1005258b564958588d21bfd240d6cd4c2e955d31c156 F ext/fts5/test/fts5ubsan.test 783d5a8d13ebfa169e634940228db54540780e3ba7a87ad1e4510e61440bf64b @@ -2141,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b27242414d6023eac7e62cf6120e1f02b0ddc7b8f0a1e4c48111cfe88d197cbd -R 05c1b264db19fc6b766555a4fdb5a28d -U stephan -Z 7009b77b29804732443dad34d2696167 +P 8fea23dc3af023ccf2909f1b4c6f91e7df0ffaac875b15f1fb3e264fba169b6a +R bb87795876c08bb47ab6453eb0b91bfd +U dan +Z 9c5031581d089ce3bdbdbf8fe6594110 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 88247987ba..5c122d0f90 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8fea23dc3af023ccf2909f1b4c6f91e7df0ffaac875b15f1fb3e264fba169b6a \ No newline at end of file +8f5e9c192ff2820d8cfb076ab28f30697d10c22710583d6c7fd7019c4a0ea795 \ No newline at end of file From 5189ef98d3d942121465d07cf7b7167a1bd8955d Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 3 Nov 2023 18:45:26 +0000 Subject: [PATCH 227/242] Back out the ALWAYS inserted late yesterday. The fuzzer discovered a counter-example. FossilOrigin-Name: 570635575cc5fbffe910ed992b58393e214117ef3b5370a66f115cd0ee202913 --- manifest | 15 ++++++++------- manifest.uuid | 2 +- src/select.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 300e384233..18d8f5e182 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scase\swhere\sadjacent\stokens\sare\shandled\sincorrectly\sby\sthe\sfts5\ssnippet()\sfunction. -D 2023-11-03T17:20:20.721 +C Back\sout\sthe\sALWAYS\sinserted\slate\syesterday.\s\sThe\sfuzzer\sdiscovered\sa\ncounter-example. +D 2023-11-03T18:45:26.322 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -724,7 +724,7 @@ F src/printf.c 9da63b9ae1c14789bcae12840f5d800fd9302500cd2d62733fac77f0041b4750 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d017bad7ba8e778617701a0e986fdeb393d67d6afa84fb28ef4e8b8ad2acf916 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 8ebbc67478e2d43f0b24c79258597646e526c5001d07801bba7d4059088c8b12 +F src/select.c a19daa26e95f7245106a31f288b2f50c72d1f2cc156703f04c8c91450e111515 F src/shell.c.in aebfbedaa7706d2c73ab7366a19fc8bc40ea68b70d2529f7feef54e6eb077ea2 F src/sqlite.h.in ef0e41e83ad1ac0dcc9ec9939bf541a44b1c5de821bee2d6c61754c3252f3276 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -2142,8 +2142,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8fea23dc3af023ccf2909f1b4c6f91e7df0ffaac875b15f1fb3e264fba169b6a -R bb87795876c08bb47ab6453eb0b91bfd -U dan -Z 9c5031581d089ce3bdbdbf8fe6594110 +P 8f5e9c192ff2820d8cfb076ab28f30697d10c22710583d6c7fd7019c4a0ea795 +Q -268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f +R 4994e654abc4ea7988499736bdf83ad0 +U drh +Z 5983c90319f7844a8c9e3e4e981877ce # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5c122d0f90..f69aa3731a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8f5e9c192ff2820d8cfb076ab28f30697d10c22710583d6c7fd7019c4a0ea795 \ No newline at end of file +570635575cc5fbffe910ed992b58393e214117ef3b5370a66f115cd0ee202913 \ No newline at end of file diff --git a/src/select.c b/src/select.c index e97a5afb74..7a79385e0b 100644 --- a/src/select.c +++ b/src/select.c @@ -8472,7 +8472,7 @@ int sqlite3Select( updateAccumulator(pParse, regAcc, pAggInfo, eDist); if( eDist!=WHERE_DISTINCT_NOOP ){ struct AggInfo_func *pF = pAggInfo->aFunc; - if( ALWAYS(pF) ){ + if( pF ){ fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr); } } From aad6808efc0b93d914ef156f976dd4b555e27e68 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 12:53:00 +0000 Subject: [PATCH 228/242] Bind the trace API to the JNI wrapper1 API and add a way to map the native-level db/stmt types to their high-level counterparts (required for translating callbacks such as tracers). FossilOrigin-Name: 702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3 --- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 11 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 111 +++++++++++++++++- .../src/org/sqlite/jni/wrapper1/Tester2.java | 58 ++++++++- manifest | 19 ++- manifest.uuid | 2 +- 5 files changed, 180 insertions(+), 21 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 4657185658..a0445adb3a 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -46,7 +46,7 @@ public class Tester1 implements Runnable { //! True to shuffle the order of the tests. private static boolean shuffle = false; //! True to dump the list of to-run tests to stdout. - private static boolean listRunTests = false; + private static int listRunTests = 0; //! True to squelch all out() and outln() output. private static boolean quietMode = false; //! Total number of runTests() calls. @@ -1701,7 +1701,7 @@ public class Tester1 implements Runnable { mlist = new ArrayList<>( testMethods.subList(0, testMethods.size()) ); java.util.Collections.shuffle(mlist); } - if( listRunTests ){ + if( (!fromThread && listRunTests>0) || listRunTests>1 ){ synchronized(this.getClass()){ if( !fromThread ){ out("Initial test"," list: "); @@ -1763,8 +1763,11 @@ public class Tester1 implements Runnable { -naps: sleep small random intervals between tests in order to add some chaos for cross-thread contention. + -list-tests: outputs the list of tests being run, minus some - which are hard-coded. This is noisy in multi-threaded mode. + which are hard-coded. In multi-threaded mode, use this twice to + to emit the list run by each thread (which may differ from the initial + list, in particular if -shuffle is used). -fail: forces an exception to be thrown during the test run. Use with -shuffle to make its appearance unpredictable. @@ -1793,7 +1796,7 @@ public class Tester1 implements Runnable { }else if(arg.equals("shuffle")){ shuffle = true; }else if(arg.equals("list-tests")){ - listRunTests = true; + ++listRunTests; }else if(arg.equals("fail")){ forceFail = true; }else if(arg.equals("sqllog")){ diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 907755d99a..685e8c326c 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -61,11 +61,31 @@ public final class Sqlite implements AutoCloseable { public static final int PREPARE_NORMALIZE = CApi.SQLITE_PREPARE_NORMALIZE; public static final int PREPARE_NO_VTAB = CApi.SQLITE_PREPARE_NO_VTAB; + public static final int TRACE_STMT = CApi.SQLITE_TRACE_STMT; + public static final int TRACE_PROFILE = CApi.SQLITE_TRACE_PROFILE; + public static final int TRACE_ROW = CApi.SQLITE_TRACE_ROW; + public static final int TRACE_CLOSE = CApi.SQLITE_TRACE_CLOSE; + public static final int TRACE_ALL = TRACE_STMT | TRACE_PROFILE | TRACE_ROW | TRACE_CLOSE; + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; } + /** Maps org.sqlite.jni.capi.sqlite3 to Sqlite instances. */ + private static final java.util.Map nativeToWrapper + = new java.util.HashMap<>(); + + /** + Returns the Sqlite object associated with the given sqlite3 + object, or null if there is no such mapping. + */ + static Sqlite fromNative(sqlite3 low){ + synchronized(nativeToWrapper){ + return nativeToWrapper.get(low); + } + } + /** Returns a newly-opened db connection or throws SqliteException if opening fails. All arguments are as documented for @@ -84,7 +104,11 @@ public final class Sqlite implements AutoCloseable { n.close(); throw ex; } - return new Sqlite(n); + Sqlite rv = new Sqlite(n); + synchronized(nativeToWrapper){ + nativeToWrapper.put(n, rv); + } + return rv; } public static Sqlite open(String filename, int flags){ @@ -124,6 +148,9 @@ public final class Sqlite implements AutoCloseable { @Override public void close(){ if(null!=this.db){ + synchronized(nativeToWrapper){ + nativeToWrapper.remove(this.db); + } this.db.close(); this.db = null; } @@ -467,11 +494,71 @@ public final class Sqlite implements AutoCloseable { return rv; } + public interface TraceCallback { + /** + Called by sqlite3 for various tracing operations, as per + sqlite3_trace_v2(). Note that this interface elides the 2nd + argument to the native trace callback, as that role is better + filled by instance-local state. + +

    These callbacks may throw, in which case their exceptions are + converted to C-level error information. + +

    The 2nd argument to this function, if non-null, will be a an + Sqlite or Sqlite.Stmt object, depending on the first argument + (see below). + +

    The final argument to this function is the "X" argument + documented for sqlite3_trace() and sqlite3_trace_v2(). Its type + depends on value of the first argument: + +

    - SQLITE_TRACE_STMT: pNative is a Sqlite.Stmt. pX is a String + containing the prepared SQL. + +

    - SQLITE_TRACE_PROFILE: pNative is a sqlite3_stmt. pX is a Long + holding an approximate number of nanoseconds the statement took + to run. + +

    - SQLITE_TRACE_ROW: pNative is a sqlite3_stmt. pX is null. + +

    - SQLITE_TRACE_CLOSE: pNative is a sqlite3. pX is null. + */ + void call(int traceFlag, Object pNative, Object pX); + } + + /** + Analog to sqlite3_trace_v2(). traceMask must be a mask of the + TRACE_... constants. Pass a null callback to remove tracing. + + Throws on error. + */ + public void trace(int traceMask, TraceCallback callback){ + final Sqlite self = this; + final org.sqlite.jni.capi.TraceV2Callback tc = + (null==callback) ? null : new org.sqlite.jni.capi.TraceV2Callback(){ + @SuppressWarnings("unchecked") + @Override public int call(int flag, Object pNative, Object pX){ + switch(flag){ + case TRACE_ROW: + case TRACE_PROFILE: + case TRACE_STMT: + callback.call(flag, Sqlite.Stmt.fromNative((sqlite3_stmt)pNative), pX); + break; + case TRACE_CLOSE: + callback.call(flag, self, pX); + break; + } + return 0; + } + }; + checkRc( CApi.sqlite3_trace_v2(thisDb(), traceMask, tc) ); + }; + /** Corresponds to the sqlite3_stmt class. Use Sqlite.prepare() to create new instances. */ - public final class Stmt implements AutoCloseable { + public static final class Stmt implements AutoCloseable { private Sqlite _db = null; private sqlite3_stmt stmt = null; /** @@ -489,12 +576,29 @@ public final class Sqlite implements AutoCloseable { this._db = db; this.stmt = stmt; this.resultColCount = CApi.sqlite3_column_count(stmt); + synchronized(nativeToWrapper){ + nativeToWrapper.put(this.stmt, this); + } } sqlite3_stmt nativeHandle(){ return stmt; } + /** Maps org.sqlite.jni.capi.sqlite3_stmt to Stmt instances. */ + private static final java.util.Map nativeToWrapper + = new java.util.HashMap<>(); + + /** + Returns the Stmt object associated with the given sqlite3_stmt + object, or null if there is no such mapping. + */ + static Stmt fromNative(sqlite3_stmt low){ + synchronized(nativeToWrapper){ + return nativeToWrapper.get(low); + } + } + /** If this statement is still opened, its low-level handle is returned, eelse an IllegalArgumentException is thrown. @@ -527,6 +631,9 @@ public final class Sqlite implements AutoCloseable { public int finalizeStmt(){ int rc = 0; if( null!=stmt ){ + synchronized(nativeToWrapper){ + nativeToWrapper.remove(this.stmt); + } sqlite3_finalize(stmt); stmt = null; _db = null; diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index d24551ebf1..b6f1011489 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -46,7 +46,7 @@ public class Tester2 implements Runnable { //! True to shuffle the order of the tests. private static boolean shuffle = false; //! True to dump the list of to-run tests to stdout. - private static boolean listRunTests = false; + private static int listRunTests = 0; //! True to squelch all out() and outln() output. private static boolean quietMode = false; //! Total number of runTests() calls. @@ -444,6 +444,54 @@ public class Tester2 implements Runnable { db.close(); } + + private void testTrace(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + /* Ensure that characters outside of the UTF BMP survive the trip + from Java to sqlite3 and back to Java. (At no small efficiency + penalty.) */ + final String nonBmpChar = "😃"; + db.trace( + Sqlite.TRACE_ALL, + new Sqlite.TraceCallback(){ + @Override public void call(int traceFlag, Object pNative, Object x){ + ++counter.value; + //outln("TRACE "+traceFlag+" pNative = "+pNative.getClass().getName()); + switch(traceFlag){ + case Sqlite.TRACE_STMT: + affirm(pNative instanceof Sqlite.Stmt); + //outln("TRACE_STMT sql = "+x); + affirm(x instanceof String); + affirm( ((String)x).indexOf(nonBmpChar) > 0 ); + break; + case Sqlite.TRACE_PROFILE: + affirm(pNative instanceof Sqlite.Stmt); + affirm(x instanceof Long); + //outln("TRACE_PROFILE time = "+x); + break; + case Sqlite.TRACE_ROW: + affirm(pNative instanceof Sqlite.Stmt); + affirm(null == x); + //outln("TRACE_ROW = "+sqlite3_column_text16((sqlite3_stmt)pNative, 0)); + break; + case Sqlite.TRACE_CLOSE: + affirm(pNative instanceof Sqlite); + affirm(null == x); + break; + default: + affirm(false /*cannot happen*/); + break; + } + } + }); + execSql(db, "SELECT coalesce(null,null,'"+nonBmpChar+"'); "+ + "SELECT 'w"+nonBmpChar+"orld'"); + affirm( 6 == counter.value ); + db.close(); + affirm( 7 == counter.value ); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); @@ -451,7 +499,7 @@ public class Tester2 implements Runnable { mlist = new ArrayList<>( testMethods.subList(0, testMethods.size()) ); java.util.Collections.shuffle(mlist); } - if( listRunTests ){ + if( (!fromThread && listRunTests>0) || listRunTests>1 ){ synchronized(this.getClass()){ if( !fromThread ){ out("Initial test"," list: "); @@ -514,7 +562,9 @@ public class Tester2 implements Runnable { some chaos for cross-thread contention. -list-tests: outputs the list of tests being run, minus some - which are hard-coded. This is noisy in multi-threaded mode. + which are hard-coded. In multi-threaded mode, use this twice to + to emit the list run by each thread (which may differ from the initial + list, in particular if -shuffle is used). -fail: forces an exception to be thrown during the test run. Use with -shuffle to make its appearance unpredictable. @@ -543,7 +593,7 @@ public class Tester2 implements Runnable { }else if(arg.equals("shuffle")){ shuffle = true; }else if(arg.equals("list-tests")){ - listRunTests = true; + ++listRunTests; }else if(arg.equals("fail")){ forceFail = true; }else if(arg.equals("sqllog")){ diff --git a/manifest b/manifest index 18d8f5e182..ae3068b124 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Back\sout\sthe\sALWAYS\sinserted\slate\syesterday.\s\sThe\sfuzzer\sdiscovered\sa\ncounter-example. -D 2023-11-03T18:45:26.322 +C Bind\sthe\strace\sAPI\sto\sthe\sJNI\swrapper1\sAPI\sand\sadd\sa\sway\sto\smap\sthe\snative-level\sdb/stmt\stypes\sto\stheir\shigh-level\scounterparts\s(required\sfor\stranslating\scallbacks\ssuch\sas\stracers). +D 2023-11-04T12:53:00.737 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java b6b2f3354ba68956a6bcd1c586b8eb25a0bd66eed2b58b340405e1129da15de9 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java fba87e2c39ba186bb7add972d9e84b7f817f656452cf4f317679575bd5a738e7 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 0b01b9058ef6737c85b505c6aa2490fb1dc1d974fb39d88a93269fed09553f9f -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 1c95f5e0f872aeb9cdd174cbb2e254d158df1f8b2fee9f0e6ec82c348602a7bd +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 12a9323a74e38e7c6229dc73c5b62bf50088a65310100f383469308549381907 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 9ab7e38e6741842f8e3b74cd3ecb4953e2f1957f5229bd32663df7331245ce95 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 83cfe6583c8df226eda985eed059f47efaefaca3951c618c286ffc8c63210ee8 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,9 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8f5e9c192ff2820d8cfb076ab28f30697d10c22710583d6c7fd7019c4a0ea795 -Q -268b5984a4263bee245a9bb47ac927bde56cdf4af8795b851dada5622224076f -R 4994e654abc4ea7988499736bdf83ad0 -U drh -Z 5983c90319f7844a8c9e3e4e981877ce +P 570635575cc5fbffe910ed992b58393e214117ef3b5370a66f115cd0ee202913 +R cb275d62547ff275bdfb4b29d97a5241 +U stephan +Z 2824e678eb263c5ade76d9ba9fb58525 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f69aa3731a..0e828aa55c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -570635575cc5fbffe910ed992b58393e214117ef3b5370a66f115cd0ee202913 \ No newline at end of file +702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3 \ No newline at end of file From 5f3b13d1367f13e8f70d85522228c71c33cf1fd9 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 13:16:49 +0000 Subject: [PATCH 229/242] Bind the bool-flag sqlite3_db_config() variants to the JNI wrapper1 API. FossilOrigin-Name: b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921 --- ext/jni/src/c/sqlite3-jni.c | 1 - ext/jni/src/org/sqlite/jni/capi/CApi.java | 3 +- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 1 + .../src/org/sqlite/jni/wrapper1/Sqlite.java | 32 +++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 21 ++++++++---- manifest | 20 ++++++------ manifest.uuid | 2 +- 7 files changed, 60 insertions(+), 20 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 6d54391e18..e6b0750cbd 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -3429,7 +3429,6 @@ S3JniApi( } break; } - case 0: default: rc = SQLITE_MISUSE; } diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index 6eeeb29a24..ef1ca17b22 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -828,7 +828,7 @@ public final class CApi { SQLITE_DBCONFIG_... options which uses this call form.

    Unlike the C API, this returns SQLITE_MISUSE if its db argument - are null (as opposed to invoking UB). + is null (as opposed to invoking UB). */ public static native int sqlite3_db_config( @NotNull sqlite3 db, int op, int onOff, @Nullable OutputPointer.Int32 out @@ -851,7 +851,6 @@ public final class CApi { return null==db ? null : sqlite3_db_name(db.getNativePointer(), ndx); } - public static native String sqlite3_db_filename( @NotNull sqlite3 db, @NotNull String dbName ); diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index a0445adb3a..fdadb3e29d 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1049,6 +1049,7 @@ public class Tester1 implements Runnable { rc = sqlite3_db_config(db1, SQLITE_DBCONFIG_MAINDBNAME, "foo"); affirm( sqlite3_db_filename(db1, "foo").endsWith(dbName) ); affirm( "foo".equals( sqlite3_db_name(db1, 0) ) ); + affirm( SQLITE_MISUSE == sqlite3_db_config(db1, 0, 0, null) ); final ValueHolder xBusyCalled = new ValueHolder<>(0); BusyHandlerCallback handler = new BusyHandlerCallback(){ diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 685e8c326c..3e24f52f33 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -67,6 +67,25 @@ public final class Sqlite implements AutoCloseable { public static final int TRACE_CLOSE = CApi.SQLITE_TRACE_CLOSE; public static final int TRACE_ALL = TRACE_STMT | TRACE_PROFILE | TRACE_ROW | TRACE_CLOSE; + public static final int DBCONFIG_ENABLE_FKEY = CApi.SQLITE_DBCONFIG_ENABLE_FKEY; + public static final int DBCONFIG_ENABLE_TRIGGER = CApi.SQLITE_DBCONFIG_ENABLE_TRIGGER; + public static final int DBCONFIG_ENABLE_FTS3_TOKENIZER = CApi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER; + public static final int DBCONFIG_ENABLE_LOAD_EXTENSION = CApi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION; + public static final int DBCONFIG_NO_CKPT_ON_CLOSE = CApi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE; + public static final int DBCONFIG_ENABLE_QPSG = CApi.SQLITE_DBCONFIG_ENABLE_QPSG; + public static final int DBCONFIG_TRIGGER_EQP = CApi.SQLITE_DBCONFIG_TRIGGER_EQP; + public static final int DBCONFIG_RESET_DATABASE = CApi.SQLITE_DBCONFIG_RESET_DATABASE; + public static final int DBCONFIG_DEFENSIVE = CApi.SQLITE_DBCONFIG_DEFENSIVE; + public static final int DBCONFIG_WRITABLE_SCHEMA = CApi.SQLITE_DBCONFIG_WRITABLE_SCHEMA; + public static final int DBCONFIG_LEGACY_ALTER_TABLE = CApi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE; + public static final int DBCONFIG_DQS_DML = CApi.SQLITE_DBCONFIG_DQS_DML; + public static final int DBCONFIG_DQS_DDL = CApi.SQLITE_DBCONFIG_DQS_DDL; + public static final int DBCONFIG_ENABLE_VIEW = CApi.SQLITE_DBCONFIG_ENABLE_VIEW; + public static final int DBCONFIG_LEGACY_FILE_FORMAT = CApi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT; + public static final int DBCONFIG_TRUSTED_SCHEMA = CApi.SQLITE_DBCONFIG_TRUSTED_SCHEMA; + public static final int DBCONFIG_STMT_SCANSTATUS = CApi.SQLITE_DBCONFIG_STMT_SCANSTATUS; + public static final int DBCONFIG_REVERSE_SCANORDER = CApi.SQLITE_DBCONFIG_REVERSE_SCANORDER; + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; @@ -375,6 +394,19 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_db_filename(thisDb(), dbName); } + /** + Analog to sqlite3_db_config() for the call forms which take one + of the boolean-type db configuration flags (namely the + DBCONFIG_... constants defined in this class). On success it + returns the result of that underlying call. Throws on error. + */ + public boolean dbConfig(int op, boolean on){ + org.sqlite.jni.capi.OutputPointer.Int32 pOut = + new org.sqlite.jni.capi.OutputPointer.Int32(); + checkRc( CApi.sqlite3_db_config(thisDb(), op, on ? 1 : 0, pOut) ); + return pOut.get()!=0; + } + /** Analog to the variant of sqlite3_db_config() for configuring the SQLITE_DBCONFIG_MAINDBNAME option. Throws on error. diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index b6f1011489..38bcb54c66 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -211,15 +211,24 @@ public class Tester2 implements Runnable { void testOpenDb1(){ Sqlite db = openDb(); affirm( 0!=db.nativeHandle().getNativePointer() ); + affirm( "main".equals( db.dbName(0) ) ); + db.setMainDbName("foo"); + affirm( "foo".equals( db.dbName(0) ) ); + affirm( db.dbConfig(Sqlite.DBCONFIG_DEFENSIVE, true) + /* The underlying function has different mangled names in jdk8 + vs jdk19, and this call is here to ensure that the build + fails if it cannot find both names. */ ); + affirm( !db.dbConfig(Sqlite.DBCONFIG_DEFENSIVE, false) ); + SqliteException ex = null; + try{ db.dbConfig(0, false); } + catch(SqliteException e){ ex = e; } + affirm( null!=ex ); + ex = null; db.close(); affirm( null==db.nativeHandle() ); - SqliteException ex = null; - try { - db = openDb("/no/such/dir/.../probably"); - }catch(SqliteException e){ - ex = e; - } + try{ db = openDb("/no/such/dir/.../probably"); } + catch(SqliteException e){ ex = e; } affirm( ex!=null ); affirm( ex.errcode() != 0 ); affirm( ex.extendedErrcode() != 0 ); diff --git a/manifest b/manifest index ae3068b124..cbf52bf2f6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\sthe\strace\sAPI\sto\sthe\sJNI\swrapper1\sAPI\sand\sadd\sa\sway\sto\smap\sthe\snative-level\sdb/stmt\stypes\sto\stheir\shigh-level\scounterparts\s(required\sfor\stranslating\scallbacks\ssuch\sas\stracers). -D 2023-11-04T12:53:00.737 +C Bind\sthe\sbool-flag\ssqlite3_db_config()\svariants\sto\sthe\sJNI\swrapper1\sAPI. +D 2023-11-04T13:16:49.628 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -241,7 +241,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c afe9c25b82279a28fe2c81f869070fa0d434b0a8ccd7f8aca0e8173db410d14a +F ext/jni/src/c/sqlite3-jni.c 53493819418048bfdc8e6f505954c7e692d4666b64c3ae732ea8319c91aac747 F ext/jni/src/c/sqlite3-jni.h 1c45fd4689cec42f3d84d2fee41bb494016a12fcb5fd80291095590666a14015 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba @@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 24aba7b14b11da52cd47083608d37c186122c2e2072e75b2ff923d1f15bfb9e5 +F ext/jni/src/org/sqlite/jni/capi/CApi.java d21e6c1c4557ae18bbc2eefb0882efdb36fdaecdc58823c142def994327a365b F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java fba87e2c39ba186bb7add972d9e84b7f817f656452cf4f317679575bd5a738e7 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 41e2b910a11dfdd4cc39ab608492d7c12f3791e85ac7f9d75d5445f7645a5e57 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 0b01b9058ef6737c85b505c6aa2490fb1dc1d974fb39d88a93269fed09553f9f -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 12a9323a74e38e7c6229dc73c5b62bf50088a65310100f383469308549381907 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 0033898c318eea50489817957ef6078064f2b70b2838733462663ca3d6b09127 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 83cfe6583c8df226eda985eed059f47efaefaca3951c618c286ffc8c63210ee8 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 00c697a57af398d6c49b2c32c10314201a5d0fa0862dc496f9d4f2139087b76b F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 570635575cc5fbffe910ed992b58393e214117ef3b5370a66f115cd0ee202913 -R cb275d62547ff275bdfb4b29d97a5241 +P 702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3 +R 86eeaee301f846f2f1ea6341b6a33699 U stephan -Z 2824e678eb263c5ade76d9ba9fb58525 +Z e6b3bd265a1978cd37eafbdc1dc5ccf4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0e828aa55c..3c3ee0a4df 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3 \ No newline at end of file +b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921 \ No newline at end of file From 348e192ea896293e704afb1b8cc323fa85dba293 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 13:37:42 +0000 Subject: [PATCH 230/242] Rework the JNI wrapper1 variants of status() and db_status() to be more Java-esque. FossilOrigin-Name: 40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8 --- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 70 +++++++++++++++++-- .../src/org/sqlite/jni/wrapper1/Tester2.java | 15 ++++ manifest | 14 ++-- manifest.uuid | 2 +- 4 files changed, 87 insertions(+), 14 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 3e24f52f33..0ea2c38768 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -44,6 +44,20 @@ public final class Sqlite implements AutoCloseable { public static final int STATUS_PAGECACHE_SIZE = CApi.SQLITE_STATUS_PAGECACHE_SIZE; public static final int STATUS_MALLOC_COUNT = CApi.SQLITE_STATUS_MALLOC_COUNT; + public static final int DBSTATUS_LOOKASIDE_USED = CApi.SQLITE_DBSTATUS_LOOKASIDE_USED; + public static final int DBSTATUS_CACHE_USED = CApi.SQLITE_DBSTATUS_CACHE_USED; + public static final int DBSTATUS_SCHEMA_USED = CApi.SQLITE_DBSTATUS_SCHEMA_USED; + public static final int DBSTATUS_STMT_USED = CApi.SQLITE_DBSTATUS_STMT_USED; + public static final int DBSTATUS_LOOKASIDE_HIT = CApi.SQLITE_DBSTATUS_LOOKASIDE_HIT; + public static final int DBSTATUS_LOOKASIDE_MISS_SIZE = CApi.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE; + public static final int DBSTATUS_LOOKASIDE_MISS_FULL = CApi.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL; + public static final int DBSTATUS_CACHE_HIT = CApi.SQLITE_DBSTATUS_CACHE_HIT; + public static final int DBSTATUS_CACHE_MISS = CApi.SQLITE_DBSTATUS_CACHE_MISS; + public static final int DBSTATUS_CACHE_WRITE = CApi.SQLITE_DBSTATUS_CACHE_WRITE; + public static final int DBSTATUS_DEFERRED_FKS = CApi.SQLITE_DBSTATUS_DEFERRED_FKS; + public static final int DBSTATUS_CACHE_USED_SHARED = CApi.SQLITE_DBSTATUS_CACHE_USED_SHARED; + public static final int DBSTATUS_CACHE_SPILL = CApi.SQLITE_DBSTATUS_CACHE_SPILL; + public static final int LIMIT_LENGTH = CApi.SQLITE_LIMIT_LENGTH; public static final int LIMIT_SQL_LENGTH = CApi.SQLITE_LIMIT_SQL_LENGTH; public static final int LIMIT_COLUMN = CApi.SQLITE_LIMIT_COLUMN; @@ -150,19 +164,49 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_sourceid(); } + + /** + Output object for use with status() and libStatus(). + */ + public static final class Status { + /** The current value for the requested status() or libStatus() metric. */ + long current; + /** The peak value for the requested status() or libStatus() metric. */ + long peak; + }; + /** As per sqlite3_status64(), but returns its current and high-water - results as a two-element array. Throws if the first argument is + results as a Status object. Throws if the first argument is not one of the STATUS_... constants. */ - public long[] libStatus(int op, boolean resetStats){ + public static Status libStatus(int op, boolean resetStats){ org.sqlite.jni.capi.OutputPointer.Int64 pCurrent = new org.sqlite.jni.capi.OutputPointer.Int64(); org.sqlite.jni.capi.OutputPointer.Int64 pHighwater = new org.sqlite.jni.capi.OutputPointer.Int64(); - final int rc = CApi.sqlite3_status64(op, pCurrent, pHighwater, resetStats); - checkRc(rc); - return new long[] {pCurrent.value, pHighwater.value}; + checkRc2( CApi.sqlite3_status64(op, pCurrent, pHighwater, resetStats) ); + final Status s = new Status(); + s.current = pCurrent.value; + s.peak = pHighwater.value; + return s; + } + + /** + As per sqlite3_status64(), but returns its current and high-water + results as a Status object. Throws if the first argument is + not one of the DBSTATUS_... constants or on any other misuse. + */ + public Status status(int op, boolean resetStats){ + org.sqlite.jni.capi.OutputPointer.Int32 pCurrent = + new org.sqlite.jni.capi.OutputPointer.Int32(); + org.sqlite.jni.capi.OutputPointer.Int32 pHighwater = + new org.sqlite.jni.capi.OutputPointer.Int32(); + checkRc( CApi.sqlite3_db_status(thisDb(), op, pCurrent, pHighwater, resetStats) ); + final Status s = new Status(); + s.current = pCurrent.value; + s.peak = pHighwater.value; + return s; } @Override public void close(){ @@ -272,6 +316,20 @@ public final class Sqlite implements AutoCloseable { } } + /** + Like checkRc() but behaves as if that function were + called with a null db object. + */ + private static void checkRc2(int rc){ + if( 0!=rc ){ + if( CApi.SQLITE_NOMEM==rc ){ + throw new OutOfMemoryError(); + }else{ + throw new SqliteException(rc); + } + } + } + /** prepFlags must be 0 or a bitmask of the PREPARE_... constants. @@ -440,7 +498,7 @@ public final class Sqlite implements AutoCloseable { /** Analog to sqlite3_release_memory(). */ - public static int releaseMemory(int n){ + public static int libReleaseMemory(int n){ return CApi.sqlite3_release_memory(n); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 38bcb54c66..b83cd44601 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -501,6 +501,21 @@ public class Tester2 implements Runnable { affirm( 7 == counter.value ); } + private void testStatus(){ + final Sqlite db = openDb(); + execSql(db, "create table t(a); insert into t values(1),(2),(3)"); + + Sqlite.Status s = Sqlite.libStatus(Sqlite.STATUS_MEMORY_USED, false); + affirm( s.current > 0 ); + affirm( s.peak >= s.current ); + + s = db.status(Sqlite.DBSTATUS_SCHEMA_USED, false); + affirm( s.current > 0 ); + affirm( s.peak == 0 /* always 0 for SCHEMA_USED */ ); + + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index cbf52bf2f6..5ee7dad393 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\sthe\sbool-flag\ssqlite3_db_config()\svariants\sto\sthe\sJNI\swrapper1\sAPI. -D 2023-11-04T13:16:49.628 +C Rework\sthe\sJNI\swrapper1\svariants\sof\sstatus()\sand\sdb_status()\sto\sbe\smore\sJava-esque. +D 2023-11-04T13:37:42.589 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 0b01b9058ef6737c85b505c6aa2490fb1dc1d974fb39d88a93269fed09553f9f -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 0033898c318eea50489817957ef6078064f2b70b2838733462663ca3d6b09127 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java ab6bee53895e5f7345b57d32ef30e9cc9c9c09979a31211f63e60dcdea9a7ab1 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 00c697a57af398d6c49b2c32c10314201a5d0fa0862dc496f9d4f2139087b76b +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java cbd087d3fcbfca384656fc2189a9b017e4afe70f0f17d8266d28c628ab97cada F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3 -R 86eeaee301f846f2f1ea6341b6a33699 +P b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921 +R 9ee74b8e162e4e8a23028ccec92c6373 U stephan -Z e6b3bd265a1978cd37eafbdc1dc5ccf4 +Z ce3f2fb1a954c596b6cdbc560de71d23 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 3c3ee0a4df..18ae81abac 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921 \ No newline at end of file +40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8 \ No newline at end of file From 1b199243cbff71e3e60caf9d7cb2be0f76eb894f Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 16:01:13 +0000 Subject: [PATCH 231/242] Expose context_db_handle() to the JNI wrapper1 API and clean up some related tests. FossilOrigin-Name: c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566 --- .../jni/wrapper1/AggregateFunction.java | 4 ---- .../org/sqlite/jni/wrapper1/SqlFunction.java | 12 +++++++++- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 2 +- .../sqlite/jni/wrapper1/SqliteException.java | 2 +- .../src/org/sqlite/jni/wrapper1/Tester2.java | 18 +++++++++++---- .../sqlite/jni/wrapper1/WindowFunction.java | 4 ---- manifest | 22 +++++++++---------- manifest.uuid | 2 +- 8 files changed, 39 insertions(+), 27 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java index 6a38d4b530..fc63b53542 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java @@ -12,10 +12,6 @@ ** This file is part of the wrapper1 interface for sqlite3. */ package org.sqlite.jni.wrapper1; -import org.sqlite.jni.capi.CApi; -import org.sqlite.jni.annotation.*; -import org.sqlite.jni.capi.sqlite3_context; -import org.sqlite.jni.capi.sqlite3_value; /** EXPERIMENTAL/INCOMPLETE/UNTESTED diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 5bcb3bd5fa..941800513d 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -56,7 +56,7 @@ public interface SqlFunction { */ Arguments(sqlite3_context cx, sqlite3_value args[]){ this.cx = cx; - this.args = args==null ? new sqlite3_value[0] : args;; + this.args = args==null ? new sqlite3_value[0] : args; this.length = this.args.length; } @@ -76,6 +76,16 @@ public interface SqlFunction { //! Returns the underlying sqlite3_context for these arguments. sqlite3_context getContext(){return cx;} + /** + Returns the Sqlite (db) object associated with this UDF call, + or null if the UDF is somehow called without such an object or + the db has been closed in an untimely manner (e.g. closed by a + UDF call). + */ + public Sqlite getDb(){ + return Sqlite.fromNative( CApi.sqlite3_context_db_handle(cx) ); + } + public int getArgCount(){ return args.length; } public int getInt(int argNdx){return CApi.sqlite3_value_int(valueAt(argNdx));} diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 0ea2c38768..4f14253a3e 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -781,7 +781,7 @@ public final class Sqlite implements AutoCloseable { Returns the Sqlite which prepared this statement, or null if this statement has been finalized. */ - public Sqlite db(){ return this._db; } + public Sqlite getDb(){ return this._db; } /** Works like sqlite3_reset() but throws on error. diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java index 27cfc0e6bb..09fa02a2ca 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java @@ -74,7 +74,7 @@ public final class SqliteException extends java.lang.RuntimeException { } public SqliteException(Sqlite.Stmt stmt){ - this(stmt.db()); + this(stmt.getDb()); } public int errcode(){ return errCode; } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index b83cd44601..5f991da4d3 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -241,6 +241,7 @@ public class Tester2 implements Runnable { Sqlite.Stmt stmt = db.prepare("SELECT ?1"); Exception e = null; affirm( null!=stmt.nativeHandle() ); + affirm( db == stmt.getDb() ); affirm( 1==stmt.bindParameterCount() ); affirm( "?1".equals(stmt.bindParameterName(1)) ); affirm( null==stmt.bindParameterName(2) ); @@ -294,21 +295,30 @@ public class Tester2 implements Runnable { final ValueHolder vh = new ValueHolder<>(0); final ScalarFunction f = new ScalarFunction(){ public void xFunc(SqlFunction.Arguments args){ + affirm( db == args.getDb() ); for( SqlFunction.Arguments.Arg arg : args ){ vh.value += arg.getInt(); } + args.resultInt(vh.value); } public void xDestroy(){ ++xDestroyCalled.value; } }; db.createFunction("myfunc", -1, f); - execSql(db, "select myfunc(1,2,3)"); + Sqlite.Stmt q = db.prepare("select myfunc(1,2,3)"); + affirm( q.step() ); affirm( 6 == vh.value ); - vh.value = 0; - execSql(db, "select myfunc(-1,-2,-3)"); - affirm( -6 == vh.value ); + affirm( 6 == q.columnInt(0) ); + q.finalizeStmt(); affirm( 0 == xDestroyCalled.value ); + vh.value = 0; + q = db.prepare("select myfunc(-1,-2,-3)"); + affirm( q.step() ); + affirm( -6 == vh.value ); + affirm( -6 == q.columnInt(0) ); + affirm( 0 == xDestroyCalled.value ); + q.finalizeStmt(); } affirm( 1 == xDestroyCalled.value ); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java index 479fc74d7f..a3905567d4 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java @@ -12,10 +12,6 @@ ** This file is part of the wrapper1 interface for sqlite3. */ package org.sqlite.jni.wrapper1; -import org.sqlite.jni.capi.CApi; -import org.sqlite.jni.annotation.*; -import org.sqlite.jni.capi.sqlite3_context; -import org.sqlite.jni.capi.sqlite3_value; /** A SqlFunction implementation for window functions. The T type diff --git a/manifest b/manifest index 5ee7dad393..661bf798a5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Rework\sthe\sJNI\swrapper1\svariants\sof\sstatus()\sand\sdb_status()\sto\sbe\smore\sJava-esque. -D 2023-11-04T13:37:42.589 +C Expose\scontext_db_handle()\sto\sthe\sJNI\swrapper1\sAPI\sand\sclean\sup\ssome\srelated\stests. +D 2023-11-04T16:01:13.004 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -293,14 +293,14 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_api.java a8e88c3783d21cec51b0748568a96653 F ext/jni/src/org/sqlite/jni/fts5/fts5_extension_function.java 9e2b954d210d572552b28aca523b272fae14bd41e318921b22f65b728d5bf978 F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ade23d329843f809cd0d0f4f1a2856da6e6b4d90 F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e -F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java bbe60ac7fd8718edb215a23dc901771bcedb1df3b46d9cf6caff6f419828587f +F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 0b01b9058ef6737c85b505c6aa2490fb1dc1d974fb39d88a93269fed09553f9f -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java ab6bee53895e5f7345b57d32ef30e9cc9c9c09979a31211f63e60dcdea9a7ab1 -F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java aa85b4b05fae240b14f3d332f9524a2f80c619fb03856be72b4adda866b63b72 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java cbd087d3fcbfca384656fc2189a9b017e4afe70f0f17d8266d28c628ab97cada +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java e787f5f36d5832fe3c7a000a8609eb0629fb160b95f8f25566df13e72e6f5470 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3e813aa4a680948a1885a5df1537c9245b3b7362aaf6aa31f679640e81da020e +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 96d7908da8bad591aff8f192cb83e038fd5861ef4601726eeda24905422718c9 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af -F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java 1a1afbafbd7406ff67e7d6405541c6347517c731de535a97d7a3df1d4db835b4 +F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 F ext/jni/src/tests/000-001-ignored.test e17e874c6ab3c437f1293d88093cf06286083b65bf162317f91bbfd92f961b70 F ext/jni/src/tests/900-001-fts.test bf0ce17a8d082773450e91f2388f5bbb2dfa316d0b676c313c637a91198090f0 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921 -R 9ee74b8e162e4e8a23028ccec92c6373 +P 40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8 +R f79739ffe6d4cd3ba58087c1ffb0d1f9 U stephan -Z ce3f2fb1a954c596b6cdbc560de71d23 +Z 05734d404abe66e6e03def34a1d0d490 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 18ae81abac..c78490991b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8 \ No newline at end of file +c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566 \ No newline at end of file From d4677f192ff63f5e670dc18afa9c78ab12e78c54 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 4 Nov 2023 21:44:00 +0000 Subject: [PATCH 232/242] Ensure that the YYYY-MM-DD input to date and time functions has been normalized prior to returning a result. [forum:/forumpost/6bb476897e|Forum post 6bb476897e]. FossilOrigin-Name: b692eb8ccb2d0645599ad73a8bdacf5df499114244aadeb38aabc580fc4dc7c5 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/date.c | 6 ++++++ test/date.test | 5 +++++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 661bf798a5..eacc52b68c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Expose\scontext_db_handle()\sto\sthe\sJNI\swrapper1\sAPI\sand\sclean\sup\ssome\srelated\stests. -D 2023-11-04T16:01:13.004 +C Ensure\sthat\sthe\sYYYY-MM-DD\sinput\sto\sdate\sand\stime\sfunctions\shas\sbeen\snormalized\nprior\sto\sreturning\sa\sresult.\n[forum:/forumpost/6bb476897e|Forum\spost\s6bb476897e]. +D 2023-11-04T21:44:00.659 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -670,7 +670,7 @@ F src/build.c 189e4517d67f09f0a3e0d8e1faa6e2ef0c2e95f6ac82e33c912cb7efa2a359cc F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 23331529e654be40ca97d171cbbffe9b3d4c71cc53b78fe5501230675952da8b -F src/date.c eebc54a00e888d3c56147779e9f361b77d62fd69ff2008c5373946aa1ba1d574 +F src/date.c 3b8d02977d160e128469de38493b4085f7c5cf4073193459909a6af3cf6d7c91 F src/dbpage.c 80e46e1df623ec40486da7a5086cb723b0275a6e2a7b01d9f9b5da0f04ba2782 F src/dbstat.c 3b677254d512fcafd4d0b341bf267b38b235ccfddbef24f9154e19360fa22e43 F src/delete.c cb766727c78e715f9fb7ec8a7d03658ed2a3016343ca687acfcec9083cdca500 @@ -1016,7 +1016,7 @@ F test/ctime.test 340f362f41f92972bbd71f44e10569a5cc694062b692231bd08aa6fe6c1c47 F test/cursorhint.test 05cf0febe5c5f8a31f199401fd1c9322249e753950d55f26f9d5aca61408a270 F test/cursorhint2.test 6f3aa9cb19e7418967a10ec6905209bcbb5968054da855fc36c8beee9ae9c42f F test/dataversion1.test 6e5e86ac681f0782e766ebcb56c019ae001522d114e0e111e5ebf68ccf2a7bb8 -F test/date.test c0d17cdfd89395bc78087b131e3538d96f864b5029c335318011accc7c0d0934 +F test/date.test ff2341a1ef71b9a27979494d299222f9a293aa22cb9ff6e9c38d88a895317ebf F test/date2.test 7e12ec14aaf4d5e6294b4ba140445b0eca06ea50062a9c3a69c4ee13d0b6f8b1 F test/date3.test a1b77abf05c6772fe5ca2337cac1398892f2a41e62bce7e6be0f4a08a0e64ae5 F test/date4.test 8aeb3de5b5e9fda968baa9357e4c0fae573724b7904943410195a19e96e31b6a @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8 -R f79739ffe6d4cd3ba58087c1ffb0d1f9 -U stephan -Z 05734d404abe66e6e03def34a1d0d490 +P c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566 +R 0a52dbd298d991529b412673e9dc7eb5 +U drh +Z 33b6056e932d878d8676b163d8b94db2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c78490991b..a2ff9c7a2a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566 \ No newline at end of file +b692eb8ccb2d0645599ad73a8bdacf5df499114244aadeb38aabc580fc4dc7c5 \ No newline at end of file diff --git a/src/date.c b/src/date.c index f163085445..e493542db9 100644 --- a/src/date.c +++ b/src/date.c @@ -1043,6 +1043,12 @@ static int isDate( } computeJD(p); if( p->isError || !validJulianDay(p->iJD) ) return 1; + if( argc==1 && p->validYMD && p->D>28 ){ + /* Make sure a YYYY-MM-DD is normalized. + ** Example: 2023-02-31 -> 2023-03-03 */ + assert( p->validJD ); + p->validYMD = 0; + } return 0; } diff --git a/test/date.test b/test/date.test index fb76dac8ac..19cecc2db3 100644 --- a/test/date.test +++ b/test/date.test @@ -146,6 +146,8 @@ datetest 2.49 {datetime('2003-10-22 12:24','0000 second')} {2003-10-22 12:24:00} datetest 2.50 {datetime('2003-10-22 12:24','0001 second')} {2003-10-22 12:24:01} datetest 2.51 {datetime('2003-10-22 12:24','nonsense')} NULL +datetest 2.60 {datetime('2023-02-31')} {2023-03-03 00:00:00} + datetest 3.1 {strftime('%d','2003-10-31 12:34:56.432')} 31 datetest 3.2.1 {strftime('pre%fpost','2003-10-31 12:34:56.432')} pre56.432post datetest 3.2.2 {strftime('%f','2003-10-31 12:34:59.9999999')} 59.999 @@ -452,6 +454,9 @@ datetest 13.31 {date('2001-01-01','+1.5 years')} {2002-07-02} datetest 13.32 {date('2002-01-01','+1.5 years')} {2003-07-02} datetest 13.33 {date('2002-01-01','-1.5 years')} {2000-07-02} datetest 13.34 {date('2001-01-01','-1.5 years')} {1999-07-02} +datetest 13.35 {date('2023-02-28')} {2023-02-28} +datetest 13.36 {date('2023-02-29')} {2023-03-01} +datetest 13.37 {date('2023-04-31')} {2023-05-01} # Test for issues reported by BareFeet (list.sql at tandb.com.au) # on mailing list on 2008-06-12. From ffdb479e7c45c8870cae7be57173ed1d55234302 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 21:51:34 +0000 Subject: [PATCH 233/242] Reimplement auto-extensions in Java for use with the JNI wrapper1 API. FossilOrigin-Name: 14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468 --- ext/jni/src/org/sqlite/jni/capi/CApi.java | 2 +- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 2 +- .../org/sqlite/jni/wrapper1/SqlFunction.java | 4 + .../src/org/sqlite/jni/wrapper1/Sqlite.java | 109 ++++++++++++++++-- .../src/org/sqlite/jni/wrapper1/Tester2.java | 77 +++++++++++++ manifest | 22 ++-- manifest.uuid | 2 +- 7 files changed, 194 insertions(+), 24 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index ef1ca17b22..79568e74ad 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -891,7 +891,7 @@ public final class CApi { } public static native boolean sqlite3_extended_result_codes( - @NotNull sqlite3 db, boolean onoff + @NotNull sqlite3 db, boolean on ); static native boolean sqlite3_get_autocommit(@NotNull long ptrToDb); diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index fdadb3e29d..479b5f72bc 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1419,7 +1419,7 @@ public class Tester1 implements Runnable { val.value = 0; final AutoExtensionCallback ax2 = new AutoExtensionCallback(){ - @Override public synchronized int call(sqlite3 db){ + @Override public int call(sqlite3 db){ ++val.value; return 0; } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java index 941800513d..b3317029c7 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java @@ -117,6 +117,10 @@ public interface SqlFunction { public void resultErrorCode(int rc){CApi.sqlite3_result_error_code(cx, rc);} public void resultObject(Object o){CApi.sqlite3_result_java_object(cx, o);} public void resultNull(){CApi.sqlite3_result_null(cx);} + /** + Analog to sqlite3_result_value(), using the Value object at the + given argument index. + */ public void resultArg(int argNdx){CApi.sqlite3_result_value(cx, valueAt(argNdx));} public void resultSubtype(int subtype){CApi.sqlite3_result_subtype(cx, subtype);} public void resultZeroBlob(long n){ diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 4f14253a3e..298b6ae55e 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -13,7 +13,6 @@ */ package org.sqlite.jni.wrapper1; import java.nio.charset.StandardCharsets; -import static org.sqlite.jni.capi.CApi.*; import org.sqlite.jni.capi.CApi; import org.sqlite.jni.capi.sqlite3; import org.sqlite.jni.capi.sqlite3_stmt; @@ -129,7 +128,7 @@ public final class Sqlite implements AutoCloseable { */ public static Sqlite open(String filename, int flags, String vfsName){ final OutputPointer.sqlite3 out = new OutputPointer.sqlite3(); - final int rc = sqlite3_open_v2(filename, out, flags, vfsName); + final int rc = CApi.sqlite3_open_v2(filename, out, flags, vfsName); final sqlite3 n = out.take(); if( 0!=rc ){ if( null==n ) throw new SqliteException(rc); @@ -137,10 +136,11 @@ public final class Sqlite implements AutoCloseable { n.close(); throw ex; } - Sqlite rv = new Sqlite(n); + final Sqlite rv = new Sqlite(n); synchronized(nativeToWrapper){ nativeToWrapper.put(n, rv); } + runAutoExtensions(rv); return rv; } @@ -149,7 +149,7 @@ public final class Sqlite implements AutoCloseable { } public static Sqlite open(String filename){ - return open(filename, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, null); + return open(filename, OPEN_READWRITE|OPEN_CREATE, null); } public static String libVersion(){ @@ -308,7 +308,7 @@ public final class Sqlite implements AutoCloseable { if( 0!=rc ){ if( CApi.SQLITE_NOMEM==rc ){ throw new OutOfMemoryError(); - }else if( null==db || 0==sqlite3_errcode(db)){ + }else if( null==db || 0==CApi.sqlite3_errcode(db)){ throw new SqliteException(rc); }else{ throw new SqliteException(db); @@ -343,7 +343,7 @@ public final class Sqlite implements AutoCloseable { */ public Stmt prepare(String sql, int prepFlags){ final OutputPointer.sqlite3_stmt out = new OutputPointer.sqlite3_stmt(); - final int rc = sqlite3_prepare_v3(thisDb(), sql, prepFlags, out); + final int rc = CApi.sqlite3_prepare_v3(thisDb(), sql, prepFlags, out); checkRc(rc); final sqlite3_stmt q = out.take(); if( null==q ){ @@ -724,7 +724,7 @@ public final class Sqlite implements AutoCloseable { synchronized(nativeToWrapper){ nativeToWrapper.remove(this.stmt); } - sqlite3_finalize(stmt); + CApi.sqlite3_finalize(stmt); stmt = null; _db = null; resultColCount = 0; @@ -745,8 +745,8 @@ public final class Sqlite implements AutoCloseable { private int checkRc(int rc){ switch(rc){ case 0: - case SQLITE_ROW: - case SQLITE_DONE: return rc; + case CApi.SQLITE_ROW: + case CApi.SQLITE_DONE: return rc; default: if( null==stmt ) throw new SqliteException(rc); else throw new SqliteException(this); @@ -759,7 +759,7 @@ public final class Sqlite implements AutoCloseable { result. */ public boolean step(){ - switch(checkRc(sqlite3_step(thisStmt()))){ + switch(checkRc(CApi.sqlite3_step(thisStmt()))){ case CApi.SQLITE_ROW: return true; case CApi.SQLITE_DONE: return false; default: @@ -930,4 +930,93 @@ public final class Sqlite implements AutoCloseable { } } /* Stmt class */ + /** + Interface for auto-extensions, as per the + sqlite3_auto_extension() API. + + Design note: the chicken/egg timing of auto-extension execution + requires that this feature be entirely re-implemented in Java + because the C-level API has no access to the Sqlite type so + cannot pass on an object of that type while the database is being + opened. One side effect of this reimplementation is that this + class's list of auto-extensions is 100% independent of the + C-level list so, e.g., clearAutoExtensions() will have no effect + on auto-extensions added via the C-level API and databases opened + from that level of API will not be passed to this level's + AutoExtension instances. + */ + public interface AutoExtension { + public void call(Sqlite db); + } + + private static final java.util.Set autoExtensions = + new java.util.LinkedHashSet<>(); + + /** + Passes db to all auto-extensions. If any one of them throws, + db.close() is called before the exception is propagated. + */ + private static void runAutoExtensions(Sqlite db){ + AutoExtension list[]; + synchronized(autoExtensions){ + /* Avoid that modifications to the AutoExtension list from within + auto-extensions affect this execution of this list. */ + list = autoExtensions.toArray(new AutoExtension[0]); + } + try { + for( AutoExtension ax : list ) ax.call(db); + }catch(Exception e){ + db.close(); + throw e; + } + } + + /** + Analog to sqlite3_auto_extension(), adds the given object to the + list of auto-extensions if it is not already in that list. The + given object will be run as part of Sqlite.open(), and passed the + being-opened database. If the extension throws then open() will + fail. + + This API does not guaranty whether or not manipulations made to + the auto-extension list from within auto-extension callbacks will + affect the current traversal of the auto-extension list. Whether + or not they do is unspecified and subject to change between + versions. e.g. if an AutoExtension calls addAutoExtension(), + whether or not the new extension will be run on the being-opened + database is undefined. + + Note that calling Sqlite.open() from an auto-extension will + necessarily result in recursion loop and (eventually) a stack + overflow. + */ + public static void addAutoExtension( AutoExtension e ){ + if( null==e ){ + throw new IllegalArgumentException("AutoExtension may not be null."); + } + synchronized(autoExtensions){ + autoExtensions.add(e); + } + } + + /** + Removes the given object from the auto-extension list if it is in + that list, otherwise this has no side-effects beyond briefly + locking that list. + */ + public static void removeAutoExtension( AutoExtension e ){ + synchronized(autoExtensions){ + autoExtensions.remove(e); + } + } + + /** + Removes all auto-extensions which were added via addAutoExtension(). + */ + public static void clearAutoExtensions(){ + synchronized(autoExtensions){ + autoExtensions.clear(); + } + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 5f991da4d3..4402ea6b3a 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -526,6 +526,83 @@ public class Tester2 implements Runnable { db.close(); } + @SingleThreadOnly /* because multiple threads legitimately make these + results unpredictable */ + private synchronized void testAutoExtension(){ + final ValueHolder val = new ValueHolder<>(0); + final ValueHolder toss = new ValueHolder<>(null); + final Sqlite.AutoExtension ax = new Sqlite.AutoExtension(){ + @Override public void call(Sqlite db){ + ++val.value; + if( null!=toss.value ){ + throw new RuntimeException(toss.value); + } + } + }; + Sqlite.addAutoExtension(ax); + openDb().close(); + affirm( 1==val.value ); + openDb().close(); + affirm( 2==val.value ); + Sqlite.clearAutoExtensions(); + openDb().close(); + affirm( 2==val.value ); + + Sqlite.addAutoExtension( ax ); + Sqlite.addAutoExtension( ax ); // Must not add a second entry + Sqlite.addAutoExtension( ax ); // or a third one + openDb().close(); + affirm( 3==val.value ); + + Sqlite db = openDb(); + affirm( 4==val.value ); + execSql(db, "ATTACH ':memory:' as foo"); + affirm( 4==val.value, "ATTACH uses the same connection, not sub-connections." ); + db.close(); + db = null; + + Sqlite.removeAutoExtension(ax); + openDb().close(); + affirm( 4==val.value ); + Sqlite.addAutoExtension(ax); + Exception err = null; + toss.value = "Throwing from auto_extension."; + try{ + openDb(); + }catch(Exception e){ + err = e; + } + affirm( err!=null ); + affirm( err.getMessage().indexOf(toss.value)>=0 ); + toss.value = null; + + val.value = 0; + final Sqlite.AutoExtension ax2 = new Sqlite.AutoExtension(){ + @Override public void call(Sqlite db){ + ++val.value; + } + }; + Sqlite.addAutoExtension(ax2); + openDb().close(); + affirm( 2 == val.value ); + Sqlite.removeAutoExtension(ax); + openDb().close(); + affirm( 3 == val.value ); + Sqlite.addAutoExtension(ax); + openDb().close(); + affirm( 5 == val.value ); + Sqlite.removeAutoExtension(ax2); + openDb().close(); + affirm( 6 == val.value ); + Sqlite.addAutoExtension(ax2); + openDb().close(); + affirm( 8 == val.value ); + + Sqlite.clearAutoExtensions(); + openDb().close(); + affirm( 8 == val.value ); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index eacc52b68c..23488e42ad 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Ensure\sthat\sthe\sYYYY-MM-DD\sinput\sto\sdate\sand\stime\sfunctions\shas\sbeen\snormalized\nprior\sto\sreturning\sa\sresult.\n[forum:/forumpost/6bb476897e|Forum\spost\s6bb476897e]. -D 2023-11-04T21:44:00.659 +C Reimplement\sauto-extensions\sin\sJava\sfor\suse\swith\sthe\sJNI\swrapper1\sAPI. +D 2023-11-04T21:51:34.589 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java d21e6c1c4557ae18bbc2eefb0882efdb36fdaecdc58823c142def994327a365b +F ext/jni/src/org/sqlite/jni/capi/CApi.java 4043d709626079cce6d524ef49122b934c043022bd88bc1e72eb697ac8df86e7 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 41e2b910a11dfdd4cc39ab608492d7c12f3791e85ac7f9d75d5445f7645a5e57 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 96c27ae10ec44ce5f6a150e8bc6525d86ab2d9118da18649943a0bf4d8d206ce F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -295,10 +295,10 @@ F ext/jni/src/org/sqlite/jni/fts5/fts5_tokenizer.java 92bdaa3893bd684533004d64ad F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe59004a1485311c50a13edbf18c79a6ff9160030e F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 -F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java e787f5f36d5832fe3c7a000a8609eb0629fb160b95f8f25566df13e72e6f5470 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3e813aa4a680948a1885a5df1537c9245b3b7362aaf6aa31f679640e81da020e +F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3da22cb18d8544fff1c7184aeaa2516c20d63e8a31db848eb7470ce285b284dc F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 96d7908da8bad591aff8f192cb83e038fd5861ef4601726eeda24905422718c9 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 03638a1774a95bcc7b5de440a5f1398720460e30fc480032a2e8be24e997d30c F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566 -R 0a52dbd298d991529b412673e9dc7eb5 -U drh -Z 33b6056e932d878d8676b163d8b94db2 +P b692eb8ccb2d0645599ad73a8bdacf5df499114244aadeb38aabc580fc4dc7c5 +R 99817a8518af3f567a07823f0172a1fb +U stephan +Z 276f4a4bca9307a54b6144f3c8e4f323 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index a2ff9c7a2a..89c3bcfb2b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b692eb8ccb2d0645599ad73a8bdacf5df499114244aadeb38aabc580fc4dc7c5 \ No newline at end of file +14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468 \ No newline at end of file From dc8a684c11113b9e2ce8fa5c0372f57fcd8c7869 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 22:47:40 +0000 Subject: [PATCH 234/242] Wrap the sqlite3_backup API in the JNI wrapper1 API. FossilOrigin-Name: 3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2 --- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 119 ++++++++++++++++-- .../src/org/sqlite/jni/wrapper1/Tester2.java | 35 ++++++ manifest | 14 +-- manifest.uuid | 2 +- 4 files changed, 154 insertions(+), 16 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 298b6ae55e..85b5460f34 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -16,6 +16,7 @@ import java.nio.charset.StandardCharsets; import org.sqlite.jni.capi.CApi; import org.sqlite.jni.capi.sqlite3; import org.sqlite.jni.capi.sqlite3_stmt; +import org.sqlite.jni.capi.sqlite3_backup; import org.sqlite.jni.capi.OutputPointer; /** @@ -767,14 +768,6 @@ public final class Sqlite implements AutoCloseable { "This \"cannot happen\": all possible result codes were checked already." ); } - /* - Potential signature change TODO: - - boolean step() - - Returning true for SQLITE_ROW and false for anything else. - Those semantics have proven useful in the WASM/JS bindings. - */ } /** @@ -1019,4 +1012,114 @@ public final class Sqlite implements AutoCloseable { } } + /** + Encapsulates state related to the sqlite3 backup API. Use + Sqlite.initBackup() to create new instances. + */ + public static final class Backup implements AutoCloseable { + private sqlite3_backup b = null; + private Sqlite dbTo = null; + private Sqlite dbFrom = null; + + + public static final int DONE = CApi.SQLITE_DONE; + public static final int BUSY = CApi.SQLITE_BUSY; + public static final int LOCKED = CApi.SQLITE_LOCKED; + + Backup(Sqlite dbDest, String schemaDest,Sqlite dbSrc, String schemaSrc){ + this.dbTo = dbDest; + this.dbFrom = dbSrc; + b = CApi.sqlite3_backup_init(dbDest.nativeHandle(), schemaDest, + dbSrc.nativeHandle(), schemaSrc); + if(null==b) toss(); + } + + private void toss(){ + int rc = CApi.sqlite3_errcode(dbTo.nativeHandle()); + if(0!=rc) throw new SqliteException(dbTo); + rc = CApi.sqlite3_errcode(dbFrom.nativeHandle()); + if(0!=rc) throw new SqliteException(dbFrom); + throw new SqliteException(CApi.SQLITE_ERROR); + } + + private sqlite3_backup getNative(){ + if( null==b ) throw new IllegalStateException("This Backup is already closed."); + return b; + } + /** + If this backup is still active, this completes the backup and + frees its native resources, otherwise it this is a no-op. + */ + public void finish(){ + if( null!=b ){ + CApi.sqlite3_backup_finish(b); + b = null; + dbTo = null; + dbFrom = null; + } + } + + /** Equivalent to finish(). */ + @Override public void close(){ + this.finish(); + } + + /** + Analog to sqlite3_backup_step(). Returns 0 if stepping succeeds + or, DONE if the end is reached, BUSY if one of the databases is + busy, LOCKED if one of the databases is locked, and throws for + any other result code or if this object has been closed. Note + that BUSY and LOCKED are not necessarily permanent errors, so + do not trigger an exception. + */ + public int step(int pageCount){ + final int rc = CApi.sqlite3_backup_step(getNative(), pageCount); + switch(rc){ + case 0: + case DONE: + case BUSY: + case LOCKED: + return rc; + default: + toss(); + return CApi.SQLITE_ERROR/*not reached*/; + } + } + + /** + Analog to sqlite3_backup_pagecount(). + */ + public int pageCount(){ + return CApi.sqlite3_backup_pagecount(getNative()); + } + + /** + Analog to sqlite3_backup_remaining(). + */ + public int remaining(){ + return CApi.sqlite3_backup_remaining(getNative()); + } + } + + /** + Analog to sqlite3_backup_init(). If schemaSrc is null, "main" is + assumed. Throws if either this db or dbSrc (the source db) are + not opened, if either of schemaDest or schemaSrc are null, or if + the underlying call to sqlite3_backup_init() fails. + + The returned object must eventually be cleaned up by either + arranging for it to be auto-closed (e.g. using + try-with-resources) or by calling its finish() method. + */ + public Backup initBackup(String schemaDest, Sqlite dbSrc, String schemaSrc){ + thisDb(); + dbSrc.thisDb(); + if( null==schemaSrc || null==schemaDest ){ + throw new IllegalArgumentException( + "Neither the source nor destination schema name may be null." + ); + } + return new Backup(this, schemaDest, dbSrc, schemaSrc); + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 4402ea6b3a..d305d6b719 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -603,6 +603,41 @@ public class Tester2 implements Runnable { affirm( 8 == val.value ); } + private void testBackup(){ + final Sqlite dbDest = openDb(); + + try (Sqlite dbSrc = openDb()) { + execSql(dbSrc, new String[]{ + "pragma page_size=512; VACUUM;", + "create table t(a);", + "insert into t(a) values(1),(2),(3);" + }); + Exception e = null; + try { + dbSrc.initBackup("main",dbSrc,"main"); + }catch(Exception x){ + e = x; + } + affirm( e instanceof SqliteException ); + e = null; + try (Sqlite.Backup b = dbDest.initBackup("main",dbSrc,"main")) { + affirm( null!=b ); + int rc; + while( Sqlite.Backup.DONE!=(rc = b.step(1)) ){ + affirm( 0==rc ); + } + affirm( b.pageCount() > 0 ); + b.finish(); + } + } + + try (Sqlite.Stmt q = dbDest.prepare("SELECT sum(a) from t")) { + q.step(); + affirm( q.columnInt(0) == 6 ); + } + dbDest.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 23488e42ad..234186ce10 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reimplement\sauto-extensions\sin\sJava\sfor\suse\swith\sthe\sJNI\swrapper1\sAPI. -D 2023-11-04T21:51:34.589 +C Wrap\sthe\ssqlite3_backup\sAPI\sin\sthe\sJNI\swrapper1\sAPI. +D 2023-11-04T22:47:40.514 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 3da22cb18d8544fff1c7184aeaa2516c20d63e8a31db848eb7470ce285b284dc +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 8dd4cce0f0a42542af768a73c3c9e7bebd1c77207a35ba93de86c97d4c572847 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 03638a1774a95bcc7b5de440a5f1398720460e30fc480032a2e8be24e997d30c +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 3c2eda2efe45a051e371ba98abee34f51ceec3bb7d28dfde866646b650fcb426 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b692eb8ccb2d0645599ad73a8bdacf5df499114244aadeb38aabc580fc4dc7c5 -R 99817a8518af3f567a07823f0172a1fb +P 14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468 +R 631890601bc1abeba3be592d27b2aeb0 U stephan -Z 276f4a4bca9307a54b6144f3c8e4f323 +Z 39a1f06f24f0b71c35deac1228d090c6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 89c3bcfb2b..5235b01fd9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468 \ No newline at end of file +3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2 \ No newline at end of file From 15d38c0ddeb98168e0bca78a6a15d99f7092e225 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 4 Nov 2023 23:37:11 +0000 Subject: [PATCH 235/242] Bind collation and collation-needed to JNI wrapper1 and correct the callback return type for collation-needed callbacks in the lower-level JNI binding. FossilOrigin-Name: 0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe --- ext/jni/src/c/sqlite3-jni.c | 2 +- .../jni/capi/CollationNeededCallback.java | 7 +- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 4 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 97 +++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 61 ++++++++++++ manifest | 20 ++-- manifest.uuid | 2 +- 7 files changed, 176 insertions(+), 17 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index e6b0750cbd..bf4e73b7c3 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2817,7 +2817,7 @@ S3JniApi(sqlite3_collation_needed(),jint,1collation_1needed)( }else{ jclass const klazz = (*env)->GetObjectClass(env, jHook); jmethodID const xCallback = (*env)->GetMethodID( - env, klazz, "call", "(Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I" + env, klazz, "call", "(Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)V" ); S3JniUnrefLocal(klazz); S3JniIfThrew { diff --git a/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java b/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java index fe61fe5065..ffd7fa94ab 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java @@ -21,8 +21,9 @@ public interface CollationNeededCallback extends CallbackProxy { Has the same semantics as the C-level sqlite3_create_collation() callback. -

    If it throws, the exception message is passed on to the db and - the exception is suppressed. +

    Because the C API has no mechanism for reporting errors + from this callbacks, any exceptions thrown by this callback + are suppressed. */ - int call(sqlite3 db, int eTextRep, String collationName); + void call(sqlite3 db, int eTextRep, String collationName); } diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 479b5f72bc..b97d568de8 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -593,9 +593,9 @@ public class Tester1 implements Runnable { }; final CollationNeededCallback collLoader = new CollationNeededCallback(){ @Override - public int call(sqlite3 dbArg, int eTextRep, String collationName){ + public void call(sqlite3 dbArg, int eTextRep, String collationName){ affirm(dbArg == db/* as opposed to a temporary object*/); - return sqlite3_create_collation(dbArg, "reversi", eTextRep, myCollation); + sqlite3_create_collation(dbArg, "reversi", eTextRep, myCollation); } }; int rc = sqlite3_collation_needed(db, collLoader); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 85b5460f34..80122cd350 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -100,6 +100,13 @@ public final class Sqlite implements AutoCloseable { public static final int DBCONFIG_STMT_SCANSTATUS = CApi.SQLITE_DBCONFIG_STMT_SCANSTATUS; public static final int DBCONFIG_REVERSE_SCANORDER = CApi.SQLITE_DBCONFIG_REVERSE_SCANORDER; + public static final int UTF8 = CApi.SQLITE_UTF8; + public static final int UTF16 = CApi.SQLITE_UTF16; + public static final int UTF16LE = CApi.SQLITE_UTF16LE; + public static final int UTF16BE = CApi.SQLITE_UTF16BE; + /* We elide the UTF16_ALIGNED from this interface because it + is irrelevant for the Java interface. */ + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; @@ -1122,4 +1129,94 @@ public final class Sqlite implements AutoCloseable { return new Backup(this, schemaDest, dbSrc, schemaSrc); } + + /** + Callback type for use with createCollation(). + */ + public interface Collation { + /** + Called by the SQLite core to compare inputs. Implementations + must compare its two arguments using memcmp(3) semantics. + + Warning: the SQLite core has no mechanism for reporting errors + from custom collations and its workflow does not accommodate + propagation of exceptions from callbacks. Any exceptions thrown + from collations will be silently supressed and sorting results + will be unpredictable. + */ + int call(byte[] lhs, byte[] rhs); + } + + /** + Analog to sqlite3_create_collation(). + + Throws if name is null or empty, c is null, or the encoding flag + is invalid. The encoding must be one of the UTF8, UTF16, UTF16LE, + or UTF16BE constants. + */ + public void createCollation(String name, int encoding, Collation c){ + thisDb(); + if( null==name || 0==name.length()){ + throw new IllegalArgumentException("Collation name may not be null or empty."); + } + if( null==c ){ + throw new IllegalArgumentException("Collation may not be null."); + } + switch(encoding){ + case UTF8: + case UTF16: + case UTF16LE: + case UTF16BE: + break; + default: + throw new IllegalArgumentException("Invalid Collation encoding."); + } + checkRc( + CApi.sqlite3_create_collation( + thisDb(), name, encoding, new org.sqlite.jni.capi.CollationCallback(){ + @Override public int call(byte[] lhs, byte[] rhs){ + try{return c.call(lhs, rhs);} + catch(Exception e){return 0;} + } + @Override public void xDestroy(){} + } + ) + ); + } + + /** + Callback for use with onCollationNeeded(). + */ + public interface CollationNeeded { + /** + Must behave as documented for the callback for + sqlite3_collation_needed(). + + Warning: the C API has no mechanism for reporting or + propagating errors from this callback, so any exceptions it + throws are suppressed. + */ + void call(Sqlite db, int encoding, String collationName); + } + + /** + Sets up the given object to be called by the SQLite core when it + encounters a collation name which it does not know. Pass a null + object to disconnect the object from the core. This replaces any + existing collation-needed loader, or is a no-op if the given + object is already registered. Throws if registering the loader + fails. + */ + public void onCollationNeeded( CollationNeeded cn ){ + org.sqlite.jni.capi.CollationNeededCallback cnc = null; + if( null!=cn ){ + cnc = new org.sqlite.jni.capi.CollationNeededCallback(){ + @Override public void call(sqlite3 db, int encoding, String collationName){ + final Sqlite xdb = Sqlite.fromNative(db); + if(null!=xdb) cn.call(xdb, encoding, collationName); + } + }; + } + checkRc( CApi.sqlite3_collation_needed(thisDb(), cnc) ); + } } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index d305d6b719..6ca0be5d17 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -638,6 +638,67 @@ public class Tester2 implements Runnable { dbDest.close(); } + private void testCollation(){ + final Sqlite db = openDb(); + execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')"); + final Sqlite.Collation myCollation = new Sqlite.Collation() { + private String myState = + "this is local state. There is much like it, but this is mine."; + @Override + // Reverse-sorts its inputs... + public int call(byte[] lhs, byte[] rhs){ + int len = lhs.length > rhs.length ? rhs.length : lhs.length; + int c = 0, i = 0; + for(i = 0; i < len; ++i){ + c = lhs[i] - rhs[i]; + if(0 != c) break; + } + if(0==c){ + if(i < lhs.length) c = 1; + else if(i < rhs.length) c = -1; + } + return -c; + } + }; + final Sqlite.CollationNeeded collLoader = new Sqlite.CollationNeeded(){ + @Override + public void call(Sqlite dbArg, int eTextRep, String collationName){ + affirm(dbArg == db); + db.createCollation("reversi", eTextRep, myCollation); + } + }; + db.onCollationNeeded(collLoader); + Sqlite.Stmt stmt = db.prepare("SELECT a FROM t ORDER BY a COLLATE reversi"); + int counter = 0; + while( stmt.step() ){ + final String val = stmt.columnText16(0); + ++counter; + switch(counter){ + case 1: affirm("c".equals(val)); break; + case 2: affirm("b".equals(val)); break; + case 3: affirm("a".equals(val)); break; + } + } + affirm(3 == counter); + stmt.finalizeStmt(); + stmt = db.prepare("SELECT a FROM t ORDER BY a"); + counter = 0; + while( stmt.step() ){ + final String val = stmt.columnText16(0); + ++counter; + //outln("Non-REVERSI'd row#"+counter+": "+val); + switch(counter){ + case 3: affirm("c".equals(val)); break; + case 2: affirm("b".equals(val)); break; + case 1: affirm("a".equals(val)); break; + } + } + affirm(3 == counter); + stmt.finalizeStmt(); + db.onCollationNeeded(null); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 234186ce10..2453b24fde 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Wrap\sthe\ssqlite3_backup\sAPI\sin\sthe\sJNI\swrapper1\sAPI. -D 2023-11-04T22:47:40.514 +C Bind\scollation\sand\scollation-needed\sto\sJNI\swrapper1\sand\scorrect\sthe\scallback\sreturn\stype\sfor\scollation-needed\scallbacks\sin\sthe\slower-level\sJNI\sbinding. +D 2023-11-04T23:37:11.738 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -241,7 +241,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 53493819418048bfdc8e6f505954c7e692d4666b64c3ae732ea8319c91aac747 +F ext/jni/src/c/sqlite3-jni.c 931a7320f5b5745034b4fd61027ea7cc29559856e6da613e4fdcf01ef102e710 F ext/jni/src/c/sqlite3-jni.h 1c45fd4689cec42f3d84d2fee41bb494016a12fcb5fd80291095590666a14015 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba @@ -254,7 +254,7 @@ F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04 F ext/jni/src/org/sqlite/jni/capi/CApi.java 4043d709626079cce6d524ef49122b934c043022bd88bc1e72eb697ac8df86e7 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a -F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java f81cf10b79c52f9b2e9247d523d29ae48863935f60420eae35f257c38c80ce95 +F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4 F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbeeb56315d15b13d8752b0fdbca705f31bd4366c58d8a33 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 96c27ae10ec44ce5f6a150e8bc6525d86ab2d9118da18649943a0bf4d8d206ce +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8823d962f283aa7af5878d1a87b759ca03e1c9519ae692077f785eab81c86f3f F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 8dd4cce0f0a42542af768a73c3c9e7bebd1c77207a35ba93de86c97d4c572847 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 6a861cfc8b3284c07cf2fa88916deab27f98e9e4234fae1bed1917c933c64083 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 3c2eda2efe45a051e371ba98abee34f51ceec3bb7d28dfde866646b650fcb426 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java a4e4b0b8ee0d56a383fd57b24244c6f93f8a0fe2e2ba5faacc0a3331f8d3fc84 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468 -R 631890601bc1abeba3be592d27b2aeb0 +P 3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2 +R ef3119e103f71f255ed5e129f7bdb70b U stephan -Z 39a1f06f24f0b71c35deac1228d090c6 +Z 99a7727c5c06597d0eb0c0df96988bd8 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5235b01fd9..48f7c632aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2 \ No newline at end of file +0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe \ No newline at end of file From b02ca781ad2e8e375ccce4c1259a9b466eac0f68 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 00:02:47 +0000 Subject: [PATCH 236/242] Add busy-handler support to JNI wrapper1. FossilOrigin-Name: dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20 --- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 83 +++++++++---------- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 68 +++++++++++---- .../src/org/sqlite/jni/wrapper1/Tester2.java | 40 ++++++++- manifest | 16 ++-- manifest.uuid | 2 +- 5 files changed, 140 insertions(+), 69 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index b97d568de8..48ab031466 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1031,49 +1031,48 @@ public class Tester1 implements Runnable { @SingleThreadOnly /* because threads inherently break this test */ private static void testBusy(){ final String dbName = "_busy-handler.db"; - final OutputPointer.sqlite3 outDb = new OutputPointer.sqlite3(); - final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt(); - - int rc = sqlite3_open(dbName, outDb); - ++metrics.dbOpen; - affirm( 0 == rc ); - final sqlite3 db1 = outDb.get(); - execSql(db1, "CREATE TABLE IF NOT EXISTS t(a)"); - rc = sqlite3_open(dbName, outDb); - ++metrics.dbOpen; - affirm( 0 == rc ); - affirm( outDb.get() != db1 ); - final sqlite3 db2 = outDb.get(); - - affirm( "main".equals( sqlite3_db_name(db1, 0) ) ); - rc = sqlite3_db_config(db1, SQLITE_DBCONFIG_MAINDBNAME, "foo"); - affirm( sqlite3_db_filename(db1, "foo").endsWith(dbName) ); - affirm( "foo".equals( sqlite3_db_name(db1, 0) ) ); - affirm( SQLITE_MISUSE == sqlite3_db_config(db1, 0, 0, null) ); - - final ValueHolder xBusyCalled = new ValueHolder<>(0); - BusyHandlerCallback handler = new BusyHandlerCallback(){ - @Override public int call(int n){ - //outln("busy handler #"+n); - return n > 2 ? 0 : ++xBusyCalled.value; - } - }; - rc = sqlite3_busy_handler(db2, handler); - affirm(0 == rc); - - // Force a locked condition... - execSql(db1, "BEGIN EXCLUSIVE"); - rc = sqlite3_prepare_v2(db2, "SELECT * from t", outStmt); - affirm( SQLITE_BUSY == rc); - affirm( null == outStmt.get() ); - affirm( 3 == xBusyCalled.value ); - sqlite3_close_v2(db1); - sqlite3_close_v2(db2); try{ - final java.io.File f = new java.io.File(dbName); - f.delete(); - }catch(Exception e){ - /* ignore */ + final OutputPointer.sqlite3 outDb = new OutputPointer.sqlite3(); + final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt(); + + int rc = sqlite3_open(dbName, outDb); + ++metrics.dbOpen; + affirm( 0 == rc ); + final sqlite3 db1 = outDb.get(); + execSql(db1, "CREATE TABLE IF NOT EXISTS t(a)"); + rc = sqlite3_open(dbName, outDb); + ++metrics.dbOpen; + affirm( 0 == rc ); + affirm( outDb.get() != db1 ); + final sqlite3 db2 = outDb.get(); + + affirm( "main".equals( sqlite3_db_name(db1, 0) ) ); + rc = sqlite3_db_config(db1, SQLITE_DBCONFIG_MAINDBNAME, "foo"); + affirm( sqlite3_db_filename(db1, "foo").endsWith(dbName) ); + affirm( "foo".equals( sqlite3_db_name(db1, 0) ) ); + affirm( SQLITE_MISUSE == sqlite3_db_config(db1, 0, 0, null) ); + + final ValueHolder xBusyCalled = new ValueHolder<>(0); + BusyHandlerCallback handler = new BusyHandlerCallback(){ + @Override public int call(int n){ + //outln("busy handler #"+n); + return n > 2 ? 0 : ++xBusyCalled.value; + } + }; + rc = sqlite3_busy_handler(db2, handler); + affirm(0 == rc); + + // Force a locked condition... + execSql(db1, "BEGIN EXCLUSIVE"); + rc = sqlite3_prepare_v2(db2, "SELECT * from t", outStmt); + affirm( SQLITE_BUSY == rc); + affirm( null == outStmt.get() ); + affirm( 3 == xBusyCalled.value ); + sqlite3_close_v2(db1); + sqlite3_close_v2(db2); + }finally{ + try{(new java.io.File(dbName)).delete();} + catch(Exception e){/* ignore */} } } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 80122cd350..ffbc695242 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -32,6 +32,7 @@ public final class Sqlite implements AutoCloseable { public static final int OPEN_READWRITE = CApi.SQLITE_OPEN_READWRITE; public static final int OPEN_CREATE = CApi.SQLITE_OPEN_CREATE; public static final int OPEN_EXRESCODE = CApi.SQLITE_OPEN_EXRESCODE; + public static final int TXN_NONE = CApi.SQLITE_TXN_NONE; public static final int TXN_READ = CApi.SQLITE_TXN_READ; public static final int TXN_WRITE = CApi.SQLITE_TXN_WRITE; @@ -107,6 +108,10 @@ public final class Sqlite implements AutoCloseable { /* We elide the UTF16_ALIGNED from this interface because it is irrelevant for the Java interface. */ + public static final int DONE = CApi.SQLITE_DONE; + public static final int BUSY = CApi.SQLITE_BUSY; + public static final int LOCKED = CApi.SQLITE_LOCKED; + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; @@ -430,10 +435,6 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_get_autocommit(thisDb()); } - public void setBusyTimeout(int ms){ - checkRc(CApi.sqlite3_busy_timeout(thisDb(), ms)); - } - /** Analog to sqlite3_txn_state(). Returns one of TXN_NONE, TXN_READ, or TXN_WRITE to denote this database's current transaction state @@ -1028,11 +1029,6 @@ public final class Sqlite implements AutoCloseable { private Sqlite dbTo = null; private Sqlite dbFrom = null; - - public static final int DONE = CApi.SQLITE_DONE; - public static final int BUSY = CApi.SQLITE_BUSY; - public static final int LOCKED = CApi.SQLITE_LOCKED; - Backup(Sqlite dbDest, String schemaDest,Sqlite dbSrc, String schemaSrc){ this.dbTo = dbDest; this.dbFrom = dbSrc; @@ -1073,19 +1069,19 @@ public final class Sqlite implements AutoCloseable { /** Analog to sqlite3_backup_step(). Returns 0 if stepping succeeds - or, DONE if the end is reached, BUSY if one of the databases is - busy, LOCKED if one of the databases is locked, and throws for - any other result code or if this object has been closed. Note - that BUSY and LOCKED are not necessarily permanent errors, so - do not trigger an exception. + or, Sqlite.DONE if the end is reached, Sqlite.BUSY if one of + the databases is busy, Sqlite.LOCKED if one of the databases is + locked, and throws for any other result code or if this object + has been closed. Note that BUSY and LOCKED are not necessarily + permanent errors, so do not trigger an exception. */ public int step(int pageCount){ final int rc = CApi.sqlite3_backup_step(getNative(), pageCount); switch(rc){ case 0: - case DONE: - case BUSY: - case LOCKED: + case Sqlite.DONE: + case Sqlite.BUSY: + case Sqlite.LOCKED: return rc; default: toss(); @@ -1219,4 +1215,42 @@ public final class Sqlite implements AutoCloseable { } checkRc( CApi.sqlite3_collation_needed(thisDb(), cnc) ); } + + /** + Callback for use with busyHandler(). + */ + public interface BusyHandler { + /** + Must function as documented for the C-level + sqlite3_busy_handler() callback argument, minus the (void*) + argument the C-level function requires. + + If this function throws, it is translated to a database-level + error. + */ + int call(int n); + } + + /** + Analog to sqlite3_busy_timeout(). + */ + public void setBusyTimeout(int ms){ + checkRc(CApi.sqlite3_busy_timeout(thisDb(), ms)); + } + + /** + Analog to sqlite3_busy_handler(). If b is null then any + current handler is cleared. + */ + void setBusyHandler( BusyHandler b ){ + org.sqlite.jni.capi.BusyHandlerCallback bhc = null; + if( null!=b ){ + bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){ + @Override public int call(int n){ + return b.call(n); + } + }; + } + checkRc( CApi.sqlite3_busy_handler(thisDb(), bhc) ); + } } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 6ca0be5d17..3a00c0953f 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -623,7 +623,7 @@ public class Tester2 implements Runnable { try (Sqlite.Backup b = dbDest.initBackup("main",dbSrc,"main")) { affirm( null!=b ); int rc; - while( Sqlite.Backup.DONE!=(rc = b.step(1)) ){ + while( Sqlite.DONE!=(rc = b.step(1)) ){ affirm( 0==rc ); } affirm( b.pageCount() > 0 ); @@ -699,6 +699,44 @@ public class Tester2 implements Runnable { db.close(); } + @SingleThreadOnly /* because threads inherently break this test */ + private void testBusy(){ + final String dbName = "_busy-handler.db"; + try{ + Sqlite db1 = openDb(dbName); + ++metrics.dbOpen; + execSql(db1, "CREATE TABLE IF NOT EXISTS t(a)"); + Sqlite db2 = openDb(dbName); + ++metrics.dbOpen; + + final ValueHolder xBusyCalled = new ValueHolder<>(0); + Sqlite.BusyHandler handler = new Sqlite.BusyHandler(){ + @Override public int call(int n){ + return n > 2 ? 0 : ++xBusyCalled.value; + } + }; + db2.setBusyHandler(handler); + + // Force a locked condition... + execSql(db1, "BEGIN EXCLUSIVE"); + int rc = 0; + SqliteException ex = null; + try{ + db2.prepare("SELECT * from t"); + }catch(SqliteException x){ + ex = x; + } + affirm( null!=ex ); + affirm( Sqlite.BUSY == ex.errcode() ); + affirm( 3 == xBusyCalled.value ); + db1.close(); + db2.close(); + }finally{ + try{(new java.io.File(dbName)).delete();} + catch(Exception e){/* ignore */} + } + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 2453b24fde..0cdcd1cfcd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bind\scollation\sand\scollation-needed\sto\sJNI\swrapper1\sand\scorrect\sthe\scallback\sreturn\stype\sfor\scollation-needed\scallbacks\sin\sthe\slower-level\sJNI\sbinding. -D 2023-11-04T23:37:11.738 +C Add\sbusy-handler\ssupport\sto\sJNI\swrapper1. +D 2023-11-05T00:02:47.384 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 8823d962f283aa7af5878d1a87b759ca03e1c9519ae692077f785eab81c86f3f +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 4bb5e62907a422a80a0fccbcb83085e9163c2c245451312a62c7550a45d16683 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 6a861cfc8b3284c07cf2fa88916deab27f98e9e4234fae1bed1917c933c64083 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java c930ca964f605ba8f175d3b0c85099d7f93069b59bf825929c9eef9e68ac96c5 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java a4e4b0b8ee0d56a383fd57b24244c6f93f8a0fe2e2ba5faacc0a3331f8d3fc84 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 6f5fae3c3827ca42ef124c319b24907483aadda69b7453173f7807e0a94f33dd F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2 -R ef3119e103f71f255ed5e129f7bdb70b +P 0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe +R 2dabe33af17a981e8c8323ecd84b4487 U stephan -Z 99a7727c5c06597d0eb0c0df96988bd8 +Z c2d53a448e9f555de7ff26068d4eba40 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 48f7c632aa..97de8be89b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe \ No newline at end of file +dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20 \ No newline at end of file From 2c930e3b86028a108cab9008b75665d32cdd11c5 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 00:48:43 +0000 Subject: [PATCH 237/242] Add commit/rollback hook support to JNI wrapper1. FossilOrigin-Name: ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8 --- ext/jni/src/c/sqlite3-jni.c | 5 +- .../sqlite/jni/capi/CommitHookCallback.java | 3 +- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 3 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 101 ++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 81 ++++++++++++++ manifest | 20 ++-- manifest.uuid | 2 +- 7 files changed, 201 insertions(+), 14 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index bf4e73b7c3..0d60e49d13 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -2942,7 +2942,10 @@ static int s3jni_commit_rollback_hook_impl(int isCommit, S3JniDb * const ps){ ? (int)(*env)->CallIntMethod(env, hook.jObj, hook.midCallback) : (int)((*env)->CallVoidMethod(env, hook.jObj, hook.midCallback), 0); S3JniIfThrew{ - rc = s3jni_db_exception(ps->pDb, SQLITE_ERROR, "hook callback threw"); + rc = s3jni_db_exception(ps->pDb, SQLITE_ERROR, + isCommit + ? "Commit hook callback threw" + : "Rollback hook callback threw"); } S3JniHook_localundup(hook); } diff --git a/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java index 24373bdf2b..e1e55c78d2 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java @@ -19,7 +19,8 @@ package org.sqlite.jni.capi; public interface CommitHookCallback extends CallbackProxy { /** Works as documented for the C-level sqlite3_commit_hook() - callback. Must not throw. + callback. If it throws, the exception is translated into + a db-level error. */ int call(); } diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 48ab031466..4a8ceb1812 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1096,6 +1096,7 @@ public class Tester1 implements Runnable { private void testCommitHook(){ final sqlite3 db = createNewDb(); + sqlite3_extended_result_codes(db, true); final ValueHolder counter = new ValueHolder<>(0); final ValueHolder hookResult = new ValueHolder<>(0); final CommitHookCallback theHook = new CommitHookCallback(){ @@ -1138,7 +1139,7 @@ public class Tester1 implements Runnable { affirm( 5 == counter.value ); hookResult.value = SQLITE_ERROR; int rc = execSql(db, false, "BEGIN; update t set a='j' where a='i'; COMMIT;"); - affirm( SQLITE_CONSTRAINT == rc ); + affirm( SQLITE_CONSTRAINT_COMMITHOOK == rc ); affirm( 6 == counter.value ); sqlite3_close_v2(db); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index ffbc695242..dcd475ea68 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -1253,4 +1253,105 @@ public final class Sqlite implements AutoCloseable { } checkRc( CApi.sqlite3_busy_handler(thisDb(), bhc) ); } + + public interface CommitHook { + /** + Must behave as documented for the C-level sqlite3_commit_hook() + callback. If it throws, the exception is translated into + a db-level error. + */ + int call(); + } + + /** + A level of indirection to permit setCommitHook() to have similar + semantics as the C API, returning the previous hook. The caveat + is that if the low-level API is used to install a hook, it will + have a different hook type than Sqlite.CommitHook so + setCommitHook() will return null instead of that object. + */ + private static class CommitHookProxy + implements org.sqlite.jni.capi.CommitHookCallback { + final CommitHook commitHook; + CommitHookProxy(CommitHook ch){ + this.commitHook = ch; + } + @Override public int call(){ + return commitHook.call(); + } + } + + /** + Analog to sqlite3_commit_hook(). Returns the previous hook, if + any (else null). Throws if this db is closed. + + Minor caveat: if a commit hook is set on this object's underlying + db handle using the lower-level SQLite API, this function may + return null when replacing it, despite there being a hook, + because it will have a different callback type. So long as the + handle is only manipulated via the high-level API, this caveat + does not apply. + */ + CommitHook setCommitHook( CommitHook c ){ + CommitHookProxy chp = null; + if( null!=c ){ + chp = new CommitHookProxy(c); + } + final org.sqlite.jni.capi.CommitHookCallback rv = + CApi.sqlite3_commit_hook(thisDb(), chp); + return (rv instanceof CommitHookProxy) + ? ((CommitHookProxy)rv).commitHook + : null; + } + + + public interface RollbackHook { + /** + Must behave as documented for the C-level sqlite3_rollback_hook() + callback. If it throws, the exception is translated into + a db-level error. + */ + void call(); + } + + /** + A level of indirection to permit setRollbackHook() to have similar + semantics as the C API, returning the previous hook. The caveat + is that if the low-level API is used to install a hook, it will + have a different hook type than Sqlite.RollbackHook so + setRollbackHook() will return null instead of that object. + */ + private static class RollbackHookProxy + implements org.sqlite.jni.capi.RollbackHookCallback { + final RollbackHook rollbackHook; + RollbackHookProxy(RollbackHook ch){ + this.rollbackHook = ch; + } + @Override public void call(){rollbackHook.call();} + } + + /** + Analog to sqlite3_rollback_hook(). Returns the previous hook, if + any (else null). Throws if this db is closed. + + Minor caveat: if a rollback hook is set on this object's underlying + db handle using the lower-level SQLite API, this function may + return null when replacing it, despite there being a hook, + because it will have a different callback type. So long as the + handle is only manipulated via the high-level API, this caveat + does not apply. + */ + RollbackHook setRollbackHook( RollbackHook c ){ + RollbackHookProxy chp = null; + if( null!=c ){ + chp = new RollbackHookProxy(c); + } + final org.sqlite.jni.capi.RollbackHookCallback rv = + CApi.sqlite3_rollback_hook(thisDb(), chp); + return (rv instanceof RollbackHookProxy) + ? ((RollbackHookProxy)rv).rollbackHook + : null; + } + + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 3a00c0953f..56ea35ef1f 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -737,6 +737,87 @@ public class Tester2 implements Runnable { } } + private void testCommitHook(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + final ValueHolder hookResult = new ValueHolder<>(0); + final Sqlite.CommitHook theHook = new Sqlite.CommitHook(){ + @Override public int call(){ + ++counter.value; + return hookResult.value; + } + }; + Sqlite.CommitHook oldHook = db.setCommitHook(theHook); + affirm( null == oldHook ); + execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')"); + affirm( 2 == counter.value ); + execSql(db, "BEGIN; SELECT 1; SELECT 2; COMMIT;"); + affirm( 2 == counter.value /* NOT invoked if no changes are made */ ); + execSql(db, "BEGIN; update t set a='d' where a='c'; COMMIT;"); + affirm( 3 == counter.value ); + oldHook = db.setCommitHook(theHook); + affirm( theHook == oldHook ); + execSql(db, "BEGIN; update t set a='e' where a='d'; COMMIT;"); + affirm( 4 == counter.value ); + oldHook = db.setCommitHook(null); + affirm( theHook == oldHook ); + execSql(db, "BEGIN; update t set a='f' where a='e'; COMMIT;"); + affirm( 4 == counter.value ); + oldHook = db.setCommitHook(null); + affirm( null == oldHook ); + execSql(db, "BEGIN; update t set a='g' where a='f'; COMMIT;"); + affirm( 4 == counter.value ); + + final Sqlite.CommitHook newHook = new Sqlite.CommitHook(){ + @Override public int call(){return 0;} + }; + oldHook = db.setCommitHook(newHook); + affirm( null == oldHook ); + execSql(db, "BEGIN; update t set a='h' where a='g'; COMMIT;"); + affirm( 4 == counter.value ); + oldHook = db.setCommitHook(theHook); + affirm( newHook == oldHook ); + execSql(db, "BEGIN; update t set a='i' where a='h'; COMMIT;"); + affirm( 5 == counter.value ); + hookResult.value = CApi.SQLITE_ERROR; + int rc = execSql(db, false, "BEGIN; update t set a='j' where a='i'; COMMIT;"); + affirm( CApi.SQLITE_CONSTRAINT_COMMITHOOK == rc ); + affirm( 6 == counter.value ); + db.close(); + } + + private void testRollbackHook(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + final Sqlite.RollbackHook theHook = new Sqlite.RollbackHook(){ + @Override public void call(){ + ++counter.value; + } + }; + Sqlite.RollbackHook oldHook = db.setRollbackHook(theHook); + affirm( null == oldHook ); + execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')"); + affirm( 0 == counter.value ); + execSql(db, false, "BEGIN; SELECT 1; SELECT 2; ROLLBACK;"); + affirm( 1 == counter.value /* contra to commit hook, is invoked if no changes are made */ ); + + final Sqlite.RollbackHook newHook = new Sqlite.RollbackHook(){ + @Override public void call(){} + }; + oldHook = db.setRollbackHook(newHook); + affirm( theHook == oldHook ); + execSql(db, false, "BEGIN; SELECT 1; ROLLBACK;"); + affirm( 1 == counter.value ); + oldHook = db.setRollbackHook(theHook); + affirm( newHook == oldHook ); + execSql(db, false, "BEGIN; SELECT 1; ROLLBACK;"); + affirm( 2 == counter.value ); + int rc = execSql(db, false, "BEGIN; SELECT 1; ROLLBACK;"); + affirm( 0 == rc ); + affirm( 3 == counter.value ); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 0cdcd1cfcd..68dcbace48 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sbusy-handler\ssupport\sto\sJNI\swrapper1. -D 2023-11-05T00:02:47.384 +C Add\scommit/rollback\shook\ssupport\sto\sJNI\swrapper1. +D 2023-11-05T00:48:43.424 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -241,7 +241,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c 931a7320f5b5745034b4fd61027ea7cc29559856e6da613e4fdcf01ef102e710 +F ext/jni/src/c/sqlite3-jni.c e24804e86759c0680064aacc46ab901d9b2b1a44eba312bcc9a387f15f044d12 F ext/jni/src/c/sqlite3-jni.h 1c45fd4689cec42f3d84d2fee41bb494016a12fcb5fd80291095590666a14015 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba @@ -255,7 +255,7 @@ F ext/jni/src/org/sqlite/jni/capi/CApi.java 4043d709626079cce6d524ef49122b934c04 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab -F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 29c002f3c638cc80f7db1594564a262d1beb32637824c3dca2d60a224d1f71d7 +F ext/jni/src/org/sqlite/jni/capi/CommitHookCallback.java 482f53dfec9e3ac2a9070d3fceebd56250932aaaf7c4f5bc8de29fc011416e0c F ext/jni/src/org/sqlite/jni/capi/ConfigLogCallback.java b995ca412f59b631803b93aa5b3684fce62e335d1e123207084c054abfd488d4 F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbeeb56315d15b13d8752b0fdbca705f31bd4366c58d8a33 F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 4bb5e62907a422a80a0fccbcb83085e9163c2c245451312a62c7550a45d16683 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 909ebd23111762c878116ebacf73a848c8323fb46e8128eb3d99a85d48905444 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java c930ca964f605ba8f175d3b0c85099d7f93069b59bf825929c9eef9e68ac96c5 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 782bb185ffc629cdabbd624565a52ed9b4b1b2d773b8b1d84476d91cbf94827d F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 6f5fae3c3827ca42ef124c319b24907483aadda69b7453173f7807e0a94f33dd +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java ab1236dd65b4f90db729c88c71382b14aa179095f8b8e4b50835125bd0072f9e F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe -R 2dabe33af17a981e8c8323ecd84b4487 +P dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20 +R f0002b14be80bf0bcecc7fa19a1e63af U stephan -Z c2d53a448e9f555de7ff26068d4eba40 +Z 507dddf857173269602bfa9033ce1fa7 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 97de8be89b..ba526bfc7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20 \ No newline at end of file +ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8 \ No newline at end of file From 0ee7ae72a1c7993878bb46df377db6583e2c4ecc Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 01:14:07 +0000 Subject: [PATCH 238/242] Add update-hook support to JNI wrapper1. FossilOrigin-Name: 6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618 --- .../sqlite/jni/capi/RollbackHookCallback.java | 5 +- .../sqlite/jni/capi/UpdateHookCallback.java | 3 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 84 +++++++++++++++++++ .../src/org/sqlite/jni/wrapper1/Tester2.java | 56 ++++++++++++- manifest | 18 ++-- manifest.uuid | 2 +- 6 files changed, 153 insertions(+), 15 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java index 5ce17e718a..cf9c4b6e7a 100644 --- a/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java @@ -18,8 +18,9 @@ package org.sqlite.jni.capi; */ public interface RollbackHookCallback extends CallbackProxy { /** - Works as documented for the C-level sqlite3_rollback_hook() - callback. + Must function as documented for the C-level sqlite3_rollback_hook() + callback. If it throws, the exception is translated into + a db-level error. */ void call(); } diff --git a/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java index 33d72a5dd2..e3d491f67e 100644 --- a/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java @@ -19,7 +19,8 @@ package org.sqlite.jni.capi; public interface UpdateHookCallback extends CallbackProxy { /** Must function as described for the C-level sqlite3_update_hook() - callback. + callback. If it throws, the exception is translated into + a db-level error. */ void call(int opId, String dbName, String tableName, long rowId); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index dcd475ea68..324f65ae29 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -112,6 +112,42 @@ public final class Sqlite implements AutoCloseable { public static final int BUSY = CApi.SQLITE_BUSY; public static final int LOCKED = CApi.SQLITE_LOCKED; + public static final int DENY = CApi.SQLITE_DENY; + public static final int IGNORE = CApi.SQLITE_IGNORE; + public static final int CREATE_INDEX = CApi.SQLITE_CREATE_INDEX; + public static final int CREATE_TABLE = CApi.SQLITE_CREATE_TABLE; + public static final int CREATE_TEMP_INDEX = CApi.SQLITE_CREATE_TEMP_INDEX; + public static final int CREATE_TEMP_TABLE = CApi.SQLITE_CREATE_TEMP_TABLE; + public static final int CREATE_TEMP_TRIGGER = CApi.SQLITE_CREATE_TEMP_TRIGGER; + public static final int CREATE_TEMP_VIEW = CApi.SQLITE_CREATE_TEMP_VIEW; + public static final int CREATE_TRIGGER = CApi.SQLITE_CREATE_TRIGGER; + public static final int CREATE_VIEW = CApi.SQLITE_CREATE_VIEW; + public static final int DELETE = CApi.SQLITE_DELETE; + public static final int DROP_INDEX = CApi.SQLITE_DROP_INDEX; + public static final int DROP_TABLE = CApi.SQLITE_DROP_TABLE; + public static final int DROP_TEMP_INDEX = CApi.SQLITE_DROP_TEMP_INDEX; + public static final int DROP_TEMP_TABLE = CApi.SQLITE_DROP_TEMP_TABLE; + public static final int DROP_TEMP_TRIGGER = CApi.SQLITE_DROP_TEMP_TRIGGER; + public static final int DROP_TEMP_VIEW = CApi.SQLITE_DROP_TEMP_VIEW; + public static final int DROP_TRIGGER = CApi.SQLITE_DROP_TRIGGER; + public static final int DROP_VIEW = CApi.SQLITE_DROP_VIEW; + public static final int INSERT = CApi.SQLITE_INSERT; + public static final int PRAGMA = CApi.SQLITE_PRAGMA; + public static final int READ = CApi.SQLITE_READ; + public static final int SELECT = CApi.SQLITE_SELECT; + public static final int TRANSACTION = CApi.SQLITE_TRANSACTION; + public static final int UPDATE = CApi.SQLITE_UPDATE; + public static final int ATTACH = CApi.SQLITE_ATTACH; + public static final int DETACH = CApi.SQLITE_DETACH; + public static final int ALTER_TABLE = CApi.SQLITE_ALTER_TABLE; + public static final int REINDEX = CApi.SQLITE_REINDEX; + public static final int ANALYZE = CApi.SQLITE_ANALYZE; + public static final int CREATE_VTABLE = CApi.SQLITE_CREATE_VTABLE; + public static final int DROP_VTABLE = CApi.SQLITE_DROP_VTABLE; + public static final int FUNCTION = CApi.SQLITE_FUNCTION; + public static final int SAVEPOINT = CApi.SQLITE_SAVEPOINT; + public static final int RECURSIVE = CApi.SQLITE_RECURSIVE; + //! Used only by the open() factory functions. private Sqlite(sqlite3 db){ this.db = db; @@ -1353,5 +1389,53 @@ public final class Sqlite implements AutoCloseable { : null; } + public interface UpdateHook { + /** + Must function as described for the C-level sqlite3_update_hook() + callback. + */ + void call(int opId, String dbName, String tableName, long rowId); + } + + /** + A level of indirection to permit setUpdateHook() to have similar + semantics as the C API, returning the previous hook. The caveat + is that if the low-level API is used to install a hook, it will + have a different hook type than Sqlite.UpdateHook so + setUpdateHook() will return null instead of that object. + */ + private static class UpdateHookProxy + implements org.sqlite.jni.capi.UpdateHookCallback { + final UpdateHook updateHook; + UpdateHookProxy(UpdateHook ch){ + this.updateHook = ch; + } + @Override public void call(int opId, String dbName, String tableName, long rowId){ + updateHook.call(opId, dbName, tableName, rowId); + } + } + + /** + Analog to sqlite3_update_hook(). Returns the previous hook, if + any (else null). Throws if this db is closed. + + Minor caveat: if a update hook is set on this object's underlying + db handle using the lower-level SQLite API, this function may + return null when replacing it, despite there being a hook, + because it will have a different callback type. So long as the + handle is only manipulated via the high-level API, this caveat + does not apply. + */ + UpdateHook setUpdateHook( UpdateHook c ){ + UpdateHookProxy chp = null; + if( null!=c ){ + chp = new UpdateHookProxy(c); + } + final org.sqlite.jni.capi.UpdateHookCallback rv = + CApi.sqlite3_update_hook(thisDb(), chp); + return (rv instanceof UpdateHookProxy) + ? ((UpdateHookProxy)rv).updateHook + : null; + } } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 56ea35ef1f..fd8fb69b7a 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -133,6 +133,9 @@ public class Tester2 implements Runnable { Executes all SQL statements in the given string. If throwOnError is true then it will throw for any prepare/step errors, else it will return the corresponding non-0 result code. + + TODO: reimplement this in the high-level API once it has the + multi-prepare capability. */ public static int execSql(Sqlite dbw, boolean throwOnError, String sql){ final sqlite3 db = dbw.nativeHandle(); @@ -163,7 +166,7 @@ public class Tester2 implements Runnable { } CApi.sqlite3_finalize(stmt); affirm(0 == stmt.getNativePointer()); - if(CApi.SQLITE_DONE!=rc){ + if(Sqlite.DONE!=rc){ break; } } @@ -181,7 +184,7 @@ public class Tester2 implements Runnable { @SingleThreadOnly /* because it's thread-agnostic */ private void test1(){ - affirm(CApi.sqlite3_libversion_number() == CApi.SQLITE_VERSION_NUMBER); + affirm(Sqlite.libVersionNumber() == CApi.SQLITE_VERSION_NUMBER); } /* Copy/paste/rename this to add new tests. */ @@ -818,6 +821,55 @@ public class Tester2 implements Runnable { db.close(); } + private void testUpdateHook(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + final ValueHolder expectedOp = new ValueHolder<>(0); + final Sqlite.UpdateHook theHook = new Sqlite.UpdateHook(){ + @Override + public void call(int opId, String dbName, String tableName, long rowId){ + ++counter.value; + if( 0!=expectedOp.value ){ + affirm( expectedOp.value == opId ); + } + } + }; + Sqlite.UpdateHook oldHook = db.setUpdateHook(theHook); + affirm( null == oldHook ); + expectedOp.value = Sqlite.INSERT; + execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')"); + affirm( 3 == counter.value ); + expectedOp.value = Sqlite.UPDATE; + execSql(db, "update t set a='d' where a='c';"); + affirm( 4 == counter.value ); + oldHook = db.setUpdateHook(theHook); + affirm( theHook == oldHook ); + expectedOp.value = Sqlite.DELETE; + execSql(db, "DELETE FROM t where a='d'"); + affirm( 5 == counter.value ); + oldHook = db.setUpdateHook(null); + affirm( theHook == oldHook ); + execSql(db, "update t set a='e' where a='b';"); + affirm( 5 == counter.value ); + oldHook = db.setUpdateHook(null); + affirm( null == oldHook ); + + final Sqlite.UpdateHook newHook = new Sqlite.UpdateHook(){ + @Override public void call(int opId, String dbName, String tableName, long rowId){ + } + }; + oldHook = db.setUpdateHook(newHook); + affirm( null == oldHook ); + execSql(db, "update t set a='h' where a='a'"); + affirm( 5 == counter.value ); + oldHook = db.setUpdateHook(theHook); + affirm( newHook == oldHook ); + expectedOp.value = Sqlite.UPDATE; + execSql(db, "update t set a='i' where a='h'"); + affirm( 6 == counter.value ); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 68dcbace48..3ee436df87 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\scommit/rollback\shook\ssupport\sto\sJNI\swrapper1. -D 2023-11-05T00:48:43.424 +C Add\supdate-hook\ssupport\sto\sJNI\swrapper1. +D 2023-11-05T01:14:07.152 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -264,14 +264,14 @@ F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java aca8f9fa72e3b6602bc9 F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17ca4b7ddde1d8cd6915b6ab7b708249a9787beca6bd6b6 F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f -F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java 105e324d09c207100485e7667ad172e64322c62426bb49b547e9b0dc9c33f5f0 +F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java e172210a2080e851ebb694c70e9f0bf89284237795e38710a7f5f1b61e3f6787 F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385155fa3b8011a5cca0bb3c28468c7131c1a5 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f F ext/jni/src/org/sqlite/jni/capi/Tester1.java 909ebd23111762c878116ebacf73a848c8323fb46e8128eb3d99a85d48905444 F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 -F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java 2766b8526bbffc4f1045f70e79f1bc1b1efe1c3e95ca06cdb8a7391032dda3b4 +F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 782bb185ffc629cdabbd624565a52ed9b4b1b2d773b8b1d84476d91cbf94827d +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 12f55248d500c0cf4148757adb442303831632edaa738a41d82708643ba42418 F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java ab1236dd65b4f90db729c88c71382b14aa179095f8b8e4b50835125bd0072f9e +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 4cb3bebcd44f4289fa8075477583b6c508832288f7b18d6101d2ec23309ee4cf F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20 -R f0002b14be80bf0bcecc7fa19a1e63af +P ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8 +R 100ace4e28cdce95fe3bed6faf77a591 U stephan -Z 507dddf857173269602bfa9033ce1fa7 +Z dbd53c8956790cde47b0f616fa6677f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ba526bfc7b..e37ae0477c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8 \ No newline at end of file +6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618 \ No newline at end of file From 9a265899409da5ecc374f97fc3cd67706da69c4b Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 01:39:29 +0000 Subject: [PATCH 239/242] Add progress-handler support to JNI wrapper1. Correct the return type of the extended_result_codes() JNI binding and expose it to wrapper1. FossilOrigin-Name: 6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88 --- ext/jni/src/c/sqlite3-jni.c | 8 +- ext/jni/src/c/sqlite3-jni.h | 4 +- ext/jni/src/org/sqlite/jni/capi/CApi.java | 2 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 162 +++++++++++------- .../sqlite/jni/wrapper1/SqliteException.java | 2 +- .../src/org/sqlite/jni/wrapper1/Tester2.java | 18 ++ manifest | 22 +-- manifest.uuid | 2 +- 8 files changed, 142 insertions(+), 78 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 0d60e49d13..c530651cd7 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -3596,12 +3596,14 @@ S3JniApi(sqlite3_normalized_sql(),jstring,1normalized_1sql)( #endif } -S3JniApi(sqlite3_extended_result_codes(),jboolean,1extended_1result_1codes)( +S3JniApi(sqlite3_extended_result_codes(),jint,1extended_1result_1codes)( JniArgsEnvClass, jobject jpDb, jboolean onoff ){ sqlite3 * const pDb = PtrGet_sqlite3(jpDb); - int const rc = pDb ? sqlite3_extended_result_codes(pDb, onoff ? 1 : 0) : 0; - return rc ? JNI_TRUE : JNI_FALSE; + int const rc = pDb + ? sqlite3_extended_result_codes(pDb, onoff ? 1 : 0) + : SQLITE_MISUSE; + return rc; } S3JniApi(sqlite3_finalize(),jint,1finalize)( diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index e4393ddd8b..a1097fe57a 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -1402,9 +1402,9 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1errcode /* * Class: org_sqlite_jni_capi_CApi * Method: sqlite3_extended_result_codes - * Signature: (Lorg/sqlite/jni/capi/sqlite3;Z)Z + * Signature: (Lorg/sqlite/jni/capi/sqlite3;Z)I */ -JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1result_1codes +JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1extended_1result_1codes (JNIEnv *, jclass, jobject, jboolean); /* diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index 79568e74ad..f1d4def500 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -890,7 +890,7 @@ public final class CApi { return sqlite3_extended_errcode(db.getNativePointer()); } - public static native boolean sqlite3_extended_result_codes( + public static native int sqlite3_extended_result_codes( @NotNull sqlite3 db, boolean on ); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index 324f65ae29..d9b5a17c20 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -213,61 +213,6 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_sourceid(); } - - /** - Output object for use with status() and libStatus(). - */ - public static final class Status { - /** The current value for the requested status() or libStatus() metric. */ - long current; - /** The peak value for the requested status() or libStatus() metric. */ - long peak; - }; - - /** - As per sqlite3_status64(), but returns its current and high-water - results as a Status object. Throws if the first argument is - not one of the STATUS_... constants. - */ - public static Status libStatus(int op, boolean resetStats){ - org.sqlite.jni.capi.OutputPointer.Int64 pCurrent = - new org.sqlite.jni.capi.OutputPointer.Int64(); - org.sqlite.jni.capi.OutputPointer.Int64 pHighwater = - new org.sqlite.jni.capi.OutputPointer.Int64(); - checkRc2( CApi.sqlite3_status64(op, pCurrent, pHighwater, resetStats) ); - final Status s = new Status(); - s.current = pCurrent.value; - s.peak = pHighwater.value; - return s; - } - - /** - As per sqlite3_status64(), but returns its current and high-water - results as a Status object. Throws if the first argument is - not one of the DBSTATUS_... constants or on any other misuse. - */ - public Status status(int op, boolean resetStats){ - org.sqlite.jni.capi.OutputPointer.Int32 pCurrent = - new org.sqlite.jni.capi.OutputPointer.Int32(); - org.sqlite.jni.capi.OutputPointer.Int32 pHighwater = - new org.sqlite.jni.capi.OutputPointer.Int32(); - checkRc( CApi.sqlite3_db_status(thisDb(), op, pCurrent, pHighwater, resetStats) ); - final Status s = new Status(); - s.current = pCurrent.value; - s.peak = pHighwater.value; - return s; - } - - @Override public void close(){ - if(null!=this.db){ - synchronized(nativeToWrapper){ - nativeToWrapper.remove(this.db); - } - this.db.close(); - this.db = null; - } - } - /** Returns the value of the native library's build-time value of the SQLITE_THREADSAFE build option. @@ -325,6 +270,61 @@ public final class Sqlite implements AutoCloseable { return 0==CApi.sqlite3_strlike(glob, txt, escChar); } + /** + Output object for use with status() and libStatus(). + */ + public static final class Status { + /** The current value for the requested status() or libStatus() metric. */ + long current; + /** The peak value for the requested status() or libStatus() metric. */ + long peak; + }; + + /** + As per sqlite3_status64(), but returns its current and high-water + results as a Status object. Throws if the first argument is + not one of the STATUS_... constants. + */ + public static Status libStatus(int op, boolean resetStats){ + org.sqlite.jni.capi.OutputPointer.Int64 pCurrent = + new org.sqlite.jni.capi.OutputPointer.Int64(); + org.sqlite.jni.capi.OutputPointer.Int64 pHighwater = + new org.sqlite.jni.capi.OutputPointer.Int64(); + checkRc2( CApi.sqlite3_status64(op, pCurrent, pHighwater, resetStats) ); + final Status s = new Status(); + s.current = pCurrent.value; + s.peak = pHighwater.value; + return s; + } + + /** + As per sqlite3_db_status(), but returns its current and + high-water results as a Status object. Throws if the first + argument is not one of the DBSTATUS_... constants or on any other + misuse. + */ + public Status status(int op, boolean resetStats){ + org.sqlite.jni.capi.OutputPointer.Int32 pCurrent = + new org.sqlite.jni.capi.OutputPointer.Int32(); + org.sqlite.jni.capi.OutputPointer.Int32 pHighwater = + new org.sqlite.jni.capi.OutputPointer.Int32(); + checkRc( CApi.sqlite3_db_status(thisDb(), op, pCurrent, pHighwater, resetStats) ); + final Status s = new Status(); + s.current = pCurrent.value; + s.peak = pHighwater.value; + return s; + } + + @Override public void close(){ + if(null!=this.db){ + synchronized(nativeToWrapper){ + nativeToWrapper.remove(this.db); + } + this.db.close(); + this.db = null; + } + } + /** Returns this object's underlying native db handle, or null if this instance has been closed. This is very specifically not @@ -379,6 +379,19 @@ public final class Sqlite implements AutoCloseable { } } + /** + Toggles the use of extended result codes on or off. By default + they are turned off, but they can be enabled by default by + including the OPEN_EXRESCODE flag when opening a database. + + Because this API reports db-side errors using exceptions, + enabling this may change the values returned by + SqliteException.errcode(). + */ + public void useExtendedResultCodes(boolean on){ + checkRc( CApi.sqlite3_extended_result_codes(thisDb(), on) ); + } + /** prepFlags must be 0 or a bitmask of the PREPARE_... constants. @@ -1278,7 +1291,7 @@ public final class Sqlite implements AutoCloseable { Analog to sqlite3_busy_handler(). If b is null then any current handler is cleared. */ - void setBusyHandler( BusyHandler b ){ + public void setBusyHandler( BusyHandler b ){ org.sqlite.jni.capi.BusyHandlerCallback bhc = null; if( null!=b ){ bhc = new org.sqlite.jni.capi.BusyHandlerCallback(){ @@ -1328,7 +1341,7 @@ public final class Sqlite implements AutoCloseable { handle is only manipulated via the high-level API, this caveat does not apply. */ - CommitHook setCommitHook( CommitHook c ){ + public CommitHook setCommitHook( CommitHook c ){ CommitHookProxy chp = null; if( null!=c ){ chp = new CommitHookProxy(c); @@ -1377,7 +1390,7 @@ public final class Sqlite implements AutoCloseable { handle is only manipulated via the high-level API, this caveat does not apply. */ - RollbackHook setRollbackHook( RollbackHook c ){ + public RollbackHook setRollbackHook( RollbackHook c ){ RollbackHookProxy chp = null; if( null!=c ){ chp = new RollbackHookProxy(c); @@ -1426,7 +1439,7 @@ public final class Sqlite implements AutoCloseable { handle is only manipulated via the high-level API, this caveat does not apply. */ - UpdateHook setUpdateHook( UpdateHook c ){ + public UpdateHook setUpdateHook( UpdateHook c ){ UpdateHookProxy chp = null; if( null!=c ){ chp = new UpdateHookProxy(c); @@ -1438,4 +1451,35 @@ public final class Sqlite implements AutoCloseable { : null; } + + /** + Callback interface for use with setProgressHandler(). + */ + public interface ProgressHandler { + /** + Must behave as documented for the C-level sqlite3_progress_handler() + callback. If it throws, the exception is translated into + a db-level error. + */ + int call(); + } + + /** + Analog to sqlite3_progress_handler(), sets the current progress + handler or clears it if p is null. + + Note that this API, in contrast to setUpdateHook(), + setRollbackHook(), and setCommitHook(), cannot return the + previous handler. That inconsistency is part of the lower-level C + API. + */ + public void setProgressHandler( int n, ProgressHandler p ){ + org.sqlite.jni.capi.ProgressHandlerCallback phc = null; + if( null!=p ){ + phc = new org.sqlite.jni.capi.ProgressHandlerCallback(){ + @Override public int call(){ return p.call(); } + }; + } + CApi.sqlite3_progress_handler( thisDb(), n, phc ); + } } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java index 09fa02a2ca..9b4440f190 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java @@ -50,7 +50,7 @@ public final class SqliteException extends java.lang.RuntimeException { /** Records the current error state of db (which must not be null and - must refer to an opened db object). Note that this does NOT close + must refer to an opened db object). Note that this does not close the db. Design note: closing the db on error is really only useful during diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index fd8fb69b7a..1af2c8c5d1 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -870,6 +870,24 @@ public class Tester2 implements Runnable { db.close(); } + private void testProgress(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + db.setProgressHandler(1, new Sqlite.ProgressHandler(){ + @Override public int call(){ + ++counter.value; + return 0; + } + }); + execSql(db, "SELECT 1; SELECT 2;"); + affirm( counter.value > 0 ); + int nOld = counter.value; + db.setProgressHandler(0, null); + execSql(db, "SELECT 1; SELECT 2;"); + affirm( nOld == counter.value ); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 3ee436df87..82936f69b9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\supdate-hook\ssupport\sto\sJNI\swrapper1. -D 2023-11-05T01:14:07.152 +C Add\sprogress-handler\ssupport\sto\sJNI\swrapper1.\sCorrect\sthe\sreturn\stype\sof\sthe\sextended_result_codes()\sJNI\sbinding\sand\sexpose\sit\sto\swrapper1. +D 2023-11-05T01:39:29.450 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -241,8 +241,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3 F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a8b8072 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa -F ext/jni/src/c/sqlite3-jni.c e24804e86759c0680064aacc46ab901d9b2b1a44eba312bcc9a387f15f044d12 -F ext/jni/src/c/sqlite3-jni.h 1c45fd4689cec42f3d84d2fee41bb494016a12fcb5fd80291095590666a14015 +F ext/jni/src/c/sqlite3-jni.c b98d822a35ef4438023c3c14816b5ac17bdbd23bc838ff80b6463c3146a75d14 +F ext/jni/src/c/sqlite3-jni.h 03f66d3b43359dacd7c2c9407d78274dbdb027bc7610985011bf2b462222414e F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca @@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java 4043d709626079cce6d524ef49122b934c043022bd88bc1e72eb697ac8df86e7 +F ext/jni/src/org/sqlite/jni/capi/CApi.java a6d4fdd35e4fcfe95c61e343eb389cfaab3d5166e9670730aef14240a982b97b F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 12f55248d500c0cf4148757adb442303831632edaa738a41d82708643ba42418 -F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 929a1e2ab4e135fbbae7f0d2d609f77cfbbc60bbec7ba789ce23d9c73bc6156e -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 4cb3bebcd44f4289fa8075477583b6c508832288f7b18d6101d2ec23309ee4cf +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 923c885609ca9e6793636fc17787d0058c80ce1d7ba5a69eb40e68cc299892d1 +F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 822cf3d66beb1efcac1792c8652cbebb80ae998275a33337de46fde1670e0008 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8 -R 100ace4e28cdce95fe3bed6faf77a591 +P 6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618 +R dafa52fdba2c999e04b851e5ec6214ab U stephan -Z dbd53c8956790cde47b0f616fa6677f5 +Z 824d9a7ed24ad4091f85bc7e5264c033 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e37ae0477c..7f82e1d85b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618 \ No newline at end of file +6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88 \ No newline at end of file From 88c90a793ef80560b90a37802c06135c5bef3617 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 01:55:20 +0000 Subject: [PATCH 240/242] Add authorizer support to JNI wrapper1. FossilOrigin-Name: 773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0 --- .../sqlite/jni/capi/AuthorizerCallback.java | 3 +- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 3 + .../src/org/sqlite/jni/wrapper1/Sqlite.java | 139 +++++++++++++++++- .../src/org/sqlite/jni/wrapper1/Tester2.java | 24 +++ manifest | 18 +-- manifest.uuid | 2 +- 6 files changed, 174 insertions(+), 15 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java b/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java index ce7c6fca6d..298e3a5900 100644 --- a/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java @@ -20,7 +20,8 @@ import org.sqlite.jni.annotation.*; public interface AuthorizerCallback extends CallbackProxy { /** Must function as described for the C-level - sqlite3_set_authorizer() callback. + sqlite3_set_authorizer() callback. If it throws, the error is + converted to a db-level error and the exception is suppressed. */ int call(int opId, @Nullable String s1, @Nullable String s2, @Nullable String s3, @Nullable String s4); diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 4a8ceb1812..fb53196d26 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1358,6 +1358,9 @@ public class Tester1 implements Runnable { authRc.value = SQLITE_DENY; int rc = execSql(db, false, "UPDATE t SET a=2"); affirm( SQLITE_AUTH==rc ); + sqlite3_set_authorizer(db, null); + rc = execSql(db, false, "UPDATE t SET a=2"); + affirm( 0==rc ); // TODO: expand these tests considerably sqlite3_close(db); } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index d9b5a17c20..cf18277329 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -29,6 +29,111 @@ import org.sqlite.jni.capi.OutputPointer; public final class Sqlite implements AutoCloseable { private sqlite3 db; + public static final int OK = CApi.SQLITE_OK; + public static final int ERROR = CApi.SQLITE_ERROR; + public static final int INTERNAL = CApi.SQLITE_INTERNAL; + public static final int PERM = CApi.SQLITE_PERM; + public static final int ABORT = CApi.SQLITE_ABORT; + public static final int BUSY = CApi.SQLITE_BUSY; + public static final int LOCKED = CApi.SQLITE_LOCKED; + public static final int NOMEM = CApi.SQLITE_NOMEM; + public static final int READONLY = CApi.SQLITE_READONLY; + public static final int INTERRUPT = CApi.SQLITE_INTERRUPT; + public static final int IOERR = CApi.SQLITE_IOERR; + public static final int CORRUPT = CApi.SQLITE_CORRUPT; + public static final int NOTFOUND = CApi.SQLITE_NOTFOUND; + public static final int FULL = CApi.SQLITE_FULL; + public static final int CANTOPEN = CApi.SQLITE_CANTOPEN; + public static final int PROTOCOL = CApi.SQLITE_PROTOCOL; + public static final int EMPTY = CApi.SQLITE_EMPTY; + public static final int SCHEMA = CApi.SQLITE_SCHEMA; + public static final int TOOBIG = CApi.SQLITE_TOOBIG; + public static final int CONSTRAINT = CApi. SQLITE_CONSTRAINT; + public static final int MISMATCH = CApi.SQLITE_MISMATCH; + public static final int MISUSE = CApi.SQLITE_MISUSE; + public static final int NOLFS = CApi.SQLITE_NOLFS; + public static final int AUTH = CApi.SQLITE_AUTH; + public static final int FORMAT = CApi.SQLITE_FORMAT; + public static final int RANGE = CApi.SQLITE_RANGE; + public static final int NOTADB = CApi.SQLITE_NOTADB; + public static final int NOTICE = CApi.SQLITE_NOTICE; + public static final int WARNING = CApi.SQLITE_WARNING; + public static final int ROW = CApi.SQLITE_ROW; + public static final int DONE = CApi.SQLITE_DONE; + public static final int ERROR_MISSING_COLLSEQ = CApi.SQLITE_ERROR_MISSING_COLLSEQ; + public static final int ERROR_RETRY = CApi.SQLITE_ERROR_RETRY; + public static final int ERROR_SNAPSHOT = CApi.SQLITE_ERROR_SNAPSHOT; + public static final int IOERR_READ = CApi.SQLITE_IOERR_READ; + public static final int IOERR_SHORT_READ = CApi.SQLITE_IOERR_SHORT_READ; + public static final int IOERR_WRITE = CApi.SQLITE_IOERR_WRITE; + public static final int IOERR_FSYNC = CApi.SQLITE_IOERR_FSYNC; + public static final int IOERR_DIR_FSYNC = CApi.SQLITE_IOERR_DIR_FSYNC; + public static final int IOERR_TRUNCATE = CApi.SQLITE_IOERR_TRUNCATE; + public static final int IOERR_FSTAT = CApi.SQLITE_IOERR_FSTAT; + public static final int IOERR_UNLOCK = CApi.SQLITE_IOERR_UNLOCK; + public static final int IOERR_RDLOCK = CApi.SQLITE_IOERR_RDLOCK; + public static final int IOERR_DELETE = CApi.SQLITE_IOERR_DELETE; + public static final int IOERR_BLOCKED = CApi.SQLITE_IOERR_BLOCKED; + public static final int IOERR_NOMEM = CApi.SQLITE_IOERR_NOMEM; + public static final int IOERR_ACCESS = CApi.SQLITE_IOERR_ACCESS; + public static final int IOERR_CHECKRESERVEDLOCK = CApi.SQLITE_IOERR_CHECKRESERVEDLOCK; + public static final int IOERR_LOCK = CApi.SQLITE_IOERR_LOCK; + public static final int IOERR_CLOSE = CApi.SQLITE_IOERR_CLOSE; + public static final int IOERR_DIR_CLOSE = CApi.SQLITE_IOERR_DIR_CLOSE; + public static final int IOERR_SHMOPEN = CApi.SQLITE_IOERR_SHMOPEN; + public static final int IOERR_SHMSIZE = CApi.SQLITE_IOERR_SHMSIZE; + public static final int IOERR_SHMLOCK = CApi.SQLITE_IOERR_SHMLOCK; + public static final int IOERR_SHMMAP = CApi.SQLITE_IOERR_SHMMAP; + public static final int IOERR_SEEK = CApi.SQLITE_IOERR_SEEK; + public static final int IOERR_DELETE_NOENT = CApi.SQLITE_IOERR_DELETE_NOENT; + public static final int IOERR_MMAP = CApi.SQLITE_IOERR_MMAP; + public static final int IOERR_GETTEMPPATH = CApi.SQLITE_IOERR_GETTEMPPATH; + public static final int IOERR_CONVPATH = CApi.SQLITE_IOERR_CONVPATH; + public static final int IOERR_VNODE = CApi.SQLITE_IOERR_VNODE; + public static final int IOERR_AUTH = CApi.SQLITE_IOERR_AUTH; + public static final int IOERR_BEGIN_ATOMIC = CApi.SQLITE_IOERR_BEGIN_ATOMIC; + public static final int IOERR_COMMIT_ATOMIC = CApi.SQLITE_IOERR_COMMIT_ATOMIC; + public static final int IOERR_ROLLBACK_ATOMIC = CApi.SQLITE_IOERR_ROLLBACK_ATOMIC; + public static final int IOERR_DATA = CApi.SQLITE_IOERR_DATA; + public static final int IOERR_CORRUPTFS = CApi.SQLITE_IOERR_CORRUPTFS; + public static final int LOCKED_SHAREDCACHE = CApi.SQLITE_LOCKED_SHAREDCACHE; + public static final int LOCKED_VTAB = CApi.SQLITE_LOCKED_VTAB; + public static final int BUSY_RECOVERY = CApi.SQLITE_BUSY_RECOVERY; + public static final int BUSY_SNAPSHOT = CApi.SQLITE_BUSY_SNAPSHOT; + public static final int BUSY_TIMEOUT = CApi.SQLITE_BUSY_TIMEOUT; + public static final int CANTOPEN_NOTEMPDIR = CApi.SQLITE_CANTOPEN_NOTEMPDIR; + public static final int CANTOPEN_ISDIR = CApi.SQLITE_CANTOPEN_ISDIR; + public static final int CANTOPEN_FULLPATH = CApi.SQLITE_CANTOPEN_FULLPATH; + public static final int CANTOPEN_CONVPATH = CApi.SQLITE_CANTOPEN_CONVPATH; + public static final int CANTOPEN_SYMLINK = CApi.SQLITE_CANTOPEN_SYMLINK; + public static final int CORRUPT_VTAB = CApi.SQLITE_CORRUPT_VTAB; + public static final int CORRUPT_SEQUENCE = CApi.SQLITE_CORRUPT_SEQUENCE; + public static final int CORRUPT_INDEX = CApi.SQLITE_CORRUPT_INDEX; + public static final int READONLY_RECOVERY = CApi.SQLITE_READONLY_RECOVERY; + public static final int READONLY_CANTLOCK = CApi.SQLITE_READONLY_CANTLOCK; + public static final int READONLY_ROLLBACK = CApi.SQLITE_READONLY_ROLLBACK; + public static final int READONLY_DBMOVED = CApi.SQLITE_READONLY_DBMOVED; + public static final int READONLY_CANTINIT = CApi.SQLITE_READONLY_CANTINIT; + public static final int READONLY_DIRECTORY = CApi.SQLITE_READONLY_DIRECTORY; + public static final int ABORT_ROLLBACK = CApi.SQLITE_ABORT_ROLLBACK; + public static final int CONSTRAINT_CHECK = CApi.SQLITE_CONSTRAINT_CHECK; + public static final int CONSTRAINT_COMMITHOOK = CApi.SQLITE_CONSTRAINT_COMMITHOOK; + public static final int CONSTRAINT_FOREIGNKEY = CApi.SQLITE_CONSTRAINT_FOREIGNKEY; + public static final int CONSTRAINT_FUNCTION = CApi.SQLITE_CONSTRAINT_FUNCTION; + public static final int CONSTRAINT_NOTNULL = CApi.SQLITE_CONSTRAINT_NOTNULL; + public static final int CONSTRAINT_PRIMARYKEY = CApi.SQLITE_CONSTRAINT_PRIMARYKEY; + public static final int CONSTRAINT_TRIGGER = CApi.SQLITE_CONSTRAINT_TRIGGER; + public static final int CONSTRAINT_UNIQUE = CApi.SQLITE_CONSTRAINT_UNIQUE; + public static final int CONSTRAINT_VTAB = CApi.SQLITE_CONSTRAINT_VTAB; + public static final int CONSTRAINT_ROWID = CApi.SQLITE_CONSTRAINT_ROWID; + public static final int CONSTRAINT_PINNED = CApi.SQLITE_CONSTRAINT_PINNED; + public static final int CONSTRAINT_DATATYPE = CApi.SQLITE_CONSTRAINT_DATATYPE; + public static final int NOTICE_RECOVER_WAL = CApi.SQLITE_NOTICE_RECOVER_WAL; + public static final int NOTICE_RECOVER_ROLLBACK = CApi.SQLITE_NOTICE_RECOVER_ROLLBACK; + public static final int WARNING_AUTOINDEX = CApi.SQLITE_WARNING_AUTOINDEX; + public static final int AUTH_USER = CApi.SQLITE_AUTH_USER; + public static final int OK_LOAD_PERMANENTLY = CApi.SQLITE_OK_LOAD_PERMANENTLY; + public static final int OPEN_READWRITE = CApi.SQLITE_OPEN_READWRITE; public static final int OPEN_CREATE = CApi.SQLITE_OPEN_CREATE; public static final int OPEN_EXRESCODE = CApi.SQLITE_OPEN_EXRESCODE; @@ -108,10 +213,6 @@ public final class Sqlite implements AutoCloseable { /* We elide the UTF16_ALIGNED from this interface because it is irrelevant for the Java interface. */ - public static final int DONE = CApi.SQLITE_DONE; - public static final int BUSY = CApi.SQLITE_BUSY; - public static final int LOCKED = CApi.SQLITE_LOCKED; - public static final int DENY = CApi.SQLITE_DENY; public static final int IGNORE = CApi.SQLITE_IGNORE; public static final int CREATE_INDEX = CApi.SQLITE_CREATE_INDEX; @@ -1482,4 +1583,34 @@ public final class Sqlite implements AutoCloseable { } CApi.sqlite3_progress_handler( thisDb(), n, phc ); } + + + /** + Callback for use with setAuthorizer(). + */ + public interface Authorizer { + /** + Must function as described for the C-level + sqlite3_set_authorizer() callback. If it throws, the error is + converted to a db-level error and the exception is suppressed. + */ + int call(int opId, String s1, String s2, String s3, String s4); + } + + /** + Analog to sqlite3_set_authorizer(), this sets the current + authorizer callback, or clears if it passed null. + */ + public void setAuthorizer( Authorizer a ) { + org.sqlite.jni.capi.AuthorizerCallback ac = null; + if( null!=a ){ + ac = new org.sqlite.jni.capi.AuthorizerCallback(){ + @Override public int call(int opId, String s1, String s2, String s3, String s4){ + return a.call(opId, s1, s2, s3, s4); + } + }; + } + checkRc( CApi.sqlite3_set_authorizer( thisDb(), ac ) ); + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index 1af2c8c5d1..b03a83417f 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -888,6 +888,30 @@ public class Tester2 implements Runnable { db.close(); } + private void testAuthorizer(){ + final Sqlite db = openDb(); + final ValueHolder counter = new ValueHolder<>(0); + final ValueHolder authRc = new ValueHolder<>(0); + final Sqlite.Authorizer auth = new Sqlite.Authorizer(){ + public int call(int op, String s0, String s1, String s2, String s3){ + ++counter.value; + //outln("xAuth(): "+s0+" "+s1+" "+s2+" "+s3); + return authRc.value; + } + }; + execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')"); + db.setAuthorizer(auth); + execSql(db, "UPDATE t SET a=1"); + affirm( 1 == counter.value ); + authRc.value = Sqlite.DENY; + int rc = execSql(db, false, "UPDATE t SET a=2"); + affirm( Sqlite.AUTH==rc ); + db.setAuthorizer(null); + rc = execSql(db, false, "UPDATE t SET a=2"); + affirm( 0==rc ); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 82936f69b9..c813cb698b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sprogress-handler\ssupport\sto\sJNI\swrapper1.\sCorrect\sthe\sreturn\stype\sof\sthe\sextended_result_codes()\sJNI\sbinding\sand\sexpose\sit\sto\swrapper1. -D 2023-11-05T01:39:29.450 +C Add\sauthorizer\ssupport\sto\s\sJNI\swrapper1. +D 2023-11-05T01:55:20.977 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -248,7 +248,7 @@ F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7 F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca F ext/jni/src/org/sqlite/jni/capi/AbstractCollationCallback.java 1afa90d3f236f79cc7fcd2497e111992644f7596fbc8e8bcf7f1908ae00acd6c F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63418129656daa9a9f30e7e7be982bd5ab394b1dbd0 -F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java 7ed409d5449684616cc924534e22ff6b07d361f12ad904b69ecb10e0568a8013 +F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca F ext/jni/src/org/sqlite/jni/capi/CApi.java a6d4fdd35e4fcfe95c61e343eb389cfaab3d5166e9670730aef14240a982b97b @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 909ebd23111762c878116ebacf73a848c8323fb46e8128eb3d99a85d48905444 +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 89d3c4b2ffa9a7d3a125daae66167d29f64058702f65254b7d4a721e3868bd1b F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 923c885609ca9e6793636fc17787d0058c80ce1d7ba5a69eb40e68cc299892d1 +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 2397e70955de15f8fb65a7ed421365f018c099d16b8080f81c7553e4dae3d44f F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 822cf3d66beb1efcac1792c8652cbebb80ae998275a33337de46fde1670e0008 +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 199b9fb56e06f808d5856494ca8840e9004ff939f27c7c6fda9a60858144f95d F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618 -R dafa52fdba2c999e04b851e5ec6214ab +P 6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88 +R d2d319f241ba72795b6add1f6b68fc9e U stephan -Z 824d9a7ed24ad4091f85bc7e5264c033 +Z a73e3653c86a5ad585af4f9360f1181a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7f82e1d85b..db8f9c9684 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88 \ No newline at end of file +773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0 \ No newline at end of file From 546db3f14a5722ddfdaff671430b32cf84bd8985 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 03:37:33 +0000 Subject: [PATCH 241/242] JNI wrapper1 normalizeSql() now throws UnsupportedOperationException, instead of returning null, if built without SQLITE_ENABLE_NORMALIZE. Remove SQLITE_PREPARE_NORMALIZE from the JNI interface because it's a legacy no-op. FossilOrigin-Name: d081a126697e214082f3b203f23ea63510080e5c2aac1d8badc9e6e4bfea7c95 --- ext/jni/src/c/sqlite3-jni.h | 2 -- ext/jni/src/org/sqlite/jni/capi/CApi.java | 1 - .../jni/capi/PreupdateHookCallback.java | 3 ++- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 2 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 23 ++++++++++++++++--- manifest | 20 ++++++++-------- manifest.uuid | 2 +- 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/ext/jni/src/c/sqlite3-jni.h b/ext/jni/src/c/sqlite3-jni.h index a1097fe57a..c4ca0559f2 100644 --- a/ext/jni/src/c/sqlite3-jni.h +++ b/ext/jni/src/c/sqlite3-jni.h @@ -427,8 +427,6 @@ extern "C" { #define org_sqlite_jni_capi_CApi_SQLITE_OPEN_EXRESCODE 33554432L #undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT #define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_PERSISTENT 1L -#undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NORMALIZE -#define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NORMALIZE 2L #undef org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB #define org_sqlite_jni_capi_CApi_SQLITE_PREPARE_NO_VTAB 4L #undef org_sqlite_jni_capi_CApi_SQLITE_OK diff --git a/ext/jni/src/org/sqlite/jni/capi/CApi.java b/ext/jni/src/org/sqlite/jni/capi/CApi.java index f1d4def500..d1930e1e32 100644 --- a/ext/jni/src/org/sqlite/jni/capi/CApi.java +++ b/ext/jni/src/org/sqlite/jni/capi/CApi.java @@ -2279,7 +2279,6 @@ public final class CApi { // prepare flags public static final int SQLITE_PREPARE_PERSISTENT = 1; - public static final int SQLITE_PREPARE_NORMALIZE = 2; public static final int SQLITE_PREPARE_NO_VTAB = 4; // result codes diff --git a/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java b/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java index 99d3fb0351..38f7c5613e 100644 --- a/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java +++ b/ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java @@ -19,7 +19,8 @@ package org.sqlite.jni.capi; public interface PreupdateHookCallback extends CallbackProxy { /** Must function as described for the C-level sqlite3_preupdate_hook() - callback. + callback. If it throws, the exception is translated to a + db-level error and the exception is suppressed. */ void call(sqlite3 db, int op, String dbName, String dbTable, long iKey1, long iKey2 ); diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index fb53196d26..5655ac7809 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -327,7 +327,7 @@ public class Tester1 implements Runnable { rc = sqlite3_prepare_v3(db, "INSERT INTO t2(a) VALUES(1),(2),(3)", - SQLITE_PREPARE_NORMALIZE, outStmt); + 0, outStmt); affirm(0 == rc); stmt = outStmt.get(); affirm(0 != stmt.getNativePointer()); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index cf18277329..abf7f20f06 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -178,7 +178,6 @@ public final class Sqlite implements AutoCloseable { public static final int LIMIT_WORKER_THREADS = CApi.SQLITE_LIMIT_WORKER_THREADS; public static final int PREPARE_PERSISTENT = CApi.SQLITE_PREPARE_PERSISTENT; - public static final int PREPARE_NORMALIZE = CApi.SQLITE_PREPARE_NORMALIZE; public static final int PREPARE_NO_VTAB = CApi.SQLITE_PREPARE_NO_VTAB; public static final int TRACE_STMT = CApi.SQLITE_TRACE_STMT; @@ -336,6 +335,22 @@ public final class Sqlite implements AutoCloseable { return CApi.sqlite3_compileoption_used(optName); } + private static boolean hasNormalizeSql = + compileOptionUsed("ENABLE_NORMALIZE"); + + /** + Throws UnsupportedOperationException if check is false. + flag is expected to be the name of an SQLITE_ENABLE_... + build flag. + */ + private static void checkSupported(boolean check, String flag){ + if( !check ){ + throw new UnsupportedOperationException( + "Library was built without "+flag + ); + } + } + /** Analog to sqlite3_complete(). */ @@ -972,10 +987,12 @@ public final class Sqlite implements AutoCloseable { } /** - Analog to sqlite3_normalized_sql(), returning null if the - library is built without the SQLITE_ENABLE_NORMALIZE flag. + Analog to sqlite3_normalized_sql(), but throws + UnsupportedOperationException if the library was built without + the SQLITE_ENABLE_NORMALIZE flag. */ public String normalizedSql(){ + Sqlite.checkSupported(hasNormalizeSql, "SQLITE_ENABLE_NORMALIZE"); return CApi.sqlite3_normalized_sql(thisStmt()); } diff --git a/manifest b/manifest index c813cb698b..5467b57897 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sauthorizer\ssupport\sto\s\sJNI\swrapper1. -D 2023-11-05T01:55:20.977 +C JNI\swrapper1\snormalizeSql()\snow\sthrows\sUnsupportedOperationException,\sinstead\sof\sreturning\snull,\sif\sbuilt\swithout\sSQLITE_ENABLE_NORMALIZE.\sRemove\sSQLITE_PREPARE_NORMALIZE\sfrom\sthe\sJNI\sinterface\sbecause\sit's\sa\slegacy\sno-op. +D 2023-11-05T03:37:33.975 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -242,7 +242,7 @@ F ext/jni/GNUmakefile 36919b7c4fb8447da4330df9996c7b064b766957f8b7be214a30eab55a F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa F ext/jni/src/c/sqlite3-jni.c b98d822a35ef4438023c3c14816b5ac17bdbd23bc838ff80b6463c3146a75d14 -F ext/jni/src/c/sqlite3-jni.h 03f66d3b43359dacd7c2c9407d78274dbdb027bc7610985011bf2b462222414e +F ext/jni/src/c/sqlite3-jni.h 9300900f7ec91fffa01445e1ad5815e35a7bece4c9ca07de464641f77195404a F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba F ext/jni/src/org/sqlite/jni/annotation/package-info.java 977b374aed9d5853cbf3438ba3b0940abfa2ea4574f702a2448ee143b98ac3ca @@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca -F ext/jni/src/org/sqlite/jni/capi/CApi.java a6d4fdd35e4fcfe95c61e343eb389cfaab3d5166e9670730aef14240a982b97b +F ext/jni/src/org/sqlite/jni/capi/CApi.java 41da9b46718b258ad2f195f3dec7265747eff37b6b350b8c427ee290eed0d83c F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab @@ -261,7 +261,7 @@ F ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java 701f2e4d8bdeb27cfbee F ext/jni/src/org/sqlite/jni/capi/NativePointerHolder.java b7036dcb1ef1b39f1f36ac605dde0ff1a24a9a01ade6aa1a605039443e089a61 F ext/jni/src/org/sqlite/jni/capi/OutputPointer.java 68f60aec7aeb5cd4e5fb83449037f668c63cb99f682ee1036cc226d0cbd909b9 F ext/jni/src/org/sqlite/jni/capi/PrepareMultiCallback.java aca8f9fa72e3b6602bc9a7dd3ae9f5b2808103fbbee9b2749dc96c19cdc261a1 -F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java 819d938e26208adde17ca4b7ddde1d8cd6915b6ab7b708249a9787beca6bd6b6 +F ext/jni/src/org/sqlite/jni/capi/PreupdateHookCallback.java efcf57545c5e282d1dd332fa63329b3b218d98f356ef107a9dbe3979be82213a F ext/jni/src/org/sqlite/jni/capi/ProgressHandlerCallback.java 01bc0c238eed2d5f93c73522cb7849a445cc9098c2ed1e78248fa20ed1cfde5b F ext/jni/src/org/sqlite/jni/capi/ResultCode.java 8141171f1bcf9f46eef303b9d3c5dc2537a25ad1628f3638398d8a60cacefa7f F ext/jni/src/org/sqlite/jni/capi/RollbackHookCallback.java e172210a2080e851ebb694c70e9f0bf89284237795e38710a7f5f1b61e3f6787 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java 89d3c4b2ffa9a7d3a125daae66167d29f64058702f65254b7d4a721e3868bd1b +F ext/jni/src/org/sqlite/jni/capi/Tester1.java f931370e0beb121390c31747a019690a7cf0927120396862d2a02f75a66bf89c F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,7 +296,7 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 2397e70955de15f8fb65a7ed421365f018c099d16b8080f81c7553e4dae3d44f +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java fbdb8d6643ac1f32c4ffdb76a2ee4580edd0b1935d8d13ad7f581a702635313b F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35 F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 199b9fb56e06f808d5856494ca8840e9004ff939f27c7c6fda9a60858144f95d F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88 -R d2d319f241ba72795b6add1f6b68fc9e +P 773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0 +R ea6cc7dea8e7673dad2d1e0c776c92af U stephan -Z a73e3653c86a5ad585af4f9360f1181a +Z d4fc1a1c9c9dbb69dd1ef9b20d8e37f3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index db8f9c9684..624838ac87 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0 \ No newline at end of file +d081a126697e214082f3b203f23ea63510080e5c2aac1d8badc9e6e4bfea7c95 \ No newline at end of file From ed99e7493aa4f3dd2c49859ca8aaa2c9a831de7a Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 5 Nov 2023 04:20:04 +0000 Subject: [PATCH 242/242] Add incremental blob I/O support to JNI wrapper1. FossilOrigin-Name: 7f1c76fe930d69a0274f70fa7b7e68e0db6226b731a065fa57d0936c8400ffb0 --- ext/jni/src/org/sqlite/jni/capi/Tester1.java | 2 +- .../src/org/sqlite/jni/wrapper1/Sqlite.java | 75 ++++++++++++++++++- .../src/org/sqlite/jni/wrapper1/Tester2.java | 26 +++++++ manifest | 16 ++-- manifest.uuid | 2 +- 5 files changed, 110 insertions(+), 11 deletions(-) diff --git a/ext/jni/src/org/sqlite/jni/capi/Tester1.java b/ext/jni/src/org/sqlite/jni/capi/Tester1.java index 5655ac7809..b25d077408 100644 --- a/ext/jni/src/org/sqlite/jni/capi/Tester1.java +++ b/ext/jni/src/org/sqlite/jni/capi/Tester1.java @@ -1633,7 +1633,7 @@ public class Tester1 implements Runnable { sqlite3_finalize(stmt); b = sqlite3_blob_open(db, "main", "t", "a", - sqlite3_last_insert_rowid(db), 1); + sqlite3_last_insert_rowid(db), 0); affirm( null!=b ); rc = sqlite3_blob_reopen(b, 2); affirm( 0==rc ); diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java index abf7f20f06..93c294f5de 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java @@ -17,6 +17,7 @@ import org.sqlite.jni.capi.CApi; import org.sqlite.jni.capi.sqlite3; import org.sqlite.jni.capi.sqlite3_stmt; import org.sqlite.jni.capi.sqlite3_backup; +import org.sqlite.jni.capi.sqlite3_blob; import org.sqlite.jni.capi.OutputPointer; /** @@ -473,7 +474,7 @@ public final class Sqlite implements AutoCloseable { if( 0!=rc ){ if( CApi.SQLITE_NOMEM==rc ){ throw new OutOfMemoryError(); - }else if( null==db || 0==CApi.sqlite3_errcode(db)){ + }else if( null==db || 0==CApi.sqlite3_errcode(db) ){ throw new SqliteException(rc); }else{ throw new SqliteException(db); @@ -1630,4 +1631,76 @@ public final class Sqlite implements AutoCloseable { checkRc( CApi.sqlite3_set_authorizer( thisDb(), ac ) ); } + /** + Object type for use with blobOpen() + */ + public final class Blob implements AutoCloseable { + private Sqlite db; + private sqlite3_blob b; + Blob(Sqlite db, sqlite3_blob b){ + this.db = db; + this.b = b; + } + + /** + Analog to sqlite3_blob_close(). + */ + @Override public void close(){ + if( null!=b ){ + CApi.sqlite3_blob_close(b); + b = null; + db = null; + } + } + + /** + Analog to sqlite3_blob_reopen() but throws on error. + */ + public void reopen(long newRowId){ + db.checkRc( CApi.sqlite3_blob_reopen(b, newRowId) ); + } + + /** + Analog to sqlite3_blob_write() but throws on error. + */ + public void write( byte[] bytes, int atOffset ){ + db.checkRc( CApi.sqlite3_blob_write(b, bytes, atOffset) ); + } + + /** + Analog to sqlite3_blob_read() but throws on error. + */ + public void read( byte[] dest, int atOffset ){ + db.checkRc( CApi.sqlite3_blob_read(b, dest, atOffset) ); + } + + /** + Analog to sqlite3_blob_bytes(). + */ + public int bytes(){ + return CApi.sqlite3_blob_bytes(b); + } + } + + /** + Analog to sqlite3_blob_open(). Returns a Blob object for the + given database, table, column, and rowid. The blob is opened for + read-write mode if writeable is true, else it is read-only. + + The returned object must eventually be freed, before this + database is closed, by either arranging for it to be auto-closed + or calling its close() method. + + Throws on error. + */ + public Blob blobOpen(String dbName, String tableName, String columnName, + long iRow, boolean writeable){ + final OutputPointer.sqlite3_blob out = new OutputPointer.sqlite3_blob(); + checkRc( + CApi.sqlite3_blob_open(thisDb(), dbName, tableName, columnName, + iRow, writeable ? 1 : 0, out) + ); + return new Blob(this, out.take()); + } + } diff --git a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java index b03a83417f..3f7593c709 100644 --- a/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java +++ b/ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java @@ -912,6 +912,32 @@ public class Tester2 implements Runnable { db.close(); } + private void testBlobOpen(){ + final Sqlite db = openDb(); + + execSql(db, "CREATE TABLE T(a BLOB);" + +"INSERT INTO t(rowid,a) VALUES(1, 'def'),(2, 'XYZ');" + ); + Sqlite.Blob b = db.blobOpen("main", "t", "a", + db.lastInsertRowId(), true); + affirm( 3==b.bytes() ); + b.write(new byte[] {100, 101, 102 /*"DEF"*/}, 0); + b.close(); + Sqlite.Stmt stmt = db.prepare("SELECT length(a), a FROM t ORDER BY a"); + affirm( stmt.step() ); + affirm( 3 == stmt.columnInt(0) ); + affirm( "def".equals(stmt.columnText16(1)) ); + stmt.finalizeStmt(); + + b = db.blobOpen("main", "t", "a", db.lastInsertRowId(), false); + b.reopen(2); + final byte[] tgt = new byte[3]; + b.read( tgt, 0 ); + affirm( 100==tgt[0] && 101==tgt[1] && 102==tgt[2], "DEF" ); + b.close(); + db.close(); + } + private void runTests(boolean fromThread) throws Exception { List mlist = testMethods; affirm( null!=mlist ); diff --git a/manifest b/manifest index 5467b57897..f81c5b0edc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C JNI\swrapper1\snormalizeSql()\snow\sthrows\sUnsupportedOperationException,\sinstead\sof\sreturning\snull,\sif\sbuilt\swithout\sSQLITE_ENABLE_NORMALIZE.\sRemove\sSQLITE_PREPARE_NORMALIZE\sfrom\sthe\sJNI\sinterface\sbecause\sit's\sa\slegacy\sno-op. -D 2023-11-05T03:37:33.975 +C Add\sincremental\sblob\sI/O\ssupport\sto\sJNI\swrapper1. +D 2023-11-05T04:20:04.320 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -269,7 +269,7 @@ F ext/jni/src/org/sqlite/jni/capi/SQLFunction.java 0d1e9afc9ff8a2adb94a155b72385 F ext/jni/src/org/sqlite/jni/capi/SQLTester.java 09bee15aa0eedac68d767ae21d9a6a62a31ade59182a3ccbf036d6463d9e30b1 F ext/jni/src/org/sqlite/jni/capi/ScalarFunction.java 93b9700fca4c68075ccab12fe0fbbc76c91cafc9f368e835b9bd7cd7732c8615 F ext/jni/src/org/sqlite/jni/capi/TableColumnMetadata.java addf120e0e76e5be1ff2260daa7ce305ff9b5fafd64153a7a28e9d8f000a815f -F ext/jni/src/org/sqlite/jni/capi/Tester1.java f931370e0beb121390c31747a019690a7cf0927120396862d2a02f75a66bf89c +F ext/jni/src/org/sqlite/jni/capi/Tester1.java 2898e38cf5ee568a93e760fa9b84f448acb58138d0fca18d146e80a1da7c45fc F ext/jni/src/org/sqlite/jni/capi/TraceV2Callback.java 0a25e117a0daae3394a77f24713e36d7b44c67d6e6d30e9e1d56a63442eef723 F ext/jni/src/org/sqlite/jni/capi/UpdateHookCallback.java c8bdf7848e6599115d601bcc9427ff902cb33129b9be32870ac6808e04b6ae56 F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb7bbf1a819aad4bb7eb77b1edc47773a3950 @@ -296,9 +296,9 @@ F ext/jni/src/org/sqlite/jni/test-script-interpreter.md f9f25126127045d051e918fe F ext/jni/src/org/sqlite/jni/wrapper1/AggregateFunction.java d5c108b02afd3c63c9e5e53f71f85273c1bfdc461ae526e0a0bb2b25e4df6483 F ext/jni/src/org/sqlite/jni/wrapper1/ScalarFunction.java 43c43adfb7866098aadaaca1620028a6ec82d5193149970019b1cce9eb59fb03 F ext/jni/src/org/sqlite/jni/wrapper1/SqlFunction.java 2833afdb9af5c1949bb35f4c926a5351fba9d1cdf0996864caa7b47827a346c7 -F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java fbdb8d6643ac1f32c4ffdb76a2ee4580edd0b1935d8d13ad7f581a702635313b +F ext/jni/src/org/sqlite/jni/wrapper1/Sqlite.java 6a310fe422d0daf79f7841c9b341f64d843ca7e85ef31829530623a81ecd25fa F ext/jni/src/org/sqlite/jni/wrapper1/SqliteException.java 982538ddb4c0719ef87dfa664cd137b09890b546029a7477810bd64d4c47ee35 -F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java 199b9fb56e06f808d5856494ca8840e9004ff939f27c7c6fda9a60858144f95d +F ext/jni/src/org/sqlite/jni/wrapper1/Tester2.java a944fd0a9047a51a5074bffd707452d80cf06e715ebc78b541480ee98629fb93 F ext/jni/src/org/sqlite/jni/wrapper1/ValueHolder.java 7b89a7391f771692c5b83b0a5b86266abe8d59f1c77d7a0eccc9b79f259d79af F ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java c7d1452f9ff26175b3c19bbf273116cc2846610af68e01756d755f037fe7319f F ext/jni/src/tests/000-000-sanity.test c3427a0e0ac84d7cbe4c95fdc1cd4b61f9ddcf43443408f3000139478c4dc745 @@ -2142,8 +2142,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0 -R ea6cc7dea8e7673dad2d1e0c776c92af +P d081a126697e214082f3b203f23ea63510080e5c2aac1d8badc9e6e4bfea7c95 +R d10239966e7198eb47ba47ac2878d98e U stephan -Z d4fc1a1c9c9dbb69dd1ef9b20d8e37f3 +Z e8e87bde5ba89e299cdcc353d989a2b2 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 624838ac87..63c307a8c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d081a126697e214082f3b203f23ea63510080e5c2aac1d8badc9e6e4bfea7c95 \ No newline at end of file +7f1c76fe930d69a0274f70fa7b7e68e0db6226b731a065fa57d0936c8400ffb0 \ No newline at end of file