sqlite 3.45.3.

This commit is contained in:
2024-04-16 12:16:36 -04:00
parent 23b3c998bd
commit 295d76d354
4 changed files with 211 additions and 52 deletions

33
deps/sqlite/shell.c vendored
View File

@ -14753,6 +14753,15 @@ static void dbdataValue(
}
}
/* This macro is a copy of the MX_CELL() macro in the SQLite core. Given
** a page-size, it returns the maximum number of cells that may be present
** on the page. */
#define DBDATA_MX_CELL(pgsz) ((pgsz-8)/6)
/* Maximum number of fields that may appear in a single record. This is
** the "hard-limit", according to comments in sqliteLimit.h. */
#define DBDATA_MX_FIELD 32676
/*
** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry.
*/
@ -14781,6 +14790,9 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
assert( iOff+3+2<=pCsr->nPage );
pCsr->iCell = pTab->bPtr ? -2 : 0;
pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
if( pCsr->nCell>DBDATA_MX_CELL(pCsr->nPage) ){
pCsr->nCell = DBDATA_MX_CELL(pCsr->nPage);
}
}
if( pTab->bPtr ){
@ -14825,19 +14837,19 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
if( pCsr->iCell>=pCsr->nCell ){
bNextPage = 1;
}else{
int iCellPtr = iOff + 8 + nPointer + pCsr->iCell*2;
iOff += 8 + nPointer + pCsr->iCell*2;
if( iOff>pCsr->nPage ){
if( iCellPtr>pCsr->nPage ){
bNextPage = 1;
}else{
iOff = get_uint16(&pCsr->aPage[iOff]);
iOff = get_uint16(&pCsr->aPage[iCellPtr]);
}
/* For an interior node cell, skip past the child-page number */
iOff += nPointer;
/* Load the "byte of payload including overflow" field */
if( bNextPage || iOff>pCsr->nPage ){
if( bNextPage || iOff>pCsr->nPage || iOff<=iCellPtr ){
bNextPage = 1;
}else{
iOff += dbdataGetVarintU32(&pCsr->aPage[iOff], &nPayload);
@ -14920,7 +14932,9 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
pCsr->iField++;
if( pCsr->iField>0 ){
sqlite3_int64 iType;
if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){
if( pCsr->pHdrPtr>=&pCsr->pRec[pCsr->nRec]
|| pCsr->iField>=DBDATA_MX_FIELD
){
bNextPage = 1;
}else{
int szField = 0;
@ -16408,7 +16422,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){
if( bTable && !bVirtual ){
if( SQLITE_ROW==sqlite3_step(pTblname) ){
const char *zTbl = (const char*)sqlite3_column_text(pTblname, 0);
recoverAddTable(p, zTbl, iRoot);
if( zTbl ) recoverAddTable(p, zTbl, iRoot);
}
recoverReset(p, pTblname);
}
@ -28771,6 +28785,7 @@ static const char zOptions[] =
" -newline SEP set output row separator. Default: '\\n'\n"
" -nofollow refuse to open symbolic links to database files\n"
" -nonce STRING set the safe-mode escape nonce\n"
" -no-rowid-in-view Disable rowid-in-view using sqlite3_config()\n"
" -nullvalue TEXT set text string for NULL values. Default ''\n"
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
" -pcachetrace trace all page cache operations\n"
@ -29061,6 +29076,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
stdin_is_interactive = 0;
}else if( cli_strcmp(z,"-utf8")==0 ){
}else if( cli_strcmp(z,"-no-utf8")==0 ){
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
int val = 0;
sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val);
assert( val==0 );
}else if( cli_strcmp(z,"-heap")==0 ){
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
const char *zSize;
@ -29336,6 +29355,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
/* already handled */
}else if( cli_strcmp(z,"-no-utf8")==0 ){
/* already handled */
}else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){
/* already handled */
}else if( cli_strcmp(z,"-heap")==0 ){
i++;
}else if( cli_strcmp(z,"-pagecache")==0 ){