From fc64c86521d418647109ca8ef54fe6d1eb70573d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 17 Oct 2015 21:13:20 +0100 Subject: Add base function for getting the last applied insert Id --- libdbpp/connection.cpp | 6 ++++++ libdbpp/connection.h | 3 +++ 2 files changed, 9 insertions(+) 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 resolvePlugin(const std::type_info &, const std::string &); private: -- cgit v1.2.3