diff options
-rw-r--r-- | libmysqlpp/Jamfile.jam | 3 | ||||
-rw-r--r-- | libmysqlpp/connection.cpp | 25 |
2 files changed, 15 insertions, 13 deletions
diff --git a/libmysqlpp/Jamfile.jam b/libmysqlpp/Jamfile.jam index a03e470..21414f2 100644 --- a/libmysqlpp/Jamfile.jam +++ b/libmysqlpp/Jamfile.jam @@ -4,6 +4,7 @@ alias glibmm : : : : ; lib mysql ; +lib adhocutil : : : : <include>/usr/include/adhocutil ; alias libmysql : : : : <cflags>"`mysql_config --include`" @@ -17,7 +18,7 @@ lib mysqlpp : <library>glibmm <library>libmysql <library>../libdbpp - <include>../libmisc + <library>adhocutil : : <include>. <cflags>"-I`mysql_config --include`" 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); |