diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 03:43:16 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-04 20:44:32 +0100 |
commit | 94927bfef6548ac20118586bfcd51e60b296e569 (patch) | |
tree | 90cc2d268219acc412321433421fb8fa7c798c5b /libmysqlpp/embeddedmy-connection.cpp | |
parent | Standalone split (diff) | |
download | libdbpp-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.cpp | 16 |
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); + } + } + } +} |