Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch branch-3.43 Excluding Merge-Ins
This is equivalent to a diff from 0f80b798b3 to 16aa729774
2024-01-12
| ||
16:33 | Fix a usan complaint about signed integer overflow. (Leaf check-in: 16aa729774 user: drh tags: branch-3.43) | |
15:38 | Fix a signed integer overflow usan complaint in fts5. This is fixed on trunk by [a76a636b23], but that is a large commit that adds new features. (check-in: 4b2d02f260 user: dan tags: branch-3.43) | |
2023-12-22
| ||
14:47 | Fix a usan complaint about signed integer overflow. (check-in: e65907e027 user: dan tags: trunk) | |
2023-08-28
| ||
05:06 | Resolve a makefile bug which causes sqlite3-worker1-bundler-friendly.mjs to be built incorrectly. Reported in forum post a874e435cf4690c1. (check-in: 289d2a0e64 user: stephan tags: branch-3.43) | |
2023-08-24
| ||
14:43 | Merge into trunk improvements made to the wasm APIs which were too late for 3.43. (check-in: ac9da5c79a user: stephan tags: trunk) | |
13:32 | Version-3.43.0 for the reuse-schema branch. (check-in: 6f1bcd6a1a user: drh tags: reuse-schema) | |
13:19 | Version 3.43.0 for the wal2 branch. (check-in: b5970fc459 user: drh tags: wal2) | |
13:17 | Version 3.43.0 for the begin-concurrent branch. (check-in: e67bf28245 user: drh tags: begin-concurrent) | |
12:36 | Version 3.43.0 (check-in: 0f80b798b3 user: drh tags: trunk, release, major-release, version-3.43.0) | |
12:01 | Change a variable name in fts5FlushOneHash() to avoid shadowing another. (check-in: 3f5bec9a68 user: dan tags: trunk) | |
Changes to Makefile.in.
︙ | ︙ | |||
1308 1309 1310 1311 1312 1313 1314 | # the testrunner.tcl script to run them in multiple cores # concurrently. testrunner: testfixture$(TEXE) ./testfixture$(TEXE) $(TOP)/test/testrunner.tcl # Runs both fuzztest and testrunner, consecutively. # | | | > > > > > > | | | 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 | # the testrunner.tcl script to run them in multiple cores # concurrently. testrunner: testfixture$(TEXE) ./testfixture$(TEXE) $(TOP)/test/testrunner.tcl # Runs both fuzztest and testrunner, consecutively. # devtest: srctree-check testfixture$(TEXE) fuzztest testrunner mdevtest: srctree-check $(TCLSH_CMD) $(TOP)/test/testrunner.tcl mdevtest sdevtest: $(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: srctree-check testfixture$(TEXE) ./testfixture$(TEXE) $(TOP)/test/testrunner.tcl release # Minimal testing that runs in less than 3 minutes # quicktest: ./testfixture$(TEXE) ./testfixture$(TEXE) $(TOP)/test/extraquick.test $(TESTOPTS) # This is the common case. Run many tests that do not take too long, # including fuzzcheck, sqlite3_analyzer, and sqldiff tests. # 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. # valgrindtest: $(TESTPROGS) valgrindfuzz OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind $(TESTOPTS) |
︙ | ︙ |
Changes to VERSION.
|
| | | 1 | 3.43.2 |
Changes to autoconf/tea/configure.ac.
︙ | ︙ | |||
15 16 17 18 19 20 21 | # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION # set as provided. These will also be added as -D defs in your Makefile # so you can encode the package version directly into the source files. # This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME> # so that we create the export library with the dll. #----------------------------------------------------------------------- | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION # set as provided. These will also be added as -D defs in your Makefile # so you can encode the package version directly into the source files. # This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME> # so that we create the export library with the dll. #----------------------------------------------------------------------- AC_INIT([sqlite],[3.43.2]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. #-------------------------------------------------------------------- |
︙ | ︙ |
Changes to configure.
1 2 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. | | | 1 2 3 4 5 6 7 8 9 10 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for sqlite 3.43.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. |
︙ | ︙ | |||
722 723 724 725 726 727 728 | subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' | | | | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' PACKAGE_VERSION='3.43.2' PACKAGE_STRING='sqlite 3.43.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> #ifdef HAVE_SYS_TYPES_H |
︙ | ︙ | |||
1466 1467 1468 1469 1470 1471 1472 | # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF | | | 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures sqlite 3.43.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. |
︙ | ︙ | |||
1531 1532 1533 1534 1535 1536 1537 | --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in | | | 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of sqlite 3.43.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] |
︙ | ︙ | |||
1661 1662 1663 1664 1665 1666 1667 | cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF | | | 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF sqlite configure 3.43.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit |
︙ | ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. | | | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 | eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by sqlite $as_me 3.43.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { |
︙ | ︙ | |||
12453 12454 12455 12456 12457 12458 12459 | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" | | | 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 | test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by sqlite $as_me 3.43.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ |
︙ | ︙ | |||
12519 12520 12521 12522 12523 12524 12525 | Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ | | | 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 | Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ sqlite config.status 3.43.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." |
︙ | ︙ |
Changes to ext/fts3/fts3_write.c.
︙ | ︙ | |||
5214 5215 5216 5217 5218 5219 5220 | int *pRc /* OUT: Return code */ ){ Fts3SegFilter filter; Fts3MultiSegReader csr; int rc; u64 cksum = 0; | | | 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 | int *pRc /* OUT: Return code */ ){ Fts3SegFilter filter; Fts3MultiSegReader csr; int rc; u64 cksum = 0; if( *pRc ) return 0; memset(&filter, 0, sizeof(filter)); memset(&csr, 0, sizeof(csr)); filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY; filter.flags |= FTS3_SEGMENT_SCAN; rc = sqlite3Fts3SegReaderCursor( |
︙ | ︙ |
Changes to ext/fts5/fts5_index.c.
︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | }else{ int iOff; for(iOff=pLvl->iOff; iOff<pData->nn; iOff++){ if( pData->p[iOff] ) break; } if( iOff<pData->nn ){ | | | | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 | }else{ int iOff; for(iOff=pLvl->iOff; iOff<pData->nn; iOff++){ if( pData->p[iOff] ) break; } if( iOff<pData->nn ){ u64 iVal; pLvl->iLeafPgno += (iOff - pLvl->iOff) + 1; iOff += fts5GetVarint(&pData->p[iOff], &iVal); pLvl->iRowid += iVal; pLvl->iOff = iOff; }else{ pLvl->bEof = 1; } } |
︙ | ︙ | |||
4206 4207 4208 4209 4210 4211 4212 | pDlidx->bPrevValid = 0; pDlidx->pgno++; }else{ bDone = 1; } if( pDlidx->bPrevValid ){ | | | 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 | pDlidx->bPrevValid = 0; pDlidx->pgno++; }else{ bDone = 1; } if( pDlidx->bPrevValid ){ iVal = (u64)iRowid - (u64)pDlidx->iPrev; }else{ i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno); assert( pDlidx->buf.n==0 ); sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, !bDone); sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iPgno); iVal = iRowid; } |
︙ | ︙ | |||
5053 5054 5055 5056 5057 5058 5059 | int iOff = 0; int nIdx = 0; u8 *aIdx = 0; int bLastInDoclist = 0; int iIdx = 0; int iStart = 0; int iKeyOff = 0; | < | 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 | int iOff = 0; int nIdx = 0; u8 *aIdx = 0; int bLastInDoclist = 0; int iIdx = 0; int iStart = 0; int iKeyOff = 0; int iDelKeyOff = 0; /* Offset of deleted key, if any */ nIdx = nPg-iPgIdx; aIdx = sqlite3Fts5MallocZero(&p->rc, nIdx+16); if( p->rc ) return; memcpy(aIdx, &aPg[iPgIdx], nIdx); |
︙ | ︙ | |||
5194 5195 5196 5197 5198 5199 5200 | } memmove(&aPg[iOff], &aPg[iNextOff], nSuffix2); iOff += nSuffix2; iNextOff += nSuffix2; } } }else if( iStart==4 ){ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > | | | | < | | | | | < < | < | | | | | | | | | | | | 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 | } memmove(&aPg[iOff], &aPg[iNextOff], nSuffix2); iOff += nSuffix2; iNextOff += nSuffix2; } } }else if( iStart==4 ){ int iPgno; assert_nc( pSeg->iLeafPgno>pSeg->iTermLeafPgno ); /* The entry being removed may be the only position list in ** its doclist. */ for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){ Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno)); int bEmpty = (pPg && pPg->nn==4); fts5DataRelease(pPg); if( bEmpty==0 ) break; } if( iPgno==pSeg->iTermLeafPgno ){ i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno); Fts5Data *pTerm = fts5DataRead(p, iId); if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){ u8 *aTermIdx = &pTerm->p[pTerm->szLeaf]; int nTermIdx = pTerm->nn - pTerm->szLeaf; int iTermIdx = 0; int iTermOff = 0; while( 1 ){ u32 iVal = 0; int nByte = fts5GetVarint32(&aTermIdx[iTermIdx], iVal); iTermOff += iVal; if( (iTermIdx+nByte)>=nTermIdx ) break; iTermIdx += nByte; } nTermIdx = iTermIdx; memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx); fts5PutU16(&pTerm->p[2], iTermOff); fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx); if( nTermIdx==0 ){ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno); } } fts5DataRelease(pTerm); } } if( p->rc==SQLITE_OK ){ const int nMove = nPg - iNextOff; /* Number of bytes to move */ int nShift = iNextOff - iOff; /* Distance to move them */ int iPrevKeyOut = 0; int iKeyIn = 0; memmove(&aPg[iOff], &aPg[iNextOff], nMove); iPgIdx -= nShift; nPg = iPgIdx; fts5PutU16(&aPg[2], iPgIdx); for(iIdx=0; iIdx<nIdx; /* no-op */){ u32 iVal = 0; iIdx += fts5GetVarint32(&aIdx[iIdx], iVal); iKeyIn += iVal; if( iKeyIn!=iDelKeyOff ){ int iKeyOut = (iKeyIn - (iKeyIn>iOff ? nShift : 0)); nPg += sqlite3Fts5PutVarint(&aPg[nPg], iKeyOut - iPrevKeyOut); iPrevKeyOut = iKeyOut; } } if( iPgIdx==nPg && nIdx>0 && pSeg->iLeafPgno!=1 ){ fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iLeafPgno); } assert_nc( nPg>4 || fts5GetU16(aPg)==0 ); fts5DataWrite(p, FTS5_SEGMENT_ROWID(iSegid,pSeg->iLeafPgno), aPg, nPg); } sqlite3_free(aIdx); } /* ** This is called as part of flushing a delete to disk in 'secure-delete' ** mode. It edits the segments within the database described by argument ** pStruct to remove the entries for term zTerm, rowid iRowid. */ |
︙ | ︙ |
Changes to ext/fts5/fts5_main.c.
︙ | ︙ | |||
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 | pCsr->iFirstRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64); pCsr->iLastRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); }else{ pCsr->iLastRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64); pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); } if( pTab->pSortCsr ){ /* If pSortCsr is non-NULL, then this call is being made as part of ** processing for a "... MATCH <expr> ORDER BY rank" query (ePlan is ** set to FTS5_PLAN_SORTED_MATCH). pSortCsr is the cursor that will ** return results to the user for this query. The current cursor ** (pCursor) is used to execute the query issued by function ** fts5CursorFirstSorted() above. */ | > > > | 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 | pCsr->iFirstRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64); pCsr->iLastRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); }else{ pCsr->iLastRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64); pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); } rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); if( rc!=SQLITE_OK ) goto filter_out; if( pTab->pSortCsr ){ /* If pSortCsr is non-NULL, then this call is being made as part of ** processing for a "... MATCH <expr> ORDER BY rank" query (ePlan is ** set to FTS5_PLAN_SORTED_MATCH). pSortCsr is the cursor that will ** return results to the user for this query. The current cursor ** (pCursor) is used to execute the query issued by function ** fts5CursorFirstSorted() above. */ |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 | pCsr->iLastRowid = pTab->pSortCsr->iLastRowid; pCsr->iFirstRowid = pTab->pSortCsr->iFirstRowid; } pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); }else if( pCsr->pExpr ){ | > | > | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | pCsr->iLastRowid = pTab->pSortCsr->iLastRowid; pCsr->iFirstRowid = pTab->pSortCsr->iFirstRowid; } pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); }else if( pCsr->pExpr ){ if( rc==SQLITE_OK ){ rc = fts5CursorParseRank(pConfig, pCsr, pRank); } if( rc==SQLITE_OK ){ if( bOrderByRank ){ pCsr->ePlan = FTS5_PLAN_SORTED_MATCH; rc = fts5CursorFirstSorted(pTab, pCsr, bDesc); }else{ pCsr->ePlan = FTS5_PLAN_MATCH; rc = fts5CursorFirst(pTab, pCsr, bDesc); |
︙ | ︙ |
Changes to ext/fts5/test/fts5misc.test.
︙ | ︙ | |||
40 41 42 43 44 45 46 | do_catchsql_test 1.2.2 { SELECT a FROM t1 WHERE rank = (SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*id')); } {0 {}} do_catchsql_test 1.3.1 { SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*reads'); | | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | do_catchsql_test 1.2.2 { SELECT a FROM t1 WHERE rank = (SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*id')); } {0 {}} do_catchsql_test 1.3.1 { SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*reads'); } {1 {no such cursor: 2}} do_catchsql_test 1.3.2 { SELECT a FROM t1 WHERE rank = (SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*reads')); } {1 {no such cursor: 2}} db close sqlite3 db test.db do_catchsql_test 1.3.3 { SELECT a FROM t1 WHERE rank = (SELECT highlight(t1, 4, '<b>', '</b>') FROM t1('*reads')); |
︙ | ︙ |
Changes to ext/fts5/test/fts5rank.test.
︙ | ︙ | |||
176 177 178 179 180 181 182 183 | } do_execsql_test 6.1 { SELECT * FROM "My.Table" WHERE Text MATCH 'table' ORDER BY rank; } { {table table table} {the table names.} {rank on an fts5 table} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | } do_execsql_test 6.1 { SELECT * FROM "My.Table" WHERE Text MATCH 'table' ORDER BY rank; } { {table table table} {the table names.} {rank on an fts5 table} } #------------------------------------------------------------------------- # forum post: https://sqlite.org/forum/forumpost/a2dd636330 # reset_db do_execsql_test 1.0 { CREATE VIRTUAL TABLE t USING fts5 (a, b); INSERT INTO t (a, b) VALUES ('data1', 'sentence1'), ('data2', 'sentence2'); INSERT INTO t(t, rank) VALUES ('rank', 'bm25(10.0,1.0)'); } sqlite3 db2 test.db do_execsql_test -db db2 1.1 { SELECT *, rank<0.0 FROM t('data*') ORDER BY RANK; } {data1 sentence1 1 data2 sentence2 1} do_execsql_test 1.2 { INSERT INTO t(t, rank) VALUES ('rank', 'bm25(10.0,1.0)'); } do_execsql_test -db db2 1.3 { SELECT *, rank<0.0 FROM t('data*') ORDER BY RANK; } {data1 sentence1 1 data2 sentence2 1} db2 close finish_test |
Changes to ext/fts5/test/fts5secure.test.
︙ | ︙ | |||
268 269 270 271 272 273 274 275 276 277 278 | do_execsql_test 5.3 { INSERT INTO t1(t1) VALUES('integrity-check'); } do_execsql_test 5.4 { SELECT rowid FROM t1('abc'); } 2 do_execsql_test 5.5 { SELECT rowid FROM t1('aa'); } 2 finish_test | > > > > > > > > > > > > > | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | do_execsql_test 5.3 { INSERT INTO t1(t1) VALUES('integrity-check'); } do_execsql_test 5.4 { SELECT rowid FROM t1('abc'); } 2 do_execsql_test 5.5 { SELECT rowid FROM t1('aa'); } 2 #------------------------------------------------------------------------- reset_db do_execsql_test 6.0 { CREATE VIRTUAL TABLE fts USING fts5(content); INSERT INTO fts(fts, rank) VALUES ('secure-delete', 1); INSERT INTO fts(rowid, content) VALUES (3407, 'profile profile profile profile profile profile profile profile pull pulling pulling really'); DELETE FROM fts WHERE rowid IS 3407; INSERT INTO fts(fts) VALUES ('integrity-check'); } finish_test |
Changes to ext/fts5/test/fts5secure3.test.
︙ | ︙ | |||
82 83 84 85 86 87 88 | #execsql_pp { SELECT id, quote(block), fts5_decode(id, block) FROM t1_data; } #------------------------------------------------------------------------- # Tests with large/small rowid values. # | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | #execsql_pp { SELECT id, quote(block), fts5_decode(id, block) FROM t1_data; } #------------------------------------------------------------------------- # Tests with large/small rowid values. # foreach {tn cfg} { 1 "" 2 "INSERT INTO fff(fff, rank) VALUES('secure-delete', 1)" } { reset_db expr srand(0) set vocab { Popper Poppins Popsicle Porfirio Porrima Porsche Porter Portia Portland Portsmouth Portugal Portuguese Poseidon Post PostgreSQL Potemkin Potomac Potsdam Pottawatomie Potter Potts Pound Poussin Powell PowerPC PowerPoint Powers Powhatan Poznan Prada Prado Praetorian Prague Praia Prakrit Pratchett Pratt Pravda Praxiteles Preakness Precambrian Preminger Premyslid Prensa Prentice Pres Presbyterian Presbyterianism } proc newdoc {} { for {set i 0} {$i<8} {incr i} { lappend ret [lindex $::vocab [expr int(abs(rand()) * [llength $::vocab])]] } set ret } db func newdoc newdoc do_execsql_test 3.$tn.0 { CREATE VIRTUAL TABLE fff USING fts5(y); INSERT INTO fff(fff, rank) VALUES('pgsz', 64); WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 ) INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s; WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 ) INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s; WITH s(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM s WHERE x<1000 ) INSERT INTO fff(rowid, y) SELECT random() , newdoc() FROM s; } execsql $cfg proc lshuffle {in} { set out [list] while {[llength $in]>0} { set idx [expr int(abs(rand()) * [llength $in])] lappend out [lindex $in $idx] set in [lreplace $in $idx $idx] } set out } #dump fff set iTest 1 foreach ii [lshuffle [db eval {SELECT rowid FROM fff}]] { #if {$iTest==1} { dump fff } #if {$iTest==1} { breakpoint } do_execsql_test 3.$tn.1.$iTest.$ii { DELETE FROM fff WHERE rowid=$ii; } #if {$iTest==1} { dump fff } if {($iTest % 20)==0} { do_execsql_test 3.$tn.1.$iTest.$ii.ic { INSERT INTO fff(fff) VALUES('integrity-check'); } } #if {$iTest==1} { break } incr iTest } } #execsql_pp { SELECT rowid FROM fff('post') ORDER BY rowid ASC } #breakpoint #execsql_pp { # SELECT rowid FROM fff('post') ORDER BY rowid DESC #} |
︙ | ︙ |
Changes to ext/session/sqlite3session.c.
︙ | ︙ | |||
3232 3233 3234 3235 3236 3237 3238 | u8 enc = (eType==SQLITE_TEXT ? SQLITE_UTF8 : 0); rc = sessionValueSetStr(apOut[i],&pIn->aData[pIn->iNext],nByte,enc); pIn->iNext += nByte; } } } if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ | > > > | | | | | | | | | > | 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 | u8 enc = (eType==SQLITE_TEXT ? SQLITE_UTF8 : 0); rc = sessionValueSetStr(apOut[i],&pIn->aData[pIn->iNext],nByte,enc); pIn->iNext += nByte; } } } if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){ if( (pIn->nData-pIn->iNext)<8 ){ rc = SQLITE_CORRUPT_BKPT; }else{ sqlite3_int64 v = sessionGetI64(aVal); if( eType==SQLITE_INTEGER ){ sqlite3VdbeMemSetInt64(apOut[i], v); }else{ double d; memcpy(&d, &v, 8); sqlite3VdbeMemSetDouble(apOut[i], d); } pIn->iNext += 8; } } } } return rc; } |
︙ | ︙ |
Changes to ext/wasm/GNUmakefile.
︙ | ︙ | |||
841 842 843 844 845 846 847 | sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.mjs sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js $(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js))) $(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\ | | | | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.mjs sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js $(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js))) $(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\ $(c-pp.D.sqlite3-bundler-friendly))) $(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js))) $(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\ $(sqlite3-worker1-promiser-bundler-friendly.js),\ $(c-pp.D.sqlite3-bundler-friendly))) $(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.js) \ $(sqlite3-worker1-promiser-bundler-friendly.js) $(sqlite3.js) $(sqlite3.mjs): $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) ######################################################################## # batch-runner.js is part of one of the test apps which reads in SQL # dumps generated by $(speedtest1) and executes them. |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-api-glue.js.
︙ | ︙ | |||
884 885 886 887 888 889 890 | /** Internal helper to assist in validating call argument counts in the hand-written sqlite3_xyz() wrappers. We do this only for consistency with non-special-case wrappings. */ const __dbArgcMismatch = (pDb,f,n)=>{ | | | | | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | /** Internal helper to assist in validating call argument counts in the hand-written sqlite3_xyz() wrappers. We do this only for consistency with non-special-case wrappings. */ const __dbArgcMismatch = (pDb,f,n)=>{ return util.sqlite3_wasm_db_error(pDb, capi.SQLITE_MISUSE, f+"() requires "+n+" argument"+ (1===n?"":'s')+"."); }; /** Code duplication reducer for functions which take an encoding argument and require SQLITE_UTF8. Sets the db error code to SQLITE_FORMAT and returns that code. */ const __errEncoding = (pDb)=>{ return util.sqlite3_wasm_db_error( |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js.
︙ | ︙ | |||
886 887 888 889 890 891 892 893 894 895 896 897 898 899 | || this.nextAvailableSAH() || toss("No available handles to import to."); const nWrote = sah.write(bytes, {at: HEADER_OFFSET_DATA}); if(nWrote != n){ this.setAssociatedPath(sah, '', 0); toss("Expected to write "+n+" bytes but wrote "+nWrote+"."); }else{ this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); } } }/*class OpfsSAHPool*/; | > > | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | || this.nextAvailableSAH() || toss("No available handles to import to."); const nWrote = sah.write(bytes, {at: HEADER_OFFSET_DATA}); if(nWrote != n){ this.setAssociatedPath(sah, '', 0); toss("Expected to write "+n+" bytes but wrote "+nWrote+"."); }else{ sah.write(new Uint8Array([1,1]), {at: HEADER_OFFSET_DATA+18} /* force db out of WAL mode */); this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); } } }/*class OpfsSAHPool*/; |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-vfs-opfs.c-pp.js.
︙ | ︙ | |||
1188 1189 1190 1191 1192 1193 1194 1195 | } const header = "SQLite format 3"; for(let i = 0; i < header.length; ++i){ if( header.charCodeAt(i) !== bytes[i] ){ toss("Input does not contain an SQLite database header."); } } const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true); | > > | | | | < | | | > | > > > > > > > | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | } const header = "SQLite format 3"; for(let i = 0; i < header.length; ++i){ if( header.charCodeAt(i) !== bytes[i] ){ toss("Input does not contain an SQLite database header."); } } let sah; const [hDir, fnamePart] = await opfsUtil.getDirForFilename(filename, true); try { const hFile = await hDir.getFileHandle(fnamePart, {create:true}); sah = await hFile.createSyncAccessHandle(); sah.truncate(0); const nWrote = sah.write(bytes, {at: 0}); if(nWrote != n){ toss("Expected to write "+n+" bytes but wrote "+nWrote+"."); } sah.write(new Uint8Array([1,1]), {at: 18}) /* force db out of WAL mode */; return nWrote; }catch(e){ if( sah ){ await sah.close(); sah = undefined; } await hDir.removeEntry( fnamePart ).catch(()=>{}); throw e; }finally{ if( sah ) await sah.close(); } }; if(sqlite3.oo1){ const OpfsDb = function(...args){ const opt = sqlite3.oo1.DB.dbCtorHelper.normalizeArgs(...args); opt.vfs = opfsVfs.$zName; sqlite3.oo1.DB.dbCtorHelper.call(this, opt); |
︙ | ︙ |
Changes to ext/wasm/api/sqlite3-wasm.c.
︙ | ︙ | |||
117 118 119 120 121 122 123 | #ifndef SQLITE_ENABLE_STMTVTAB # define SQLITE_ENABLE_STMTVTAB 1 #endif #ifndef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION # define SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION #endif | < < < < < < | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | #ifndef SQLITE_ENABLE_STMTVTAB # define SQLITE_ENABLE_STMTVTAB 1 #endif #ifndef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION # define SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION #endif /**********************************************************************/ /* SQLITE_O... */ #ifndef SQLITE_OMIT_DEPRECATED # define SQLITE_OMIT_DEPRECATED 1 #endif #ifndef SQLITE_OMIT_LOAD_EXTENSION # define SQLITE_OMIT_LOAD_EXTENSION 1 |
︙ | ︙ |
Changes to src/btree.c.
︙ | ︙ | |||
7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 | int iEnd = i+nCell; /* Loop terminator */ u8 *pCellptr = pPg->aCellIdx; u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); u8 *pData; int k; /* Current slot in pCArray->apEnd[] */ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ assert( i<iEnd ); j = get2byte(&aData[hdr+5]); if( NEVER(j>(u32)usableSize) ){ j = 0; } memcpy(&pTmp[j], &aData[j], usableSize - j); for(k=0; ALWAYS(k<NB*2) && pCArray->ixNx[k]<=i; k++){} pSrcEnd = pCArray->apEnd[k]; | > | 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 | int iEnd = i+nCell; /* Loop terminator */ u8 *pCellptr = pPg->aCellIdx; u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager); u8 *pData; int k; /* Current slot in pCArray->apEnd[] */ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ assert( nCell>0 ); assert( i<iEnd ); j = get2byte(&aData[hdr+5]); if( NEVER(j>(u32)usableSize) ){ j = 0; } memcpy(&pTmp[j], &aData[j], usableSize - j); for(k=0; ALWAYS(k<NB*2) && pCArray->ixNx[k]<=i; k++){} pSrcEnd = pCArray->apEnd[k]; |
︙ | ︙ | |||
7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 | pCArray->pRef->xCellSize(pCArray->pRef, pCArray->apCell[i+iNew])) ); } #endif return SQLITE_OK; editpage_fail: /* Unable to edit this page. Rebuild it from scratch instead. */ populateCellCache(pCArray, iNew, nNew); return rebuildPage(pCArray, iNew, nNew, pPg); } #ifndef SQLITE_OMIT_QUICKBALANCE /* | > | 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 | pCArray->pRef->xCellSize(pCArray->pRef, pCArray->apCell[i+iNew])) ); } #endif 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); } #ifndef SQLITE_OMIT_QUICKBALANCE /* |
︙ | ︙ |
Changes to src/func.c.
︙ | ︙ | |||
1812 1813 1814 1815 1816 1817 1818 1819 | static void sumFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ if( p->approx ){ if( p->ovrfl ){ sqlite3_result_error(context,"integer overflow",-1); }else{ | > > | | > | > | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 | static void sumFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ if( p->approx ){ if( p->ovrfl ){ sqlite3_result_error(context,"integer overflow",-1); }else if( !sqlite3IsNaN(p->rErr) ){ sqlite3_result_double(context, p->rSum+p->rErr); }else{ sqlite3_result_double(context, p->rSum); } }else{ sqlite3_result_int64(context, p->iSum); } } } static void avgFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); if( p && p->cnt>0 ){ double r; if( p->approx ){ r = p->rSum; if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } sqlite3_result_double(context, r/(double)p->cnt); } } static void totalFinalize(sqlite3_context *context){ SumCtx *p; double r = 0.0; p = sqlite3_aggregate_context(context, 0); if( p ){ if( p->approx ){ r = p->rSum; if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } } sqlite3_result_double(context, r); } |
︙ | ︙ |
Changes to src/json.c.
︙ | ︙ | |||
2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | for(;;){ while( j<=pRoot->n && (i>0 || ((pRoot[j].jnFlags & JNODE_REMOVE)!=0 && pParse->useMod)) ){ if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ) i--; j += jsonNodeSize(&pRoot[j]); } if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; if( pParse->useMod==0 ) break; assert( pRoot->eU==2 ); iRoot = pRoot->u.iAppend; pRoot = &pParse->aNode[iRoot]; j = 1; } | > | 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 | for(;;){ while( j<=pRoot->n && (i>0 || ((pRoot[j].jnFlags & JNODE_REMOVE)!=0 && pParse->useMod)) ){ 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 ); iRoot = pRoot->u.iAppend; pRoot = &pParse->aNode[iRoot]; j = 1; } |
︙ | ︙ | |||
2480 2481 2482 2483 2484 2485 2486 | pNode = p->aNode; } if( pNode==0 ){ return; } if( pNode->eType==JSON_ARRAY ){ while( 1 /*exit-by-break*/ ){ | > | > | 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 | pNode = p->aNode; } if( pNode==0 ){ return; } if( pNode->eType==JSON_ARRAY ){ while( 1 /*exit-by-break*/ ){ i = 1; while( i<=pNode->n ){ if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++; i += jsonNodeSize(&pNode[i]); } if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; if( p->useMod==0 ) break; assert( pNode->eU==2 ); pNode = &p->aNode[pNode->u.iAppend]; } |
︙ | ︙ | |||
2837 2838 2839 2840 2841 2842 2843 | const char *z = (const char*)sqlite3_value_text(pValue); u32 n = (u32)sqlite3_value_bytes(pValue); if( z==0 ){ p->oom = 1; break; } if( sqlite3_value_subtype(pValue)!=JSON_SUBTYPE ){ | | > > | | 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 | const char *z = (const char*)sqlite3_value_text(pValue); u32 n = (u32)sqlite3_value_bytes(pValue); if( z==0 ){ p->oom = 1; break; } if( sqlite3_value_subtype(pValue)!=JSON_SUBTYPE ){ char *zCopy = sqlite3_malloc64( n+1 ); int k; if( zCopy ){ memcpy(zCopy, z, n); zCopy[n] = 0; jsonParseAddCleanup(p, sqlite3_free, zCopy); }else{ p->oom = 1; sqlite3_result_error_nomem(pCtx); } k = jsonParseAddNode(p, JSON_STRING, n, zCopy); assert( k>0 || p->oom ); if( p->oom==0 ) p->aNode[k].jnFlags |= JNODE_RAW; }else{ |
︙ | ︙ | |||
2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 | if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, "replace"); return; } pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); if( pParse==0 ) return; for(i=1; i<(u32)argc; i+=2){ zPath = (const char*)sqlite3_value_text(argv[i]); pParse->useMod = 1; pNode = jsonLookup(pParse, zPath, 0, ctx); if( pParse->nErr ) goto replace_err; if( pNode ){ jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); } } jsonReturnJson(pParse, pParse->aNode, ctx, 1); replace_err: jsonDebugPrintParse(pParse); } /* ** json_set(JSON, PATH, VALUE, ...) ** ** Set the value at PATH to VALUE. Create the PATH if it does not already | > > | 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 | if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, "replace"); return; } 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; pNode = jsonLookup(pParse, zPath, 0, ctx); if( pParse->nErr ) goto replace_err; if( pNode ){ jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); } } jsonReturnJson(pParse, pParse->aNode, ctx, 1); replace_err: jsonDebugPrintParse(pParse); jsonParseFree(pParse); } /* ** json_set(JSON, PATH, VALUE, ...) ** ** Set the value at PATH to VALUE. Create the PATH if it does not already |
︙ | ︙ | |||
2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 | if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert"); return; } pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); if( pParse==0 ) return; for(i=1; i<(u32)argc; i+=2){ zPath = (const char*)sqlite3_value_text(argv[i]); bApnd = 0; pParse->useMod = 1; pNode = jsonLookup(pParse, zPath, &bApnd, ctx); if( pParse->oom ){ sqlite3_result_error_nomem(ctx); goto jsonSetDone; }else if( pParse->nErr ){ goto jsonSetDone; }else if( pNode && (bApnd || bIsSet) ){ jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); } } jsonDebugPrintParse(pParse); jsonReturnJson(pParse, pParse->aNode, ctx, 1); | > < < > | 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 | if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert"); return; } 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; pParse->useMod = 1; pNode = jsonLookup(pParse, zPath, &bApnd, ctx); if( pParse->oom ){ sqlite3_result_error_nomem(ctx); goto jsonSetDone; }else if( pParse->nErr ){ goto jsonSetDone; }else if( pNode && (bApnd || bIsSet) ){ jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); } } jsonDebugPrintParse(pParse); jsonReturnJson(pParse, pParse->aNode, ctx, 1); jsonSetDone: jsonParseFree(pParse); } /* ** json_type(JSON) ** json_type(JSON, PATH) ** ** Return the top-level "type" of a JSON string. json_type() raises an |
︙ | ︙ |
Changes to src/resolve.c.
︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter); } #endif pNC2 = pNC; while( pNC2 && sqlite3ReferencesSrcList(pParse, pExpr, pNC2->pSrcList)==0 ){ | | > | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter); } #endif pNC2 = pNC; while( pNC2 && sqlite3ReferencesSrcList(pParse, pExpr, pNC2->pSrcList)==0 ){ 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 ); testcase( (pDef->funcFlags & SQLITE_FUNC_ANYORDER)!=0 ); pNC2->ncFlags |= NC_HasAgg | ((pDef->funcFlags^SQLITE_FUNC_ANYORDER) & (SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER)); |
︙ | ︙ | |||
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | assert( pSub->pPrior && pSub->pOrderBy==0 ); pSub->pOrderBy = p->pOrderBy; p->pOrderBy = 0; } /* Recursively resolve names in all subqueries in the FROM clause */ for(i=0; i<p->pSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ int nRef = pOuterNC ? pOuterNC->nRef : 0; const char *zSavedContext = pParse->zAuthContext; if( pItem->zName ) pParse->zAuthContext = pItem->zName; | > | 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 | assert( pSub->pPrior && pSub->pOrderBy==0 ); pSub->pOrderBy = p->pOrderBy; p->pOrderBy = 0; } /* Recursively resolve names in all subqueries in the FROM clause */ if( pOuterNC ) pOuterNC->nNestedSelect++; for(i=0; i<p->pSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ int nRef = pOuterNC ? pOuterNC->nRef : 0; const char *zSavedContext = pParse->zAuthContext; if( pItem->zName ) pParse->zAuthContext = pItem->zName; |
︙ | ︙ | |||
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 | ** context containing the column when it resolves a name. */ if( pOuterNC ){ assert( pItem->fg.isCorrelated==0 && pOuterNC->nRef>=nRef ); pItem->fg.isCorrelated = (pOuterNC->nRef>nRef); } } } /* Set up the local name-context to pass to sqlite3ResolveExprNames() to ** resolve the result-set expression list. */ sNC.ncFlags = NC_AllowAgg|NC_AllowWin; sNC.pSrcList = p->pSrc; sNC.pNext = pOuterNC; | > | 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 | ** context containing the column when it resolves a name. */ if( pOuterNC ){ assert( pItem->fg.isCorrelated==0 && pOuterNC->nRef>=nRef ); pItem->fg.isCorrelated = (pOuterNC->nRef>nRef); } } } if( pOuterNC ) pOuterNC->nNestedSelect--; /* Set up the local name-context to pass to sqlite3ResolveExprNames() to ** resolve the result-set expression list. */ sNC.ncFlags = NC_AllowAgg|NC_AllowWin; sNC.pSrcList = p->pSrc; sNC.pNext = pOuterNC; |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
5297 5298 5299 5300 5301 5302 5303 | return 0; } assert( pItem->pTab!=0 ); pTab = pItem->pTab; assert( pItem->pSelect!=0 ); pSub = pItem->pSelect; assert( pSub->pEList->nExpr==pTab->nCol ); | > | | | | | < | 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 | return 0; } assert( pItem->pTab!=0 ); pTab = pItem->pTab; assert( pItem->pSelect!=0 ); pSub = pItem->pSelect; assert( pSub->pEList->nExpr==pTab->nCol ); for(pX=pSub; pX; pX=pX->pPrior){ if( (pX->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){ testcase( pX->selFlags & SF_Distinct ); testcase( pX->selFlags & SF_Aggregate ); return 0; } if( pX->pPrior && pX->op!=TK_ALL ){ /* This optimization does not work for compound subqueries that ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */ return 0; } #ifndef SQLITE_OMIT_WINDOWFUNC if( pX->pWin ){ |
︙ | ︙ |
Changes to src/shell.c.in.
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | sqlite3_value **apVal ){ double r = sqlite3_value_double(apVal[0]); int n = nVal>=2 ? sqlite3_value_int(apVal[1]) : 26; char z[400]; if( n<1 ) n = 1; if( n>350 ) n = 350; | | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 | sqlite3_value **apVal ){ double r = sqlite3_value_double(apVal[0]); int n = nVal>=2 ? sqlite3_value_int(apVal[1]) : 26; char z[400]; if( n<1 ) n = 1; if( n>350 ) n = 350; snprintf(z, sizeof(z)-1, "%#+.*e", n, r); sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); } /* ** SQL function: shell_module_schema(X) ** |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 | Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */ int iBaseReg; /* For TK_REGISTER when parsing RETURNING */ } uNC; NameContext *pNext; /* Next outer name context. NULL for outermost */ 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 */ Select *pWinSelect; /* SELECT statement for any window functions */ }; /* ** Allowed values for the NameContext, ncFlags field. ** ** Value constraints (all checked via assert()): | > | 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 | Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */ int iBaseReg; /* For TK_REGISTER when parsing RETURNING */ } uNC; NameContext *pNext; /* Next outer name context. NULL for outermost */ 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 */ }; /* ** Allowed values for the NameContext, ncFlags field. ** ** Value constraints (all checked via assert()): |
︙ | ︙ |
Changes to src/util.c.
︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 | ** decimal extension, for example as follows: ** ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100))); */ double rr[2]; rr[0] = r; rr[1] = 0.0; | | | | | | | | | 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | ** decimal extension, for example as follows: ** ** SELECT decimal_exp(decimal_sub('1.0e+100',decimal(1.0e+100))); */ double rr[2]; rr[0] = r; rr[1] = 0.0; if( rr[0]>9.223372036854774784e+18 ){ while( rr[0]>9.223372036854774784e+118 ){ exp += 100; dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117); } while( rr[0]>9.223372036854774784e+28 ){ exp += 10; dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27); } while( rr[0]>9.223372036854774784e+18 ){ exp += 1; dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18); } }else{ while( rr[0]<9.223372036854774784e-83 ){ exp -= 100; dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83); } while( rr[0]<9.223372036854774784e+07 ){ exp -= 10; dekkerMul2(rr, 1.0e+10, 0.0); } while( rr[0]<9.22337203685477478e+17 ){ exp -= 1; dekkerMul2(rr, 1.0e+01, 0.0); } } v = rr[1]<0.0 ? (u64)rr[0]-(u64)(-rr[1]) : (u64)rr[0]+(u64)rr[1]; } |
︙ | ︙ |
Changes to src/vdbeblob.c.
︙ | ︙ | |||
55 56 57 58 59 60 61 | int rc; /* Error code */ char *zErr = 0; /* Error message */ Vdbe *v = (Vdbe *)p->pStmt; /* Set the value of register r[1] in the SQL statement to integer iRow. ** This is done directly as a performance optimization */ | < | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | int rc; /* Error code */ char *zErr = 0; /* Error message */ Vdbe *v = (Vdbe *)p->pStmt; /* Set the value of register r[1] in the SQL statement to integer iRow. ** This is done directly as a performance optimization */ 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 ** have been down with an extra OP_Goto, but simply setting the program ** counter is faster. */ if( v->pc>4 ){ v->pc = 4; |
︙ | ︙ |
Changes to src/vdbesort.c.
︙ | ︙ | |||
182 183 184 185 186 187 188 | ** are connected using SorterRecord.u.pNext. If aMemory!=0 then all objects ** are stored in the aMemory[] bulk memory, one right after the other, and ** are connected using SorterRecord.u.iNext. */ struct SorterList { SorterRecord *pList; /* Linked list of records */ u8 *aMemory; /* If non-NULL, bulk memory to hold pList */ | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | ** are connected using SorterRecord.u.pNext. If aMemory!=0 then all objects ** are stored in the aMemory[] bulk memory, one right after the other, and ** are connected using SorterRecord.u.iNext. */ struct SorterList { SorterRecord *pList; /* Linked list of records */ u8 *aMemory; /* If non-NULL, bulk memory to hold pList */ i64 szPMA; /* Size of pList as PMA in bytes */ }; /* ** The MergeEngine object is used to combine two or more smaller PMAs into ** one big PMA using a merge operation. Separate PMAs all need to be ** combined into one big PMA in order to be able to step through the sorted ** records in order. |
︙ | ︙ | |||
291 292 293 294 295 296 297 298 299 300 | ** after the thread has finished are not dire. So we don't worry about ** memory barriers and such here. */ 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 */ 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 */ | > < | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | ** after the thread has finished are not dire. So we don't worry about ** memory barriers and such here. */ 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 */ SorterCompare xCompare; /* Compare function to use */ SorterFile file; /* Temp file for level-0 PMAs */ SorterFile file2; /* Space for other PMAs */ }; /* |
︙ | ︙ | |||
1768 1769 1770 1771 1772 1773 1774 | const VdbeCursor *pCsr, /* Sorter cursor */ Mem *pVal /* Memory cell containing record */ ){ VdbeSorter *pSorter; int rc = SQLITE_OK; /* Return Code */ SorterRecord *pNew; /* New list element */ int bFlush; /* True to flush contents of memory to PMA */ | | | | 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 | const VdbeCursor *pCsr, /* Sorter cursor */ Mem *pVal /* Memory cell containing record */ ){ VdbeSorter *pSorter; int rc = SQLITE_OK; /* Return Code */ SorterRecord *pNew; /* New list element */ int bFlush; /* True to flush contents of memory to PMA */ 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 ); pSorter = pCsr->uc.pSorter; getVarint32NR((const u8*)&pVal->z[1], t); if( t>0 && t<10 && t!=7 ){ pSorter->typeMask &= SORTER_TYPE_INTEGER; |
︙ | ︙ |
Changes to test/aggnested.test.
︙ | ︙ | |||
353 354 355 356 357 358 359 360 361 362 363 364 365 | } {{}} do_execsql_test 6.2.2 { SELECT ( SELECT c FROM (SELECT t2.b AS c FROM t1) GROUP BY c HAVING t2.b ) FROM t2 GROUP BY 'constant_string'; } {{}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | } {{}} do_execsql_test 6.2.2 { SELECT ( SELECT c FROM (SELECT t2.b AS c FROM t1) GROUP BY c HAVING t2.b ) 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} finish_test |
Changes to test/func.test.
︙ | ︙ | |||
1540 1541 1542 1543 1544 1545 1546 1547 1548 | WITH c(x) AS (VALUES(9223372036854775807),(1)) SELECT sum(x) FROM c; } {1 {integer overflow}} do_catchsql_test func-37.120 { WITH c(x) AS (VALUES(9223372036854775807),(10000),(-10010)) SELECT sum(x) FROM c; } {1 {integer overflow}} finish_test | > > > > > > > > | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | WITH c(x) AS (VALUES(9223372036854775807),(1)) SELECT sum(x) FROM c; } {1 {integer overflow}} do_catchsql_test func-37.120 { WITH c(x) AS (VALUES(9223372036854775807),(10000),(-10010)) SELECT sum(x) FROM c; } {1 {integer overflow}} # 2023-08-28 forum post https://sqlite.org/forum/forumpost/1c06ddcacc86032a # Incorrect handling of infinity by SUM(). # do_execsql_test func-38.100 { WITH t1(x) AS (VALUES(9e+999)) SELECT sum(x), avg(x), total(x) FROM t1; WITH t1(x) AS (VALUES(-9e+999)) SELECT sum(x), avg(x), total(x) FROM t1; } {Inf Inf Inf -Inf -Inf -Inf} finish_test |
Changes to test/json101.test.
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 | } {} do_execsql_test json101-4.7 { SELECT x FROM j1 WHERE json_set(x)<>x; } {} do_execsql_test json101-4.8 { SELECT x FROM j1 WHERE json_insert(x)<>x; } {} # json_extract(JSON,'$') will return objects and arrays without change. # do_execsql_test json101-4.10 { SELECT count(*) FROM j1 WHERE json_type(x) IN ('object','array'); SELECT x FROM j1 WHERE json_extract(x,'$')<>x | > > > | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | } {} do_execsql_test json101-4.7 { SELECT x FROM j1 WHERE json_set(x)<>x; } {} 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. # do_execsql_test json101-4.10 { SELECT count(*) FROM j1 WHERE json_type(x) IN ('object','array'); SELECT x FROM j1 WHERE json_extract(x,'$')<>x |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | SELECT json_group_array(x) FROM c; } {[1,2.0,null,"three"]} do_execsql_test json101-21.27 { WITH c(x,y) AS (VALUES('a',1),('b',2.0),('c',NULL),(NULL,'three'),('e','four')) SELECT json_group_object(x,y) FROM c; } {{{"a":1,"b":2.0,"c":null,:"three","e":"four"}}} | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | SELECT json_group_array(x) FROM c; } {[1,2.0,null,"three"]} do_execsql_test json101-21.27 { WITH c(x,y) AS (VALUES('a',1),('b',2.0),('c',NULL),(NULL,'three'),('e','four')) 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}}} # 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 |
Changes to test/json102.test.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | } {{[1,null,"3","[4,5]","{\"six\":7.7}"]}} do_execsql_test json102-180 { SELECT json_array(1,null,'3',json('[4,5]'),json('{"six":7.7}')); } {{[1,null,"3",[4,5],{"six":7.7}]}} do_execsql_test json102-190 { SELECT json_array_length('[1,2,3,4]'); } {{4}} do_execsql_test json102-200 { SELECT json_array_length('[1,2,3,4]', '$'); } {{4}} do_execsql_test json102-210 { SELECT json_array_length('[1,2,3,4]', '$[2]'); } {{0}} do_execsql_test json102-220 { | > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | } {{[1,null,"3","[4,5]","{\"six\":7.7}"]}} do_execsql_test json102-180 { SELECT json_array(1,null,'3',json('[4,5]'),json('{"six":7.7}')); } {{[1,null,"3",[4,5],{"six":7.7}]}} do_execsql_test json102-190 { SELECT json_array_length('[1,2,3,4]'); } {{4}} do_execsql_test json102-191 { SELECT json_array_length( json_remove('[1,2,3,4]','$[2]') ); } {{3}} do_execsql_test json102-200 { SELECT json_array_length('[1,2,3,4]', '$'); } {{4}} do_execsql_test json102-210 { SELECT json_array_length('[1,2,3,4]', '$[2]'); } {{0}} do_execsql_test json102-220 { |
︙ | ︙ |
Changes to test/selectH.test.
︙ | ︙ | |||
109 110 111 112 113 114 115 | # 2023-02-25 dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15 # do_execsql_test 4.1 { DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT); SELECT 1 FROM (SELECT DISTINCT name COLLATE rtrim FROM sqlite_schema UNION ALL SELECT a FROM t1); | > > > > > > > > > > > > > > > > > > > > | > > > > > > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | # 2023-02-25 dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15 # do_execsql_test 4.1 { DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT); SELECT 1 FROM (SELECT DISTINCT name COLLATE rtrim FROM sqlite_schema UNION ALL SELECT a FROM t1); } {1 1} do_execsql_test 4.2 { SELECT DISTINCT name COLLATE rtrim FROM sqlite_schema UNION ALL SELECT a FROM t1 } {v1 t1} #------------------------------------------------------------------------- # forum post https://sqlite.org/forum/forumpost/b83c7b2168 # reset_db do_execsql_test 5.0 { CREATE TABLE t1 (val1); INSERT INTO t1 VALUES(4); INSERT INTO t1 VALUES(5); CREATE TABLE t2 (val2); } do_execsql_test 5.1 { SELECT DISTINCT val1 FROM t1 UNION ALL SELECT val2 FROM t2; } { 4 5 } do_execsql_test 5.2 { SELECT count(1234) FROM ( SELECT DISTINCT val1 FROM t1 UNION ALL SELECT val2 FROM t2 ) } {2} finish_test |
Changes to test/testrunner_data.tcl.
︙ | ︙ | |||
94 95 96 97 98 99 100 | # set build(All-Debug) { --enable-debug --enable-all } set build(All-O0) { -O0 --enable-all } | | > > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | # set build(All-Debug) { --enable-debug --enable-all } set build(All-O0) { -O0 --enable-all } set build(All-Sanitize) { -DSQLITE_OMIT_LOOKASIDE=1 --enable-all -fsanitize=address,undefined } set build(Sanitize) { CC=clang -fsanitize=address,undefined -DSQLITE_ENABLE_STAT4 -DCONFIG_SLOWDOWN_FACTOR=5.0 --enable-debug --enable-all |
︙ | ︙ |
Changes to test/window1.test.
︙ | ︙ | |||
1877 1878 1879 1880 1881 1882 1883 | INSERT INTO t1(a) VALUES(22); CREATE TABLE t3(y); INSERT INTO t3(y) VALUES(5),(11),(-9); SELECT ( SELECT max(y) OVER( ORDER BY (SELECT x FROM (SELECT sum(y) AS x FROM t1))) ) FROM t3; | | | 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | INSERT INTO t1(a) VALUES(22); CREATE TABLE t3(y); INSERT INTO t3(y) VALUES(5),(11),(-9); SELECT ( SELECT max(y) OVER( ORDER BY (SELECT x FROM (SELECT sum(y) AS x FROM t1))) ) FROM t3; } {0 5} # 2020-06-06 ticket 1f6f353b684fc708 reset_db do_execsql_test 58.1 { CREATE TABLE a(a, b, c); INSERT INTO a VALUES(1, 2, 3); INSERT INTO a VALUES(4, 5, 6); |
︙ | ︙ |
Changes to tool/mkautoconfamal.sh.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | set -e set -u TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'` # If this script is given an argument of --snapshot, then generate a # snapshot tarball named for the current checkout SHA1 hash, rather than # the version number. # if test "$#" -ge 1 -a x$1 != x--snapshot then | > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | set -e set -u TMPSPACE=./mkpkg_tmp_dir VERSION=`cat $TOP/VERSION` HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid` DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'` # Verify that the version number in the TEA autoconf file is correct. # Fail with an error if not. # 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 # If this script is given an argument of --snapshot, then generate a # snapshot tarball named for the current checkout SHA1 hash, rather than # the version number. # if test "$#" -ge 1 -a x$1 != x--snapshot then |
︙ | ︙ |
Added tool/srctree-check.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #!/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" } |