summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/connection.cpp11
-rw-r--r--libdbpp/connection.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index c42c4fb..2d93ce3 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -1,5 +1,7 @@
#include "connection.h"
#include "modifycommand.h"
+#include <factory.impl.h>
+#include <buffer.h>
DB::Connection::~Connection()
{
@@ -37,3 +39,12 @@ DB::Connection::releaseSavepoint(const std::string & sp) const
execute("RELEASE SAVEPOINT " + sp);
}
+boost::optional<std::string>
+DB::Connection::resolvePlugin(const std::type_info &, const std::string & name)
+{
+ return stringbf("libdbpp-%s.so", name);
+}
+
+INSTANIATEFACTORY(DB::Connection, std::string);
+PLUGINRESOLVER(DB::ConnectionFactory, DB::Connection::resolvePlugin);
+
diff --git a/libdbpp/connection.h b/libdbpp/connection.h
index 2da3f05..9c6b46e 100644
--- a/libdbpp/connection.h
+++ b/libdbpp/connection.h
@@ -2,6 +2,7 @@
#define CONNECTION_H
#include <string>
+#include <factory.h>
#include <visibility.h>
namespace DB {
@@ -41,8 +42,11 @@ namespace DB {
virtual void endBulkUpload(const char *) const = 0;
virtual size_t bulkUploadData(const char *, size_t) const = 0;
+ static boost::optional<std::string> resolvePlugin(const std::type_info &, const std::string &);
private:
};
+
+ typedef AdHoc::Factory<Connection, std::string> ConnectionFactory;
}
#endif