1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-21 13:38:01 +03:00

Merge trunk into wasi-patches branch.

FossilOrigin-Name: 2ce89f5efcdb8b4c58eb2d30833a76d79ae0134c31d5ab8564be9e1cf5a1f4f0
This commit is contained in:
stephan
2023-01-27 05:37:24 +00:00
28 changed files with 437 additions and 153 deletions

View File

@@ -5287,9 +5287,8 @@ static void fts3EvalNextRow(
Fts3Expr *pExpr, /* Expr. to advance to next matching row */ Fts3Expr *pExpr, /* Expr. to advance to next matching row */
int *pRc /* IN/OUT: Error code */ int *pRc /* IN/OUT: Error code */
){ ){
if( *pRc==SQLITE_OK ){ if( *pRc==SQLITE_OK && pExpr->bEof==0 ){
int bDescDoclist = pCsr->bDesc; /* Used by DOCID_CMP() macro */ int bDescDoclist = pCsr->bDesc; /* Used by DOCID_CMP() macro */
assert( pExpr->bEof==0 );
pExpr->bStart = 1; pExpr->bStart = 1;
switch( pExpr->eType ){ switch( pExpr->eType ){
@@ -5765,6 +5764,22 @@ static void fts3EvalUpdateCounts(Fts3Expr *pExpr, int nCol){
} }
} }
/*
** This is an sqlite3Fts3ExprIterate() callback. If the Fts3Expr.aMI[] array
** has not yet been allocated, allocate and zero it. Otherwise, just zero
** it.
*/
static int fts3AllocateMSI(Fts3Expr *pExpr, int iPhrase, void *pCtx){
Fts3Table *pTab = (Fts3Table*)pCtx;
UNUSED_PARAMETER(iPhrase);
if( pExpr->aMI==0 ){
pExpr->aMI = (u32 *)sqlite3_malloc64(pTab->nColumn * 3 * sizeof(u32));
if( pExpr->aMI==0 ) return SQLITE_NOMEM;
}
memset(pExpr->aMI, 0, pTab->nColumn * 3 * sizeof(u32));
return SQLITE_OK;
}
/* /*
** Expression pExpr must be of type FTSQUERY_PHRASE. ** Expression pExpr must be of type FTSQUERY_PHRASE.
** **
@@ -5786,7 +5801,6 @@ static int fts3EvalGatherStats(
if( pExpr->aMI==0 ){ if( pExpr->aMI==0 ){
Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
Fts3Expr *pRoot; /* Root of NEAR expression */ Fts3Expr *pRoot; /* Root of NEAR expression */
Fts3Expr *p; /* Iterator used for several purposes */
sqlite3_int64 iPrevId = pCsr->iPrevId; sqlite3_int64 iPrevId = pCsr->iPrevId;
sqlite3_int64 iDocid; sqlite3_int64 iDocid;
@@ -5794,7 +5808,9 @@ static int fts3EvalGatherStats(
/* Find the root of the NEAR expression */ /* Find the root of the NEAR expression */
pRoot = pExpr; pRoot = pExpr;
while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){ while( pRoot->pParent
&& (pRoot->pParent->eType==FTSQUERY_NEAR || pRoot->bDeferred)
){
pRoot = pRoot->pParent; pRoot = pRoot->pParent;
} }
iDocid = pRoot->iDocid; iDocid = pRoot->iDocid;
@@ -5802,14 +5818,8 @@ static int fts3EvalGatherStats(
assert( pRoot->bStart ); assert( pRoot->bStart );
/* Allocate space for the aMSI[] array of each FTSQUERY_PHRASE node */ /* Allocate space for the aMSI[] array of each FTSQUERY_PHRASE node */
for(p=pRoot; p; p=p->pLeft){ rc = sqlite3Fts3ExprIterate(pRoot, fts3AllocateMSI, (void*)pTab);
Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight); if( rc!=SQLITE_OK ) return rc;
assert( pE->aMI==0 );
pE->aMI = (u32 *)sqlite3_malloc64(pTab->nColumn * 3 * sizeof(u32));
if( !pE->aMI ) return SQLITE_NOMEM;
memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32));
}
fts3EvalRestart(pCsr, pRoot, &rc); fts3EvalRestart(pCsr, pRoot, &rc);
while( pCsr->isEof==0 && rc==SQLITE_OK ){ while( pCsr->isEof==0 && rc==SQLITE_OK ){
@@ -5965,6 +5975,7 @@ int sqlite3Fts3EvalPhrasePoslist(
u8 bTreeEof = 0; u8 bTreeEof = 0;
Fts3Expr *p; /* Used to iterate from pExpr to root */ Fts3Expr *p; /* Used to iterate from pExpr to root */
Fts3Expr *pNear; /* Most senior NEAR ancestor (or pExpr) */ Fts3Expr *pNear; /* Most senior NEAR ancestor (or pExpr) */
Fts3Expr *pRun; /* Closest non-deferred ancestor of pNear */
int bMatch; int bMatch;
/* Check if this phrase descends from an OR expression node. If not, /* Check if this phrase descends from an OR expression node. If not,
@@ -5979,25 +5990,30 @@ int sqlite3Fts3EvalPhrasePoslist(
if( p->bEof ) bTreeEof = 1; if( p->bEof ) bTreeEof = 1;
} }
if( bOr==0 ) return SQLITE_OK; if( bOr==0 ) return SQLITE_OK;
pRun = pNear;
while( pRun->bDeferred ){
assert( pRun->pParent );
pRun = pRun->pParent;
}
/* This is the descendent of an OR node. In this case we cannot use /* This is the descendent of an OR node. In this case we cannot use
** an incremental phrase. Load the entire doclist for the phrase ** an incremental phrase. Load the entire doclist for the phrase
** into memory in this case. */ ** into memory in this case. */
if( pPhrase->bIncr ){ if( pPhrase->bIncr ){
int bEofSave = pNear->bEof; int bEofSave = pRun->bEof;
fts3EvalRestart(pCsr, pNear, &rc); fts3EvalRestart(pCsr, pRun, &rc);
while( rc==SQLITE_OK && !pNear->bEof ){ while( rc==SQLITE_OK && !pRun->bEof ){
fts3EvalNextRow(pCsr, pNear, &rc); fts3EvalNextRow(pCsr, pRun, &rc);
if( bEofSave==0 && pNear->iDocid==iDocid ) break; if( bEofSave==0 && pRun->iDocid==iDocid ) break;
} }
assert( rc!=SQLITE_OK || pPhrase->bIncr==0 ); assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
if( rc==SQLITE_OK && pNear->bEof!=bEofSave ){ if( rc==SQLITE_OK && pRun->bEof!=bEofSave ){
rc = FTS_CORRUPT_VTAB; rc = FTS_CORRUPT_VTAB;
} }
} }
if( bTreeEof ){ if( bTreeEof ){
while( rc==SQLITE_OK && !pNear->bEof ){ while( rc==SQLITE_OK && !pRun->bEof ){
fts3EvalNextRow(pCsr, pNear, &rc); fts3EvalNextRow(pCsr, pRun, &rc);
} }
} }
if( rc!=SQLITE_OK ) return rc; if( rc!=SQLITE_OK ) return rc;

View File

@@ -650,5 +650,7 @@ int sqlite3FtsUnicodeIsalnum(int);
int sqlite3FtsUnicodeIsdiacritic(int); int sqlite3FtsUnicodeIsdiacritic(int);
#endif #endif
int sqlite3Fts3ExprIterate(Fts3Expr*, int (*x)(Fts3Expr*,int,void*), void*);
#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */ #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */
#endif /* _FTSINT_H */ #endif /* _FTSINT_H */

View File

@@ -41,7 +41,7 @@ typedef sqlite3_int64 i64;
/* /*
** Used as an fts3ExprIterate() context when loading phrase doclists to ** Used as an sqlite3Fts3ExprIterate() context when loading phrase doclists to
** Fts3Expr.aDoclist[]/nDoclist. ** Fts3Expr.aDoclist[]/nDoclist.
*/ */
typedef struct LoadDoclistCtx LoadDoclistCtx; typedef struct LoadDoclistCtx LoadDoclistCtx;
@@ -85,7 +85,7 @@ struct SnippetFragment {
}; };
/* /*
** This type is used as an fts3ExprIterate() context object while ** This type is used as an sqlite3Fts3ExprIterate() context object while
** accumulating the data returned by the matchinfo() function. ** accumulating the data returned by the matchinfo() function.
*/ */
typedef struct MatchInfo MatchInfo; typedef struct MatchInfo MatchInfo;
@@ -244,7 +244,7 @@ static void fts3GetDeltaPosition(char **pp, i64 *piPos){
} }
/* /*
** Helper function for fts3ExprIterate() (see below). ** Helper function for sqlite3Fts3ExprIterate() (see below).
*/ */
static int fts3ExprIterate2( static int fts3ExprIterate2(
Fts3Expr *pExpr, /* Expression to iterate phrases of */ Fts3Expr *pExpr, /* Expression to iterate phrases of */
@@ -278,7 +278,7 @@ static int fts3ExprIterate2(
** Otherwise, SQLITE_OK is returned after a callback has been made for ** Otherwise, SQLITE_OK is returned after a callback has been made for
** all eligible phrase nodes. ** all eligible phrase nodes.
*/ */
static int fts3ExprIterate( int sqlite3Fts3ExprIterate(
Fts3Expr *pExpr, /* Expression to iterate phrases of */ Fts3Expr *pExpr, /* Expression to iterate phrases of */
int (*x)(Fts3Expr*,int,void*), /* Callback function to invoke for phrases */ int (*x)(Fts3Expr*,int,void*), /* Callback function to invoke for phrases */
void *pCtx /* Second argument to pass to callback */ void *pCtx /* Second argument to pass to callback */
@@ -287,10 +287,9 @@ static int fts3ExprIterate(
return fts3ExprIterate2(pExpr, &iPhrase, x, pCtx); return fts3ExprIterate2(pExpr, &iPhrase, x, pCtx);
} }
/* /*
** This is an fts3ExprIterate() callback used while loading the doclists ** This is an sqlite3Fts3ExprIterate() callback used while loading the
** for each phrase into Fts3Expr.aDoclist[]/nDoclist. See also ** doclists for each phrase into Fts3Expr.aDoclist[]/nDoclist. See also
** fts3ExprLoadDoclists(). ** fts3ExprLoadDoclists().
*/ */
static int fts3ExprLoadDoclistsCb(Fts3Expr *pExpr, int iPhrase, void *ctx){ static int fts3ExprLoadDoclistsCb(Fts3Expr *pExpr, int iPhrase, void *ctx){
@@ -322,9 +321,9 @@ static int fts3ExprLoadDoclists(
int *pnToken /* OUT: Number of tokens in query */ int *pnToken /* OUT: Number of tokens in query */
){ ){
int rc; /* Return Code */ int rc; /* Return Code */
LoadDoclistCtx sCtx = {0,0,0}; /* Context for fts3ExprIterate() */ LoadDoclistCtx sCtx = {0,0,0}; /* Context for sqlite3Fts3ExprIterate() */
sCtx.pCsr = pCsr; sCtx.pCsr = pCsr;
rc = fts3ExprIterate(pCsr->pExpr, fts3ExprLoadDoclistsCb, (void *)&sCtx); rc = sqlite3Fts3ExprIterate(pCsr->pExpr,fts3ExprLoadDoclistsCb,(void*)&sCtx);
if( pnPhrase ) *pnPhrase = sCtx.nPhrase; if( pnPhrase ) *pnPhrase = sCtx.nPhrase;
if( pnToken ) *pnToken = sCtx.nToken; if( pnToken ) *pnToken = sCtx.nToken;
return rc; return rc;
@@ -337,7 +336,7 @@ static int fts3ExprPhraseCountCb(Fts3Expr *pExpr, int iPhrase, void *ctx){
} }
static int fts3ExprPhraseCount(Fts3Expr *pExpr){ static int fts3ExprPhraseCount(Fts3Expr *pExpr){
int nPhrase = 0; int nPhrase = 0;
(void)fts3ExprIterate(pExpr, fts3ExprPhraseCountCb, (void *)&nPhrase); (void)sqlite3Fts3ExprIterate(pExpr, fts3ExprPhraseCountCb, (void *)&nPhrase);
return nPhrase; return nPhrase;
} }
@@ -465,8 +464,9 @@ static void fts3SnippetDetails(
} }
/* /*
** This function is an fts3ExprIterate() callback used by fts3BestSnippet(). ** This function is an sqlite3Fts3ExprIterate() callback used by
** Each invocation populates an element of the SnippetIter.aPhrase[] array. ** fts3BestSnippet(). Each invocation populates an element of the
** SnippetIter.aPhrase[] array.
*/ */
static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){ static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){
SnippetIter *p = (SnippetIter *)ctx; SnippetIter *p = (SnippetIter *)ctx;
@@ -556,7 +556,9 @@ static int fts3BestSnippet(
sIter.nSnippet = nSnippet; sIter.nSnippet = nSnippet;
sIter.nPhrase = nList; sIter.nPhrase = nList;
sIter.iCurrent = -1; sIter.iCurrent = -1;
rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void*)&sIter); rc = sqlite3Fts3ExprIterate(
pCsr->pExpr, fts3SnippetFindPositions, (void*)&sIter
);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
/* Set the *pmSeen output variable. */ /* Set the *pmSeen output variable. */
@@ -917,10 +919,10 @@ static int fts3ExprLHitGather(
} }
/* /*
** fts3ExprIterate() callback used to collect the "global" matchinfo stats ** sqlite3Fts3ExprIterate() callback used to collect the "global" matchinfo
** for a single query. ** stats for a single query.
** **
** fts3ExprIterate() callback to load the 'global' elements of a ** sqlite3Fts3ExprIterate() callback to load the 'global' elements of a
** FTS3_MATCHINFO_HITS matchinfo array. The global stats are those elements ** FTS3_MATCHINFO_HITS matchinfo array. The global stats are those elements
** of the matchinfo array that are constant for all rows returned by the ** of the matchinfo array that are constant for all rows returned by the
** current query. ** current query.
@@ -955,7 +957,7 @@ static int fts3ExprGlobalHitsCb(
} }
/* /*
** fts3ExprIterate() callback used to collect the "local" part of the ** sqlite3Fts3ExprIterate() callback used to collect the "local" part of the
** FTS3_MATCHINFO_HITS array. The local stats are those elements of the ** FTS3_MATCHINFO_HITS array. The local stats are those elements of the
** array that are different for each row returned by the query. ** array that are different for each row returned by the query.
*/ */
@@ -1151,7 +1153,7 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){
**/ **/
aIter = sqlite3Fts3MallocZero(sizeof(LcsIterator) * pCsr->nPhrase); aIter = sqlite3Fts3MallocZero(sizeof(LcsIterator) * pCsr->nPhrase);
if( !aIter ) return SQLITE_NOMEM; if( !aIter ) return SQLITE_NOMEM;
(void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter); (void)sqlite3Fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter);
for(i=0; i<pInfo->nPhrase; i++){ for(i=0; i<pInfo->nPhrase; i++){
LcsIterator *pIter = &aIter[i]; LcsIterator *pIter = &aIter[i];
@@ -1328,11 +1330,11 @@ static int fts3MatchinfoValues(
rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc,0,0); rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc,0,0);
if( rc!=SQLITE_OK ) break; if( rc!=SQLITE_OK ) break;
} }
rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo); rc = sqlite3Fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);
sqlite3Fts3EvalTestDeferred(pCsr, &rc); sqlite3Fts3EvalTestDeferred(pCsr, &rc);
if( rc!=SQLITE_OK ) break; if( rc!=SQLITE_OK ) break;
} }
(void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo); (void)sqlite3Fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);
break; break;
} }
} }
@@ -1555,7 +1557,7 @@ struct TermOffsetCtx {
}; };
/* /*
** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets(). ** This function is an sqlite3Fts3ExprIterate() callback used by sqlite3Fts3Offsets().
*/ */
static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){
TermOffsetCtx *p = (TermOffsetCtx *)ctx; TermOffsetCtx *p = (TermOffsetCtx *)ctx;
@@ -1637,7 +1639,9 @@ void sqlite3Fts3Offsets(
*/ */
sCtx.iCol = iCol; sCtx.iCol = iCol;
sCtx.iTerm = 0; sCtx.iTerm = 0;
rc = fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx); rc = sqlite3Fts3ExprIterate(
pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx
);
if( rc!=SQLITE_OK ) goto offsets_out; if( rc!=SQLITE_OK ) goto offsets_out;
/* Retreive the text stored in column iCol. If an SQL NULL is stored /* Retreive the text stored in column iCol. If an SQL NULL is stored

View File

@@ -41,10 +41,10 @@ SQLITE_API int sqlite3_carray_bind(
#define CARRAY_INT64 1 /* Data is 64-bit signed integers */ #define CARRAY_INT64 1 /* Data is 64-bit signed integers */
#define CARRAY_DOUBLE 2 /* Data is doubles */ #define CARRAY_DOUBLE 2 /* Data is doubles */
#define CARRAY_TEXT 3 /* Data is char* */ #define CARRAY_TEXT 3 /* Data is char* */
#define CARRAY_BLOB 4 /* Data is struct iovec */
#ifdef __cplusplus #ifdef __cplusplus
} /* end of the 'extern "C"' block */ } /* end of the 'extern "C"' block */
#endif #endif
#endif /* ifndef _CARRAY_H */ #endif /* ifndef _CARRAY_H */

View File

@@ -9,6 +9,8 @@
# #
#*********************************************************************** #***********************************************************************
# #
# TESTRUNNER: slow
#
# This file contains tests of multiple RBU operations running # This file contains tests of multiple RBU operations running
# concurrently within the same process. # concurrently within the same process.
# #

View File

@@ -9,6 +9,8 @@
# #
#*********************************************************************** #***********************************************************************
# #
# TESTRUNNER: slow
#
# This file contains tests for resumption of RBU operations in the # This file contains tests for resumption of RBU operations in the
# case where the previous RBU process crashed. # case where the previous RBU process crashed.
# #

View File

@@ -9,6 +9,7 @@
# #
#*********************************************************************** #***********************************************************************
# #
# TESTRUNNER: slow
source [file join [file dirname [info script]] rbu_common.tcl] source [file join [file dirname [info script]] rbu_common.tcl]
set ::testprefix rbutemplimit set ::testprefix rbutemplimit

View File

@@ -98,7 +98,7 @@
** The order of the columns in the data_% table does not matter. ** The order of the columns in the data_% table does not matter.
** **
** Instead of a regular table, the RBU database may also contain virtual ** Instead of a regular table, the RBU database may also contain virtual
** tables or view named using the data_<target> naming scheme. ** tables or views named using the data_<target> naming scheme.
** **
** Instead of the plain data_<target> naming scheme, RBU database tables ** Instead of the plain data_<target> naming scheme, RBU database tables
** may also be named data<integer>_<target>, where <integer> is any sequence ** may also be named data<integer>_<target>, where <integer> is any sequence
@@ -111,7 +111,7 @@
** **
** If the target database table is a virtual table or a table that has no ** If the target database table is a virtual table or a table that has no
** PRIMARY KEY declaration, the data_% table must also contain a column ** PRIMARY KEY declaration, the data_% table must also contain a column
** named "rbu_rowid". This column is mapped to the tables implicit primary ** named "rbu_rowid". This column is mapped to the table's implicit primary
** key column - "rowid". Virtual tables for which the "rowid" column does ** key column - "rowid". Virtual tables for which the "rowid" column does
** not function like a primary key value cannot be updated using RBU. For ** not function like a primary key value cannot be updated using RBU. For
** example, if the target db contains either of the following: ** example, if the target db contains either of the following:

View File

@@ -12,12 +12,11 @@
This file is intended to be combined at build-time with other This file is intended to be combined at build-time with other
related code, most notably a header and footer which wraps this related code, most notably a header and footer which wraps this
whole file into an Emscripten Module.postRun() handler which has a whole file into an Emscripten Module.postRun() handler. The sqlite3
parameter named "Module" (the Emscripten Module object). The sqlite3 JS API has no hard requirements on Emscripten and does not expose
JS API has no hard requirements on Emscripten, and does not expose
any Emscripten APIs to clients. It is structured such that its build any Emscripten APIs to clients. It is structured such that its build
can be tweaked to include it in arbitrary WASM environments which can be tweaked to include it in arbitrary WASM environments which
supply the necessary underlying features (e.g. a POSIX file I/O can supply the necessary underlying features (e.g. a POSIX file I/O
layer). layer).
Main project home page: https://sqlite.org Main project home page: https://sqlite.org
@@ -42,8 +41,8 @@
Emscripten. (Note the default values for the config object!) The Emscripten. (Note the default values for the config object!) The
config object is only honored the first time this is config object is only honored the first time this is
called. Subsequent calls ignore the argument and return the same called. Subsequent calls ignore the argument and return the same
(configured) object which gets initialized by the first call. (configured) object which gets initialized by the first call. This
This function will throw if any of the required config options are function will throw if any of the required config options are
missing. missing.
The config object properties include: The config object properties include:
@@ -62,6 +61,8 @@
true if `self.BigInt64Array` is available, else false. Some APIs true if `self.BigInt64Array` is available, else false. Some APIs
will throw exceptions if called without BigInt support, as BigInt will throw exceptions if called without BigInt support, as BigInt
is required for marshalling C-side int64 into and out of JS. is required for marshalling C-side int64 into and out of JS.
(Sidebar: it is technically possible to add int64 support via
marshalling of int32 pairs, but doing so is unduly invasive.)
- `allocExportName`: the name of the function, in `exports`, of the - `allocExportName`: the name of the function, in `exports`, of the
`malloc(3)`-compatible routine for the WASM environment. Defaults `malloc(3)`-compatible routine for the WASM environment. Defaults
@@ -69,7 +70,9 @@
sqlite3_malloc() may require care in certain client-side code sqlite3_malloc() may require care in certain client-side code
regarding which allocator is uses. Notably, sqlite3_deserialize() regarding which allocator is uses. Notably, sqlite3_deserialize()
and sqlite3_serialize() can only safely use memory from different and sqlite3_serialize() can only safely use memory from different
allocators under very specific conditions. allocators under very specific conditions. The canonical builds
of this API guaranty that `sqlite3_malloc()` is the JS-side
allocator implementation.
- `deallocExportName`: the name of the function, in `exports`, of - `deallocExportName`: the name of the function, in `exports`, of
the `free(3)`-compatible routine for the WASM the `free(3)`-compatible routine for the WASM
@@ -84,9 +87,11 @@
in the WASMFS+OPFS combination. This option is currently ignored. in the WASMFS+OPFS combination. This option is currently ignored.
[^1] = This property may optionally be a function, in which case this [^1] = This property may optionally be a function, in which case this
function re-assigns it to the value returned from that function, function re-assigns calls that function to fetch the value,
enabling delayed evaluation. enabling delayed evaluation.
The returned object is the top-level sqlite3 namespace object.
*/ */
'use strict'; 'use strict';
self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
@@ -1008,7 +1013,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
space managed by Emscripten's stack-management, so does not space managed by Emscripten's stack-management, so does not
collide with Emscripten-provided stack allocation APIs. The collide with Emscripten-provided stack allocation APIs. The
memory lives in the WASM heap and can be used with routines such memory lives in the WASM heap and can be used with routines such
as wasm.poke() and any wasm.heap8u().slice(). as wasm.poke() and wasm.heap8u().slice().
*/ */
wasm.pstack = Object.assign(Object.create(null),{ wasm.pstack = Object.assign(Object.create(null),{
/** /**
@@ -1021,7 +1026,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
Attempts to allocate the given number of bytes from the Attempts to allocate the given number of bytes from the
pstack. On success, it zeroes out a block of memory of the pstack. On success, it zeroes out a block of memory of the
given size, adjusts the pstack pointer, and returns a pointer given size, adjusts the pstack pointer, and returns a pointer
to the memory. On error, returns throws a WasmAllocError. The to the memory. On error, throws a WasmAllocError. The
memory must eventually be released using restore(). memory must eventually be released using restore().
If n is a string, it must be a WASM "IR" value in the set If n is a string, it must be a WASM "IR" value in the set
@@ -1064,9 +1069,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
const mem = wasm.pstack.alloc(n * sz); const mem = wasm.pstack.alloc(n * sz);
const rc = []; const rc = [];
let i = 0, offset = 0; let i = 0, offset = 0;
for(; i < n; offset = (sz * ++i)){ for(; i < n; ++i, offset += sz) rc.push(mem + offset);
rc.push(mem + offset);
}
return rc; return rc;
}, },
/** /**

View File

@@ -1,4 +1,4 @@
/* /**
2022-07-22 2022-07-22
The author disclaims copyright to this source code. In place of a The author disclaims copyright to this source code. In place of a
@@ -10,12 +10,12 @@
*********************************************************************** ***********************************************************************
This file implements the initializer for the sqlite3 "Worker API This file implements the initializer for SQLite's "Worker API #1", a
#1", a very basic DB access API intended to be scripted from a main very basic DB access API intended to be scripted from a main window
window thread via Worker-style messages. Because of limitations in thread via Worker-style messages. Because of limitations in that
that type of communication, this API is minimalistic and only type of communication, this API is minimalistic and only capable of
capable of serving relatively basic DB requests (e.g. it cannot serving relatively basic DB requests (e.g. it cannot process nested
process nested query loops concurrently). query loops concurrently).
This file requires that the core C-style sqlite3 API and OO API #1 This file requires that the core C-style sqlite3 API and OO API #1
have been loaded. have been loaded.

View File

@@ -1,5 +1,5 @@
C Merge\strunk\sinto\swasi-patches\sbranch. C Merge\strunk\sinto\swasi-patches\sbranch.
D 2023-01-21T12:18:28.661 D 2023-01-27T05:37:24.147
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -58,16 +58,16 @@ F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d F ext/fts3/README.tokenizers b92bdeb8b46503f0dd301d364efc5ef59ef9fa8e2758b8e742f39fa93a2e422d
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 46c116ee0868fc09520d61a1b747c62343c71c399ba67a3d0395b0be29b1a19f F ext/fts3/fts3.c 66d2ced306ac88c39c00d81184f2c60f338696af6ae8cc26ed7c361b157b09f7
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h ae2a44b04cddb5fb35cac4ea5f7f819b2894fd258186465777a19f7acfdf84ed F ext/fts3/fts3Int.h e573c6d881f7238d77cc3fd2396cbb9b2fe13efef7d2ad295a155151c4e7efbd
F ext/fts3/fts3_aux.c f0dc9bd98582615b7750218899bd0c729879b6bbf94d1be57ca1833ff49afc6f F ext/fts3/fts3_aux.c f0dc9bd98582615b7750218899bd0c729879b6bbf94d1be57ca1833ff49afc6f
F ext/fts3/fts3_expr.c 903bfb9433109fffb10e910d7066c49cbf8eeae316adc93f0499c4da7dfc932a F ext/fts3/fts3_expr.c 903bfb9433109fffb10e910d7066c49cbf8eeae316adc93f0499c4da7dfc932a
F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7 F ext/fts3/fts3_hash.c 8b6e31bfb0844c27dc6092c2620bdb1fca17ed613072db057d96952c6bdb48b7
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116 F ext/fts3/fts3_icu.c 305ce7fb6036484085b5556a9c8e62acdc7763f0f4cdf5fd538212a9f3720116
F ext/fts3/fts3_porter.c e19807ce0ae31c1c6e9898e89ecc93183d7ec224ea101af039722a4f49e5f2b8 F ext/fts3/fts3_porter.c e19807ce0ae31c1c6e9898e89ecc93183d7ec224ea101af039722a4f49e5f2b8
F ext/fts3/fts3_snippet.c f9a8149173553113f3c495a503843e30028b5dc3723d0ca798c5ad6142e130e6 F ext/fts3/fts3_snippet.c 4d6523e3eddeb7b46e7a82b3476a0a86a0c04821e0e2b8dd40f45ee28057cb13
F ext/fts3/fts3_term.c f45a1e7c6ef464abb1231245d123dae12266b69e05cc56e14045b76591ae92d1 F ext/fts3/fts3_term.c f45a1e7c6ef464abb1231245d123dae12266b69e05cc56e14045b76591ae92d1
F ext/fts3/fts3_test.c d8d7b2734f894e8a489987447658e374cdd3a3bc8575c401decf1911cb7c6454 F ext/fts3/fts3_test.c d8d7b2734f894e8a489987447658e374cdd3a3bc8575c401decf1911cb7c6454
F ext/fts3/fts3_tokenize_vtab.c a95feda3590f3c3e17672fe35b67ea6112471aeea4c07ef7744a6606b66549aa F ext/fts3/fts3_tokenize_vtab.c a95feda3590f3c3e17672fe35b67ea6112471aeea4c07ef7744a6606b66549aa
@@ -269,7 +269,7 @@ F ext/misc/basexx.c 5e859e1820620aa8080fb9145eb47089de426ae808f6abb01a8e12921c3a
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9 F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
F ext/misc/carray.c 0ba03f1e6647785d4e05b51be567f5652f06941314ff9d3d3763900aa353b6b5 F ext/misc/carray.c 0ba03f1e6647785d4e05b51be567f5652f06941314ff9d3d3763900aa353b6b5
F ext/misc/carray.h d2b1b12486d531367c37832d3d0dad34eea4bdd83ed839d445521ef01f0bc4e3 F ext/misc/carray.h 503209952ccf2431c7fd899ebb92bf46bf7635b38aace42ec8aa1b8d7b6e98a5
F ext/misc/cksumvfs.c 9224e33cc0cb6aa61ff1d7d7b8fd6fe56beca9f9c47954fa4ae0a69bef608f69 F ext/misc/cksumvfs.c 9224e33cc0cb6aa61ff1d7d7b8fd6fe56beca9f9c47954fa4ae0a69bef608f69
F ext/misc/closure.c dbfd8543b2a017ae6b1a5843986b22ddf99ff126ec9634a2f4047cd14c85c243 F ext/misc/closure.c dbfd8543b2a017ae6b1a5843986b22ddf99ff126ec9634a2f4047cd14c85c243
F ext/misc/completion.c 6dafd7f4348eecc7be9e920d4b419d1fb2af75d938cd9c59a20cfe8beb2f22b9 F ext/misc/completion.c 6dafd7f4348eecc7be9e920d4b419d1fb2af75d938cd9c59a20cfe8beb2f22b9
@@ -348,21 +348,21 @@ F ext/rbu/rbufault3.test b2fcc9db5c982b869f67d1d4688d8cb515d5b92f58011fff95665f2
F ext/rbu/rbufault4.test 03d2849c3df7d7bd14a622e789ff049e5080edd34a79cd432e01204db2a5930a F ext/rbu/rbufault4.test 03d2849c3df7d7bd14a622e789ff049e5080edd34a79cd432e01204db2a5930a
F ext/rbu/rbufts.test 0ae8d1da191c75bd776b86e24456db0fb6e97b7c944259fae5407ea55d23c31d F ext/rbu/rbufts.test 0ae8d1da191c75bd776b86e24456db0fb6e97b7c944259fae5407ea55d23c31d
F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb
F ext/rbu/rbumulti.test 5fb139058f37ddc5a113c5b93238de915b769b7792de41b44c983bc7c18cf5b9 F ext/rbu/rbumulti.test bf28c1486b45215f5bf877cc560a4ddf50d22c4ed2ae267482bcf4af285bb115
F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c
F ext/rbu/rbupass.test 1a8f635a9f6026f905a952e70a081811d8042de28165099d874832c1bf49d4b9 F ext/rbu/rbupass.test 1a8f635a9f6026f905a952e70a081811d8042de28165099d874832c1bf49d4b9
F ext/rbu/rbuprogress.test 857cf1f8166c83ef977edb9ef4fc42d80f71fbd798652b46ae2f3a7031870f8d F ext/rbu/rbuprogress.test 857cf1f8166c83ef977edb9ef4fc42d80f71fbd798652b46ae2f3a7031870f8d
F ext/rbu/rburename.test a9b4aea612352b74c45de1757edd2ecb2079348b1d4cc734572dc29e55b1b376 F ext/rbu/rburename.test a9b4aea612352b74c45de1757edd2ecb2079348b1d4cc734572dc29e55b1b376
F ext/rbu/rburesume.test dbdc4ca504e9c76375a69e5f0d91205db967dcc509a5166ca80231f8fda49eb1 F ext/rbu/rburesume.test c46a77f031cbaec58abf0edbafbf75190cbafd3b941ed081cb6626ebb3e8230c
F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926 F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926
F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8 F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8
F ext/rbu/rbutemplimit.test 05ceefa90a2e26a99f40dd48282ed63a00df5e59c1f2bfd479c143e201a1b0ba F ext/rbu/rbutemplimit.test 8d18f1c7e8a04814d9dbe36f75f0d8921bcca00c18901d518bce5fc6bc98b877
F ext/rbu/rbuvacuum.test 55e101e90168c2b31df6c9638fe73dc7f7cc666b6142266d1563697d79f73534 F ext/rbu/rbuvacuum.test 55e101e90168c2b31df6c9638fe73dc7f7cc666b6142266d1563697d79f73534
F ext/rbu/rbuvacuum2.test 2643b58f4d8d3573db0f93faae18805a35ab162b4c55ff6b656062ff432ed55b F ext/rbu/rbuvacuum2.test 2643b58f4d8d3573db0f93faae18805a35ab162b4c55ff6b656062ff432ed55b
F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc
F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10 F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10
F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac9659c15ea F ext/rbu/sqlite3rbu.c 348bb6251e6ec459de102f8b2dd50789a98643ef7a28e56e4c787ac9659c15ea
F ext/rbu/sqlite3rbu.h 02d981e2d39c151391759e1a400e29c7388730812957ac3db8dad7f6c9f9cfc8 F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304
F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055 F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055
F ext/recover/dbdata.c dc25628e405c86936c597e28f3e6f56a257029c3034c5ef7f6b10f7c02f41018 F ext/recover/dbdata.c dc25628e405c86936c597e28f3e6f56a257029c3034c5ef7f6b10f7c02f41018
F ext/recover/recover1.test 2a2df2943d6696f9487e75868feae4b1511c4a511b102854ba0d2af0326d9dfb F ext/recover/recover1.test 2a2df2943d6696f9487e75868feae4b1511c4a511b102854ba0d2af0326d9dfb
@@ -480,12 +480,12 @@ F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a9578430388
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785 F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771 F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
F ext/wasm/api/sqlite3-api-prologue.js 0b9b463db92881990ab6995c863c5968969da3d2a5029112037cbf425c9cb6b1 F ext/wasm/api/sqlite3-api-prologue.js 69a74f2777aaafafc07ad2c922674fe3197ef63c921a3262b4772f937e7eb14a
F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e3cc6f22acf81794d32fc0b F ext/wasm/api/sqlite3-api-worker1.js c462199c40358f00f93e326206bddc756c52b93f2cb60ffb63f54fe4f9a9e977
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24 F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 66daf6fb6843bea615fe193109e1542efbeca24f560ee9da63375a910bb48115 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 50e4f6103dc65556e3e040f9e80eb8f14bfc6f979fa018952859f7755e201b27
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
@@ -573,7 +573,7 @@ F src/delete.c 86573edae75e3d3e9a8b590d87db8e47222103029df4f3e11fa56044459b514e
F src/expr.c 204af6a83c191f5ac19ec4af6ecc546f188cc2dd1c76fc5280982f710ec4b9c4 F src/expr.c 204af6a83c191f5ac19ec4af6ecc546f188cc2dd1c76fc5280982f710ec4b9c4
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 722f20779f5342a787922deded3628d8c74b5249cab04098cf17ee2f2aaff002 F src/fkey.c 722f20779f5342a787922deded3628d8c74b5249cab04098cf17ee2f2aaff002
F src/func.c 68f610a44962814a4ba593fc95137a6682cb7e65086f22167e167b75ee3432e7 F src/func.c 0bf5b82df41ffa1afe2bc67c3d0d361761c56c9e1785c999e24a15ba04c28d2b
F src/global.c e06ff8e0acd85aec13563c9ecb44fbbf38232ccf73594998fd880b92d619594b F src/global.c e06ff8e0acd85aec13563c9ecb44fbbf38232ccf73594998fd880b92d619594b
F src/hash.c c6af5f96a7a76d000f07c5402c48c318c2566beecdee9e78b9d9f60ce7119565 F src/hash.c c6af5f96a7a76d000f07c5402c48c318c2566beecdee9e78b9d9f60ce7119565
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
@@ -604,10 +604,10 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a
F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
F src/os_unix.c ca8e0cd2fb8ec774cfe6bb1f101e480f2a8f913716976d95c5556fee780c099e F src/os_unix.c 2ab48df80d598e11fe216dcae5cdf28d2b4c7ab195a685bd4047b9e534c3aaf6
F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345 F src/os_win.c 295fe45f18bd86f2477f4cd79f3377c6f883ceb941b1f46808665c73747f2345
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c d3122cf67f327f1e2df12d06236a3473a8099542071e257067552f42917f172d F src/pager.c fc6d3ec7017d7369ab5dc5421ad1763ff224551c9381866b6da69040db62e406
F src/pager.h f82e9844166e1585f5786837ddc7709966138ced17f568c16af7ccf946c2baa3 F src/pager.h f82e9844166e1585f5786837ddc7709966138ced17f568c16af7ccf946c2baa3
F src/parse.y 8e67d820030d2655b9942ffe61c1e7e6b96cea2f2f72183533299393907d0564 F src/parse.y 8e67d820030d2655b9942ffe61c1e7e6b96cea2f2f72183533299393907d0564
F src/pcache.c f4268f7f73c6a3db12ce22fd25bc68dc42315d19599414ab1207d7cf32f79197 F src/pcache.c f4268f7f73c6a3db12ce22fd25bc68dc42315d19599414ab1207d7cf32f79197
@@ -621,8 +621,8 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 5a98a7bf277aa60584b6bb4c5dd6a9ef2b19537910612c34f596e2901e88596d F src/resolve.c 5a98a7bf277aa60584b6bb4c5dd6a9ef2b19537910612c34f596e2901e88596d
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c d389ccdb96855dbfaadc22d936889e1f0652ffca17e31a6b6522b45d99daa8ce F src/select.c d389ccdb96855dbfaadc22d936889e1f0652ffca17e31a6b6522b45d99daa8ce
F src/shell.c.in 5795ec29ce0169ba5d084ef55cb6064c6fdf7cd3ad175873f3abfd71a307fb3d F src/shell.c.in afe1b3762f7f33752d9c51ebc92c9ba8de21c3470af9ae03e961b380d1521ecf
F src/sqlite.h.in 67749bfeae75c78184248fb867f600a8795ad3b4ecacbfd8c9d53eadef51f7b3 F src/sqlite.h.in 2b41f4908dd16cecb3754fe3fa2287a27ee825fb75d508ff2d7546b14e5a6ae6
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4 F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
F src/sqliteInt.h 43eeee1ea80543a0e40444bf53643ca259a2b1158ccfe859a6a6435b7358ecdd F src/sqliteInt.h 43eeee1ea80543a0e40444bf53643ca259a2b1158ccfe859a6a6435b7358ecdd
@@ -692,22 +692,22 @@ F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145
F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0
F src/util.c 3ff7bc2b48dd425b1448304bb86273b05da1621f136d51dbb9789f8803559a1f F src/util.c 3ff7bc2b48dd425b1448304bb86273b05da1621f136d51dbb9789f8803559a1f
F src/vacuum.c 84ce7f01f8a7a08748e107a441db83bcec13970190ddcb0c9ff522adbc1c23fd F src/vacuum.c 84ce7f01f8a7a08748e107a441db83bcec13970190ddcb0c9ff522adbc1c23fd
F src/vdbe.c da2963a170cea17d88e140c1ab00ce702d27b90e2e27831274a2ae9e9b704897 F src/vdbe.c 47d3b78e75e239e1909933f0d77612b4111ebe760f01fdd0085e4e30b59b4cc6
F src/vdbe.h 73b904a6b3bb27f308c6cc287a5751ebc7f1f89456be0ed068a12b92844c6e8c F src/vdbe.h 73b904a6b3bb27f308c6cc287a5751ebc7f1f89456be0ed068a12b92844c6e8c
F src/vdbeInt.h fc15815b7bdafbb27e7f027faba2b0112e87d382c0d72241672528806ebc0db5 F src/vdbeInt.h a4147a4ddf613cb1bcb555ace9e9e74a9c099d65facd88155f191b1fb4d74cfb
F src/vdbeapi.c 4ee67890913c1d2469c68e3ad2e7ddeab57ac5924a64bbfd0906a8ea0d542c7f F src/vdbeapi.c 40c47b1528d308a322203de21d2e0d711753257ed9771771b6129214b1d65932
F src/vdbeaux.c 3f9e3b6585e7434aa11300169dd66ddf0fc963a0c6f7940bdc058335dadeb353 F src/vdbeaux.c 3f9e3b6585e7434aa11300169dd66ddf0fc963a0c6f7940bdc058335dadeb353
F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd
F src/vdbemem.c 316d518115f3720b4097f0231e2a3d6eefd06c787eccf44972f8d8f462153421 F src/vdbemem.c 316d518115f3720b4097f0231e2a3d6eefd06c787eccf44972f8d8f462153421
F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35 F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac F src/vdbevtab.c aae4bd769410eb7e1d02c42613eec961d514459b1c3c1c63cfc84e92a137daac
F src/vtab.c b2f993aa954078985bc40317bb2140fe0880a08a7440f3a428b60fce74636808 F src/vtab.c a39f6ed161f16a84ff445af9dba4776b2cf0898be08a33bee8e1128a66c0074b
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
F src/where.c 14ee8da18f9b4518af06931a32386dd0c7ec2eacab520726d6425e252e54b280 F src/where.c e75ca01cc4025c0023a4e32c137ad933ecaf1d5fbaf9f88ffae7db216ac2f762
F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c F src/whereInt.h e25203e5bfee149f5f1225ae0166cfb4f1e65490c998a024249e98bb0647377c
F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2 F src/wherecode.c 76bca3379219880d2527493b71a3be49e696f75396d3481e4de5d4ceec7886b2
F src/whereexpr.c 7c5671a04b00c876bec5e99fd4e6f688065feb4773160fbf76fd7900d2901777 F src/whereexpr.c 7c5671a04b00c876bec5e99fd4e6f688065feb4773160fbf76fd7900d2901777
@@ -976,7 +976,7 @@ F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac
F test/expr.test 5c06696478212e5a04e04b043f993373f6f8e5ce5a80f5548a84703b123b6caa F test/expr.test 5c06696478212e5a04e04b043f993373f6f8e5ce5a80f5548a84703b123b6caa
F test/expr2.test c27327ae9c017a7ff6280123f67aff496f912da74d78c888926d68b46ec75fd8 F test/expr2.test c27327ae9c017a7ff6280123f67aff496f912da74d78c888926d68b46ec75fd8
F test/exprfault.test 497cc0b8fe6a677f49b55cb485e040f709ec2834b84f25912fe9c2dfeeda33db F test/exprfault.test da33606d799718e2f8e34efd0e5858884a1ad87f608774c552a7f5517cc27181
F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9 F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9
F test/external_reader.test c7d34694f1b25c32d866f56ac80c1e29edddc42b4ef90cad589263ffac2cde0c F test/external_reader.test c7d34694f1b25c32d866f56ac80c1e29edddc42b4ef90cad589263ffac2cde0c
F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79 F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79
@@ -1067,7 +1067,7 @@ F test/fts3corrupt6.test f417c910254f32c0bc9ead7affa991a1d5aec35b3b32a183ffb05ee
F test/fts3cov.test 7eacdbefd756cfa4dc2241974e3db2834e9b372ca215880e00032222f32194cf F test/fts3cov.test 7eacdbefd756cfa4dc2241974e3db2834e9b372ca215880e00032222f32194cf
F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f F test/fts3d.test 2bd8c97bcb9975f2334147173b4872505b6a41359a4f9068960a36afe07a679f
F test/fts3defer.test f4c20e4c7153d20a98ee49ee5f3faef624fefc9a067f8d8d629db380c4d9f1de F test/fts3defer.test f4c20e4c7153d20a98ee49ee5f3faef624fefc9a067f8d8d629db380c4d9f1de
F test/fts3defer2.test 3da52ca2114e300e9971eee2f0cc1a2e5f27e6a9ee67957d49e63e41fdfcc0e7 F test/fts3defer2.test 3bbe54a7fca7d548bb7ac4f59447ee591070bfbe0c9f3e279defa0b898e9afbb
F test/fts3defer3.test dd53fc13223c6d8264a98244e9b19abd35ed71cd F test/fts3defer3.test dd53fc13223c6d8264a98244e9b19abd35ed71cd
F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297 F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297
F test/fts3dropmod.test 7de242ea1c8a713a8b143ea54468f4b1c4953fa068349e23ac178e2c90c59889 F test/fts3dropmod.test 7de242ea1c8a713a8b143ea54468f4b1c4953fa068349e23ac178e2c90c59889
@@ -1372,7 +1372,7 @@ F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035c
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442 F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 3e0d6eea70e5087f3240b1a2fe621b0c73445f38a262029f0a1d2d89564026f7 F test/permutations.test 4705a032bbfef531bb3fd98b8c6ba4a739998949eae9ac0ea97c8696b331211d
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test a74a9c9642e5d7e32f5a2aa77a2ed64ec5b69fecff39d52c4daf5945a2a4de65 F test/pragma.test a74a9c9642e5d7e32f5a2aa77a2ed64ec5b69fecff39d52c4daf5945a2a4de65
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@@ -1563,7 +1563,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637 F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl e72c337f01e47c2833c83288b60e0a1730165cc7de7b59724e925c4ce026c0a1 F test/tester.tcl e72c337f01e47c2833c83288b60e0a1730165cc7de7b59724e925c4ce026c0a1
F test/testrunner.tcl 86b57135754ab2160aeb04b4829d321fb285a5cfa7a505fe61d69aed605854cc F test/testrunner.tcl 407fc02be0c859ef7a85b9431de9c5aa79363cab822ecbee3500a0daeb6b82cd
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899 F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502 F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
@@ -1758,6 +1758,7 @@ F test/tt3_vacuum.c 71b254cde1fc49d6c8c44efd54f4668f3e57d7b3a8f4601ade069f75a999
F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff
F test/types2.test 1aeb81976841a91eef292723649b5c4fe3bc3cac F test/types2.test 1aeb81976841a91eef292723649b5c4fe3bc3cac
F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a
F test/unhex.test 47b547f4b35e4f6525ecac7c7839bd3ae4eb4613d4e8932592eff55da83308f1
F test/unionall.test eb9afa030897af75fd2f0dd28354ef63c8a5897b6c76aa1f15acae61a12eabcf F test/unionall.test eb9afa030897af75fd2f0dd28354ef63c8a5897b6c76aa1f15acae61a12eabcf
F test/unionall2.test 71e8fa08d5699d50dc9f9dc0c9799c2e7a6bb7931a330d369307a4df7f157fa1 F test/unionall2.test 71e8fa08d5699d50dc9f9dc0c9799c2e7a6bb7931a330d369307a4df7f157fa1
F test/unionallfault.test 652bfbb630e6c43135965dc1e8f0a9a791da83aec885d626a632fe1909c56f73 F test/unionallfault.test 652bfbb630e6c43135965dc1e8f0a9a791da83aec885d626a632fe1909c56f73
@@ -2043,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P adc0ede0a43241b85563408d0de8e640a75ec4f7bdfe5e48acc5cdd6b182b88c 5a316f9fd94b73fc54ef94a1dab2f13bdd16c4fb13d2620b7c907d104d5b4d7a P 6fc20d75d49310aedbc3351a4a5f1aa9ef5b4100501c7bfbe556aca2be2e44d7 9a26fae545b9c97129893b83ff97e62b1c477eccd1379af1dce4a3cc4fa9f932
R de6b861425c8d5878acd44fd86977c48 R 145aa0c23a71f0a1d2cc97d60c0a4a1e
U stephan U stephan
Z f0c9570019c6692ba71970c30a38e676 Z ecd9a24931c0cd6ff26d46c7f1fc2570
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
6fc20d75d49310aedbc3351a4a5f1aa9ef5b4100501c7bfbe556aca2be2e44d7 2ce89f5efcdb8b4c58eb2d30833a76d79ae0134c31d5ab8564be9e1cf5a1f4f0

View File

@@ -1223,6 +1223,96 @@ static void hexFunc(
} }
} }
/*
** Buffer zStr contains nStr bytes of utf-8 encoded text. Return 1 if zStr
** contains character ch, or 0 if it does not.
*/
static int strContainsChar(const u8 *zStr, int nStr, u32 ch){
const u8 *zEnd = &zStr[nStr];
const u8 *z = zStr;
while( z<zEnd ){
u32 tst = Utf8Read(z);
if( tst==ch ) return 1;
}
return 0;
}
/*
** The unhex() function. This function may be invoked with either one or
** two arguments. In both cases the first argument is interpreted as text
** a text value containing a set of pairs of hexadecimal digits which are
** decoded and returned as a blob.
**
** If there is only a single argument, then it must consist only of an
** even number of hexadeximal digits. Otherwise, return NULL.
**
** Or, if there is a second argument, then any character that appears in
** the second argument is also allowed to appear between pairs of hexadecimal
** digits in the first argument. If any other character appears in the
** first argument, or if one of the allowed characters appears between
** two hexadecimal digits that make up a single byte, NULL is returned.
**
** The following expressions are all true:
**
** unhex('ABCD') IS x'ABCD'
** unhex('AB CD') IS NULL
** unhex('AB CD', ' ') IS x'ABCD'
** unhex('A BCD', ' ') IS NULL
*/
static void unhexFunc(
sqlite3_context *pCtx,
int argc,
sqlite3_value **argv
){
const u8 *zPass = (const u8*)"";
int nPass = 0;
const u8 *zHex = sqlite3_value_text(argv[0]);
int nHex = sqlite3_value_bytes(argv[0]);
#ifdef SQLITE_DEBUG
const u8 *zEnd = &zHex[nHex];
#endif
u8 *pBlob = 0;
u8 *p = 0;
assert( argc==1 || argc==2 );
if( argc==2 ){
zPass = sqlite3_value_text(argv[1]);
nPass = sqlite3_value_bytes(argv[1]);
}
if( !zHex || !zPass ) return;
p = pBlob = contextMalloc(pCtx, (nHex/2)+1);
if( pBlob ){
u8 c; /* Most significant digit of next byte */
u8 d; /* Least significant digit of next byte */
while( (c = *zHex)!=0x00 ){
while( !sqlite3Isxdigit(c) ){
u32 ch = Utf8Read(zHex);
assert( zHex<=zEnd );
if( !strContainsChar(zPass, nPass, ch) ) goto unhex_null;
c = *zHex;
if( c==0x00 ) goto unhex_done;
}
zHex++;
assert( *zEnd==0x00 );
assert( zHex<=zEnd );
d = *(zHex++);
if( !sqlite3Isxdigit(d) ) goto unhex_null;
*(p++) = (sqlite3HexToInt(c)<<4) | sqlite3HexToInt(d);
}
}
unhex_done:
sqlite3_result_blob(pCtx, pBlob, (p - pBlob), sqlite3_free);
return;
unhex_null:
sqlite3_free(pBlob);
return;
}
/* /*
** The zeroblob(N) function returns a zero-filled blob of size N bytes. ** The zeroblob(N) function returns a zero-filled blob of size N bytes.
*/ */
@@ -2287,6 +2377,8 @@ void sqlite3RegisterBuiltinFunctions(void){
FUNCTION(upper, 1, 0, 0, upperFunc ), FUNCTION(upper, 1, 0, 0, upperFunc ),
FUNCTION(lower, 1, 0, 0, lowerFunc ), FUNCTION(lower, 1, 0, 0, lowerFunc ),
FUNCTION(hex, 1, 0, 0, hexFunc ), FUNCTION(hex, 1, 0, 0, hexFunc ),
FUNCTION(unhex, 1, 0, 0, unhexFunc ),
FUNCTION(unhex, 2, 0, 0, unhexFunc ),
INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ), INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ),
VFUNCTION(random, 0, 0, 0, randomFunc ), VFUNCTION(random, 0, 0, 0, randomFunc ),
VFUNCTION(randomblob, 1, 0, 0, randomBlob ), VFUNCTION(randomblob, 1, 0, 0, randomBlob ),

View File

@@ -218,7 +218,7 @@
#endif /* SQLITE_WASI */ #endif /* SQLITE_WASI */
#ifdef SQLITE_WASI #ifdef SQLITE_WASI
# define osGetpid(X) 1 # define osGetpid(X) (pid_t)1
#else #else
/* Always cast the getpid() return type for compatibility with /* Always cast the getpid() return type for compatibility with
** kernel modules in VxWorks. */ ** kernel modules in VxWorks. */

View File

@@ -2935,7 +2935,7 @@ end_playback:
** see if it is possible to delete the super-journal. ** see if it is possible to delete the super-journal.
*/ */
assert( zSuper==&pPager->pTmpSpace[4] ); assert( zSuper==&pPager->pTmpSpace[4] );
memset(&zSuper[-4], 0, 4); memset(pPager->pTmpSpace, 0, 4);
rc = pager_delsuper(pPager, zSuper); rc = pager_delsuper(pPager, zSuper);
testcase( rc!=SQLITE_OK ); testcase( rc!=SQLITE_OK );
} }

View File

@@ -4789,6 +4789,7 @@ static const char *(azHelp[]) = {
".unmodule NAME ... Unregister virtual table modules", ".unmodule NAME ... Unregister virtual table modules",
" --allexcept Unregister everything except those named", " --allexcept Unregister everything except those named",
#endif #endif
".version Show source, library and compiler versions",
".vfsinfo ?AUX? Information about the top-level VFS", ".vfsinfo ?AUX? Information about the top-level VFS",
".vfslist List all available VFSes", ".vfslist List all available VFSes",
".vfsname ?AUX? Print the name of the VFS stack", ".vfsname ?AUX? Print the name of the VFS stack",

View File

@@ -9806,14 +9806,13 @@ int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
** is undefined and probably harmful. ** is undefined and probably harmful.
** **
** The X parameter in a call to sqlite3_vtab_in_first(X,P) or ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
** sqlite3_vtab_in_next(X,P) must be one of the parameters to the ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
** xFilter method which invokes these routines, and specifically ** xFilter method which invokes these routines, and specifically
** a parameter that was previously selected for all-at-once IN constraint ** a parameter that was previously selected for all-at-once IN constraint
** processing use the [sqlite3_vtab_in()] interface in the ** processing use the [sqlite3_vtab_in()] interface in the
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
** an xFilter argument that was selected for all-at-once IN constraint ** an xFilter argument that was selected for all-at-once IN constraint
** processing, then these routines return [SQLITE_MISUSE])^ or perhaps ** processing, then these routines return [SQLITE_ERROR].)^
** exhibit some other undefined or harmful behavior.
** **
** ^(Use these routines to access all values on the right-hand side ** ^(Use these routines to access all values on the right-hand side
** of the IN constraint using code like the following: ** of the IN constraint using code like the following:

View File

@@ -8031,7 +8031,7 @@ case OP_VInitIn: { /* out2, ncycle */
pRhs->pOut = &aMem[pOp->p3]; pRhs->pOut = &aMem[pOp->p3];
pOut = out2Prerelease(p, pOp); pOut = out2Prerelease(p, pOp);
pOut->flags = MEM_Null; pOut->flags = MEM_Null;
sqlite3VdbeMemSetPointer(pOut, pRhs, "ValueList", sqlite3_free); sqlite3VdbeMemSetPointer(pOut, pRhs, "ValueList", sqlite3VdbeValueListFree);
break; break;
} }
#endif /* SQLITE_OMIT_VIRTUALTABLE */ #endif /* SQLITE_OMIT_VIRTUALTABLE */

View File

@@ -657,6 +657,8 @@ int sqlite3VdbeSorterRewind(const VdbeCursor *, int *);
int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *); int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *);
int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);
void sqlite3VdbeValueListFree(void*);
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
void sqlite3VdbeIncrWriteCounter(Vdbe*, VdbeCursor*); void sqlite3VdbeIncrWriteCounter(Vdbe*, VdbeCursor*);
void sqlite3VdbeAssertAbortable(Vdbe*); void sqlite3VdbeAssertAbortable(Vdbe*);

View File

@@ -882,6 +882,17 @@ int sqlite3_vtab_nochange(sqlite3_context *p){
return sqlite3_value_nochange(p->pOut); return sqlite3_value_nochange(p->pOut);
} }
/*
** The destructor function for a ValueList object. This needs to be
** a separate function, unknowable to the application, to ensure that
** calls to sqlite3_vtab_in_first()/sqlite3_vtab_in_next() that are not
** preceeded by activation of IN processing via sqlite3_vtab_int() do not
** try to access a fake ValueList object inserted by a hostile extension.
*/
void sqlite3VdbeValueListFree(void *pToDelete){
sqlite3_free(pToDelete);
}
/* /*
** Implementation of sqlite3_vtab_in_first() (if bNext==0) and ** Implementation of sqlite3_vtab_in_first() (if bNext==0) and
** sqlite3_vtab_in_next() (if bNext!=0). ** sqlite3_vtab_in_next() (if bNext!=0).
@@ -896,8 +907,15 @@ static int valueFromValueList(
*ppOut = 0; *ppOut = 0;
if( pVal==0 ) return SQLITE_MISUSE; if( pVal==0 ) return SQLITE_MISUSE;
pRhs = (ValueList*)sqlite3_value_pointer(pVal, "ValueList"); if( (pVal->flags & MEM_Dyn)==0 || pVal->xDel!=sqlite3VdbeValueListFree ){
if( pRhs==0 ) return SQLITE_MISUSE; return SQLITE_ERROR;
}else{
assert( (pVal->flags&(MEM_TypeMask|MEM_Term|MEM_Subtype)) ==
(MEM_Null|MEM_Term|MEM_Subtype) );
assert( pVal->eSubtype=='p' );
assert( pVal->u.zPType!=0 && strcmp(pVal->u.zPType,"ValueList")==0 );
pRhs = (ValueList*)pVal->z;
}
if( bNext ){ if( bNext ){
rc = sqlite3BtreeNext(pRhs->pCsr, 0); rc = sqlite3BtreeNext(pRhs->pCsr, 0);
}else{ }else{

View File

@@ -211,10 +211,10 @@ void sqlite3VtabUnlock(VTable *pVTab){
pVTab->nRef--; pVTab->nRef--;
if( pVTab->nRef==0 ){ if( pVTab->nRef==0 ){
sqlite3_vtab *p = pVTab->pVtab; sqlite3_vtab *p = pVTab->pVtab;
sqlite3VtabModuleUnref(pVTab->db, pVTab->pMod);
if( p ){ if( p ){
p->pModule->xDisconnect(p); p->pModule->xDisconnect(p);
} }
sqlite3VtabModuleUnref(pVTab->db, pVTab->pMod);
sqlite3DbFree(db, pVTab); sqlite3DbFree(db, pVTab);
} }
} }

View File

@@ -4095,7 +4095,7 @@ int sqlite3_vtab_distinct(sqlite3_index_info *pIdxInfo){
&& !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_VIRTUALTABLE)
/* /*
** Cause the prepared statement that is associated with a call to ** Cause the prepared statement that is associated with a call to
** xBestIndex to potentiall use all schemas. If the statement being ** xBestIndex to potentially use all schemas. If the statement being
** prepared is read-only, then just start read transactions on all ** prepared is read-only, then just start read transactions on all
** schemas. But if this is a write operation, start writes on all ** schemas. But if this is a write operation, start writes on all
** schemas. ** schemas.
@@ -4110,7 +4110,7 @@ void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){
for(i=0; i<nDb; i++){ for(i=0; i<nDb; i++){
sqlite3CodeVerifySchema(pParse, i); sqlite3CodeVerifySchema(pParse, i);
} }
if( pParse->writeMask ){ if( DbMaskNonZero(pParse->writeMask) ){
for(i=0; i<nDb; i++){ for(i=0; i<nDb; i++){
sqlite3BeginWriteOperation(pParse, 0, i); sqlite3BeginWriteOperation(pParse, 0, i);
} }

View File

@@ -31,5 +31,15 @@ do_faultsim_test 1.1 -faults oom* -prep {
faultsim_test_result {0 {}} faultsim_test_result {0 {}}
} }
do_faultsim_test 2 -faults oom* -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT hex ( unhex('ABCDEF') );
}
} -test {
faultsim_test_result {0 ABCDEF}
}
finish_test finish_test

View File

@@ -161,5 +161,33 @@ foreach {tn sql} {
} {1 {1 1 1 4 4 11 912 6} 3 {1 1 1 4 4 11 912 6}} } {1 {1 1 1 4 4 11 912 6} 3 {1 1 1 4 4 11 912 6}}
} }
do_execsql_test 2.5 {
INSERT INTO t3(t3) VALUES('rebuild');
}
do_execsql_test 2.6 {
SELECT rowid, length(offsets(t3)) FROM t3 WHERE t3 MATCH '(a NEAR a)';
} {11 228929}
do_execsql_test 2.7 {
SELECT rowid, length(offsets(t3)) FROM t3 WHERE t3 MATCH '(a NEAR b NEAR a)';
} {1 23 3 23 11 205}
do_execsql_test 2.8 {
SELECT rowid, length(offsets(t3)) FROM t3 WHERE t3 MATCH '(a NEAR b)';
} {1 15 3 15 11 106}
do_execsql_test 2.9 {
SELECT rowid, length(matchinfo(t3)) FROM t3 WHERE t3 MATCH '(a NEAR a)';
} {11 32}
do_execsql_test 2.10 {
SELECT rowid, length(matchinfo(t3)) FROM t3 WHERE t3 MATCH '(a NEAR b NEAR a)'
} {1 44 3 44 11 44}
do_execsql_test 2.11 {
SELECT rowid, length(matchinfo(t3)) FROM t3 WHERE t3 MATCH '(a NEAR b)';
} {1 32 3 32 11 32}
do_execsql_test 2.12 {
SELECT rowid, length(matchinfo(t3)) FROM t3
WHERE t3 MATCH '(a NEAR b NEAR a NEAR b NEAR a)'
} {1 68 3 68 11 68}
finish_test finish_test

View File

@@ -92,6 +92,7 @@ foreach f [glob -nocomplain \
$testdir/../ext/expert/*.test \ $testdir/../ext/expert/*.test \
$testdir/../ext/lsm1/test/*.test \ $testdir/../ext/lsm1/test/*.test \
$testdir/../ext/recover/*.test \ $testdir/../ext/recover/*.test \
$testdir/../ext/rbu/*.test \
] { ] {
lappend alltests $f lappend alltests $f
} }
@@ -190,7 +191,7 @@ test_suite "veryquick" -prefix "" -description {
that test malloc and IO errors are omitted. that test malloc and IO errors are omitted.
} -files [ } -files [
test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \ test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
*fts5corrupt* *fts5big* *fts5aj* *fts5corrupt* *fts5big* *fts5aj* *rbucrash*
] ]
test_suite "shell" -prefix "" -description { test_suite "shell" -prefix "" -description {
@@ -1059,7 +1060,7 @@ test_suite "session_strm" -description {
test_suite "rbu" -description { test_suite "rbu" -description {
RBU tests. RBU tests.
} -files [ } -files [
test_set [glob -nocomplain $::testdir/../ext/rbu/*.test] -exclude rbu.test test_set [glob -nocomplain $::testdir/../ext/rbu/*.test]
] ]
test_suite "no_optimization" -description { test_suite "no_optimization" -description {

View File

@@ -117,7 +117,7 @@ proc default_njob {} {
set R(dbname) [file normalize testrunner.db] set R(dbname) [file normalize testrunner.db]
set R(logname) [file normalize testrunner.log] set R(logname) [file normalize testrunner.log]
set R(info_script) [file normalize [info script]] set R(info_script) [file normalize [info script]]
set R(timeout) 10000 ;# Default busy-timeout for testrunner. set R(timeout) 10000 ;# Default busy-timeout for testrunner.db
set R(nJob) [default_njob] ;# Default number of helper processes set R(nJob) [default_njob] ;# Default number of helper processes
set R(leaker) "" ;# Name of first script to leak memory set R(leaker) "" ;# Name of first script to leak memory

102
test/unhex.test Normal file
View File

@@ -0,0 +1,102 @@
# 2023 January 23
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
set testdir [file dirname $argv0]
source [file join $testdir tester.tcl]
set testprefix unhex
foreach {tn hex} {
1 0000
2 FFFF
3 0123456789ABCDEF
} {
do_execsql_test 1.$tn.1 {
SELECT hex( unhex( $hex ) );
} $hex
do_execsql_test 1.$tn.2 {
SELECT hex( unhex( lower( $hex ) ) );
} $hex
}
do_execsql_test 2.0 {
SELECT typeof( unhex('') ), length( unhex('') );
} {blob 0}
foreach {tn hex} {
1 ABC
2 hello
3 123456x7
4 0xff
} {
do_execsql_test 2.$tn {
SELECT unhex( $hex ) IS NULL;
} 1
}
do_catchsql_test 3.0 {
SELECT unhex();
} {1 {wrong number of arguments to function unhex()}}
do_catchsql_test 3.1 {
SELECT unhex('ABCD', '1234', '');
} {1 {wrong number of arguments to function unhex()}}
#--------------------------------------------------------------------------
# Test the 2-argument version.
#
foreach {tn hex} {
1 "FFFF ABCD"
2 "FFFF ABCD"
3 "FFFFABCD "
4 " FFFFABCD"
5 "--FFFF AB- -CD- "
6 "--"
7 " --"
} {
set out ""
foreach x [split $hex ""] {
if {[string is xdigit $x]} { append out $x }
}
do_execsql_test 5.$tn.1 {
SELECT hex( unhex($hex, ' -') );
} [list $out]
}
do_execsql_test 6.0 {
SELECT typeof( unhex(' ', ' -') ), length( unhex('-', ' -') );
} {blob 0}
do_execsql_test 6.1 "
SELECT hex( unhex('\u0E01ABCD\u0E02', '\uE01\uE02') )
" {ABCD}
do_execsql_test 6.2 "
SELECT typeof( unhex('\u0E01ABCD\u0E02', '\uE03\uE02') )
" {null}
do_execsql_test 6.3 "
SELECT hex( unhex('\u0E01AB CD\uE02\uE01', '\uE01 \uE02') )
" {ABCD}
#--------------------------------------------------------------------------
# Test that if either argument is NULL, the returned value is also NULL.
#
do_execsql_test 6.4.1 { SELECT typeof(unhex(NULL)) } {null}
do_execsql_test 6.4.2 { SELECT typeof(unhex(NULL, ' ')) } {null}
do_execsql_test 6.4.3 { SELECT typeof(unhex('1234', NULL)) } {null}
finish_test