summaryrefslogtreecommitdiff
path: root/libmysqlpp/connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-09-02 19:54:28 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-09-02 20:21:26 +0100
commitcad84e6309e2f7b297e84904aadf30f075bf77d6 (patch)
tree9fc0e87dd821f8c7d741f82dc95daccedc259fe4 /libmysqlpp/connection.cpp
parentMove to C++0y (diff)
downloadlibdbpp-mysql-cad84e6309e2f7b297e84904aadf30f075bf77d6.tar.bz2
libdbpp-mysql-cad84e6309e2f7b297e84904aadf30f075bf77d6.tar.xz
libdbpp-mysql-cad84e6309e2f7b297e84904aadf30f075bf77d6.zip
Use libadhocutil
Diffstat (limited to 'libmysqlpp/connection.cpp')
-rw-r--r--libmysqlpp/connection.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/libmysqlpp/connection.cpp b/libmysqlpp/connection.cpp
index b6d1b1b..d0cb53d 100644
--- a/libmysqlpp/connection.cpp
+++ b/libmysqlpp/connection.cpp
@@ -2,7 +2,7 @@
#include "error.h"
#include "selectcommand.h"
#include "modifycommand.h"
-#include "reflection.h"
+#include <nvpParse.h>
#include <ucontext.h>
#include <boost/optional.hpp>
@@ -17,8 +17,6 @@ class Opts {
unsigned int port;
OptString unix_socket;
OptString options;
-
- static Reflector<Opts>::Vars vars;
};
const char *
@@ -40,14 +38,15 @@ namespace std {
}
}
-Reflector<Opts>::Vars Opts::vars = {
- Map(Opts, server),
- Map(Opts, user),
- Map(Opts, password),
- Map(Opts, database),
- Map(Opts, unix_socket),
- Map(Opts, port),
- Map(Opts, options),
+using namespace AdHoc;
+NvpTarget(Opts) OptsTargetMap {
+ NvpValue(Opts, server),
+ NvpValue(Opts, user),
+ NvpValue(Opts, password),
+ NvpValue(Opts, database),
+ NvpValue(Opts, unix_socket),
+ NvpValue(Opts, port),
+ NvpValue(Opts, options),
};
@@ -55,7 +54,9 @@ MySQL::Connection::Connection(const std::string & str) :
txDepth(0),
rolledback(false)
{
- Opts o(Reflector<Opts>::NameValueNew(str));
+ std::stringstream i(str);
+ Opts o;
+ NvpParse::parse(i, OptsTargetMap, o);
mysql_init(&conn);
if (o.options) {
mysql_options(&conn, MYSQL_READ_DEFAULT_GROUP, ~o.options);