From 94927bfef6548ac20118586bfcd51e60b296e569 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 24 Dec 2015 03:43:16 +0000 Subject: Beginnings of embbeded MySQL --- libmysqlpp/embeddedmy-connection.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 libmysqlpp/embeddedmy-connection.cpp (limited to 'libmysqlpp/embeddedmy-connection.cpp') 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); + } + } + } +} -- cgit v1.2.3