summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-29 04:22:30 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-29 06:00:07 +0000
commita38f7ab1f5eb157c3deb88285bf819627ec421c5 (patch)
treee3657452009f4a47aee3e0f29029c2055302c21c
parentNon-const execute and save points (diff)
downloadlibdbpp-a38f7ab1f5eb157c3deb88285bf819627ec421c5.tar.bz2
libdbpp-a38f7ab1f5eb157c3deb88285bf819627ec421c5.tar.xz
libdbpp-a38f7ab1f5eb157c3deb88285bf819627ec421c5.zip
Default (not supported) bulk upload implementation
-rw-r--r--libdbpp/connection.cpp18
-rw-r--r--libdbpp/connection.h6
-rw-r--r--libdbpp/unittests/testConnection.cpp4
3 files changed, 21 insertions, 7 deletions
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index b58a0e1..b267af1 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -69,6 +69,24 @@ DB::Connection::releaseSavepoint(const std::string & sp)
execute("RELEASE SAVEPOINT " + sp);
}
+void
+DB::Connection::beginBulkUpload(const char *, const char *)
+{
+ throw DB::BulkUploadNotSupported();
+}
+
+void
+DB::Connection::endBulkUpload(const char *)
+{
+ throw DB::BulkUploadNotSupported();
+}
+
+size_t
+DB::Connection::bulkUploadData(const char *, size_t) const
+{
+ throw DB::BulkUploadNotSupported();
+}
+
boost::optional<std::string>
DB::Connection::resolvePlugin(const std::type_info &, const std::string & name)
{
diff --git a/libdbpp/connection.h b/libdbpp/connection.h
index 3c0627a..9690164 100644
--- a/libdbpp/connection.h
+++ b/libdbpp/connection.h
@@ -127,11 +127,11 @@ namespace DB {
/// Begin a bulk upload operation.
/// @param table the target table.
/// @param opts database specific options to the load command.
- virtual void beginBulkUpload(const char * table, const char * opts) const = 0;
+ virtual void beginBulkUpload(const char * table, const char * opts);
/// Finish a bulk upload operation.
- virtual void endBulkUpload(const char *) const = 0;
+ virtual void endBulkUpload(const char *);
/// Load data for the current bulk load operation.
- virtual size_t bulkUploadData(const char *, size_t) const = 0;
+ virtual size_t bulkUploadData(const char *, size_t) const;
/// Return the Id used in the last insert
virtual int64_t insertId() const;
diff --git a/libdbpp/unittests/testConnection.cpp b/libdbpp/unittests/testConnection.cpp
index a5fc1a6..c42ddca 100644
--- a/libdbpp/unittests/testConnection.cpp
+++ b/libdbpp/unittests/testConnection.cpp
@@ -29,10 +29,6 @@ class MockDb : public DB::Connection {
DB::SelectCommand * newSelectCommand(const std::string &) const { return nullptr; }
DB::ModifyCommand * newModifyCommand(const std::string &) const { return nullptr; }
- void beginBulkUpload(const char *, const char *) const {}
- void endBulkUpload(const char *) const {}
- size_t bulkUploadData(const char *, size_t) const {return 0;}
-
mutable std::vector<std::string> executed;
mutable unsigned int txDepth;
};