diff options
| author | 2023-10-24 16:45:22 -0700 | |
|---|---|---|
| committer | 2023-10-24 16:47:02 -0700 | |
| commit | c7349b7652d0b78fa7e06fc36e48f0f6a520af1d (patch) | |
| tree | 549a596006bd892780ec856759ed8fbb1744275a /c/sqlite3.c | |
| parent | Add paths field in build.zig.zon (diff) | |
| download | zig-sqlite-c7349b7652d0b78fa7e06fc36e48f0f6a520af1d.tar.gz zig-sqlite-c7349b7652d0b78fa7e06fc36e48f0f6a520af1d.tar.xz zig-sqlite-c7349b7652d0b78fa7e06fc36e48f0f6a520af1d.zip | |
Update to sqlite 3.43.2
Diffstat (limited to 'c/sqlite3.c')
| -rw-r--r-- | c/sqlite3.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/c/sqlite3.c b/c/sqlite3.c index 1884b08..a1fbd60 100644 --- a/c/sqlite3.c +++ b/c/sqlite3.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.43.1. By combining all the individual C code files into this | 3 | ** version 3.43.2. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements | 6 | ** possible if the files were compiled separately. Performance improvements |
| @@ -18,7 +18,7 @@ | |||
| 18 | ** separate file. This file contains only code for the core SQLite library. | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** | 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** d3a40c05c49e1a49264912b1a05bc2143ac. | 21 | ** 310099cce5a487035fa535dd3002c59ac7f. |
| 22 | */ | 22 | */ |
| 23 | #define SQLITE_CORE 1 | 23 | #define SQLITE_CORE 1 |
| 24 | #define SQLITE_AMALGAMATION 1 | 24 | #define SQLITE_AMALGAMATION 1 |
| @@ -459,9 +459,9 @@ extern "C" { | |||
| 459 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], | 459 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 460 | ** [sqlite_version()] and [sqlite_source_id()]. | 460 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 461 | */ | 461 | */ |
| 462 | #define SQLITE_VERSION "3.43.1" | 462 | #define SQLITE_VERSION "3.43.2" |
| 463 | #define SQLITE_VERSION_NUMBER 3043001 | 463 | #define SQLITE_VERSION_NUMBER 3043002 |
| 464 | #define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0" | 464 | #define SQLITE_SOURCE_ID "2023-10-10 12:14:04 4310099cce5a487035fa535dd3002c59ac7f1d1bec68d7cf317fd3e769484790" |
| 465 | 465 | ||
| 466 | /* | 466 | /* |
| 467 | ** CAPI3REF: Run-Time Library Version Numbers | 467 | ** CAPI3REF: Run-Time Library Version Numbers |
| @@ -35185,29 +35185,29 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou | |||
| 35185 | double rr[2]; | 35185 | double rr[2]; |
| 35186 | rr[0] = r; | 35186 | rr[0] = r; |
| 35187 | rr[1] = 0.0; | 35187 | rr[1] = 0.0; |
| 35188 | if( rr[0]>1.84e+19 ){ | 35188 | if( rr[0]>9.223372036854774784e+18 ){ |
| 35189 | while( rr[0]>1.84e+119 ){ | 35189 | while( rr[0]>9.223372036854774784e+118 ){ |
| 35190 | exp += 100; | 35190 | exp += 100; |
| 35191 | dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117); | 35191 | dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117); |
| 35192 | } | 35192 | } |
| 35193 | while( rr[0]>1.84e+29 ){ | 35193 | while( rr[0]>9.223372036854774784e+28 ){ |
| 35194 | exp += 10; | 35194 | exp += 10; |
| 35195 | dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27); | 35195 | dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27); |
| 35196 | } | 35196 | } |
| 35197 | while( rr[0]>1.84e+19 ){ | 35197 | while( rr[0]>9.223372036854774784e+18 ){ |
| 35198 | exp += 1; | 35198 | exp += 1; |
| 35199 | dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18); | 35199 | dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18); |
| 35200 | } | 35200 | } |
| 35201 | }else{ | 35201 | }else{ |
| 35202 | while( rr[0]<1.84e-82 ){ | 35202 | while( rr[0]<9.223372036854774784e-83 ){ |
| 35203 | exp -= 100; | 35203 | exp -= 100; |
| 35204 | dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83); | 35204 | dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83); |
| 35205 | } | 35205 | } |
| 35206 | while( rr[0]<1.84e+08 ){ | 35206 | while( rr[0]<9.223372036854774784e+07 ){ |
| 35207 | exp -= 10; | 35207 | exp -= 10; |
| 35208 | dekkerMul2(rr, 1.0e+10, 0.0); | 35208 | dekkerMul2(rr, 1.0e+10, 0.0); |
| 35209 | } | 35209 | } |
| 35210 | while( rr[0]<1.84e+18 ){ | 35210 | while( rr[0]<9.22337203685477478e+17 ){ |
| 35211 | exp -= 1; | 35211 | exp -= 1; |
| 35212 | dekkerMul2(rr, 1.0e+01, 0.0); | 35212 | dekkerMul2(rr, 1.0e+01, 0.0); |
| 35213 | } | 35213 | } |
| @@ -77024,6 +77024,7 @@ static int rebuildPage( | |||
| 77024 | int k; /* Current slot in pCArray->apEnd[] */ | 77024 | int k; /* Current slot in pCArray->apEnd[] */ |
| 77025 | u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ | 77025 | u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ |
| 77026 | 77026 | ||
| 77027 | assert( nCell>0 ); | ||
| 77027 | assert( i<iEnd ); | 77028 | assert( i<iEnd ); |
| 77028 | j = get2byte(&aData[hdr+5]); | 77029 | j = get2byte(&aData[hdr+5]); |
| 77029 | if( NEVER(j>(u32)usableSize) ){ j = 0; } | 77030 | if( NEVER(j>(u32)usableSize) ){ j = 0; } |
| @@ -77330,6 +77331,7 @@ static int editPage( | |||
| 77330 | return SQLITE_OK; | 77331 | return SQLITE_OK; |
| 77331 | editpage_fail: | 77332 | editpage_fail: |
| 77332 | /* Unable to edit this page. Rebuild it from scratch instead. */ | 77333 | /* Unable to edit this page. Rebuild it from scratch instead. */ |
| 77334 | if( nNew<1 ) return SQLITE_CORRUPT_BKPT; | ||
| 77333 | populateCellCache(pCArray, iNew, nNew); | 77335 | populateCellCache(pCArray, iNew, nNew); |
| 77334 | return rebuildPage(pCArray, iNew, nNew, pPg); | 77336 | return rebuildPage(pCArray, iNew, nNew, pPg); |
| 77335 | } | 77337 | } |
| @@ -100833,8 +100835,7 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ | |||
| 100833 | /* Set the value of register r[1] in the SQL statement to integer iRow. | 100835 | /* Set the value of register r[1] in the SQL statement to integer iRow. |
| 100834 | ** This is done directly as a performance optimization | 100836 | ** This is done directly as a performance optimization |
| 100835 | */ | 100837 | */ |
| 100836 | v->aMem[1].flags = MEM_Int; | 100838 | sqlite3VdbeMemSetInt64(&v->aMem[1], iRow); |
| 100837 | v->aMem[1].u.i = iRow; | ||
| 100838 | 100839 | ||
| 100839 | /* If the statement has been run before (and is paused at the OP_ResultRow) | 100840 | /* If the statement has been run before (and is paused at the OP_ResultRow) |
| 100840 | ** then back it up to the point where it does the OP_NotExists. This could | 100841 | ** then back it up to the point where it does the OP_NotExists. This could |
| @@ -204136,6 +204137,7 @@ static void jsonReplaceFunc( | |||
| 204136 | } | 204137 | } |
| 204137 | pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); | 204138 | pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); |
| 204138 | if( pParse==0 ) return; | 204139 | if( pParse==0 ) return; |
| 204140 | pParse->nJPRef++; | ||
| 204139 | for(i=1; i<(u32)argc; i+=2){ | 204141 | for(i=1; i<(u32)argc; i+=2){ |
| 204140 | zPath = (const char*)sqlite3_value_text(argv[i]); | 204142 | zPath = (const char*)sqlite3_value_text(argv[i]); |
| 204141 | pParse->useMod = 1; | 204143 | pParse->useMod = 1; |
| @@ -204148,6 +204150,7 @@ static void jsonReplaceFunc( | |||
| 204148 | jsonReturnJson(pParse, pParse->aNode, ctx, 1); | 204150 | jsonReturnJson(pParse, pParse->aNode, ctx, 1); |
| 204149 | replace_err: | 204151 | replace_err: |
| 204150 | jsonDebugPrintParse(pParse); | 204152 | jsonDebugPrintParse(pParse); |
| 204153 | jsonParseFree(pParse); | ||
| 204151 | } | 204154 | } |
| 204152 | 204155 | ||
| 204153 | 204156 | ||
| @@ -204182,6 +204185,7 @@ static void jsonSetFunc( | |||
| 204182 | } | 204185 | } |
| 204183 | pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); | 204186 | pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); |
| 204184 | if( pParse==0 ) return; | 204187 | if( pParse==0 ) return; |
| 204188 | pParse->nJPRef++; | ||
| 204185 | for(i=1; i<(u32)argc; i+=2){ | 204189 | for(i=1; i<(u32)argc; i+=2){ |
| 204186 | zPath = (const char*)sqlite3_value_text(argv[i]); | 204190 | zPath = (const char*)sqlite3_value_text(argv[i]); |
| 204187 | bApnd = 0; | 204191 | bApnd = 0; |
| @@ -204198,9 +204202,8 @@ static void jsonSetFunc( | |||
| 204198 | } | 204202 | } |
| 204199 | jsonDebugPrintParse(pParse); | 204203 | jsonDebugPrintParse(pParse); |
| 204200 | jsonReturnJson(pParse, pParse->aNode, ctx, 1); | 204204 | jsonReturnJson(pParse, pParse->aNode, ctx, 1); |
| 204201 | |||
| 204202 | jsonSetDone: | 204205 | jsonSetDone: |
| 204203 | /* no cleanup required */; | 204206 | jsonParseFree(pParse); |
| 204204 | } | 204207 | } |
| 204205 | 204208 | ||
| 204206 | /* | 204209 | /* |
| @@ -239689,7 +239692,6 @@ static void fts5DoSecureDelete( | |||
| 239689 | int iIdx = 0; | 239692 | int iIdx = 0; |
| 239690 | int iStart = 0; | 239693 | int iStart = 0; |
| 239691 | int iKeyOff = 0; | 239694 | int iKeyOff = 0; |
| 239692 | int iPrevKeyOff = 0; | ||
| 239693 | int iDelKeyOff = 0; /* Offset of deleted key, if any */ | 239695 | int iDelKeyOff = 0; /* Offset of deleted key, if any */ |
| 239694 | 239696 | ||
| 239695 | nIdx = nPg-iPgIdx; | 239697 | nIdx = nPg-iPgIdx; |
| @@ -244251,6 +244253,9 @@ static int fts5FilterMethod( | |||
| 244251 | pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); | 244253 | pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); |
| 244252 | } | 244254 | } |
| 244253 | 244255 | ||
| 244256 | rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); | ||
| 244257 | if( rc!=SQLITE_OK ) goto filter_out; | ||
| 244258 | |||
| 244254 | if( pTab->pSortCsr ){ | 244259 | if( pTab->pSortCsr ){ |
| 244255 | /* If pSortCsr is non-NULL, then this call is being made as part of | 244260 | /* If pSortCsr is non-NULL, then this call is being made as part of |
| 244256 | ** processing for a "... MATCH <expr> ORDER BY rank" query (ePlan is | 244261 | ** processing for a "... MATCH <expr> ORDER BY rank" query (ePlan is |
| @@ -244273,7 +244278,9 @@ static int fts5FilterMethod( | |||
| 244273 | pCsr->pExpr = pTab->pSortCsr->pExpr; | 244278 | pCsr->pExpr = pTab->pSortCsr->pExpr; |
| 244274 | rc = fts5CursorFirst(pTab, pCsr, bDesc); | 244279 | rc = fts5CursorFirst(pTab, pCsr, bDesc); |
| 244275 | }else if( pCsr->pExpr ){ | 244280 | }else if( pCsr->pExpr ){ |
| 244276 | rc = fts5CursorParseRank(pConfig, pCsr, pRank); | 244281 | if( rc==SQLITE_OK ){ |
| 244282 | rc = fts5CursorParseRank(pConfig, pCsr, pRank); | ||
| 244283 | } | ||
| 244277 | if( rc==SQLITE_OK ){ | 244284 | if( rc==SQLITE_OK ){ |
| 244278 | if( bOrderByRank ){ | 244285 | if( bOrderByRank ){ |
| 244279 | pCsr->ePlan = FTS5_PLAN_SORTED_MATCH; | 244286 | pCsr->ePlan = FTS5_PLAN_SORTED_MATCH; |
| @@ -245754,7 +245761,7 @@ static void fts5SourceIdFunc( | |||
| 245754 | ){ | 245761 | ){ |
| 245755 | assert( nArg==0 ); | 245762 | assert( nArg==0 ); |
| 245756 | UNUSED_PARAM2(nArg, apUnused); | 245763 | UNUSED_PARAM2(nArg, apUnused); |
| 245757 | sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT); | 245764 | sqlite3_result_text(pCtx, "fts5: 2023-10-10 12:14:04 4310099cce5a487035fa535dd3002c59ac7f1d1bec68d7cf317fd3e769484790", -1, SQLITE_TRANSIENT); |
| 245758 | } | 245765 | } |
| 245759 | 245766 | ||
| 245760 | /* | 245767 | /* |