sqlite 3.45.3.
This commit is contained in:
parent
23b3c998bd
commit
295d76d354
@ -7,7 +7,7 @@ VERSION_CODE := 18
|
||||
VERSION_NUMBER := 0.0.18-wip
|
||||
VERSION_NAME := Celebrating totality for upwards of 3m1.4s.
|
||||
|
||||
SQLITE_URL := https://www.sqlite.org/2024/sqlite-amalgamation-3450200.zip
|
||||
SQLITE_URL := https://www.sqlite.org/2024/sqlite-amalgamation-3450300.zip
|
||||
LIBUV_URL := https://dist.libuv.org/dist/v1.48.0/libuv-v1.48.0.tar.gz
|
||||
|
||||
PROJECT = tildefriends
|
||||
|
33
deps/sqlite/shell.c
vendored
33
deps/sqlite/shell.c
vendored
@ -14753,6 +14753,15 @@ static void dbdataValue(
|
||||
}
|
||||
}
|
||||
|
||||
/* This macro is a copy of the MX_CELL() macro in the SQLite core. Given
|
||||
** a page-size, it returns the maximum number of cells that may be present
|
||||
** on the page. */
|
||||
#define DBDATA_MX_CELL(pgsz) ((pgsz-8)/6)
|
||||
|
||||
/* Maximum number of fields that may appear in a single record. This is
|
||||
** the "hard-limit", according to comments in sqliteLimit.h. */
|
||||
#define DBDATA_MX_FIELD 32676
|
||||
|
||||
/*
|
||||
** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry.
|
||||
*/
|
||||
@ -14781,6 +14790,9 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
|
||||
assert( iOff+3+2<=pCsr->nPage );
|
||||
pCsr->iCell = pTab->bPtr ? -2 : 0;
|
||||
pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
|
||||
if( pCsr->nCell>DBDATA_MX_CELL(pCsr->nPage) ){
|
||||
pCsr->nCell = DBDATA_MX_CELL(pCsr->nPage);
|
||||
}
|
||||
}
|
||||
|
||||
if( pTab->bPtr ){
|
||||
@ -14825,19 +14837,19 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
|
||||
if( pCsr->iCell>=pCsr->nCell ){
|
||||
bNextPage = 1;
|
||||
}else{
|
||||
int iCellPtr = iOff + 8 + nPointer + pCsr->iCell*2;
|
||||
|
||||
iOff += 8 + nPointer + pCsr->iCell*2;
|
||||
if( iOff>pCsr->nPage ){
|
||||
if( iCellPtr>pCsr->nPage ){
|
||||
bNextPage = 1;
|
||||
}else{
|
||||
iOff = get_uint16(&pCsr->aPage[iOff]);
|
||||
iOff = get_uint16(&pCsr->aPage[iCellPtr]);
|
||||
}
|
||||
|
||||
/* For an interior node cell, skip past the child-page number */
|
||||
iOff += nPointer;
|
||||
|
||||
/* Load the "byte of payload including overflow" field */
|
||||
if( bNextPage || iOff>pCsr->nPage ){
|
||||
if( bNextPage || iOff>pCsr->nPage || iOff<=iCellPtr ){
|
||||
bNextPage = 1;
|
||||
}else{
|
||||
iOff += dbdataGetVarintU32(&pCsr->aPage[iOff], &nPayload);
|
||||
@ -14920,7 +14932,9 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
|
||||
pCsr->iField++;
|
||||
if( pCsr->iField>0 ){
|
||||
sqlite3_int64 iType;
|
||||
if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){
|
||||
if( pCsr->pHdrPtr>=&pCsr->pRec[pCsr->nRec]
|
||||
|| pCsr->iField>=DBDATA_MX_FIELD
|
||||
){
|
||||
bNextPage = 1;
|
||||
}else{
|
||||
int szField = 0;
|
||||
@ -16408,7 +16422,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){
|
||||
if( bTable && !bVirtual ){
|
||||
if( SQLITE_ROW==sqlite3_step(pTblname) ){
|
||||
const char *zTbl = (const char*)sqlite3_column_text(pTblname, 0);
|
||||
recoverAddTable(p, zTbl, iRoot);
|
||||
if( zTbl ) recoverAddTable(p, zTbl, iRoot);
|
||||
}
|
||||
recoverReset(p, pTblname);
|
||||
}
|
||||
@ -28771,6 +28785,7 @@ static const char zOptions[] =
|
||||
" -newline SEP set output row separator. Default: '\\n'\n"
|
||||
" -nofollow refuse to open symbolic links to database files\n"
|
||||
" -nonce STRING set the safe-mode escape nonce\n"
|
||||
" -no-rowid-in-view Disable rowid-in-view using sqlite3_config()\n"
|
||||
" -nullvalue TEXT set text string for NULL values. Default ''\n"
|
||||
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
|
||||
" -pcachetrace trace all page cache operations\n"
|
||||
@ -29061,6 +29076,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
stdin_is_interactive = 0;
|
||||
}else if( cli_strcmp(z,"-utf8")==0 ){
|
||||
}else if( cli_strcmp(z,"-no-utf8")==0 ){
|
||||
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
|
||||
int val = 0;
|
||||
sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
|
||||
assert( val==0 );
|
||||
}else if( cli_strcmp(z,"-heap")==0 ){
|
||||
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
|
||||
const char *zSize;
|
||||
@ -29336,6 +29355,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
/* already handled */
|
||||
}else if( cli_strcmp(z,"-no-utf8")==0 ){
|
||||
/* already handled */
|
||||
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
|
||||
/* already handled */
|
||||
}else if( cli_strcmp(z,"-heap")==0 ){
|
||||
i++;
|
||||
}else if( cli_strcmp(z,"-pagecache")==0 ){
|
||||
|
205
deps/sqlite/sqlite3.c
vendored
205
deps/sqlite/sqlite3.c
vendored
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
** This file is an amalgamation of many separate C source files from SQLite
|
||||
** version 3.45.2. By combining all the individual C code files into this
|
||||
** version 3.45.3. By combining all the individual C code files into this
|
||||
** single large file, the entire code can be compiled as a single translation
|
||||
** unit. This allows many compilers to do optimizations that would not be
|
||||
** possible if the files were compiled separately. Performance improvements
|
||||
@ -18,7 +18,7 @@
|
||||
** separate file. This file contains only code for the core SQLite library.
|
||||
**
|
||||
** The content in this amalgamation comes from Fossil check-in
|
||||
** d8cd6d49b46a395b13955387d05e9e1a2a47.
|
||||
** 8653b758870e6ef0c98d46b3ace27849054a.
|
||||
*/
|
||||
#define SQLITE_CORE 1
|
||||
#define SQLITE_AMALGAMATION 1
|
||||
@ -459,9 +459,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.45.2"
|
||||
#define SQLITE_VERSION_NUMBER 3045002
|
||||
#define SQLITE_SOURCE_ID "2024-03-12 11:06:23 d8cd6d49b46a395b13955387d05e9e1a2a47e54fb99f3c9b59835bbefad6af77"
|
||||
#define SQLITE_VERSION "3.45.3"
|
||||
#define SQLITE_VERSION_NUMBER 3045003
|
||||
#define SQLITE_SOURCE_ID "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@ -2456,6 +2456,22 @@ struct sqlite3_mem_methods {
|
||||
** configuration setting is never used, then the default maximum is determined
|
||||
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
|
||||
** compile-time option is not set, then the default maximum is 1073741824.
|
||||
**
|
||||
** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
|
||||
** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
|
||||
** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
|
||||
** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
|
||||
** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
|
||||
** defaults to on. This configuration option queries the current setting or
|
||||
** changes the setting to off or on. The argument is a pointer to an integer.
|
||||
** If that integer initially holds a value of 1, then the ability for VIEWs to
|
||||
** have ROWIDs is activated. If the integer initially holds zero, then the
|
||||
** ability is deactivated. Any other initial value for the integer leaves the
|
||||
** setting unchanged. After changes, if any, the integer is written with
|
||||
** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
|
||||
** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
|
||||
** recommended case) then the integer is always filled with zero, regardless
|
||||
** if its initial value.
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
||||
@ -2487,6 +2503,7 @@ struct sqlite3_mem_methods {
|
||||
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
|
||||
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
|
||||
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
|
||||
#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Database Connection Configuration Options
|
||||
@ -18430,6 +18447,15 @@ struct Table {
|
||||
#define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0)
|
||||
#define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0)
|
||||
|
||||
/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is
|
||||
** available. By default, this macro is false
|
||||
*/
|
||||
#ifndef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
# define ViewCanHaveRowid 0
|
||||
#else
|
||||
# define ViewCanHaveRowid (sqlite3Config.mNoVisibleRowid==0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Each foreign key constraint is an instance of the following structure.
|
||||
**
|
||||
@ -20144,6 +20170,11 @@ struct Sqlite3Config {
|
||||
#endif
|
||||
#ifndef SQLITE_UNTESTABLE
|
||||
int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */
|
||||
#endif
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
u32 mNoVisibleRowid; /* TF_NoVisibleRowid if the ROWID_IN_VIEW
|
||||
** feature is disabled. 0 if rowids can
|
||||
** occur in views. */
|
||||
#endif
|
||||
int bLocaltimeFault; /* True to fail localtime() calls */
|
||||
int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */
|
||||
@ -20600,10 +20631,13 @@ SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*);
|
||||
# define EXP754 (((u64)0x7ff)<<52)
|
||||
# define MAN754 ((((u64)1)<<52)-1)
|
||||
# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)
|
||||
# define IsOvfl(X) (((X)&EXP754)==EXP754)
|
||||
SQLITE_PRIVATE int sqlite3IsNaN(double);
|
||||
SQLITE_PRIVATE int sqlite3IsOverflow(double);
|
||||
#else
|
||||
# define IsNaN(X) 0
|
||||
# define sqlite3IsNaN(X) 0
|
||||
# define IsNaN(X) 0
|
||||
# define sqlite3IsNaN(X) 0
|
||||
# define sqlite3IsOVerflow(X) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -21839,6 +21873,9 @@ static const char * const sqlite3azCompileOpt[] = {
|
||||
"ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN),
|
||||
# endif
|
||||
#endif
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
"ALLOW_ROWID_IN_VIEW",
|
||||
#endif
|
||||
#ifdef SQLITE_ALLOW_URI_AUTHORITY
|
||||
"ALLOW_URI_AUTHORITY",
|
||||
#endif
|
||||
@ -22858,6 +22895,9 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
|
||||
#endif
|
||||
#ifndef SQLITE_UNTESTABLE
|
||||
0, /* xTestCallback */
|
||||
#endif
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
0, /* mNoVisibleRowid. 0 == allow rowid-in-view */
|
||||
#endif
|
||||
0, /* bLocaltimeFault */
|
||||
0, /* xAltLocaltime */
|
||||
@ -34646,6 +34686,19 @@ SQLITE_PRIVATE int sqlite3IsNaN(double x){
|
||||
}
|
||||
#endif /* SQLITE_OMIT_FLOATING_POINT */
|
||||
|
||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||
/*
|
||||
** Return true if the floating point value is NaN or +Inf or -Inf.
|
||||
*/
|
||||
SQLITE_PRIVATE int sqlite3IsOverflow(double x){
|
||||
int rc; /* The value return */
|
||||
u64 y;
|
||||
memcpy(&y,&x,sizeof(y));
|
||||
rc = IsOvfl(y);
|
||||
return rc;
|
||||
}
|
||||
#endif /* SQLITE_OMIT_FLOATING_POINT */
|
||||
|
||||
/*
|
||||
** Compute a string length that is limited to what can be stored in
|
||||
** lower 30 bits of a 32-bit signed integer.
|
||||
@ -63802,7 +63855,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
|
||||
** This will be either the rollback journal or the WAL file.
|
||||
*/
|
||||
SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){
|
||||
#if SQLITE_OMIT_WAL
|
||||
#ifdef SQLITE_OMIT_WAL
|
||||
return pPager->jfd;
|
||||
#else
|
||||
return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd;
|
||||
@ -79619,7 +79672,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
|
||||
}else if( loc<0 && pPage->nCell>0 ){
|
||||
assert( pPage->leaf );
|
||||
idx = ++pCur->ix;
|
||||
pCur->curFlags &= ~BTCF_ValidNKey;
|
||||
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
|
||||
}else{
|
||||
assert( pPage->leaf );
|
||||
}
|
||||
@ -79649,7 +79702,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
|
||||
*/
|
||||
if( pPage->nOverflow ){
|
||||
assert( rc==SQLITE_OK );
|
||||
pCur->curFlags &= ~(BTCF_ValidNKey);
|
||||
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
|
||||
rc = balance(pCur);
|
||||
|
||||
/* Must make sure nOverflow is reset to zero even if the balance()
|
||||
@ -106656,8 +106709,37 @@ static int lookupName(
|
||||
}
|
||||
}
|
||||
if( 0==cnt && VisibleRowid(pTab) ){
|
||||
/* pTab is a potential ROWID match. Keep track of it and match
|
||||
** the ROWID later if that seems appropriate. (Search for "cntTab"
|
||||
** to find related code.) Only allow a ROWID match if there is
|
||||
** a single ROWID match candidate.
|
||||
*/
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
/* In SQLITE_ALLOW_ROWID_IN_VIEW mode, allow a ROWID match
|
||||
** if there is a single VIEW candidate or if there is a single
|
||||
** non-VIEW candidate plus multiple VIEW candidates. In other
|
||||
** words non-VIEW candidate terms take precedence over VIEWs.
|
||||
*/
|
||||
if( cntTab==0
|
||||
|| (cntTab==1
|
||||
&& ALWAYS(pMatch!=0)
|
||||
&& ALWAYS(pMatch->pTab!=0)
|
||||
&& (pMatch->pTab->tabFlags & TF_Ephemeral)!=0
|
||||
&& (pTab->tabFlags & TF_Ephemeral)==0)
|
||||
){
|
||||
cntTab = 1;
|
||||
pMatch = pItem;
|
||||
}else{
|
||||
cntTab++;
|
||||
}
|
||||
#else
|
||||
/* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is
|
||||
** simpler since we require exactly one candidate, which will
|
||||
** always be a non-VIEW
|
||||
*/
|
||||
cntTab++;
|
||||
pMatch = pItem;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if( pMatch ){
|
||||
@ -106783,13 +106865,13 @@ static int lookupName(
|
||||
** Perhaps the name is a reference to the ROWID
|
||||
*/
|
||||
if( cnt==0
|
||||
&& cntTab==1
|
||||
&& cntTab>=1
|
||||
&& pMatch
|
||||
&& (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0
|
||||
&& sqlite3IsRowid(zCol)
|
||||
&& ALWAYS(VisibleRowid(pMatch->pTab) || pMatch->fg.isNestedFrom)
|
||||
){
|
||||
cnt = 1;
|
||||
cnt = cntTab;
|
||||
if( pMatch->fg.isNestedFrom==0 ) pExpr->iColumn = -1;
|
||||
pExpr->affExpr = SQLITE_AFF_INTEGER;
|
||||
}
|
||||
@ -108647,9 +108729,10 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){
|
||||
assert( pExpr->x.pList->nExpr>0 );
|
||||
assert( pExpr->op==TK_FUNCTION );
|
||||
pExpr = pExpr->x.pList->a[0].pExpr;
|
||||
}else{
|
||||
assert( pExpr->op==TK_COLLATE );
|
||||
}else if( pExpr->op==TK_COLLATE ){
|
||||
pExpr = pExpr->pLeft;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pExpr;
|
||||
@ -111168,9 +111251,12 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){
|
||||
return 0;
|
||||
case TK_COLUMN:
|
||||
assert( ExprUseYTab(p) );
|
||||
return ExprHasProperty(p, EP_CanBeNull) ||
|
||||
NEVER(p->y.pTab==0) || /* Reference to column of index on expr */
|
||||
(p->iColumn>=0
|
||||
return ExprHasProperty(p, EP_CanBeNull)
|
||||
|| NEVER(p->y.pTab==0) /* Reference to column of index on expr */
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
|| (p->iColumn==XN_ROWID && IsView(p->y.pTab))
|
||||
#endif
|
||||
|| (p->iColumn>=0
|
||||
&& p->y.pTab->aCol!=0 /* Possible due to prior error */
|
||||
&& ALWAYS(p->iColumn<p->y.pTab->nCol)
|
||||
&& p->y.pTab->aCol[p->iColumn].notNull==0);
|
||||
@ -123661,9 +123747,12 @@ SQLITE_PRIVATE void sqlite3CreateView(
|
||||
** on a view, even though views do not have rowids. The following flag
|
||||
** setting fixes this problem. But the fix can be disabled by compiling
|
||||
** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that
|
||||
** depend upon the old buggy behavior. */
|
||||
#ifndef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
p->tabFlags |= TF_NoVisibleRowid;
|
||||
** depend upon the old buggy behavior. The ability can also be toggled
|
||||
** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
p->tabFlags |= sqlite3Config.mNoVisibleRowid; /* Optional. Allow by default */
|
||||
#else
|
||||
p->tabFlags |= TF_NoVisibleRowid; /* Never allow rowid in view */
|
||||
#endif
|
||||
|
||||
sqlite3TwoPartName(pParse, pName1, pName2, &pName);
|
||||
@ -129827,7 +129916,7 @@ static void sumFinalize(sqlite3_context *context){
|
||||
if( p->approx ){
|
||||
if( p->ovrfl ){
|
||||
sqlite3_result_error(context,"integer overflow",-1);
|
||||
}else if( !sqlite3IsNaN(p->rErr) ){
|
||||
}else if( !sqlite3IsOverflow(p->rErr) ){
|
||||
sqlite3_result_double(context, p->rSum+p->rErr);
|
||||
}else{
|
||||
sqlite3_result_double(context, p->rSum);
|
||||
@ -129844,7 +129933,7 @@ static void avgFinalize(sqlite3_context *context){
|
||||
double r;
|
||||
if( p->approx ){
|
||||
r = p->rSum;
|
||||
if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
|
||||
if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr;
|
||||
}else{
|
||||
r = (double)(p->iSum);
|
||||
}
|
||||
@ -129858,7 +129947,7 @@ static void totalFinalize(sqlite3_context *context){
|
||||
if( p ){
|
||||
if( p->approx ){
|
||||
r = p->rSum;
|
||||
if( !sqlite3IsNaN(p->rErr) ) r += p->rErr;
|
||||
if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr;
|
||||
}else{
|
||||
r = (double)(p->iSum);
|
||||
}
|
||||
@ -135156,7 +135245,10 @@ static int xferOptimization(
|
||||
}
|
||||
}
|
||||
#ifndef SQLITE_OMIT_CHECK
|
||||
if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
|
||||
if( pDest->pCheck
|
||||
&& (db->mDbFlags & DBFLAG_Vacuum)==0
|
||||
&& sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1)
|
||||
){
|
||||
return 0; /* Tables have different CHECK constraints. Ticket #2252 */
|
||||
}
|
||||
#endif
|
||||
@ -140557,7 +140649,11 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
|
||||
j = seen[0]-1;
|
||||
pIdxInfo->aConstraintUsage[j].argvIndex = 1;
|
||||
pIdxInfo->aConstraintUsage[j].omit = 1;
|
||||
if( seen[1]==0 ) return SQLITE_OK;
|
||||
if( seen[1]==0 ){
|
||||
pIdxInfo->estimatedCost = (double)1000;
|
||||
pIdxInfo->estimatedRows = 1000;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
pIdxInfo->estimatedCost = (double)20;
|
||||
pIdxInfo->estimatedRows = 20;
|
||||
j = seen[1]-1;
|
||||
@ -143784,11 +143880,7 @@ static const char *columnTypeImpl(
|
||||
** data for the result-set column of the sub-select.
|
||||
*/
|
||||
if( iCol<pS->pEList->nExpr
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
&& iCol>=0
|
||||
#else
|
||||
&& ALWAYS(iCol>=0)
|
||||
#endif
|
||||
&& (!ViewCanHaveRowid || iCol>=0)
|
||||
){
|
||||
/* If iCol is less than zero, then the expression requests the
|
||||
** rowid of the sub-select or view. This expression is legal (see
|
||||
@ -146963,6 +147055,10 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
|
||||
**
|
||||
** (11) The subquery is not a VALUES clause
|
||||
**
|
||||
** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This
|
||||
** case only comes up if SQLite is compiled using
|
||||
** SQLITE_ALLOW_ROWID_IN_VIEW.
|
||||
**
|
||||
** Return 0 if no changes are made and non-zero if one or more WHERE clause
|
||||
** terms are duplicated into the subquery.
|
||||
*/
|
||||
@ -147073,6 +147169,18 @@ static int pushDownWhereTerms(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
if( ViewCanHaveRowid && (pWhere->op==TK_ISNULL || pWhere->op==TK_NOTNULL) ){
|
||||
Expr *pLeft = pWhere->pLeft;
|
||||
if( ALWAYS(pLeft)
|
||||
&& pLeft->op==TK_COLUMN
|
||||
&& pLeft->iColumn < 0
|
||||
){
|
||||
return 0; /* Restriction (12) */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
|
||||
nChng++;
|
||||
pSubq->selFlags |= SF_PushDown;
|
||||
@ -147700,12 +147808,14 @@ SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
|
||||
while( pSel->pPrior ){ pSel = pSel->pPrior; }
|
||||
sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
|
||||
pTab->iPKey = -1;
|
||||
pTab->eTabType = TABTYP_VIEW;
|
||||
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
|
||||
#ifndef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
/* The usual case - do not allow ROWID on a subquery */
|
||||
pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
|
||||
#else
|
||||
pTab->tabFlags |= TF_Ephemeral; /* Legacy compatibility mode */
|
||||
/* Legacy compatibility mode */
|
||||
pTab->tabFlags |= TF_Ephemeral | sqlite3Config.mNoVisibleRowid;
|
||||
#endif
|
||||
return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
|
||||
}
|
||||
@ -147973,7 +148083,7 @@ static int selectExpander(Walker *pWalker, Select *p){
|
||||
pNestedFrom = pFrom->pSelect->pEList;
|
||||
assert( pNestedFrom!=0 );
|
||||
assert( pNestedFrom->nExpr==pTab->nCol );
|
||||
assert( VisibleRowid(pTab)==0 );
|
||||
assert( VisibleRowid(pTab)==0 || ViewCanHaveRowid );
|
||||
}else{
|
||||
if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
|
||||
continue;
|
||||
@ -148005,7 +148115,8 @@ static int selectExpander(Walker *pWalker, Select *p){
|
||||
pUsing = 0;
|
||||
}
|
||||
|
||||
nAdd = pTab->nCol + (VisibleRowid(pTab) && (selFlags&SF_NestedFrom));
|
||||
nAdd = pTab->nCol;
|
||||
if( VisibleRowid(pTab) && (selFlags & SF_NestedFrom)!=0 ) nAdd++;
|
||||
for(j=0; j<nAdd; j++){
|
||||
const char *zName;
|
||||
struct ExprList_item *pX; /* Newly added ExprList term */
|
||||
@ -148087,7 +148198,8 @@ static int selectExpander(Walker *pWalker, Select *p){
|
||||
pX = &pNew->a[pNew->nExpr-1];
|
||||
assert( pX->zEName==0 );
|
||||
if( (selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){
|
||||
if( pNestedFrom ){
|
||||
if( pNestedFrom && (!ViewCanHaveRowid || j<pNestedFrom->nExpr) ){
|
||||
assert( j<pNestedFrom->nExpr );
|
||||
pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName);
|
||||
testcase( pX->zEName==0 );
|
||||
}else{
|
||||
@ -153021,6 +153133,9 @@ SQLITE_PRIVATE void sqlite3Update(
|
||||
}
|
||||
}
|
||||
if( chngRowid==0 && pPk==0 ){
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
if( isView ) sqlite3VdbeAddOp2(v, OP_Null, 0, regOldRowid);
|
||||
#endif
|
||||
sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid);
|
||||
}
|
||||
}
|
||||
@ -166730,16 +166845,10 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
|
||||
for(i=0; i<pIdx->nColumn; i++){
|
||||
Expr *pExpr;
|
||||
int j = pIdx->aiColumn[i];
|
||||
int bMaybeNullRow;
|
||||
if( j==XN_EXPR ){
|
||||
pExpr = pIdx->aColExpr->a[i].pExpr;
|
||||
testcase( pTabItem->fg.jointype & JT_LEFT );
|
||||
testcase( pTabItem->fg.jointype & JT_RIGHT );
|
||||
testcase( pTabItem->fg.jointype & JT_LTORJ );
|
||||
bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0;
|
||||
}else if( j>=0 && (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)!=0 ){
|
||||
pExpr = sqlite3ColumnExpr(pTab, &pTab->aCol[j]);
|
||||
bMaybeNullRow = 0;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
@ -166771,7 +166880,7 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
|
||||
p->iDataCur = pTabItem->iCursor;
|
||||
p->iIdxCur = iIdxCur;
|
||||
p->iIdxCol = i;
|
||||
p->bMaybeNullRow = bMaybeNullRow;
|
||||
p->bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0;
|
||||
if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){
|
||||
p->aff = pIdx->zColAff[i];
|
||||
}
|
||||
@ -178976,6 +179085,18 @@ SQLITE_API int sqlite3_config(int op, ...){
|
||||
}
|
||||
#endif /* SQLITE_OMIT_DESERIALIZE */
|
||||
|
||||
case SQLITE_CONFIG_ROWID_IN_VIEW: {
|
||||
int *pVal = va_arg(ap,int*);
|
||||
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
|
||||
if( 0==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid;
|
||||
if( 1==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = 0;
|
||||
*pVal = (sqlite3GlobalConfig.mNoVisibleRowid==0);
|
||||
#else
|
||||
*pVal = 0;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
rc = SQLITE_ERROR;
|
||||
break;
|
||||
@ -250678,7 +250799,7 @@ static void fts5SourceIdFunc(
|
||||
){
|
||||
assert( nArg==0 );
|
||||
UNUSED_PARAM2(nArg, apUnused);
|
||||
sqlite3_result_text(pCtx, "fts5: 2024-03-12 11:06:23 d8cd6d49b46a395b13955387d05e9e1a2a47e54fb99f3c9b59835bbefad6af77", -1, SQLITE_TRANSIENT);
|
||||
sqlite3_result_text(pCtx, "fts5: 2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355", -1, SQLITE_TRANSIENT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
23
deps/sqlite/sqlite3.h
vendored
23
deps/sqlite/sqlite3.h
vendored
@ -146,9 +146,9 @@ extern "C" {
|
||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||
** [sqlite_version()] and [sqlite_source_id()].
|
||||
*/
|
||||
#define SQLITE_VERSION "3.45.2"
|
||||
#define SQLITE_VERSION_NUMBER 3045002
|
||||
#define SQLITE_SOURCE_ID "2024-03-12 11:06:23 d8cd6d49b46a395b13955387d05e9e1a2a47e54fb99f3c9b59835bbefad6af77"
|
||||
#define SQLITE_VERSION "3.45.3"
|
||||
#define SQLITE_VERSION_NUMBER 3045003
|
||||
#define SQLITE_SOURCE_ID "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1e8355"
|
||||
|
||||
/*
|
||||
** CAPI3REF: Run-Time Library Version Numbers
|
||||
@ -2143,6 +2143,22 @@ struct sqlite3_mem_methods {
|
||||
** configuration setting is never used, then the default maximum is determined
|
||||
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
|
||||
** compile-time option is not set, then the default maximum is 1073741824.
|
||||
**
|
||||
** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
|
||||
** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
|
||||
** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
|
||||
** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
|
||||
** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
|
||||
** defaults to on. This configuration option queries the current setting or
|
||||
** changes the setting to off or on. The argument is a pointer to an integer.
|
||||
** If that integer initially holds a value of 1, then the ability for VIEWs to
|
||||
** have ROWIDs is activated. If the integer initially holds zero, then the
|
||||
** ability is deactivated. Any other initial value for the integer leaves the
|
||||
** setting unchanged. After changes, if any, the integer is written with
|
||||
** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
|
||||
** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
|
||||
** recommended case) then the integer is always filled with zero, regardless
|
||||
** if its initial value.
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
||||
@ -2174,6 +2190,7 @@ struct sqlite3_mem_methods {
|
||||
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
|
||||
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
|
||||
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
|
||||
#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Database Connection Configuration Options
|
||||
|
Loading…
Reference in New Issue
Block a user