diff options
Diffstat (limited to 'libpqpp/pq-modifycommand.cpp')
-rw-r--r-- | libpqpp/pq-modifycommand.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/libpqpp/pq-modifycommand.cpp b/libpqpp/pq-modifycommand.cpp index caad5c6..4cc31d2 100644 --- a/libpqpp/pq-modifycommand.cpp +++ b/libpqpp/pq-modifycommand.cpp @@ -6,8 +6,7 @@ PQ::ModifyCommand::ModifyCommand(Connection * conn, const std::string & sql, unsigned int no) : DB::Command(sql), DB::ModifyCommand(sql), - PQ::Command(conn, sql, no), - pstmt(nullptr) + PQ::PreparedStatement(conn, sql, no) { } @@ -15,25 +14,6 @@ PQ::ModifyCommand::~ModifyCommand() { } -const char * -PQ::ModifyCommand::prepare() const -{ - if (pstmt) { - return pstmt; - } - auto hash(std::hash<std::string>()(sql)); - auto i = c->preparedStatements.find(hash); - if (i != c->preparedStatements.end()) { - return (pstmt = i->second.c_str()); - } - std::string psql; - psql.reserve(sql.length() + 20); - prepareSql(psql, sql); - c->checkResultFree(PQprepare( - c->conn, stmntName.c_str(), psql.c_str(), values.size(), NULL), PGRES_COMMAND_OK); - return (pstmt = c->preparedStatements.insert({hash, stmntName}).first->second.c_str()); -} - unsigned int PQ::ModifyCommand::execute(bool anc) { |