From c4db2be862a2a31361f7e0ff3a0a47e970ec2c48 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 22 May 2021 17:06:42 +0100 Subject: Wrap up mysql_query --- lib/input/mysqlConn.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/input/mysqlConn.cpp') 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 #include 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(!mysql_set_character_set(this, "utf8"), "Set character set"); } MySQLConn::~MySQLConn() { mysql_close(this); } + + void + MySQLConn::query(const char * const q) + { + verify(!mysql_query(this, q), q); + } } -- cgit v1.2.3