1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Attempt to provide a mechanism to do early termination of long-running

statement preparation by invoking the progress handler at strategic points
during sqlite3_parpare().  This experiment shows that sqlite3_prepare() might
leave the resulting prepared statement uninitialized following an interrupt.

FossilOrigin-Name: 79636f2d80aee70832913a78933da2a7e30cc037810b93903ebbc1925ea93fef
This commit is contained in:
drh
2023-01-12 13:25:48 +00:00
parent 8518eaccd7
commit f84cbd1676
7 changed files with 46 additions and 16 deletions

View File

@@ -2211,7 +2211,7 @@ int sqlite3ColumnsFromExprList(
*pnCol = nCol;
*paCol = aCol;
for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
for(i=0, pCol=aCol; i<nCol && !pParse->nErr; i++, pCol++){
struct ExprList_item *pX = &pEList->a[i];
struct ExprList_item *pCollide;
/* Get an appropriate name for the column
@@ -2261,7 +2261,10 @@ int sqlite3ColumnsFromExprList(
if( zName[j]==':' ) nName = j;
}
zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt);
if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);
sqlite3ProgressCheck(pParse);
if( cnt>3 ){
sqlite3_randomness(sizeof(cnt), &cnt);
}
}
pCol->zCnName = zName;
pCol->hName = sqlite3StrIHash(zName);
@@ -2274,14 +2277,14 @@ int sqlite3ColumnsFromExprList(
}
}
sqlite3HashClear(&ht);
if( db->mallocFailed ){
if( pParse->nErr ){
for(j=0; j<i; j++){
sqlite3DbFree(db, aCol[j].zCnName);
}
sqlite3DbFree(db, aCol);
*paCol = 0;
*pnCol = 0;
return SQLITE_NOMEM_BKPT;
return pParse->rc;
}
return SQLITE_OK;
}