diff options
Diffstat (limited to 'lib/input/mysqlConn.cpp')
-rw-r--r-- | lib/input/mysqlConn.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/input/mysqlConn.cpp b/lib/input/mysqlConn.cpp index 6c00628..3a2c9f4 100644 --- a/lib/input/mysqlConn.cpp +++ b/lib/input/mysqlConn.cpp @@ -1,4 +1,6 @@ #include "mysqlConn.h" +#include "helpers.h" +#include <mysql.h> #include <stdexcept> namespace MyGrate::Input { @@ -11,11 +13,17 @@ namespace MyGrate::Input { mysql_close(this); throw std::runtime_error("ConnectionError"); } - mysql_query(this, "SET NAMES utf8"); + verify<std::runtime_error>(!mysql_set_character_set(this, "utf8"), "Set character set"); } MySQLConn::~MySQLConn() { mysql_close(this); } + + void + MySQLConn::query(const char * const q) + { + verify<std::runtime_error>(!mysql_query(this, q), q); + } } |