From d37aea4101f0b900f9bd09f50ffcaaac553b5b78 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 17 Oct 2015 15:45:42 +0100 Subject: Tidy up execute method --- libdbpp/connection.cpp | 12 +++--------- 1 file 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 #include #include +#include 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(newModifyCommand(sql)); + cmd->execute(true); } void -- cgit v1.2.3