diff options
author | drh <> | 2022-04-03 22:35:13 +0000 |
---|---|---|
committer | drh <> | 2022-04-03 22:35:13 +0000 |
commit | 8703edd3e9c10a687e1bf9f95901bca24c3a6881 (patch) | |
tree | 48fa4aaf789668efe31e2b04262f2cb849faae75 /src | |
parent | 8bb93daca0004d8c882fd7d46a4bdf2a5979ad88 (diff) | |
download | sqlite-8703edd3e9c10a687e1bf9f95901bca24c3a6881.tar.gz sqlite-8703edd3e9c10a687e1bf9f95901bca24c3a6881.zip |
Performance optimization in the sqlite3VdbeHalt() routine.
FossilOrigin-Name: 9564d72a0820dbcb38f905fcd42ed4c858ea8fb5f648b189ceb65380a14a785b
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 7 | ||||
-rw-r--r-- | src/vdbeaux.c | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index a4177ae2e..3f7dd4447 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3649,7 +3649,10 @@ case OP_Savepoint: { } } if( rc ) goto abort_due_to_error; - + if( p->eVdbeState==VDBE_HALT_STATE ){ + rc = SQLITE_DONE; + goto vdbe_return; + } break; } @@ -8602,7 +8605,7 @@ abort_due_to_error: testcase( sqlite3GlobalConfig.xLog!=0 ); sqlite3_log(rc, "statement aborts at %d: [%s] %s", (int)(pOp - aOp), p->zSql, p->zErrMsg); - sqlite3VdbeHalt(p); + if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p); if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db); if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){ db->flags |= SQLITE_CorruptRdOnly; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index a1908edf3..6e6e240cd 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3044,9 +3044,7 @@ int sqlite3VdbeHalt(Vdbe *p){ ** one, or the complete transaction if there is no statement transaction. */ - if( p->eVdbeState!=VDBE_RUN_STATE ){ - return SQLITE_OK; - } + assert( p->eVdbeState==VDBE_RUN_STATE ); if( db->mallocFailed ){ p->rc = SQLITE_NOMEM_BKPT; } @@ -3306,7 +3304,7 @@ int sqlite3VdbeReset(Vdbe *p){ ** error, then it might not have been halted properly. So halt ** it now. */ - sqlite3VdbeHalt(p); + if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p); /* If the VDBE has been run even partially, then transfer the error code ** and error message from the VDBE into the main database structure. But |