From cad84e6309e2f7b297e84904aadf30f075bf77d6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 2 Sep 2015 19:54:28 +0100 Subject: Use libadhocutil --- libmysqlpp/connection.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'libmysqlpp/connection.cpp') 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 #include #include @@ -17,8 +17,6 @@ class Opts { unsigned int port; OptString unix_socket; OptString options; - - static Reflector::Vars vars; }; const char * @@ -40,14 +38,15 @@ namespace std { } } -Reflector::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::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); -- cgit v1.2.3