diff options
Diffstat (limited to '')
-rw-r--r-- | src/sqlitepp.client.hh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sqlitepp.client.hh b/src/sqlitepp.client.hh index 5a82756..46c4a64 100644 --- a/src/sqlitepp.client.hh +++ b/src/sqlitepp.client.hh @@ -103,7 +103,10 @@ bind_values(sqlite3_stmt* stmt, Args... args) } struct prepared_stmt { - prepared_stmt(auto_mem<sqlite3_stmt> stmt) : ps_stmt(std::move(stmt)) {} + explicit prepared_stmt(auto_mem<sqlite3_stmt> stmt) + : ps_stmt(std::move(stmt)) + { + } Result<void, std::string> execute() { @@ -195,10 +198,12 @@ prepare_stmt(sqlite3* db, const char* sql, Args... args) sqlite3_errmsg(db))); } - if (bind_values(retval.in(), args...) != SQLITE_OK) { - return Err( - fmt::format(FMT_STRING("unable to prepare SQL statement: {}"), - sqlite3_errmsg(db))); + if (sizeof...(args) > 0) { + if (bind_values(retval.in(), args...) != SQLITE_OK) { + return Err( + fmt::format(FMT_STRING("unable to prepare SQL statement: {}"), + sqlite3_errmsg(db))); + } } return Ok(prepared_stmt{ |