Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b23d4d4

Browse files
authored
Merge pull request #138 from montegoulding/sqliteerror
[[ Bug 22346 ]] Fix abort on error when query contains format specifier
2 parents c7a6c8e + 379129e commit b23d4d4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libsqlite/src/sqlitedataset.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,10 @@ int SqliteDatabase::connect(bool p_use_uri)
409409
{
410410
char* err=NULL;
411411
if (setErr(sqlite3_exec(getHandle(),"PRAGMA empty_result_callbacks=ON",NULL,NULL,&err),"PRAGMA empty_result_callbacks=ON") != SQLITE_OK)
412-
throw DbErrors(getErrorMsg());
412+
throw DbErrors("%s", getErrorMsg());
413413

414414
if (setErr(sqlite3_exec(getHandle(),"PRAGMA SHOW_DATATYPES=ON",NULL,NULL,&err),"PRAGMA SHOW_DATATYPES=ON") != SQLITE_OK)
415-
throw DbErrors(getErrorMsg());
415+
throw DbErrors("%s", getErrorMsg());
416416

417417
//load any collations
418418
#ifdef CUSTOM_COLLATION
@@ -435,7 +435,7 @@ int SqliteDatabase::connect(bool p_use_uri)
435435
sqlite3_close(conn);
436436
conn = nullptr;
437437
}
438-
throw DbErrors(getErrorMsg());
438+
throw DbErrors("%s", getErrorMsg());
439439
}
440440

441441
return DB_CONNECTION_NONE;
@@ -558,7 +558,7 @@ void SqliteDataset::make_query(StringList &_sql) {
558558
char* err=NULL;
559559
Dataset::parse_sql(query);
560560
if (db->setErr(sqlite3_exec(this->handle(),query.c_str(),NULL,NULL,&err),query.c_str())!=SQLITE_OK) {
561-
throw DbErrors(db->getErrorMsg());
561+
throw DbErrors("%s", db->getErrorMsg());
562562
}
563563
} // end of for
564564

@@ -889,7 +889,7 @@ int SqliteDataset::exec(const string &sql) {
889889
return res;
890890
else
891891
{
892-
throw DbErrors(db->getErrorMsg());
892+
throw DbErrors("%s", db->getErrorMsg());
893893
}
894894
}
895895

@@ -935,7 +935,7 @@ bool SqliteDataset::query(const char *query)
935935
if (t_query_result == SQLITE_ERROR)
936936
db -> setErrDirect(errmsg);
937937

938-
throw DbErrors(db->getErrorMsg());
938+
throw DbErrors("%s", db->getErrorMsg());
939939
}
940940
}
941941

0 commit comments

Comments
 (0)