summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-17 21:13:20 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-17 21:44:34 +0100
commitfc64c86521d418647109ca8ef54fe6d1eb70573d (patch)
treec36f5162f8eaccf1404243f255e9cff5c2225616
parentRestructure alias all list and add missing things (diff)
downloadlibdbpp-fc64c86521d418647109ca8ef54fe6d1eb70573d.tar.bz2
libdbpp-fc64c86521d418647109ca8ef54fe6d1eb70573d.tar.xz
libdbpp-fc64c86521d418647109ca8ef54fe6d1eb70573d.zip
Add base function for getting the last applied insert Idlibdbpp-0.9.1
-rw-r--r--libdbpp/connection.cpp6
-rw-r--r--libdbpp/connection.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index e5a64f5..048b3b5 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -47,6 +47,12 @@ DB::Connection::resolvePlugin(const std::type_info &, const std::string & name)
return stringbf("libdbpp-%s.so", name);
}
+int64_t
+DB::Connection::insertId() const
+{
+ throw std::runtime_error("insertId not implemented for this driver.");
+}
+
INSTANTIATEFACTORY(DB::Connection, std::string);
PLUGINRESOLVER(DB::ConnectionFactory, DB::Connection::resolvePlugin);
diff --git a/libdbpp/connection.h b/libdbpp/connection.h
index c9111f8..9ff757b 100644
--- a/libdbpp/connection.h
+++ b/libdbpp/connection.h
@@ -67,6 +67,9 @@ namespace DB {
/// Load data for the current bulk load operation.
virtual size_t bulkUploadData(const char *, size_t) const = 0;
+ /// Return the Id used in the last insert
+ virtual int64_t insertId() const;
+
/// AdHoc plugin resolver helper for database connectors.
static boost::optional<std::string> resolvePlugin(const std::type_info &, const std::string &);
private: