1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Avoid redundant calls to sqlite3ApiExit() in sqlite3_step().

FossilOrigin-Name: 527974d4caba8bce7c89a28ea04a573b14c558657c14d9ad3c64bf1e0884caf8
This commit is contained in:
drh
2017-08-02 19:04:37 +00:00
parent 59533aa5e0
commit 754ee285fa
3 changed files with 28 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
C Only\sattempt\sto\sinvoke\sWAL\scallbacks\swhen\sa\stransaction\shas\scommitted. C Avoid\sredundant\scalls\sto\ssqlite3ApiExit()\sin\ssqlite3_step().
D 2017-08-02T18:28:26.315 D 2017-08-02T19:04:37.188
F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8 F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016 F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
@@ -523,7 +523,7 @@ F src/vacuum.c 90839322fd5f00df9617eb21b68beda9b6e2a2937576b0d65985e4aeb1c53739
F src/vdbe.c 5752a157cfb2898d154ecdd4a805135d2e9b1708084a3205dbc379af3ae8ef07 F src/vdbe.c 5752a157cfb2898d154ecdd4a805135d2e9b1708084a3205dbc379af3ae8ef07
F src/vdbe.h d50cadf12bcf9fb99117ef392ce1ea283aa429270481426b6e8b0280c101fd97 F src/vdbe.h d50cadf12bcf9fb99117ef392ce1ea283aa429270481426b6e8b0280c101fd97
F src/vdbeInt.h ff2b7db0968d20e6184aee256d2e535d565f5a172e3588a78adb166a41fc4911 F src/vdbeInt.h ff2b7db0968d20e6184aee256d2e535d565f5a172e3588a78adb166a41fc4911
F src/vdbeapi.c 6e27a510b90fda08fd57aa55157f4a8c9df5916f4f200e5730636f2fe9f7d957 F src/vdbeapi.c dc282e27bf3d3c148f95aded4098894494c17d3d39c887c5ed97b9561dcd9bdd
F src/vdbeaux.c 5feca7a5f38a0bd154d8f68710e3afffdb9a83d7b56350497fdd316eb1dd6775 F src/vdbeaux.c 5feca7a5f38a0bd154d8f68710e3afffdb9a83d7b56350497fdd316eb1dd6775
F src/vdbeblob.c db3cf91060f6f4b2f1358a4200e844697990752177784c7c95da00b7ac9f1c7b F src/vdbeblob.c db3cf91060f6f4b2f1358a4200e844697990752177784c7c95da00b7ac9f1c7b
F src/vdbemem.c 9ca2854976f35db40341977e688a08204c96427505f5b90215dc7970f6ea42c4 F src/vdbemem.c 9ca2854976f35db40341977e688a08204c96427505f5b90215dc7970f6ea42c4
@@ -1640,7 +1640,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f3c39c2986be08683c2af4df610bc12e3c6bc6bec265c94ce01b94a950723524 P bcc6dacb9114df709ef1bde24264c2193d9e39fc7fab024d5ebfc6056033274c
R 65e3cc8741593ad1ca5069325bf0f8ba R c2ce69750ff40b8566324e65e78319fb
U drh U drh
Z de8423cf21d34bd26fb77342a7fad01e Z 4c16d972871bc4f6fb8b1229cdad47da

View File

@@ -1 +1 @@
bcc6dacb9114df709ef1bde24264c2193d9e39fc7fab024d5ebfc6056033274c 527974d4caba8bce7c89a28ea04a573b14c558657c14d9ad3c64bf1e0884caf8

View File

@@ -677,7 +677,6 @@ end_of_step:
*/ */
int sqlite3_step(sqlite3_stmt *pStmt){ int sqlite3_step(sqlite3_stmt *pStmt){
int rc = SQLITE_OK; /* Result from sqlite3Step() */ int rc = SQLITE_OK; /* Result from sqlite3Step() */
int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */ Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
int cnt = 0; /* Counter to prevent infinite loop of reprepares */ int cnt = 0; /* Counter to prevent infinite loop of reprepares */
sqlite3 *db; /* The database connection */ sqlite3 *db; /* The database connection */
@@ -691,32 +690,31 @@ int sqlite3_step(sqlite3_stmt *pStmt){
while( (rc = sqlite3Step(v))==SQLITE_SCHEMA while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
&& cnt++ < SQLITE_MAX_SCHEMA_RETRY ){ && cnt++ < SQLITE_MAX_SCHEMA_RETRY ){
int savedPc = v->pc; int savedPc = v->pc;
rc2 = rc = sqlite3Reprepare(v); rc = sqlite3Reprepare(v);
if( rc!=SQLITE_OK) break; if( rc!=SQLITE_OK ){
/* This case occurs after failing to recompile an sql statement.
** The error message from the SQL compiler has already been loaded
** into the database handle. This block copies the error message
** from the database handle into the statement and sets the statement
** program counter to 0 to ensure that when the statement is
** finalized or reset the parser error message is available via
** sqlite3_errmsg() and sqlite3_errcode().
*/
const char *zErr = (const char *)sqlite3_value_text(db->pErr);
sqlite3DbFree(db, v->zErrMsg);
if( !db->mallocFailed ){
v->zErrMsg = sqlite3DbStrDup(db, zErr);
v->rc = rc = sqlite3ApiExit(db, rc);
} else {
v->zErrMsg = 0;
v->rc = rc = SQLITE_NOMEM_BKPT;
}
break;
}
sqlite3_reset(pStmt); sqlite3_reset(pStmt);
if( savedPc>=0 ) v->doingRerun = 1; if( savedPc>=0 ) v->doingRerun = 1;
assert( v->expired==0 ); assert( v->expired==0 );
} }
if( rc2!=SQLITE_OK ){
/* This case occurs after failing to recompile an sql statement.
** The error message from the SQL compiler has already been loaded
** into the database handle. This block copies the error message
** from the database handle into the statement and sets the statement
** program counter to 0 to ensure that when the statement is
** finalized or reset the parser error message is available via
** sqlite3_errmsg() and sqlite3_errcode().
*/
const char *zErr = (const char *)sqlite3_value_text(db->pErr);
sqlite3DbFree(db, v->zErrMsg);
if( !db->mallocFailed ){
v->zErrMsg = sqlite3DbStrDup(db, zErr);
v->rc = rc2;
} else {
v->zErrMsg = 0;
v->rc = rc = SQLITE_NOMEM_BKPT;
}
}
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);
return rc; return rc;
} }