More efficient error handling and reset in the binding mechanism.
FossilOrigin-Name: 9a3e3b34ba6eafce2f560c13225a3673e18d696b29295b59d958e938fa593baf
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index bdc5f03..3e439e3 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -1303,8 +1303,10 @@
if( rc==SQLITE_OK && encoding!=0 ){
rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
}
- sqlite3Error(p->db, rc);
- rc = sqlite3ApiExit(p->db, rc);
+ if( rc ){
+ sqlite3Error(p->db, rc);
+ rc = sqlite3ApiExit(p->db, rc);
+ }
}
sqlite3_mutex_leave(p->db->mutex);
}else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index be1c128..1961fba 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -2820,10 +2820,10 @@
sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
sqlite3EndBenignMalloc();
db->bBenignMalloc--;
- db->errCode = rc;
- }else{
- sqlite3Error(db, rc);
+ }else if( db->pErr ){
+ sqlite3ValueSetNull(db->pErr);
}
+ db->errCode = rc;
return rc;
}