1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Do a better job of capturing all system errno values regardless of when

they occur.

FossilOrigin-Name: 7d49998d571d841a6d1b55f5f9889e613daaab2a
This commit is contained in:
drh
2016-03-21 11:38:01 +00:00
parent b7c9659db3
commit 8d2f41ccd2
4 changed files with 14 additions and 10 deletions

View File

@@ -120,10 +120,14 @@ const char *sqlite3StrNext(const char *z){
/*
** Set the current error code to err_code and clear any prior error message.
*/
static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){
if( db->pErr ) sqlite3ValueSetNull(db->pErr);
sqlite3SystemError(db, err_code);
}
void sqlite3Error(sqlite3 *db, int err_code){
assert( db!=0 );
db->errCode = err_code;
if( db->pErr ) sqlite3ValueSetNull(db->pErr);
if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
}
/*
@@ -162,6 +166,7 @@ void sqlite3SystemError(sqlite3 *db, int rc){
void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *zFormat, ...){
assert( db!=0 );
db->errCode = err_code;
sqlite3SystemError(db, err_code);
if( zFormat==0 ){
sqlite3Error(db, err_code);
}else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){