Check return of QSqlQuery::prepare
This commit is contained in:
parent
eaed82c9b2
commit
75ab6f25f4
|
@ -210,7 +210,7 @@ bool CollectionQuery::Exec() {
|
||||||
sql.replace("%fts_table_noprefix", fts_table_.section('.', -1, -1));
|
sql.replace("%fts_table_noprefix", fts_table_.section('.', -1, -1));
|
||||||
sql.replace("%fts_table", fts_table_);
|
sql.replace("%fts_table", fts_table_);
|
||||||
|
|
||||||
QSqlQuery::prepare(sql);
|
if (!QSqlQuery::prepare(sql)) return false;
|
||||||
|
|
||||||
// Bind values
|
// Bind values
|
||||||
for (const QVariant &value : bound_values_) {
|
for (const QVariant &value : bound_values_) {
|
||||||
|
|
|
@ -60,7 +60,10 @@ void Console::RunQuery() {
|
||||||
|
|
||||||
QSqlDatabase db = app_->database()->Connect();
|
QSqlDatabase db = app_->database()->Connect();
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
query.prepare(ui_.query->text());
|
if (!query.prepare(ui_.query->text())) {
|
||||||
|
qLog(Error) << query.lastError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!query.exec()) {
|
if (!query.exec()) {
|
||||||
qLog(Error) << query.lastError();
|
qLog(Error) << query.lastError();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue