diff options
Diffstat (limited to 'lib/input/mysqlStmt.cpp')
-rw-r--r-- | lib/input/mysqlStmt.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/input/mysqlStmt.cpp b/lib/input/mysqlStmt.cpp index 08d1303..d3ba9ef 100644 --- a/lib/input/mysqlStmt.cpp +++ b/lib/input/mysqlStmt.cpp @@ -1,5 +1,6 @@ #include "mysqlStmt.h" #include "mysqlBindings.h" +#include "mysqlConn.h" #include "mysqlRecordSet.h" #include <cstring> #include <helpers.h> @@ -10,15 +11,15 @@ namespace MyGrate::Input { MySQLPrepStmt::MySQLPrepStmt(const char * const q, MYSQL * c) : stmt {mysql_stmt_init(c), &mysql_stmt_close} { - verify<std::runtime_error>(!mysql_stmt_prepare(stmt.get(), q, strlen(q)), q); + verify<MySQLErr>(!mysql_stmt_prepare(stmt.get(), q, strlen(q)), q, c); } void MySQLPrepStmt::execute(const std::initializer_list<DbValue> & vs) { Bindings b {vs}; - verify<std::runtime_error>(!mysql_stmt_bind_param(stmt.get(), b.binds.data()), "Param count mismatch"); - verify<std::runtime_error>(!mysql_stmt_execute(stmt.get()), "Prepared statement execute"); + verify<std::logic_error>(!mysql_stmt_bind_param(stmt.get(), b.binds.data()), "Param count mismatch"); + verify<MySQLErr>(!mysql_stmt_execute(stmt.get()), "Prepared statement execute", stmt->mysql); } std::size_t |