mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:09:27 +08:00
Merge pull request #1235 from gwenn/3.39.4
Upgrade SQLite bundled version to 3.39.4
This commit is contained in:
commit
421bd34a5e
@ -1,9 +1,9 @@
|
|||||||
/* automatically generated by rust-bindgen 0.60.1 */
|
/* automatically generated by rust-bindgen 0.60.1 */
|
||||||
|
|
||||||
pub const SQLITE_VERSION: &[u8; 7usize] = b"3.39.3\0";
|
pub const SQLITE_VERSION: &[u8; 7usize] = b"3.39.4\0";
|
||||||
pub const SQLITE_VERSION_NUMBER: i32 = 3039003;
|
pub const SQLITE_VERSION_NUMBER: i32 = 3039004;
|
||||||
pub const SQLITE_SOURCE_ID: &[u8; 85usize] =
|
pub const SQLITE_SOURCE_ID: &[u8; 85usize] =
|
||||||
b"2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8\0";
|
b"2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309\0";
|
||||||
pub const SQLITE_OK: i32 = 0;
|
pub const SQLITE_OK: i32 = 0;
|
||||||
pub const SQLITE_ERROR: i32 = 1;
|
pub const SQLITE_ERROR: i32 = 1;
|
||||||
pub const SQLITE_INTERNAL: i32 = 2;
|
pub const SQLITE_INTERNAL: i32 = 2;
|
||||||
|
191
libsqlite3-sys/sqlite3/sqlite3.c
vendored
191
libsqlite3-sys/sqlite3/sqlite3.c
vendored
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** This file is an amalgamation of many separate C source files from SQLite
|
** This file is an amalgamation of many separate C source files from SQLite
|
||||||
** version 3.39.3. By combining all the individual C code files into this
|
** version 3.39.4. By combining all the individual C code files into this
|
||||||
** single large file, the entire code can be compiled as a single translation
|
** 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
|
** unit. This allows many compilers to do optimizations that would not be
|
||||||
** possible if the files were compiled separately. Performance improvements
|
** possible if the files were compiled separately. Performance improvements
|
||||||
@ -452,9 +452,9 @@ extern "C" {
|
|||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.39.3"
|
#define SQLITE_VERSION "3.39.4"
|
||||||
#define SQLITE_VERSION_NUMBER 3039003
|
#define SQLITE_VERSION_NUMBER 3039004
|
||||||
#define SQLITE_SOURCE_ID "2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8"
|
#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
@ -45497,8 +45497,9 @@ SQLITE_API int sqlite3_win32_set_directory8(
|
|||||||
const char *zValue /* New value for directory being set or reset */
|
const char *zValue /* New value for directory being set or reset */
|
||||||
){
|
){
|
||||||
char **ppDirectory = 0;
|
char **ppDirectory = 0;
|
||||||
|
int rc;
|
||||||
#ifndef SQLITE_OMIT_AUTOINIT
|
#ifndef SQLITE_OMIT_AUTOINIT
|
||||||
int rc = sqlite3_initialize();
|
rc = sqlite3_initialize();
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
#endif
|
#endif
|
||||||
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||||
@ -51691,14 +51692,24 @@ SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){
|
|||||||
*/
|
*/
|
||||||
SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
|
SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
|
||||||
PCache *pCache = p->pCache;
|
PCache *pCache = p->pCache;
|
||||||
|
sqlite3_pcache_page *pOther;
|
||||||
assert( p->nRef>0 );
|
assert( p->nRef>0 );
|
||||||
assert( newPgno>0 );
|
assert( newPgno>0 );
|
||||||
assert( sqlite3PcachePageSanity(p) );
|
assert( sqlite3PcachePageSanity(p) );
|
||||||
pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
|
pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
|
||||||
|
pOther = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, newPgno, 0);
|
||||||
|
if( pOther ){
|
||||||
|
PgHdr *pXPage = (PgHdr*)pOther->pExtra;
|
||||||
|
assert( pXPage->nRef==0 );
|
||||||
|
pXPage->nRef++;
|
||||||
|
pCache->nRefSum++;
|
||||||
|
sqlite3PcacheDrop(pXPage);
|
||||||
|
}
|
||||||
sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
|
sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
|
||||||
p->pgno = newPgno;
|
p->pgno = newPgno;
|
||||||
if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
|
if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
|
||||||
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
|
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
|
||||||
|
assert( sqlite3PcachePageSanity(p) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53080,23 +53091,26 @@ static void pcache1Rekey(
|
|||||||
PCache1 *pCache = (PCache1 *)p;
|
PCache1 *pCache = (PCache1 *)p;
|
||||||
PgHdr1 *pPage = (PgHdr1 *)pPg;
|
PgHdr1 *pPage = (PgHdr1 *)pPg;
|
||||||
PgHdr1 **pp;
|
PgHdr1 **pp;
|
||||||
unsigned int h;
|
unsigned int hOld, hNew;
|
||||||
assert( pPage->iKey==iOld );
|
assert( pPage->iKey==iOld );
|
||||||
assert( pPage->pCache==pCache );
|
assert( pPage->pCache==pCache );
|
||||||
|
assert( iOld!=iNew ); /* The page number really is changing */
|
||||||
|
|
||||||
pcache1EnterMutex(pCache->pGroup);
|
pcache1EnterMutex(pCache->pGroup);
|
||||||
|
|
||||||
h = iOld%pCache->nHash;
|
assert( pcache1FetchNoMutex(p, iOld, 0)==pPage ); /* pPg really is iOld */
|
||||||
pp = &pCache->apHash[h];
|
hOld = iOld%pCache->nHash;
|
||||||
|
pp = &pCache->apHash[hOld];
|
||||||
while( (*pp)!=pPage ){
|
while( (*pp)!=pPage ){
|
||||||
pp = &(*pp)->pNext;
|
pp = &(*pp)->pNext;
|
||||||
}
|
}
|
||||||
*pp = pPage->pNext;
|
*pp = pPage->pNext;
|
||||||
|
|
||||||
h = iNew%pCache->nHash;
|
assert( pcache1FetchNoMutex(p, iNew, 0)==0 ); /* iNew not in cache */
|
||||||
|
hNew = iNew%pCache->nHash;
|
||||||
pPage->iKey = iNew;
|
pPage->iKey = iNew;
|
||||||
pPage->pNext = pCache->apHash[h];
|
pPage->pNext = pCache->apHash[hNew];
|
||||||
pCache->apHash[h] = pPage;
|
pCache->apHash[hNew] = pPage;
|
||||||
if( iNew>pCache->iMaxKey ){
|
if( iNew>pCache->iMaxKey ){
|
||||||
pCache->iMaxKey = iNew;
|
pCache->iMaxKey = iNew;
|
||||||
}
|
}
|
||||||
@ -68400,7 +68414,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
|
|||||||
if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage);
|
if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage);
|
||||||
memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
|
memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
|
||||||
sz += sz2;
|
sz += sz2;
|
||||||
}else if( NEVER(iFree+sz>usableSize) ){
|
}else if( iFree+sz>usableSize ){
|
||||||
return SQLITE_CORRUPT_PAGE(pPage);
|
return SQLITE_CORRUPT_PAGE(pPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74756,8 +74770,6 @@ static int balance_nonroot(
|
|||||||
Pgno pgno; /* Temp var to store a page number in */
|
Pgno pgno; /* Temp var to store a page number in */
|
||||||
u8 abDone[NB+2]; /* True after i'th new page is populated */
|
u8 abDone[NB+2]; /* True after i'th new page is populated */
|
||||||
Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
|
Pgno aPgno[NB+2]; /* Page numbers of new pages before shuffling */
|
||||||
Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
|
|
||||||
u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
|
|
||||||
CellArray b; /* Parsed information on cells being balanced */
|
CellArray b; /* Parsed information on cells being balanced */
|
||||||
|
|
||||||
memset(abDone, 0, sizeof(abDone));
|
memset(abDone, 0, sizeof(abDone));
|
||||||
@ -75181,42 +75193,39 @@ static int balance_nonroot(
|
|||||||
** of the table is closer to a linear scan through the file. That in turn
|
** of the table is closer to a linear scan through the file. That in turn
|
||||||
** helps the operating system to deliver pages from the disk more rapidly.
|
** helps the operating system to deliver pages from the disk more rapidly.
|
||||||
**
|
**
|
||||||
** An O(n^2) insertion sort algorithm is used, but since n is never more
|
** An O(N*N) sort algorithm is used, but since N is never more than NB+2
|
||||||
** than (NB+2) (a small constant), that should not be a problem.
|
** (5), that is not a performance concern.
|
||||||
**
|
**
|
||||||
** When NB==3, this one optimization makes the database about 25% faster
|
** When NB==3, this one optimization makes the database about 25% faster
|
||||||
** for large insertions and deletions.
|
** for large insertions and deletions.
|
||||||
*/
|
*/
|
||||||
for(i=0; i<nNew; i++){
|
for(i=0; i<nNew; i++){
|
||||||
aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
|
aPgno[i] = apNew[i]->pgno;
|
||||||
aPgFlags[i] = apNew[i]->pDbPage->flags;
|
assert( apNew[i]->pDbPage->flags & PGHDR_WRITEABLE );
|
||||||
for(j=0; j<i; j++){
|
assert( apNew[i]->pDbPage->flags & PGHDR_DIRTY );
|
||||||
if( NEVER(aPgno[j]==aPgno[i]) ){
|
|
||||||
/* This branch is taken if the set of sibling pages somehow contains
|
|
||||||
** duplicate entries. This can happen if the database is corrupt.
|
|
||||||
** It would be simpler to detect this as part of the loop below, but
|
|
||||||
** we do the detection here in order to avoid populating the pager
|
|
||||||
** cache with two separate objects associated with the same
|
|
||||||
** page number. */
|
|
||||||
assert( CORRUPT_DB );
|
|
||||||
rc = SQLITE_CORRUPT_BKPT;
|
|
||||||
goto balance_cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for(i=0; i<nNew; i++){
|
for(i=0; i<nNew-1; i++){
|
||||||
int iBest = 0; /* aPgno[] index of page number to use */
|
int iB = i;
|
||||||
for(j=1; j<nNew; j++){
|
for(j=i+1; j<nNew; j++){
|
||||||
if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
|
if( apNew[j]->pgno < apNew[iB]->pgno ) iB = j;
|
||||||
}
|
}
|
||||||
pgno = aPgOrder[iBest];
|
|
||||||
aPgOrder[iBest] = 0xffffffff;
|
/* If apNew[i] has a page number that is bigger than any of the
|
||||||
if( iBest!=i ){
|
** subsequence apNew[i] entries, then swap apNew[i] with the subsequent
|
||||||
if( iBest>i ){
|
** entry that has the smallest page number (which we know to be
|
||||||
sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
|
** entry apNew[iB]).
|
||||||
}
|
*/
|
||||||
sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
|
if( iB!=i ){
|
||||||
apNew[i]->pgno = pgno;
|
Pgno pgnoA = apNew[i]->pgno;
|
||||||
|
Pgno pgnoB = apNew[iB]->pgno;
|
||||||
|
Pgno pgnoTemp = (PENDING_BYTE/pBt->pageSize)+1;
|
||||||
|
u16 fgA = apNew[i]->pDbPage->flags;
|
||||||
|
u16 fgB = apNew[iB]->pDbPage->flags;
|
||||||
|
sqlite3PagerRekey(apNew[i]->pDbPage, pgnoTemp, fgB);
|
||||||
|
sqlite3PagerRekey(apNew[iB]->pDbPage, pgnoA, fgA);
|
||||||
|
sqlite3PagerRekey(apNew[i]->pDbPage, pgnoB, fgB);
|
||||||
|
apNew[i]->pgno = pgnoB;
|
||||||
|
apNew[iB]->pgno = pgnoA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144039,6 +144048,23 @@ SQLITE_PRIVATE void sqlite3FinishTrigger(
|
|||||||
Vdbe *v;
|
Vdbe *v;
|
||||||
char *z;
|
char *z;
|
||||||
|
|
||||||
|
/* If this is a new CREATE TABLE statement, and if shadow tables
|
||||||
|
** are read-only, and the trigger makes a change to a shadow table,
|
||||||
|
** then raise an error - do not allow the trigger to be created. */
|
||||||
|
if( sqlite3ReadOnlyShadowTables(db) ){
|
||||||
|
TriggerStep *pStep;
|
||||||
|
for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
|
||||||
|
if( pStep->zTarget!=0
|
||||||
|
&& sqlite3ShadowTableName(db, pStep->zTarget)
|
||||||
|
){
|
||||||
|
sqlite3ErrorMsg(pParse,
|
||||||
|
"trigger \"%s\" may not write to shadow table \"%s\"",
|
||||||
|
pTrig->zName, pStep->zTarget);
|
||||||
|
goto triggerfinish_cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Make an entry in the sqlite_schema table */
|
/* Make an entry in the sqlite_schema table */
|
||||||
v = sqlite3GetVdbe(pParse);
|
v = sqlite3GetVdbe(pParse);
|
||||||
if( v==0 ) goto triggerfinish_cleanup;
|
if( v==0 ) goto triggerfinish_cleanup;
|
||||||
@ -177004,7 +177030,7 @@ struct Fts3MultiSegReader {
|
|||||||
int nAdvance; /* How many seg-readers to advance */
|
int nAdvance; /* How many seg-readers to advance */
|
||||||
Fts3SegFilter *pFilter; /* Pointer to filter object */
|
Fts3SegFilter *pFilter; /* Pointer to filter object */
|
||||||
char *aBuffer; /* Buffer to merge doclists in */
|
char *aBuffer; /* Buffer to merge doclists in */
|
||||||
int nBuffer; /* Allocated size of aBuffer[] in bytes */
|
i64 nBuffer; /* Allocated size of aBuffer[] in bytes */
|
||||||
|
|
||||||
int iColFilter; /* If >=0, filter for this column */
|
int iColFilter; /* If >=0, filter for this column */
|
||||||
int bRestart;
|
int bRestart;
|
||||||
@ -179700,7 +179726,7 @@ static int fts3TermSelectMerge(
|
|||||||
**
|
**
|
||||||
** Similar padding is added in the fts3DoclistOrMerge() function.
|
** Similar padding is added in the fts3DoclistOrMerge() function.
|
||||||
*/
|
*/
|
||||||
pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1);
|
pTS->aaOutput[0] = sqlite3_malloc64((i64)nDoclist + FTS3_VARINT_MAX + 1);
|
||||||
pTS->anOutput[0] = nDoclist;
|
pTS->anOutput[0] = nDoclist;
|
||||||
if( pTS->aaOutput[0] ){
|
if( pTS->aaOutput[0] ){
|
||||||
memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
|
memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
|
||||||
@ -181557,7 +181583,7 @@ static int fts3EvalIncrPhraseNext(
|
|||||||
if( bEof==0 ){
|
if( bEof==0 ){
|
||||||
int nList = 0;
|
int nList = 0;
|
||||||
int nByte = a[p->nToken-1].nList;
|
int nByte = a[p->nToken-1].nList;
|
||||||
char *aDoclist = sqlite3_malloc(nByte+FTS3_BUFFER_PADDING);
|
char *aDoclist = sqlite3_malloc64((i64)nByte+FTS3_BUFFER_PADDING);
|
||||||
if( !aDoclist ) return SQLITE_NOMEM;
|
if( !aDoclist ) return SQLITE_NOMEM;
|
||||||
memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);
|
memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);
|
||||||
memset(&aDoclist[nByte], 0, FTS3_BUFFER_PADDING);
|
memset(&aDoclist[nByte], 0, FTS3_BUFFER_PADDING);
|
||||||
@ -185793,7 +185819,7 @@ static int porterNext(
|
|||||||
if( n>c->nAllocated ){
|
if( n>c->nAllocated ){
|
||||||
char *pNew;
|
char *pNew;
|
||||||
c->nAllocated = n+20;
|
c->nAllocated = n+20;
|
||||||
pNew = sqlite3_realloc(c->zToken, c->nAllocated);
|
pNew = sqlite3_realloc64(c->zToken, c->nAllocated);
|
||||||
if( !pNew ) return SQLITE_NOMEM;
|
if( !pNew ) return SQLITE_NOMEM;
|
||||||
c->zToken = pNew;
|
c->zToken = pNew;
|
||||||
}
|
}
|
||||||
@ -186545,7 +186571,7 @@ static int simpleNext(
|
|||||||
if( n>c->nTokenAllocated ){
|
if( n>c->nTokenAllocated ){
|
||||||
char *pNew;
|
char *pNew;
|
||||||
c->nTokenAllocated = n+20;
|
c->nTokenAllocated = n+20;
|
||||||
pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
|
pNew = sqlite3_realloc64(c->pToken, c->nTokenAllocated);
|
||||||
if( !pNew ) return SQLITE_NOMEM;
|
if( !pNew ) return SQLITE_NOMEM;
|
||||||
c->pToken = pNew;
|
c->pToken = pNew;
|
||||||
}
|
}
|
||||||
@ -187707,7 +187733,7 @@ static int fts3PendingListAppendVarint(
|
|||||||
|
|
||||||
/* Allocate or grow the PendingList as required. */
|
/* Allocate or grow the PendingList as required. */
|
||||||
if( !p ){
|
if( !p ){
|
||||||
p = sqlite3_malloc(sizeof(*p) + 100);
|
p = sqlite3_malloc64(sizeof(*p) + 100);
|
||||||
if( !p ){
|
if( !p ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -187716,14 +187742,14 @@ static int fts3PendingListAppendVarint(
|
|||||||
p->nData = 0;
|
p->nData = 0;
|
||||||
}
|
}
|
||||||
else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
|
else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
|
||||||
int nNew = p->nSpace * 2;
|
i64 nNew = p->nSpace * 2;
|
||||||
p = sqlite3_realloc(p, sizeof(*p) + nNew);
|
p = sqlite3_realloc64(p, sizeof(*p) + nNew);
|
||||||
if( !p ){
|
if( !p ){
|
||||||
sqlite3_free(*pp);
|
sqlite3_free(*pp);
|
||||||
*pp = 0;
|
*pp = 0;
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
p->nSpace = nNew;
|
p->nSpace = (int)nNew;
|
||||||
p->aData = (char *)&p[1];
|
p->aData = (char *)&p[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188280,7 +188306,7 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock(
|
|||||||
int nByte = sqlite3_blob_bytes(p->pSegments);
|
int nByte = sqlite3_blob_bytes(p->pSegments);
|
||||||
*pnBlob = nByte;
|
*pnBlob = nByte;
|
||||||
if( paBlob ){
|
if( paBlob ){
|
||||||
char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);
|
char *aByte = sqlite3_malloc64((i64)nByte + FTS3_NODE_PADDING);
|
||||||
if( !aByte ){
|
if( !aByte ){
|
||||||
rc = SQLITE_NOMEM;
|
rc = SQLITE_NOMEM;
|
||||||
}else{
|
}else{
|
||||||
@ -188397,7 +188423,7 @@ static int fts3SegReaderNext(
|
|||||||
int nTerm = fts3HashKeysize(pElem);
|
int nTerm = fts3HashKeysize(pElem);
|
||||||
if( (nTerm+1)>pReader->nTermAlloc ){
|
if( (nTerm+1)>pReader->nTermAlloc ){
|
||||||
sqlite3_free(pReader->zTerm);
|
sqlite3_free(pReader->zTerm);
|
||||||
pReader->zTerm = (char*)sqlite3_malloc((nTerm+1)*2);
|
pReader->zTerm = (char*)sqlite3_malloc64(((i64)nTerm+1)*2);
|
||||||
if( !pReader->zTerm ) return SQLITE_NOMEM;
|
if( !pReader->zTerm ) return SQLITE_NOMEM;
|
||||||
pReader->nTermAlloc = (nTerm+1)*2;
|
pReader->nTermAlloc = (nTerm+1)*2;
|
||||||
}
|
}
|
||||||
@ -188405,7 +188431,7 @@ static int fts3SegReaderNext(
|
|||||||
pReader->zTerm[nTerm] = '\0';
|
pReader->zTerm[nTerm] = '\0';
|
||||||
pReader->nTerm = nTerm;
|
pReader->nTerm = nTerm;
|
||||||
|
|
||||||
aCopy = (char*)sqlite3_malloc(nCopy);
|
aCopy = (char*)sqlite3_malloc64(nCopy);
|
||||||
if( !aCopy ) return SQLITE_NOMEM;
|
if( !aCopy ) return SQLITE_NOMEM;
|
||||||
memcpy(aCopy, pList->aData, nCopy);
|
memcpy(aCopy, pList->aData, nCopy);
|
||||||
pReader->nNode = pReader->nDoclist = nCopy;
|
pReader->nNode = pReader->nDoclist = nCopy;
|
||||||
@ -188692,7 +188718,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
|
|||||||
nExtra = nRoot + FTS3_NODE_PADDING;
|
nExtra = nRoot + FTS3_NODE_PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
|
pReader = (Fts3SegReader *)sqlite3_malloc64(sizeof(Fts3SegReader) + nExtra);
|
||||||
if( !pReader ){
|
if( !pReader ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -188784,7 +188810,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
|
|||||||
if( nElem==nAlloc ){
|
if( nElem==nAlloc ){
|
||||||
Fts3HashElem **aElem2;
|
Fts3HashElem **aElem2;
|
||||||
nAlloc += 16;
|
nAlloc += 16;
|
||||||
aElem2 = (Fts3HashElem **)sqlite3_realloc(
|
aElem2 = (Fts3HashElem **)sqlite3_realloc64(
|
||||||
aElem, nAlloc*sizeof(Fts3HashElem *)
|
aElem, nAlloc*sizeof(Fts3HashElem *)
|
||||||
);
|
);
|
||||||
if( !aElem2 ){
|
if( !aElem2 ){
|
||||||
@ -189118,7 +189144,7 @@ static int fts3NodeAddTerm(
|
|||||||
** this is not expected to be a serious problem.
|
** this is not expected to be a serious problem.
|
||||||
*/
|
*/
|
||||||
assert( pTree->aData==(char *)&pTree[1] );
|
assert( pTree->aData==(char *)&pTree[1] );
|
||||||
pTree->aData = (char *)sqlite3_malloc(nReq);
|
pTree->aData = (char *)sqlite3_malloc64(nReq);
|
||||||
if( !pTree->aData ){
|
if( !pTree->aData ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -189136,7 +189162,7 @@ static int fts3NodeAddTerm(
|
|||||||
|
|
||||||
if( isCopyTerm ){
|
if( isCopyTerm ){
|
||||||
if( pTree->nMalloc<nTerm ){
|
if( pTree->nMalloc<nTerm ){
|
||||||
char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);
|
char *zNew = sqlite3_realloc64(pTree->zMalloc, (i64)nTerm*2);
|
||||||
if( !zNew ){
|
if( !zNew ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -189162,7 +189188,7 @@ static int fts3NodeAddTerm(
|
|||||||
** now. Instead, the term is inserted into the parent of pTree. If pTree
|
** now. Instead, the term is inserted into the parent of pTree. If pTree
|
||||||
** has no parent, one is created here.
|
** has no parent, one is created here.
|
||||||
*/
|
*/
|
||||||
pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);
|
pNew = (SegmentNode *)sqlite3_malloc64(sizeof(SegmentNode) + p->nNodeSize);
|
||||||
if( !pNew ){
|
if( !pNew ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -189300,7 +189326,7 @@ static int fts3SegWriterAdd(
|
|||||||
){
|
){
|
||||||
int nPrefix; /* Size of term prefix in bytes */
|
int nPrefix; /* Size of term prefix in bytes */
|
||||||
int nSuffix; /* Size of term suffix in bytes */
|
int nSuffix; /* Size of term suffix in bytes */
|
||||||
int nReq; /* Number of bytes required on leaf page */
|
i64 nReq; /* Number of bytes required on leaf page */
|
||||||
int nData;
|
int nData;
|
||||||
SegmentWriter *pWriter = *ppWriter;
|
SegmentWriter *pWriter = *ppWriter;
|
||||||
|
|
||||||
@ -189309,13 +189335,13 @@ static int fts3SegWriterAdd(
|
|||||||
sqlite3_stmt *pStmt;
|
sqlite3_stmt *pStmt;
|
||||||
|
|
||||||
/* Allocate the SegmentWriter structure */
|
/* Allocate the SegmentWriter structure */
|
||||||
pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
|
pWriter = (SegmentWriter *)sqlite3_malloc64(sizeof(SegmentWriter));
|
||||||
if( !pWriter ) return SQLITE_NOMEM;
|
if( !pWriter ) return SQLITE_NOMEM;
|
||||||
memset(pWriter, 0, sizeof(SegmentWriter));
|
memset(pWriter, 0, sizeof(SegmentWriter));
|
||||||
*ppWriter = pWriter;
|
*ppWriter = pWriter;
|
||||||
|
|
||||||
/* Allocate a buffer in which to accumulate data */
|
/* Allocate a buffer in which to accumulate data */
|
||||||
pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
|
pWriter->aData = (char *)sqlite3_malloc64(p->nNodeSize);
|
||||||
if( !pWriter->aData ) return SQLITE_NOMEM;
|
if( !pWriter->aData ) return SQLITE_NOMEM;
|
||||||
pWriter->nSize = p->nNodeSize;
|
pWriter->nSize = p->nNodeSize;
|
||||||
|
|
||||||
@ -189390,7 +189416,7 @@ static int fts3SegWriterAdd(
|
|||||||
** the buffer to make it large enough.
|
** the buffer to make it large enough.
|
||||||
*/
|
*/
|
||||||
if( nReq>pWriter->nSize ){
|
if( nReq>pWriter->nSize ){
|
||||||
char *aNew = sqlite3_realloc(pWriter->aData, nReq);
|
char *aNew = sqlite3_realloc64(pWriter->aData, nReq);
|
||||||
if( !aNew ) return SQLITE_NOMEM;
|
if( !aNew ) return SQLITE_NOMEM;
|
||||||
pWriter->aData = aNew;
|
pWriter->aData = aNew;
|
||||||
pWriter->nSize = nReq;
|
pWriter->nSize = nReq;
|
||||||
@ -189415,7 +189441,7 @@ static int fts3SegWriterAdd(
|
|||||||
*/
|
*/
|
||||||
if( isCopyTerm ){
|
if( isCopyTerm ){
|
||||||
if( nTerm>pWriter->nMalloc ){
|
if( nTerm>pWriter->nMalloc ){
|
||||||
char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
|
char *zNew = sqlite3_realloc64(pWriter->zMalloc, (i64)nTerm*2);
|
||||||
if( !zNew ){
|
if( !zNew ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -189723,12 +189749,12 @@ static void fts3ColumnFilter(
|
|||||||
static int fts3MsrBufferData(
|
static int fts3MsrBufferData(
|
||||||
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
|
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
|
||||||
char *pList,
|
char *pList,
|
||||||
int nList
|
i64 nList
|
||||||
){
|
){
|
||||||
if( nList>pMsr->nBuffer ){
|
if( nList>pMsr->nBuffer ){
|
||||||
char *pNew;
|
char *pNew;
|
||||||
pMsr->nBuffer = nList*2;
|
pMsr->nBuffer = nList*2;
|
||||||
pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);
|
pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
|
||||||
if( !pNew ) return SQLITE_NOMEM;
|
if( !pNew ) return SQLITE_NOMEM;
|
||||||
pMsr->aBuffer = pNew;
|
pMsr->aBuffer = pNew;
|
||||||
}
|
}
|
||||||
@ -189784,7 +189810,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
|
|||||||
fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);
|
fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);
|
||||||
|
|
||||||
if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
|
if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
|
||||||
rc = fts3MsrBufferData(pMsr, pList, nList+1);
|
rc = fts3MsrBufferData(pMsr, pList, (i64)nList+1);
|
||||||
if( rc!=SQLITE_OK ) return rc;
|
if( rc!=SQLITE_OK ) return rc;
|
||||||
assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );
|
assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );
|
||||||
pList = pMsr->aBuffer;
|
pList = pMsr->aBuffer;
|
||||||
@ -189921,11 +189947,11 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){
|
|||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, int nReq){
|
static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, i64 nReq){
|
||||||
if( nReq>pCsr->nBuffer ){
|
if( nReq>pCsr->nBuffer ){
|
||||||
char *aNew;
|
char *aNew;
|
||||||
pCsr->nBuffer = nReq*2;
|
pCsr->nBuffer = nReq*2;
|
||||||
aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
|
aNew = sqlite3_realloc64(pCsr->aBuffer, pCsr->nBuffer);
|
||||||
if( !aNew ){
|
if( !aNew ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -190016,7 +190042,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
|||||||
){
|
){
|
||||||
pCsr->nDoclist = apSegment[0]->nDoclist;
|
pCsr->nDoclist = apSegment[0]->nDoclist;
|
||||||
if( fts3SegReaderIsPending(apSegment[0]) ){
|
if( fts3SegReaderIsPending(apSegment[0]) ){
|
||||||
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);
|
rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist,
|
||||||
|
(i64)pCsr->nDoclist);
|
||||||
pCsr->aDoclist = pCsr->aBuffer;
|
pCsr->aDoclist = pCsr->aBuffer;
|
||||||
}else{
|
}else{
|
||||||
pCsr->aDoclist = apSegment[0]->aDoclist;
|
pCsr->aDoclist = apSegment[0]->aDoclist;
|
||||||
@ -190069,7 +190096,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
|||||||
|
|
||||||
nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
|
nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
|
||||||
|
|
||||||
rc = fts3GrowSegReaderBuffer(pCsr, nByte+nDoclist+FTS3_NODE_PADDING);
|
rc = fts3GrowSegReaderBuffer(pCsr,
|
||||||
|
(i64)nByte+nDoclist+FTS3_NODE_PADDING);
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
|
|
||||||
if( isFirst ){
|
if( isFirst ){
|
||||||
@ -190095,7 +190123,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
|
|||||||
fts3SegReaderSort(apSegment, nMerge, j, xCmp);
|
fts3SegReaderSort(apSegment, nMerge, j, xCmp);
|
||||||
}
|
}
|
||||||
if( nDoclist>0 ){
|
if( nDoclist>0 ){
|
||||||
rc = fts3GrowSegReaderBuffer(pCsr, nDoclist+FTS3_NODE_PADDING);
|
rc = fts3GrowSegReaderBuffer(pCsr, (i64)nDoclist+FTS3_NODE_PADDING);
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
|
memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
|
||||||
pCsr->aDoclist = pCsr->aBuffer;
|
pCsr->aDoclist = pCsr->aBuffer;
|
||||||
@ -190808,7 +190836,7 @@ struct NodeReader {
|
|||||||
static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){
|
static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){
|
||||||
if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
|
if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
|
||||||
int nAlloc = nMin;
|
int nAlloc = nMin;
|
||||||
char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc);
|
char *a = (char *)sqlite3_realloc64(pBlob->a, nAlloc);
|
||||||
if( a ){
|
if( a ){
|
||||||
pBlob->nAlloc = nAlloc;
|
pBlob->nAlloc = nAlloc;
|
||||||
pBlob->a = a;
|
pBlob->a = a;
|
||||||
@ -191605,7 +191633,7 @@ static int fts3RepackSegdirLevel(
|
|||||||
if( nIdx>=nAlloc ){
|
if( nIdx>=nAlloc ){
|
||||||
int *aNew;
|
int *aNew;
|
||||||
nAlloc += 16;
|
nAlloc += 16;
|
||||||
aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));
|
aNew = sqlite3_realloc64(aIdx, nAlloc*sizeof(int));
|
||||||
if( !aNew ){
|
if( !aNew ){
|
||||||
rc = SQLITE_NOMEM;
|
rc = SQLITE_NOMEM;
|
||||||
break;
|
break;
|
||||||
@ -191979,7 +192007,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){
|
|||||||
|
|
||||||
/* Allocate space for the cursor, filter and writer objects */
|
/* Allocate space for the cursor, filter and writer objects */
|
||||||
const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
|
const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);
|
||||||
pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
|
pWriter = (IncrmergeWriter *)sqlite3_malloc64(nAlloc);
|
||||||
if( !pWriter ) return SQLITE_NOMEM;
|
if( !pWriter ) return SQLITE_NOMEM;
|
||||||
pFilter = (Fts3SegFilter *)&pWriter[1];
|
pFilter = (Fts3SegFilter *)&pWriter[1];
|
||||||
pCsr = (Fts3MultiSegReader *)&pFilter[1];
|
pCsr = (Fts3MultiSegReader *)&pFilter[1];
|
||||||
@ -192615,7 +192643,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(
|
|||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
pRet = (char *)sqlite3_malloc(p->pList->nData);
|
pRet = (char *)sqlite3_malloc64(p->pList->nData);
|
||||||
if( !pRet ) return SQLITE_NOMEM;
|
if( !pRet ) return SQLITE_NOMEM;
|
||||||
|
|
||||||
nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);
|
nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);
|
||||||
@ -192635,7 +192663,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
|
|||||||
int iCol /* Column that token must appear in (or -1) */
|
int iCol /* Column that token must appear in (or -1) */
|
||||||
){
|
){
|
||||||
Fts3DeferredToken *pDeferred;
|
Fts3DeferredToken *pDeferred;
|
||||||
pDeferred = sqlite3_malloc(sizeof(*pDeferred));
|
pDeferred = sqlite3_malloc64(sizeof(*pDeferred));
|
||||||
if( !pDeferred ){
|
if( !pDeferred ){
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@ -204817,8 +204845,9 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){
|
|||||||
|
|
||||||
if( U_SUCCESS(status) ){
|
if( U_SUCCESS(status) ){
|
||||||
sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);
|
sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);
|
||||||
}else{
|
pExpr = sqlite3_get_auxdata(p, 0);
|
||||||
assert(!pExpr);
|
}
|
||||||
|
if( !pExpr ){
|
||||||
icuFunctionError(p, "uregex_open", status);
|
icuFunctionError(p, "uregex_open", status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -236704,7 +236733,7 @@ static void fts5SourceIdFunc(
|
|||||||
){
|
){
|
||||||
assert( nArg==0 );
|
assert( nArg==0 );
|
||||||
UNUSED_PARAM2(nArg, apUnused);
|
UNUSED_PARAM2(nArg, apUnused);
|
||||||
sqlite3_result_text(pCtx, "fts5: 2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8", -1, SQLITE_TRANSIENT);
|
sqlite3_result_text(pCtx, "fts5: 2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309", -1, SQLITE_TRANSIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
6
libsqlite3-sys/sqlite3/sqlite3.h
vendored
6
libsqlite3-sys/sqlite3/sqlite3.h
vendored
@ -146,9 +146,9 @@ extern "C" {
|
|||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.39.3"
|
#define SQLITE_VERSION "3.39.4"
|
||||||
#define SQLITE_VERSION_NUMBER 3039003
|
#define SQLITE_VERSION_NUMBER 3039004
|
||||||
#define SQLITE_SOURCE_ID "2022-09-05 11:02:23 4635f4a69c8c2a8df242b384a992aea71224e39a2ccab42d8c0b0602f1e826e8"
|
#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
@ -9,7 +9,7 @@ export SQLITE3_LIB_DIR="$SCRIPT_DIR/sqlite3"
|
|||||||
export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR"
|
export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR"
|
||||||
|
|
||||||
# Download and extract amalgamation
|
# Download and extract amalgamation
|
||||||
SQLITE=sqlite-amalgamation-3390300
|
SQLITE=sqlite-amalgamation-3390400
|
||||||
curl -O https://sqlite.org/2022/$SQLITE.zip
|
curl -O https://sqlite.org/2022/$SQLITE.zip
|
||||||
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c"
|
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c"
|
||||||
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h"
|
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user