Fossil SCM

Update the built-in SQLite to the latest 3.39.0 beta.

drh 2022-06-03 15:23 trunk
Commit e3e9544638a62a1b4b21cd1f61972b79456bfd5d4706d0157730b86dad9e1aaf
+24 -2
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -23712,10 +23712,33 @@
2371223712
const char * fiddle_db_filename(const char * zDbName){
2371323713
return globalDb
2371423714
? sqlite3_db_filename(globalDb, zDbName ? zDbName : "main")
2371523715
: NULL;
2371623716
}
23717
+
23718
+/*
23719
+** Closes, unlinks, and reopens the db using its current filename (or
23720
+** the default if the db is currently closed). It is assumed, for
23721
+** purposes of the fiddle build, that the file is in a transient
23722
+** virtual filesystem within the browser.
23723
+*/
23724
+void fiddle_reset_db(void){
23725
+ char *zFilename = 0;
23726
+ if(0==globalDb){
23727
+ shellState.pAuxDb->zDbFilename = "/fiddle.sqlite3";
23728
+ }else{
23729
+ zFilename =
23730
+ sqlite3_mprintf("%s", sqlite3_db_filename(globalDb, "main"));
23731
+ shell_check_oom(zFilename);
23732
+ close_db(globalDb);
23733
+ shellDeleteFile(zFilename);
23734
+ shellState.db = 0;
23735
+ shellState.pAuxDb->zDbFilename = zFilename;
23736
+ }
23737
+ open_db(&shellState, 0);
23738
+ sqlite3_free(zFilename);
23739
+}
2371723740
2371823741
/*
2371923742
** Trivial exportable function for emscripten. Needs to be exported using:
2372023743
**
2372123744
** emcc ..flags... -sEXPORTED_FUNCTIONS=_fiddle_exec -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
@@ -23740,12 +23763,11 @@
2374023763
sqlite3_libversion(), sqlite3_sourceid()
2374123764
);
2374223765
puts("WASM shell");
2374323766
puts("Enter \".help\" for usage hints.");
2374423767
if(once>0){
23745
- shellState.pAuxDb->zDbFilename = "/fiddle.sqlite3";
23746
- open_db(&shellState, 0);
23768
+ fiddle_reset_db();
2374723769
}
2374823770
if(shellState.db){
2374923771
printf("Connected to %s.\n", fiddle_db_filename(NULL));
2375023772
}else{
2375123773
fprintf(stderr,"ERROR initializing db!\n");
2375223774
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -23712,10 +23712,33 @@
23712 const char * fiddle_db_filename(const char * zDbName){
23713 return globalDb
23714 ? sqlite3_db_filename(globalDb, zDbName ? zDbName : "main")
23715 : NULL;
23716 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23717
23718 /*
23719 ** Trivial exportable function for emscripten. Needs to be exported using:
23720 **
23721 ** emcc ..flags... -sEXPORTED_FUNCTIONS=_fiddle_exec -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
@@ -23740,12 +23763,11 @@
23740 sqlite3_libversion(), sqlite3_sourceid()
23741 );
23742 puts("WASM shell");
23743 puts("Enter \".help\" for usage hints.");
23744 if(once>0){
23745 shellState.pAuxDb->zDbFilename = "/fiddle.sqlite3";
23746 open_db(&shellState, 0);
23747 }
23748 if(shellState.db){
23749 printf("Connected to %s.\n", fiddle_db_filename(NULL));
23750 }else{
23751 fprintf(stderr,"ERROR initializing db!\n");
23752
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -23712,10 +23712,33 @@
23712 const char * fiddle_db_filename(const char * zDbName){
23713 return globalDb
23714 ? sqlite3_db_filename(globalDb, zDbName ? zDbName : "main")
23715 : NULL;
23716 }
23717
23718 /*
23719 ** Closes, unlinks, and reopens the db using its current filename (or
23720 ** the default if the db is currently closed). It is assumed, for
23721 ** purposes of the fiddle build, that the file is in a transient
23722 ** virtual filesystem within the browser.
23723 */
23724 void fiddle_reset_db(void){
23725 char *zFilename = 0;
23726 if(0==globalDb){
23727 shellState.pAuxDb->zDbFilename = "/fiddle.sqlite3";
23728 }else{
23729 zFilename =
23730 sqlite3_mprintf("%s", sqlite3_db_filename(globalDb, "main"));
23731 shell_check_oom(zFilename);
23732 close_db(globalDb);
23733 shellDeleteFile(zFilename);
23734 shellState.db = 0;
23735 shellState.pAuxDb->zDbFilename = zFilename;
23736 }
23737 open_db(&shellState, 0);
23738 sqlite3_free(zFilename);
23739 }
23740
23741 /*
23742 ** Trivial exportable function for emscripten. Needs to be exported using:
23743 **
23744 ** emcc ..flags... -sEXPORTED_FUNCTIONS=_fiddle_exec -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
@@ -23740,12 +23763,11 @@
23763 sqlite3_libversion(), sqlite3_sourceid()
23764 );
23765 puts("WASM shell");
23766 puts("Enter \".help\" for usage hints.");
23767 if(once>0){
23768 fiddle_reset_db();
 
23769 }
23770 if(shellState.db){
23771 printf("Connected to %s.\n", fiddle_db_filename(NULL));
23772 }else{
23773 fprintf(stderr,"ERROR initializing db!\n");
23774
+90 -49
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455455
#define SQLITE_VERSION "3.39.0"
456456
#define SQLITE_VERSION_NUMBER 3039000
457
-#define SQLITE_SOURCE_ID "2022-05-25 13:10:29 c48a735bd4a1dbd541aed5937c25fc0c606c4263d8ee94cae30a06b1a7b26d9a"
457
+#define SQLITE_SOURCE_ID "2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -6586,11 +6586,13 @@
65866586
** CAPI3REF: Return The Schema Name For A Database Connection
65876587
** METHOD: sqlite3
65886588
**
65896589
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
65906590
** for the N-th database on database connection D, or a NULL pointer of N is
6591
-** out of range.
6591
+** out of range. An N alue of 0 means the main database file. An N of 1 is
6592
+** the "temp" schema. Larger values of N correspond to various ATTACH-ed
6593
+** databases.
65926594
**
65936595
** Space to hold the string that is returned by sqlite3_db_name() is managed
65946596
** by SQLite itself. The string might be deallocated by any operation that
65956597
** changes the schema, including [ATTACH] or [DETACH] or calls to
65966598
** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
@@ -17184,11 +17186,11 @@
1718417186
#define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
1718517187
#define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
1718617188
#define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
1718717189
** single query - might change over time */
1718817190
#define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
17189
-#define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */
17191
+/* 0x8000 -- available for reuse */
1719017192
#define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
1719117193
#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
1719217194
#define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
1719317195
#define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
1719417196
#define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
@@ -17201,10 +17203,11 @@
1720117203
#define INLINEFUNC_implies_nonnull_row 1
1720217204
#define INLINEFUNC_expr_implies_expr 2
1720317205
#define INLINEFUNC_expr_compare 3
1720417206
#define INLINEFUNC_affinity 4
1720517207
#define INLINEFUNC_iif 5
17208
+#define INLINEFUNC_sqlite_offset 6
1720617209
#define INLINEFUNC_unlikely 99 /* Default case */
1720717210
1720817211
/*
1720917212
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
1721017213
** used to create the initializers for the FuncDef structures.
@@ -75943,11 +75946,11 @@
7594375946
}
7594475947
7594575948
TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
7594675949
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7594775950
loc==0 ? "overwrite" : "new entry"));
75948
- assert( pPage->isInit );
75951
+ assert( pPage->isInit || CORRUPT_DB );
7594975952
newCell = pBt->pTmpSpace;
7595075953
assert( newCell!=0 );
7595175954
if( flags & BTREE_PREFORMAT ){
7595275955
rc = SQLITE_OK;
7595375956
szNew = pBt->nPreformatSize;
@@ -107506,11 +107509,21 @@
107506107509
memset(&caseExpr, 0, sizeof(caseExpr));
107507107510
caseExpr.op = TK_CASE;
107508107511
caseExpr.x.pList = pFarg;
107509107512
return sqlite3ExprCodeTarget(pParse, &caseExpr, target);
107510107513
}
107511
-
107514
+#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
107515
+ case INLINEFUNC_sqlite_offset: {
107516
+ Expr *pArg = pFarg->a[0].pExpr;
107517
+ if( pArg->op==TK_COLUMN && pArg->iTable>=0 ){
107518
+ sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
107519
+ }else{
107520
+ sqlite3VdbeAddOp2(v, OP_Null, 0, target);
107521
+ }
107522
+ break;
107523
+ }
107524
+#endif
107512107525
default: {
107513107526
/* The UNLIKELY() function is a no-op. The result is the value
107514107527
** of the first argument.
107515107528
*/
107516107529
assert( nFarg==1 || nFarg==2 );
@@ -108045,24 +108058,12 @@
108045108058
#endif
108046108059
if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){
108047108060
if( !pColl ) pColl = db->pDfltColl;
108048108061
sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
108049108062
}
108050
-#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
108051
- if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){
108052
- Expr *pArg = pFarg->a[0].pExpr;
108053
- if( pArg->op==TK_COLUMN ){
108054
- sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
108055
- }else{
108056
- sqlite3VdbeAddOp2(v, OP_Null, 0, target);
108057
- }
108058
- }else
108059
-#endif
108060
- {
108061
- sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg,
108062
- pDef, pExpr->op2);
108063
- }
108063
+ sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg,
108064
+ pDef, pExpr->op2);
108064108065
if( nFarg ){
108065108066
if( constMask==0 ){
108066108067
sqlite3ReleaseTempRange(pParse, r1, nFarg);
108067108068
}else{
108068108069
sqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1);
@@ -111282,31 +111283,37 @@
111282111283
if( pParse->nErr ) rc = pParse->rc;
111283111284
}
111284111285
if( rc==SQLITE_OK && pStep->zTarget ){
111285111286
SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
111286111287
if( pSrc ){
111287
- int i;
111288
- for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
111289
- SrcItem *p = &pSrc->a[i];
111290
- p->iCursor = pParse->nTab++;
111291
- if( p->pSelect ){
111292
- sqlite3SelectPrep(pParse, p->pSelect, 0);
111293
- sqlite3ExpandSubquery(pParse, p);
111294
- assert( i>0 );
111295
- assert( pStep->pFrom->a[i-1].pSelect );
111296
- sqlite3SelectPrep(pParse, pStep->pFrom->a[i-1].pSelect, 0);
111297
- }else{
111298
- p->pTab = sqlite3LocateTableItem(pParse, 0, p);
111299
- if( p->pTab==0 ){
111300
- rc = SQLITE_ERROR;
111301
- }else{
111302
- p->pTab->nTabRef++;
111303
- rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
111288
+ Select *pSel = sqlite3SelectNew(
111289
+ pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
111290
+ );
111291
+ if( pSel==0 ){
111292
+ pStep->pExprList = 0;
111293
+ pSrc = 0;
111294
+ rc = SQLITE_NOMEM;
111295
+ }else{
111296
+ sqlite3SelectPrep(pParse, pSel, 0);
111297
+ rc = pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
111298
+ assert( pStep->pExprList==0 || pStep->pExprList==pSel->pEList );
111299
+ assert( pSrc==pSel->pSrc );
111300
+ if( pStep->pExprList ) pSel->pEList = 0;
111301
+ pSel->pSrc = 0;
111302
+ sqlite3SelectDelete(db, pSel);
111303
+ }
111304
+ if( pStep->pFrom ){
111305
+ int i;
111306
+ for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
111307
+ SrcItem *p = &pStep->pFrom->a[i];
111308
+ if( p->pSelect ){
111309
+ sqlite3SelectPrep(pParse, p->pSelect, 0);
111304111310
}
111305111311
}
111306111312
}
111307
- if( rc==SQLITE_OK && db->mallocFailed ){
111313
+
111314
+ if( db->mallocFailed ){
111308111315
rc = SQLITE_NOMEM;
111309111316
}
111310111317
sNC.pSrcList = pSrc;
111311111318
if( rc==SQLITE_OK && pStep->pWhere ){
111312111319
rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere);
@@ -111753,10 +111760,19 @@
111753111760
if( rc==SQLITE_OK ){
111754111761
renameWalkTrigger(&sWalker, pTrigger);
111755111762
for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
111756111763
if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
111757111764
renameTokenFind(&sParse, &sCtx, pStep->zTarget);
111765
+ }
111766
+ if( pStep->pFrom ){
111767
+ int i;
111768
+ for(i=0; i<pStep->pFrom->nSrc; i++){
111769
+ SrcItem *pItem = &pStep->pFrom->a[i];
111770
+ if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
111771
+ renameTokenFind(&sParse, &sCtx, pItem->zName);
111772
+ }
111773
+ }
111758111774
}
111759111775
}
111760111776
}
111761111777
}
111762111778
}
@@ -124495,12 +124511,11 @@
124495124511
#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
124496124512
INLINE_FUNC(unlikely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124497124513
INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124498124514
INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124499124515
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
124500
- {1, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_OFFSET|SQLITE_FUNC_TYPEOF,
124501
- 0, 0, noopFunc, 0, 0, 0, "sqlite_offset", {0} },
124516
+ INLINE_FUNC(sqlite_offset, 1, INLINEFUNC_sqlite_offset, 0 ),
124502124517
#endif
124503124518
FUNCTION(ltrim, 1, 1, 0, trimFunc ),
124504124519
FUNCTION(ltrim, 2, 1, 0, trimFunc ),
124505124520
FUNCTION(rtrim, 1, 2, 0, trimFunc ),
124506124521
FUNCTION(rtrim, 2, 2, 0, trimFunc ),
@@ -137648,14 +137663,15 @@
137648137663
pColExpr = pColExpr->pRight;
137649137664
assert( pColExpr!=0 );
137650137665
}
137651137666
if( pColExpr->op==TK_COLUMN
137652137667
&& ALWAYS( ExprUseYTab(pColExpr) )
137653
- && (pTab = pColExpr->y.pTab)!=0
137668
+ && ALWAYS( pColExpr->y.pTab!=0 )
137654137669
){
137655137670
/* For columns use the column name name */
137656137671
int iCol = pColExpr->iColumn;
137672
+ pTab = pColExpr->y.pTab;
137657137673
if( iCol<0 ) iCol = pTab->iPKey;
137658137674
zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
137659137675
}else if( pColExpr->op==TK_ID ){
137660137676
assert( !ExprHasProperty(pColExpr, EP_IntValue) );
137661137677
zName = pColExpr->u.zToken;
@@ -139264,10 +139280,15 @@
139264139280
sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
139265139281
pExpr->flags & (EP_OuterON|EP_InnerON));
139266139282
}
139267139283
sqlite3ExprDelete(db, pExpr);
139268139284
pExpr = pNew;
139285
+ if( pExpr->op==TK_TRUEFALSE ){
139286
+ pExpr->u.iValue = sqlite3ExprTruthValue(pExpr);
139287
+ pExpr->op = TK_INTEGER;
139288
+ ExprSetProperty(pExpr, EP_IntValue);
139289
+ }
139269139290
139270139291
/* Ensure that the expression now has an implicit collation sequence,
139271139292
** just as it did when it was a column of a view or sub-query. */
139272139293
if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){
139273139294
CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr);
@@ -143981,11 +144002,11 @@
143981144002
** sees an UPDATE statement inside the body of a CREATE TRIGGER.
143982144003
*/
143983144004
SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
143984144005
Parse *pParse, /* Parser */
143985144006
Token *pTableName, /* Name of the table to be updated */
143986
- SrcList *pFrom,
144007
+ SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
143987144008
ExprList *pEList, /* The SET clause: list of column and new values */
143988144009
Expr *pWhere, /* The WHERE clause */
143989144010
u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
143990144011
const char *zStart, /* Start of SQL text */
143991144012
const char *zEnd /* End of SQL text */
@@ -144317,10 +144338,18 @@
144317144338
if( pSchema!=db->aDb[1].pSchema ){
144318144339
pSrc->a[0].pSchema = pSchema;
144319144340
}
144320144341
if( pStep->pFrom ){
144321144342
SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
144343
+ if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
144344
+ Select *pSubquery;
144345
+ Token as;
144346
+ pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0);
144347
+ as.n = 0;
144348
+ as.z = 0;
144349
+ pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
144350
+ }
144322144351
pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
144323144352
}
144324144353
}else{
144325144354
sqlite3DbFree(db, zName);
144326144355
}
@@ -148977,12 +149006,13 @@
148977149006
#define WO_ISNULL 0x0100
148978149007
#define WO_OR 0x0200 /* Two or more OR-connected terms */
148979149008
#define WO_AND 0x0400 /* Two or more AND-connected terms */
148980149009
#define WO_EQUIV 0x0800 /* Of the form A==B, both columns */
148981149010
#define WO_NOOP 0x1000 /* This term does not restrict search space */
149011
+#define WO_ROWVAL 0x2000 /* A row-value term */
148982149012
148983
-#define WO_ALL 0x1fff /* Mask of all possible WO_* values */
149013
+#define WO_ALL 0x3fff /* Mask of all possible WO_* values */
148984149014
#define WO_SINGLE 0x01ff /* Mask of all non-compound WO_* values */
148985149015
148986149016
/*
148987149017
** These are definitions of bits in the WhereLoop.wsFlags field.
148988149018
** The particular combination of bits in each WhereLoop help to
@@ -151622,10 +151652,13 @@
151622151652
if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
151623151653
if( !ExprHasProperty(pE,EP_OuterON|EP_InnerON) ){
151624151654
/* Defer processing WHERE clause constraints until after outer
151625151655
** join processing. tag-20220513a */
151626151656
continue;
151657
+ }else if( (pTabItem->fg.jointype & JT_LEFT)==JT_LEFT
151658
+ && !ExprHasProperty(pE,EP_OuterON) ){
151659
+ continue;
151627151660
}else{
151628151661
Bitmask m = sqlite3WhereGetMask(&pWInfo->sMaskSet, pE->w.iJoin);
151629151662
if( m & pLevel->notReady ){
151630151663
/* An ON clause that is not ripe */
151631151664
continue;
@@ -151857,11 +151890,15 @@
151857151890
}
151858151891
if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
151859151892
mAll |= pLoop->maskSelf;
151860151893
for(k=0; k<pWC->nTerm; k++){
151861151894
WhereTerm *pTerm = &pWC->a[k];
151862
- if( pTerm->wtFlags & TERM_VIRTUAL ) break;
151895
+ if( (pTerm->wtFlags & (TERM_VIRTUAL|TERM_SLICE))!=0
151896
+ && pTerm->eOperator!=WO_ROWVAL
151897
+ ){
151898
+ break;
151899
+ }
151863151900
if( pTerm->prereqAll & ~mAll ) continue;
151864151901
if( ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) ) continue;
151865151902
pSubWhere = sqlite3ExprAnd(pParse, pSubWhere,
151866151903
sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
151867151904
}
@@ -153015,11 +153052,11 @@
153015153052
153016153053
#ifdef SQLITE_DEBUG
153017153054
if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){
153018153055
printf("\n*** Incorrect prereqAll computed for:\n");
153019153056
sqlite3TreeViewExpr(0,pExpr,0);
153020
- abort();
153057
+ assert( 0 );
153021153058
}
153022153059
#endif
153023153060
153024153061
if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) ){
153025153062
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin);
@@ -153321,11 +153358,11 @@
153321153358
idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE);
153322153359
exprAnalyze(pSrc, pWC, idxNew);
153323153360
}
153324153361
pTerm = &pWC->a[idxTerm];
153325153362
pTerm->wtFlags |= TERM_CODED|TERM_VIRTUAL; /* Disable the original */
153326
- pTerm->eOperator = 0;
153363
+ pTerm->eOperator = WO_ROWVAL;
153327153364
}
153328153365
153329153366
/* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
153330153367
** a virtual term for each vector component. The expression object
153331153368
** used by each such virtual term is pExpr (the full vector IN(...)
@@ -153522,11 +153559,11 @@
153522153559
for(ii=0; ii<pWC->nTerm; ii++){
153523153560
if( pWC->a[ii].wtFlags & TERM_CODED ){
153524153561
/* This term is a vector operation that has been decomposed into
153525153562
** other, subsequent terms. It can be ignored. See tag-20220128a */
153526153563
assert( pWC->a[ii].wtFlags & TERM_VIRTUAL );
153527
- assert( pWC->a[ii].eOperator==0 );
153564
+ assert( pWC->a[ii].eOperator==WO_ROWVAL );
153528153565
continue;
153529153566
}
153530153567
if( pWC->a[ii].leftCursor!=iCsr ) return;
153531153568
}
153532153569
@@ -159792,10 +159829,11 @@
159792159829
WhereLevel *pLevel;
159793159830
WhereLoop *pLoop;
159794159831
SrcList *pTabList = pWInfo->pTabList;
159795159832
sqlite3 *db = pParse->db;
159796159833
int iEnd = sqlite3VdbeCurrentAddr(v);
159834
+ int nRJ = 0;
159797159835
159798159836
/* Generate loop termination code.
159799159837
*/
159800159838
VdbeModuleComment((v, "End WHERE-core"));
159801159839
for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -159808,12 +159846,11 @@
159808159846
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
159809159847
pLevel->addrCont = 0;
159810159848
pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
159811159849
sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
159812159850
VdbeCoverage(v);
159813
- assert( pParse->withinRJSubrtn>0 );
159814
- pParse->withinRJSubrtn--;
159851
+ nRJ++;
159815159852
}
159816159853
pLoop = pLevel->pWLoop;
159817159854
if( pLevel->op!=OP_Noop ){
159818159855
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
159819159856
int addrSeek = 0;
@@ -160090,10 +160127,11 @@
160090160127
160091160128
/* Final cleanup
160092160129
*/
160093160130
pParse->nQueryLoop = pWInfo->savedNQueryLoop;
160094160131
whereInfoFree(db, pWInfo);
160132
+ pParse->withinRJSubrtn -= nRJ;
160095160133
return;
160096160134
}
160097160135
160098160136
/************** End of where.c ***********************************************/
160099160137
/************** Begin file window.c ******************************************/
@@ -190661,10 +190699,12 @@
190661190699
if( rc==SQLITE_OK ){
190662190700
if( pNode->key.n ){
190663190701
pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix);
190664190702
}
190665190703
pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix);
190704
+ assert( nPrefix+nSuffix<=nTerm );
190705
+ assert( nPrefix>=0 );
190666190706
memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix);
190667190707
pBlk->n += nSuffix;
190668190708
190669190709
memcpy(pNode->key.a, zTerm, nTerm);
190670190710
pNode->key.n = nTerm;
@@ -190783,10 +190823,11 @@
190783190823
NodeWriter *pLeaf; /* Object used to write leaf nodes */
190784190824
190785190825
pLeaf = &pWriter->aNodeWriter[0];
190786190826
nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);
190787190827
nSuffix = nTerm - nPrefix;
190828
+ if(nSuffix<=0 ) return FTS_CORRUPT_VTAB;
190788190829
190789190830
nSpace = sqlite3Fts3VarintLen(nPrefix);
190790190831
nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;
190791190832
nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist;
190792190833
@@ -236405,11 +236446,11 @@
236405236446
int nArg, /* Number of args */
236406236447
sqlite3_value **apUnused /* Function arguments */
236407236448
){
236408236449
assert( nArg==0 );
236409236450
UNUSED_PARAM2(nArg, apUnused);
236410
- sqlite3_result_text(pCtx, "fts5: 2022-05-23 11:51:10 919ba2f0472e12c2d1e82364c1481e778b24ea406615b08992964a4eb80abee7", -1, SQLITE_TRANSIENT);
236451
+ sqlite3_result_text(pCtx, "fts5: 2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25", -1, SQLITE_TRANSIENT);
236411236452
}
236412236453
236413236454
/*
236414236455
** Return true if zName is the extension on one of the shadow tables used
236415236456
** by this module.
236416236457
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.39.0"
456 #define SQLITE_VERSION_NUMBER 3039000
457 #define SQLITE_SOURCE_ID "2022-05-25 13:10:29 c48a735bd4a1dbd541aed5937c25fc0c606c4263d8ee94cae30a06b1a7b26d9a"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -6586,11 +6586,13 @@
6586 ** CAPI3REF: Return The Schema Name For A Database Connection
6587 ** METHOD: sqlite3
6588 **
6589 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
6590 ** for the N-th database on database connection D, or a NULL pointer of N is
6591 ** out of range.
 
 
6592 **
6593 ** Space to hold the string that is returned by sqlite3_db_name() is managed
6594 ** by SQLite itself. The string might be deallocated by any operation that
6595 ** changes the schema, including [ATTACH] or [DETACH] or calls to
6596 ** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
@@ -17184,11 +17186,11 @@
17184 #define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
17185 #define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
17186 #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
17187 ** single query - might change over time */
17188 #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
17189 #define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */
17190 #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
17191 #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
17192 #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
17193 #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
17194 #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
@@ -17201,10 +17203,11 @@
17201 #define INLINEFUNC_implies_nonnull_row 1
17202 #define INLINEFUNC_expr_implies_expr 2
17203 #define INLINEFUNC_expr_compare 3
17204 #define INLINEFUNC_affinity 4
17205 #define INLINEFUNC_iif 5
 
17206 #define INLINEFUNC_unlikely 99 /* Default case */
17207
17208 /*
17209 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
17210 ** used to create the initializers for the FuncDef structures.
@@ -75943,11 +75946,11 @@
75943 }
75944
75945 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
75946 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
75947 loc==0 ? "overwrite" : "new entry"));
75948 assert( pPage->isInit );
75949 newCell = pBt->pTmpSpace;
75950 assert( newCell!=0 );
75951 if( flags & BTREE_PREFORMAT ){
75952 rc = SQLITE_OK;
75953 szNew = pBt->nPreformatSize;
@@ -107506,11 +107509,21 @@
107506 memset(&caseExpr, 0, sizeof(caseExpr));
107507 caseExpr.op = TK_CASE;
107508 caseExpr.x.pList = pFarg;
107509 return sqlite3ExprCodeTarget(pParse, &caseExpr, target);
107510 }
107511
 
 
 
 
 
 
 
 
 
 
107512 default: {
107513 /* The UNLIKELY() function is a no-op. The result is the value
107514 ** of the first argument.
107515 */
107516 assert( nFarg==1 || nFarg==2 );
@@ -108045,24 +108058,12 @@
108045 #endif
108046 if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){
108047 if( !pColl ) pColl = db->pDfltColl;
108048 sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
108049 }
108050 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
108051 if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){
108052 Expr *pArg = pFarg->a[0].pExpr;
108053 if( pArg->op==TK_COLUMN ){
108054 sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
108055 }else{
108056 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
108057 }
108058 }else
108059 #endif
108060 {
108061 sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg,
108062 pDef, pExpr->op2);
108063 }
108064 if( nFarg ){
108065 if( constMask==0 ){
108066 sqlite3ReleaseTempRange(pParse, r1, nFarg);
108067 }else{
108068 sqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1);
@@ -111282,31 +111283,37 @@
111282 if( pParse->nErr ) rc = pParse->rc;
111283 }
111284 if( rc==SQLITE_OK && pStep->zTarget ){
111285 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
111286 if( pSrc ){
111287 int i;
111288 for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
111289 SrcItem *p = &pSrc->a[i];
111290 p->iCursor = pParse->nTab++;
111291 if( p->pSelect ){
111292 sqlite3SelectPrep(pParse, p->pSelect, 0);
111293 sqlite3ExpandSubquery(pParse, p);
111294 assert( i>0 );
111295 assert( pStep->pFrom->a[i-1].pSelect );
111296 sqlite3SelectPrep(pParse, pStep->pFrom->a[i-1].pSelect, 0);
111297 }else{
111298 p->pTab = sqlite3LocateTableItem(pParse, 0, p);
111299 if( p->pTab==0 ){
111300 rc = SQLITE_ERROR;
111301 }else{
111302 p->pTab->nTabRef++;
111303 rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
 
 
 
 
 
111304 }
111305 }
111306 }
111307 if( rc==SQLITE_OK && db->mallocFailed ){
 
111308 rc = SQLITE_NOMEM;
111309 }
111310 sNC.pSrcList = pSrc;
111311 if( rc==SQLITE_OK && pStep->pWhere ){
111312 rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere);
@@ -111753,10 +111760,19 @@
111753 if( rc==SQLITE_OK ){
111754 renameWalkTrigger(&sWalker, pTrigger);
111755 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
111756 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
111757 renameTokenFind(&sParse, &sCtx, pStep->zTarget);
 
 
 
 
 
 
 
 
 
111758 }
111759 }
111760 }
111761 }
111762 }
@@ -124495,12 +124511,11 @@
124495 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
124496 INLINE_FUNC(unlikely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124497 INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124498 INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124499 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
124500 {1, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_OFFSET|SQLITE_FUNC_TYPEOF,
124501 0, 0, noopFunc, 0, 0, 0, "sqlite_offset", {0} },
124502 #endif
124503 FUNCTION(ltrim, 1, 1, 0, trimFunc ),
124504 FUNCTION(ltrim, 2, 1, 0, trimFunc ),
124505 FUNCTION(rtrim, 1, 2, 0, trimFunc ),
124506 FUNCTION(rtrim, 2, 2, 0, trimFunc ),
@@ -137648,14 +137663,15 @@
137648 pColExpr = pColExpr->pRight;
137649 assert( pColExpr!=0 );
137650 }
137651 if( pColExpr->op==TK_COLUMN
137652 && ALWAYS( ExprUseYTab(pColExpr) )
137653 && (pTab = pColExpr->y.pTab)!=0
137654 ){
137655 /* For columns use the column name name */
137656 int iCol = pColExpr->iColumn;
 
137657 if( iCol<0 ) iCol = pTab->iPKey;
137658 zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
137659 }else if( pColExpr->op==TK_ID ){
137660 assert( !ExprHasProperty(pColExpr, EP_IntValue) );
137661 zName = pColExpr->u.zToken;
@@ -139264,10 +139280,15 @@
139264 sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
139265 pExpr->flags & (EP_OuterON|EP_InnerON));
139266 }
139267 sqlite3ExprDelete(db, pExpr);
139268 pExpr = pNew;
 
 
 
 
 
139269
139270 /* Ensure that the expression now has an implicit collation sequence,
139271 ** just as it did when it was a column of a view or sub-query. */
139272 if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){
139273 CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr);
@@ -143981,11 +144002,11 @@
143981 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
143982 */
143983 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
143984 Parse *pParse, /* Parser */
143985 Token *pTableName, /* Name of the table to be updated */
143986 SrcList *pFrom,
143987 ExprList *pEList, /* The SET clause: list of column and new values */
143988 Expr *pWhere, /* The WHERE clause */
143989 u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
143990 const char *zStart, /* Start of SQL text */
143991 const char *zEnd /* End of SQL text */
@@ -144317,10 +144338,18 @@
144317 if( pSchema!=db->aDb[1].pSchema ){
144318 pSrc->a[0].pSchema = pSchema;
144319 }
144320 if( pStep->pFrom ){
144321 SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
 
 
 
 
 
 
 
 
144322 pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
144323 }
144324 }else{
144325 sqlite3DbFree(db, zName);
144326 }
@@ -148977,12 +149006,13 @@
148977 #define WO_ISNULL 0x0100
148978 #define WO_OR 0x0200 /* Two or more OR-connected terms */
148979 #define WO_AND 0x0400 /* Two or more AND-connected terms */
148980 #define WO_EQUIV 0x0800 /* Of the form A==B, both columns */
148981 #define WO_NOOP 0x1000 /* This term does not restrict search space */
 
148982
148983 #define WO_ALL 0x1fff /* Mask of all possible WO_* values */
148984 #define WO_SINGLE 0x01ff /* Mask of all non-compound WO_* values */
148985
148986 /*
148987 ** These are definitions of bits in the WhereLoop.wsFlags field.
148988 ** The particular combination of bits in each WhereLoop help to
@@ -151622,10 +151652,13 @@
151622 if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
151623 if( !ExprHasProperty(pE,EP_OuterON|EP_InnerON) ){
151624 /* Defer processing WHERE clause constraints until after outer
151625 ** join processing. tag-20220513a */
151626 continue;
 
 
 
151627 }else{
151628 Bitmask m = sqlite3WhereGetMask(&pWInfo->sMaskSet, pE->w.iJoin);
151629 if( m & pLevel->notReady ){
151630 /* An ON clause that is not ripe */
151631 continue;
@@ -151857,11 +151890,15 @@
151857 }
151858 if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
151859 mAll |= pLoop->maskSelf;
151860 for(k=0; k<pWC->nTerm; k++){
151861 WhereTerm *pTerm = &pWC->a[k];
151862 if( pTerm->wtFlags & TERM_VIRTUAL ) break;
 
 
 
 
151863 if( pTerm->prereqAll & ~mAll ) continue;
151864 if( ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) ) continue;
151865 pSubWhere = sqlite3ExprAnd(pParse, pSubWhere,
151866 sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
151867 }
@@ -153015,11 +153052,11 @@
153015
153016 #ifdef SQLITE_DEBUG
153017 if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){
153018 printf("\n*** Incorrect prereqAll computed for:\n");
153019 sqlite3TreeViewExpr(0,pExpr,0);
153020 abort();
153021 }
153022 #endif
153023
153024 if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) ){
153025 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin);
@@ -153321,11 +153358,11 @@
153321 idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE);
153322 exprAnalyze(pSrc, pWC, idxNew);
153323 }
153324 pTerm = &pWC->a[idxTerm];
153325 pTerm->wtFlags |= TERM_CODED|TERM_VIRTUAL; /* Disable the original */
153326 pTerm->eOperator = 0;
153327 }
153328
153329 /* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
153330 ** a virtual term for each vector component. The expression object
153331 ** used by each such virtual term is pExpr (the full vector IN(...)
@@ -153522,11 +153559,11 @@
153522 for(ii=0; ii<pWC->nTerm; ii++){
153523 if( pWC->a[ii].wtFlags & TERM_CODED ){
153524 /* This term is a vector operation that has been decomposed into
153525 ** other, subsequent terms. It can be ignored. See tag-20220128a */
153526 assert( pWC->a[ii].wtFlags & TERM_VIRTUAL );
153527 assert( pWC->a[ii].eOperator==0 );
153528 continue;
153529 }
153530 if( pWC->a[ii].leftCursor!=iCsr ) return;
153531 }
153532
@@ -159792,10 +159829,11 @@
159792 WhereLevel *pLevel;
159793 WhereLoop *pLoop;
159794 SrcList *pTabList = pWInfo->pTabList;
159795 sqlite3 *db = pParse->db;
159796 int iEnd = sqlite3VdbeCurrentAddr(v);
 
159797
159798 /* Generate loop termination code.
159799 */
159800 VdbeModuleComment((v, "End WHERE-core"));
159801 for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -159808,12 +159846,11 @@
159808 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
159809 pLevel->addrCont = 0;
159810 pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
159811 sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
159812 VdbeCoverage(v);
159813 assert( pParse->withinRJSubrtn>0 );
159814 pParse->withinRJSubrtn--;
159815 }
159816 pLoop = pLevel->pWLoop;
159817 if( pLevel->op!=OP_Noop ){
159818 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
159819 int addrSeek = 0;
@@ -160090,10 +160127,11 @@
160090
160091 /* Final cleanup
160092 */
160093 pParse->nQueryLoop = pWInfo->savedNQueryLoop;
160094 whereInfoFree(db, pWInfo);
 
160095 return;
160096 }
160097
160098 /************** End of where.c ***********************************************/
160099 /************** Begin file window.c ******************************************/
@@ -190661,10 +190699,12 @@
190661 if( rc==SQLITE_OK ){
190662 if( pNode->key.n ){
190663 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix);
190664 }
190665 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix);
 
 
190666 memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix);
190667 pBlk->n += nSuffix;
190668
190669 memcpy(pNode->key.a, zTerm, nTerm);
190670 pNode->key.n = nTerm;
@@ -190783,10 +190823,11 @@
190783 NodeWriter *pLeaf; /* Object used to write leaf nodes */
190784
190785 pLeaf = &pWriter->aNodeWriter[0];
190786 nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);
190787 nSuffix = nTerm - nPrefix;
 
190788
190789 nSpace = sqlite3Fts3VarintLen(nPrefix);
190790 nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;
190791 nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist;
190792
@@ -236405,11 +236446,11 @@
236405 int nArg, /* Number of args */
236406 sqlite3_value **apUnused /* Function arguments */
236407 ){
236408 assert( nArg==0 );
236409 UNUSED_PARAM2(nArg, apUnused);
236410 sqlite3_result_text(pCtx, "fts5: 2022-05-23 11:51:10 919ba2f0472e12c2d1e82364c1481e778b24ea406615b08992964a4eb80abee7", -1, SQLITE_TRANSIENT);
236411 }
236412
236413 /*
236414 ** Return true if zName is the extension on one of the shadow tables used
236415 ** by this module.
236416
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -452,11 +452,11 @@
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.39.0"
456 #define SQLITE_VERSION_NUMBER 3039000
457 #define SQLITE_SOURCE_ID "2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -6586,11 +6586,13 @@
6586 ** CAPI3REF: Return The Schema Name For A Database Connection
6587 ** METHOD: sqlite3
6588 **
6589 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
6590 ** for the N-th database on database connection D, or a NULL pointer of N is
6591 ** out of range. An N alue of 0 means the main database file. An N of 1 is
6592 ** the "temp" schema. Larger values of N correspond to various ATTACH-ed
6593 ** databases.
6594 **
6595 ** Space to hold the string that is returned by sqlite3_db_name() is managed
6596 ** by SQLite itself. The string might be deallocated by any operation that
6597 ** changes the schema, including [ATTACH] or [DETACH] or calls to
6598 ** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
@@ -17184,11 +17186,11 @@
17186 #define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
17187 #define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
17188 #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a
17189 ** single query - might change over time */
17190 #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
17191 /* 0x8000 -- available for reuse */
17192 #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
17193 #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
17194 #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
17195 #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
17196 #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
@@ -17201,10 +17203,11 @@
17203 #define INLINEFUNC_implies_nonnull_row 1
17204 #define INLINEFUNC_expr_implies_expr 2
17205 #define INLINEFUNC_expr_compare 3
17206 #define INLINEFUNC_affinity 4
17207 #define INLINEFUNC_iif 5
17208 #define INLINEFUNC_sqlite_offset 6
17209 #define INLINEFUNC_unlikely 99 /* Default case */
17210
17211 /*
17212 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
17213 ** used to create the initializers for the FuncDef structures.
@@ -75943,11 +75946,11 @@
75946 }
75947
75948 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
75949 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
75950 loc==0 ? "overwrite" : "new entry"));
75951 assert( pPage->isInit || CORRUPT_DB );
75952 newCell = pBt->pTmpSpace;
75953 assert( newCell!=0 );
75954 if( flags & BTREE_PREFORMAT ){
75955 rc = SQLITE_OK;
75956 szNew = pBt->nPreformatSize;
@@ -107506,11 +107509,21 @@
107509 memset(&caseExpr, 0, sizeof(caseExpr));
107510 caseExpr.op = TK_CASE;
107511 caseExpr.x.pList = pFarg;
107512 return sqlite3ExprCodeTarget(pParse, &caseExpr, target);
107513 }
107514 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
107515 case INLINEFUNC_sqlite_offset: {
107516 Expr *pArg = pFarg->a[0].pExpr;
107517 if( pArg->op==TK_COLUMN && pArg->iTable>=0 ){
107518 sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
107519 }else{
107520 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
107521 }
107522 break;
107523 }
107524 #endif
107525 default: {
107526 /* The UNLIKELY() function is a no-op. The result is the value
107527 ** of the first argument.
107528 */
107529 assert( nFarg==1 || nFarg==2 );
@@ -108045,24 +108058,12 @@
108058 #endif
108059 if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){
108060 if( !pColl ) pColl = db->pDfltColl;
108061 sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
108062 }
108063 sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg,
108064 pDef, pExpr->op2);
 
 
 
 
 
 
 
 
 
 
 
 
108065 if( nFarg ){
108066 if( constMask==0 ){
108067 sqlite3ReleaseTempRange(pParse, r1, nFarg);
108068 }else{
108069 sqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1);
@@ -111282,31 +111283,37 @@
111283 if( pParse->nErr ) rc = pParse->rc;
111284 }
111285 if( rc==SQLITE_OK && pStep->zTarget ){
111286 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
111287 if( pSrc ){
111288 Select *pSel = sqlite3SelectNew(
111289 pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
111290 );
111291 if( pSel==0 ){
111292 pStep->pExprList = 0;
111293 pSrc = 0;
111294 rc = SQLITE_NOMEM;
111295 }else{
111296 sqlite3SelectPrep(pParse, pSel, 0);
111297 rc = pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
111298 assert( pStep->pExprList==0 || pStep->pExprList==pSel->pEList );
111299 assert( pSrc==pSel->pSrc );
111300 if( pStep->pExprList ) pSel->pEList = 0;
111301 pSel->pSrc = 0;
111302 sqlite3SelectDelete(db, pSel);
111303 }
111304 if( pStep->pFrom ){
111305 int i;
111306 for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
111307 SrcItem *p = &pStep->pFrom->a[i];
111308 if( p->pSelect ){
111309 sqlite3SelectPrep(pParse, p->pSelect, 0);
111310 }
111311 }
111312 }
111313
111314 if( db->mallocFailed ){
111315 rc = SQLITE_NOMEM;
111316 }
111317 sNC.pSrcList = pSrc;
111318 if( rc==SQLITE_OK && pStep->pWhere ){
111319 rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere);
@@ -111753,10 +111760,19 @@
111760 if( rc==SQLITE_OK ){
111761 renameWalkTrigger(&sWalker, pTrigger);
111762 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
111763 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
111764 renameTokenFind(&sParse, &sCtx, pStep->zTarget);
111765 }
111766 if( pStep->pFrom ){
111767 int i;
111768 for(i=0; i<pStep->pFrom->nSrc; i++){
111769 SrcItem *pItem = &pStep->pFrom->a[i];
111770 if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
111771 renameTokenFind(&sParse, &sCtx, pItem->zName);
111772 }
111773 }
111774 }
111775 }
111776 }
111777 }
111778 }
@@ -124495,12 +124511,11 @@
124511 #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
124512 INLINE_FUNC(unlikely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124513 INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124514 INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY),
124515 #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
124516 INLINE_FUNC(sqlite_offset, 1, INLINEFUNC_sqlite_offset, 0 ),
 
124517 #endif
124518 FUNCTION(ltrim, 1, 1, 0, trimFunc ),
124519 FUNCTION(ltrim, 2, 1, 0, trimFunc ),
124520 FUNCTION(rtrim, 1, 2, 0, trimFunc ),
124521 FUNCTION(rtrim, 2, 2, 0, trimFunc ),
@@ -137648,14 +137663,15 @@
137663 pColExpr = pColExpr->pRight;
137664 assert( pColExpr!=0 );
137665 }
137666 if( pColExpr->op==TK_COLUMN
137667 && ALWAYS( ExprUseYTab(pColExpr) )
137668 && ALWAYS( pColExpr->y.pTab!=0 )
137669 ){
137670 /* For columns use the column name name */
137671 int iCol = pColExpr->iColumn;
137672 pTab = pColExpr->y.pTab;
137673 if( iCol<0 ) iCol = pTab->iPKey;
137674 zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
137675 }else if( pColExpr->op==TK_ID ){
137676 assert( !ExprHasProperty(pColExpr, EP_IntValue) );
137677 zName = pColExpr->u.zToken;
@@ -139264,10 +139280,15 @@
139280 sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
139281 pExpr->flags & (EP_OuterON|EP_InnerON));
139282 }
139283 sqlite3ExprDelete(db, pExpr);
139284 pExpr = pNew;
139285 if( pExpr->op==TK_TRUEFALSE ){
139286 pExpr->u.iValue = sqlite3ExprTruthValue(pExpr);
139287 pExpr->op = TK_INTEGER;
139288 ExprSetProperty(pExpr, EP_IntValue);
139289 }
139290
139291 /* Ensure that the expression now has an implicit collation sequence,
139292 ** just as it did when it was a column of a view or sub-query. */
139293 if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){
139294 CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr);
@@ -143981,11 +144002,11 @@
144002 ** sees an UPDATE statement inside the body of a CREATE TRIGGER.
144003 */
144004 SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(
144005 Parse *pParse, /* Parser */
144006 Token *pTableName, /* Name of the table to be updated */
144007 SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
144008 ExprList *pEList, /* The SET clause: list of column and new values */
144009 Expr *pWhere, /* The WHERE clause */
144010 u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
144011 const char *zStart, /* Start of SQL text */
144012 const char *zEnd /* End of SQL text */
@@ -144317,10 +144338,18 @@
144338 if( pSchema!=db->aDb[1].pSchema ){
144339 pSrc->a[0].pSchema = pSchema;
144340 }
144341 if( pStep->pFrom ){
144342 SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
144343 if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
144344 Select *pSubquery;
144345 Token as;
144346 pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0);
144347 as.n = 0;
144348 as.z = 0;
144349 pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
144350 }
144351 pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
144352 }
144353 }else{
144354 sqlite3DbFree(db, zName);
144355 }
@@ -148977,12 +149006,13 @@
149006 #define WO_ISNULL 0x0100
149007 #define WO_OR 0x0200 /* Two or more OR-connected terms */
149008 #define WO_AND 0x0400 /* Two or more AND-connected terms */
149009 #define WO_EQUIV 0x0800 /* Of the form A==B, both columns */
149010 #define WO_NOOP 0x1000 /* This term does not restrict search space */
149011 #define WO_ROWVAL 0x2000 /* A row-value term */
149012
149013 #define WO_ALL 0x3fff /* Mask of all possible WO_* values */
149014 #define WO_SINGLE 0x01ff /* Mask of all non-compound WO_* values */
149015
149016 /*
149017 ** These are definitions of bits in the WhereLoop.wsFlags field.
149018 ** The particular combination of bits in each WhereLoop help to
@@ -151622,10 +151652,13 @@
151652 if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
151653 if( !ExprHasProperty(pE,EP_OuterON|EP_InnerON) ){
151654 /* Defer processing WHERE clause constraints until after outer
151655 ** join processing. tag-20220513a */
151656 continue;
151657 }else if( (pTabItem->fg.jointype & JT_LEFT)==JT_LEFT
151658 && !ExprHasProperty(pE,EP_OuterON) ){
151659 continue;
151660 }else{
151661 Bitmask m = sqlite3WhereGetMask(&pWInfo->sMaskSet, pE->w.iJoin);
151662 if( m & pLevel->notReady ){
151663 /* An ON clause that is not ripe */
151664 continue;
@@ -151857,11 +151890,15 @@
151890 }
151891 if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
151892 mAll |= pLoop->maskSelf;
151893 for(k=0; k<pWC->nTerm; k++){
151894 WhereTerm *pTerm = &pWC->a[k];
151895 if( (pTerm->wtFlags & (TERM_VIRTUAL|TERM_SLICE))!=0
151896 && pTerm->eOperator!=WO_ROWVAL
151897 ){
151898 break;
151899 }
151900 if( pTerm->prereqAll & ~mAll ) continue;
151901 if( ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) ) continue;
151902 pSubWhere = sqlite3ExprAnd(pParse, pSubWhere,
151903 sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
151904 }
@@ -153015,11 +153052,11 @@
153052
153053 #ifdef SQLITE_DEBUG
153054 if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){
153055 printf("\n*** Incorrect prereqAll computed for:\n");
153056 sqlite3TreeViewExpr(0,pExpr,0);
153057 assert( 0 );
153058 }
153059 #endif
153060
153061 if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) ){
153062 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin);
@@ -153321,11 +153358,11 @@
153358 idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE);
153359 exprAnalyze(pSrc, pWC, idxNew);
153360 }
153361 pTerm = &pWC->a[idxTerm];
153362 pTerm->wtFlags |= TERM_CODED|TERM_VIRTUAL; /* Disable the original */
153363 pTerm->eOperator = WO_ROWVAL;
153364 }
153365
153366 /* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
153367 ** a virtual term for each vector component. The expression object
153368 ** used by each such virtual term is pExpr (the full vector IN(...)
@@ -153522,11 +153559,11 @@
153559 for(ii=0; ii<pWC->nTerm; ii++){
153560 if( pWC->a[ii].wtFlags & TERM_CODED ){
153561 /* This term is a vector operation that has been decomposed into
153562 ** other, subsequent terms. It can be ignored. See tag-20220128a */
153563 assert( pWC->a[ii].wtFlags & TERM_VIRTUAL );
153564 assert( pWC->a[ii].eOperator==WO_ROWVAL );
153565 continue;
153566 }
153567 if( pWC->a[ii].leftCursor!=iCsr ) return;
153568 }
153569
@@ -159792,10 +159829,11 @@
159829 WhereLevel *pLevel;
159830 WhereLoop *pLoop;
159831 SrcList *pTabList = pWInfo->pTabList;
159832 sqlite3 *db = pParse->db;
159833 int iEnd = sqlite3VdbeCurrentAddr(v);
159834 int nRJ = 0;
159835
159836 /* Generate loop termination code.
159837 */
159838 VdbeModuleComment((v, "End WHERE-core"));
159839 for(i=pWInfo->nLevel-1; i>=0; i--){
@@ -159808,12 +159846,11 @@
159846 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
159847 pLevel->addrCont = 0;
159848 pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
159849 sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
159850 VdbeCoverage(v);
159851 nRJ++;
 
159852 }
159853 pLoop = pLevel->pWLoop;
159854 if( pLevel->op!=OP_Noop ){
159855 #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
159856 int addrSeek = 0;
@@ -160090,10 +160127,11 @@
160127
160128 /* Final cleanup
160129 */
160130 pParse->nQueryLoop = pWInfo->savedNQueryLoop;
160131 whereInfoFree(db, pWInfo);
160132 pParse->withinRJSubrtn -= nRJ;
160133 return;
160134 }
160135
160136 /************** End of where.c ***********************************************/
160137 /************** Begin file window.c ******************************************/
@@ -190661,10 +190699,12 @@
190699 if( rc==SQLITE_OK ){
190700 if( pNode->key.n ){
190701 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix);
190702 }
190703 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix);
190704 assert( nPrefix+nSuffix<=nTerm );
190705 assert( nPrefix>=0 );
190706 memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix);
190707 pBlk->n += nSuffix;
190708
190709 memcpy(pNode->key.a, zTerm, nTerm);
190710 pNode->key.n = nTerm;
@@ -190783,10 +190823,11 @@
190823 NodeWriter *pLeaf; /* Object used to write leaf nodes */
190824
190825 pLeaf = &pWriter->aNodeWriter[0];
190826 nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);
190827 nSuffix = nTerm - nPrefix;
190828 if(nSuffix<=0 ) return FTS_CORRUPT_VTAB;
190829
190830 nSpace = sqlite3Fts3VarintLen(nPrefix);
190831 nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;
190832 nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist;
190833
@@ -236405,11 +236446,11 @@
236446 int nArg, /* Number of args */
236447 sqlite3_value **apUnused /* Function arguments */
236448 ){
236449 assert( nArg==0 );
236450 UNUSED_PARAM2(nArg, apUnused);
236451 sqlite3_result_text(pCtx, "fts5: 2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25", -1, SQLITE_TRANSIENT);
236452 }
236453
236454 /*
236455 ** Return true if zName is the extension on one of the shadow tables used
236456 ** by this module.
236457
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.39.0"
150150
#define SQLITE_VERSION_NUMBER 3039000
151
-#define SQLITE_SOURCE_ID "2022-05-25 13:10:29 c48a735bd4a1dbd541aed5937c25fc0c606c4263d8ee94cae30a06b1a7b26d9a"
151
+#define SQLITE_SOURCE_ID "2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -6280,11 +6280,13 @@
62806280
** CAPI3REF: Return The Schema Name For A Database Connection
62816281
** METHOD: sqlite3
62826282
**
62836283
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
62846284
** for the N-th database on database connection D, or a NULL pointer of N is
6285
-** out of range.
6285
+** out of range. An N alue of 0 means the main database file. An N of 1 is
6286
+** the "temp" schema. Larger values of N correspond to various ATTACH-ed
6287
+** databases.
62866288
**
62876289
** Space to hold the string that is returned by sqlite3_db_name() is managed
62886290
** by SQLite itself. The string might be deallocated by any operation that
62896291
** changes the schema, including [ATTACH] or [DETACH] or calls to
62906292
** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
62916293
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.39.0"
150 #define SQLITE_VERSION_NUMBER 3039000
151 #define SQLITE_SOURCE_ID "2022-05-25 13:10:29 c48a735bd4a1dbd541aed5937c25fc0c606c4263d8ee94cae30a06b1a7b26d9a"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -6280,11 +6280,13 @@
6280 ** CAPI3REF: Return The Schema Name For A Database Connection
6281 ** METHOD: sqlite3
6282 **
6283 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
6284 ** for the N-th database on database connection D, or a NULL pointer of N is
6285 ** out of range.
 
 
6286 **
6287 ** Space to hold the string that is returned by sqlite3_db_name() is managed
6288 ** by SQLite itself. The string might be deallocated by any operation that
6289 ** changes the schema, including [ATTACH] or [DETACH] or calls to
6290 ** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
6291
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.39.0"
150 #define SQLITE_VERSION_NUMBER 3039000
151 #define SQLITE_SOURCE_ID "2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -6280,11 +6280,13 @@
6280 ** CAPI3REF: Return The Schema Name For A Database Connection
6281 ** METHOD: sqlite3
6282 **
6283 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
6284 ** for the N-th database on database connection D, or a NULL pointer of N is
6285 ** out of range. An N alue of 0 means the main database file. An N of 1 is
6286 ** the "temp" schema. Larger values of N correspond to various ATTACH-ed
6287 ** databases.
6288 **
6289 ** Space to hold the string that is returned by sqlite3_db_name() is managed
6290 ** by SQLite itself. The string might be deallocated by any operation that
6291 ** changes the schema, including [ATTACH] or [DETACH] or calls to
6292 ** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that
6293

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button