Ensure that the sqlite3_exec() callback gets the correct number of columns
for a query, even if the schema changes out from under it. FossilOrigin-Name: a16ffb5a4b30f1ac4a8384fccde0a0f69e49545b6f9be9267928609328c4a151
This commit is contained in:
+2
-3
@@ -46,7 +46,7 @@ int sqlite3_exec(
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
sqlite3Error(db, SQLITE_OK);
|
||||
while( rc==SQLITE_OK && zSql[0] ){
|
||||
int nCol;
|
||||
int nCol = 0;
|
||||
char **azVals = 0;
|
||||
|
||||
pStmt = 0;
|
||||
@@ -60,9 +60,7 @@ int sqlite3_exec(
|
||||
zSql = zLeftover;
|
||||
continue;
|
||||
}
|
||||
|
||||
callbackIsInit = 0;
|
||||
nCol = sqlite3_column_count(pStmt);
|
||||
|
||||
while( 1 ){
|
||||
int i;
|
||||
@@ -73,6 +71,7 @@ int sqlite3_exec(
|
||||
(SQLITE_DONE==rc && !callbackIsInit
|
||||
&& db->flags&SQLITE_NullCallback)) ){
|
||||
if( !callbackIsInit ){
|
||||
nCol = sqlite3_column_count(pStmt);
|
||||
azCols = sqlite3DbMallocRaw(db, (2*nCol+1)*sizeof(const char*));
|
||||
if( azCols==0 ){
|
||||
goto exec_out;
|
||||
|
||||
Reference in New Issue
Block a user