diff options
-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. |