summaryrefslogtreecommitdiff
path: root/libmysqlpp/embeddedmy-connection.cpp
diff options
context:
space:
mode:
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);
+ }
+ }
+ }
+}