1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Avoid unnecessary calls to sqlite3_step() with null prepared statements

while parsing the schema.

FossilOrigin-Name: ae04d2d15d3d96f607adb394a631d96cd4cf2c1d
This commit is contained in:
drh
2010-04-09 09:14:05 +00:00
parent 9e48165b07
commit 6498f0bb2e
3 changed files with 15 additions and 15 deletions

View File

@@ -73,15 +73,15 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
** or executed. All the parser does is build the internal data
** structures that describe the table, index, or view.
*/
char *zErr;
int rc;
sqlite3_stmt *pStmt;
assert( db->init.busy );
db->init.iDb = iDb;
db->init.newTnum = atoi(argv[1]);
db->init.orphanTrigger = 0;
rc = sqlite3_exec(db, argv[2], 0, 0, &zErr);
rc = sqlite3_prepare(db, argv[2], -1, &pStmt, 0);
db->init.iDb = 0;
assert( rc!=SQLITE_OK || zErr==0 );
if( SQLITE_OK!=rc ){
if( db->init.orphanTrigger ){
assert( iDb==1 );
@@ -90,11 +90,11 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
if( rc==SQLITE_NOMEM ){
db->mallocFailed = 1;
}else if( rc!=SQLITE_INTERRUPT && rc!=SQLITE_LOCKED ){
corruptSchema(pData, argv[0], zErr);
corruptSchema(pData, argv[0], sqlite3_errmsg(db));
}
}
sqlite3DbFree(db, zErr);
}
sqlite3_finalize(pStmt);
}else if( argv[0]==0 ){
corruptSchema(pData, 0, 0);
}else{