diff options
Diffstat (limited to 'libpqpp/pq-prepared.cpp')
-rw-r--r-- | libpqpp/pq-prepared.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libpqpp/pq-prepared.cpp b/libpqpp/pq-prepared.cpp index 8678c11..defcee1 100644 --- a/libpqpp/pq-prepared.cpp +++ b/libpqpp/pq-prepared.cpp @@ -9,8 +9,8 @@ #include <utility> #include <vector> -PQ::PreparedStatement::PreparedStatement(Connection * c, const std::string & sql, const DB::CommandOptionsCPtr & opts) : - DB::Command(sql), Command(c, sql, opts), pstmt(nullptr) +PQ::PreparedStatement::PreparedStatement(Connection * conn, const std::string & sql, + const DB::CommandOptionsCPtr & opts) : DB::Command(sql), Command(conn, sql, opts), pstmt(nullptr) { } @@ -20,9 +20,8 @@ PQ::PreparedStatement::prepare() const if (pstmt) { return pstmt; } - auto i = c->preparedStatements.find(hash); - if (i != c->preparedStatements.end()) { - return (pstmt = i->second.c_str()); + if (auto existingItr = c->preparedStatements.find(hash); existingItr != c->preparedStatements.end()) { + return (pstmt = existingItr->second.c_str()); } std::stringstream psql; prepareSql(psql, sql); |