@@ -494,12 +494,13 @@ SQLResultSet SQLiteHandle::run(sqlite3_stmt *stmt, const std::string &sql,
494
494
} else if (ret == SQLITE_DONE) {
495
495
break ;
496
496
} else {
497
- throw FactoryException (std::string (" SQLite error on " )
498
- .append (sql)
499
- .append (" : code = " )
497
+ throw FactoryException (std::string (" SQLite error [ " )
498
+ .append (" code = " )
500
499
.append (internal::toString (ret))
501
500
.append (" , msg = " )
502
- .append (sqlite3_errmsg (sqlite_handle_)));
501
+ .append (sqlite3_errmsg (sqlite_handle_))
502
+ .append (" ] on " )
503
+ .append (sql));
503
504
}
504
505
}
505
506
return result;
@@ -515,8 +516,10 @@ SQLResultSet SQLiteHandle::run(const std::string &sql,
515
516
if (sqlite3_prepare_v2 (sqlite_handle_, sql.c_str (),
516
517
static_cast <int >(sql.size ()), &stmt,
517
518
nullptr ) != SQLITE_OK) {
518
- throw FactoryException (" SQLite error on " + sql + " : " +
519
- sqlite3_errmsg (sqlite_handle_));
519
+ throw FactoryException (std::string (" SQLite error [ " )
520
+ .append (sqlite3_errmsg (sqlite_handle_))
521
+ .append (" ] on " )
522
+ .append (sql));
520
523
}
521
524
auto ret = run (stmt, sql, parameters, useMaxFloatPrecision);
522
525
sqlite3_finalize (stmt);
@@ -1443,8 +1446,11 @@ SQLResultSet DatabaseContext::Private::run(const std::string &sql,
1443
1446
if (sqlite3_prepare_v2 (l_handle->handle (), sql.c_str (),
1444
1447
static_cast <int >(sql.size ()), &stmt,
1445
1448
nullptr ) != SQLITE_OK) {
1446
- throw FactoryException (" SQLite error on " + sql + " : " +
1447
- sqlite3_errmsg (l_handle->handle ()));
1449
+ throw FactoryException (
1450
+ std::string (" SQLite error [ " )
1451
+ .append (sqlite3_errmsg (l_handle->handle ()))
1452
+ .append (" ] on " )
1453
+ .append (sql));
1448
1454
}
1449
1455
mapSqlToStatement_.insert (
1450
1456
std::pair<std::string, sqlite3_stmt *>(sql, stmt));
0 commit comments