diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 03:43:45 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 06:00:07 +0000 |
commit | a9f6a2aca701adfa5e9186c938c37a9465909069 (patch) | |
tree | 07483cf0c656f576601b8bd479abb15e65578b15 | |
parent | Move TablePatch to its own files (diff) | |
download | libdbpp-a9f6a2aca701adfa5e9186c938c37a9465909069.tar.bz2 libdbpp-a9f6a2aca701adfa5e9186c938c37a9465909069.tar.xz libdbpp-a9f6a2aca701adfa5e9186c938c37a9465909069.zip |
Add briefer, smart pointer functions for getting new command instances
-rw-r--r-- | libdbpp/connection.cpp | 14 | ||||
-rw-r--r-- | libdbpp/connection.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp index aaa7591..6c36d45 100644 --- a/libdbpp/connection.cpp +++ b/libdbpp/connection.cpp @@ -1,5 +1,6 @@ #include "connection.h" #include "modifycommand.h" +#include "selectcommand.h" #include "error.h" #include <factory.impl.h> #include <buffer.h> @@ -28,6 +29,19 @@ DB::Connection::execute(const std::string & sql) const cmd->execute(true); } + +DB::SelectCommandPtr +DB::Connection::select(const std::string & sql) +{ + return DB::SelectCommandPtr(newSelectCommand(sql)); +} + +DB::ModifyCommandPtr +DB::Connection::modify(const std::string & sql) +{ + return DB::ModifyCommandPtr(newModifyCommand(sql)); +} + void DB::Connection::executeScript(std::istream & f, const boost::filesystem::path & s) const { diff --git a/libdbpp/connection.h b/libdbpp/connection.h index 7ee1bc9..8430b3d 100644 --- a/libdbpp/connection.h +++ b/libdbpp/connection.h @@ -117,8 +117,12 @@ namespace DB { virtual void executeScript(std::istream & f, const boost::filesystem::path & s) const; /// Create a new select command with the given SQL. virtual SelectCommand * newSelectCommand(const std::string & sql) const = 0; + /// Create a new select command with the given SQL [smart pointer]. + virtual boost::shared_ptr<SelectCommand> select(const std::string & sql); /// Create a new modify command with the given SQL. virtual ModifyCommand * newModifyCommand(const std::string & sql) const = 0; + /// Create a new modify command with the given SQL [smart pointer]. + virtual boost::shared_ptr<ModifyCommand> modify(const std::string & sql); /// Begin a bulk upload operation. /// @param table the target table. |