summaryrefslogtreecommitdiff
path: root/libmysqlpp/embeddedmy-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-24 03:43:16 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-05-04 20:44:32 +0100
commit94927bfef6548ac20118586bfcd51e60b296e569 (patch)
tree90cc2d268219acc412321433421fb8fa7c798c5b /libmysqlpp/embeddedmy-connection.cpp
parentStandalone split (diff)
downloadlibdbpp-mysql-94927bfef6548ac20118586bfcd51e60b296e569.tar.bz2
libdbpp-mysql-94927bfef6548ac20118586bfcd51e60b296e569.tar.xz
libdbpp-mysql-94927bfef6548ac20118586bfcd51e60b296e569.zip
Beginnings of embbeded MySQL
Diffstat (limited to 'libmysqlpp/embeddedmy-connection.cpp')
-rw-r--r--libmysqlpp/embeddedmy-connection.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libmysqlpp/embeddedmy-connection.cpp b/libmysqlpp/embeddedmy-connection.cpp
new file mode 100644
index 0000000..f0bb24d
--- /dev/null
+++ b/libmysqlpp/embeddedmy-connection.cpp
@@ -0,0 +1,16 @@
+#include "embeddedmy-connection.h"
+
+NAMEDFACTORY("embeddedmysql", MySQL::Embedded::Connection, DB::ConnectionFactory);
+
+namespace MySQL {
+ namespace Embedded {
+ Connection::Connection(const std::string &)
+ {
+ mysql_init(&conn);
+ mysql_options(&conn, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
+ if (mysql_real_connect(&conn, NULL, NULL, NULL, "database1", 0, NULL, 0)) {
+ throw MySQL::Error(&conn);
+ }
+ }
+ }
+}