diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-10-17 15:45:42 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-10-17 15:45:42 +0100 |
commit | d37aea4101f0b900f9bd09f50ffcaaac553b5b78 (patch) | |
tree | 7d1c0efe2882e8ad5166a2570b36f1dd241203f8 | |
parent | Exclude fake DB class from coverage (diff) | |
download | libdbpp-d37aea4101f0b900f9bd09f50ffcaaac553b5b78.tar.bz2 libdbpp-d37aea4101f0b900f9bd09f50ffcaaac553b5b78.tar.xz libdbpp-d37aea4101f0b900f9bd09f50ffcaaac553b5b78.zip |
Tidy up execute method
-rw-r--r-- | libdbpp/connection.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp index 6a86c00..e5a64f5 100644 --- a/libdbpp/connection.cpp +++ b/libdbpp/connection.cpp @@ -3,6 +3,7 @@ #include <factory.impl.h> #include <buffer.h> #include <sqlParse.h> +#include <boost/shared_ptr.hpp> DB::Connection::~Connection() { @@ -11,15 +12,8 @@ DB::Connection::~Connection() void DB::Connection::execute(const std::string & sql) const { - ModifyCommand * cmd = newModifyCommand(sql); - try { - cmd->execute(true); - delete cmd; - } - catch (...) { - delete cmd; - throw; - } + auto cmd = boost::shared_ptr<ModifyCommand>(newModifyCommand(sql)); + cmd->execute(true); } void |