summaryrefslogtreecommitdiff
path: root/libpqpp/pq-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-09 12:06:17 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-09 14:00:32 +0100
commitfbad5dcdf8f17d1a3f3ff954f48b55d605d0a50c (patch)
tree38683378917dcea930f220da73c70392bd2363c6 /libpqpp/pq-connection.cpp
parentC++17 (diff)
downloadlibdbpp-postgresql-fbad5dcdf8f17d1a3f3ff954f48b55d605d0a50c.tar.bz2
libdbpp-postgresql-fbad5dcdf8f17d1a3f3ff954f48b55d605d0a50c.tar.xz
libdbpp-postgresql-fbad5dcdf8f17d1a3f3ff954f48b55d605d0a50c.zip
Updates to include C++17 changes for command options.
Diffstat (limited to 'libpqpp/pq-connection.cpp')
-rw-r--r--libpqpp/pq-connection.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp
index 214f211..3ec8991 100644
--- a/libpqpp/pq-connection.cpp
+++ b/libpqpp/pq-connection.cpp
@@ -62,7 +62,7 @@ PQ::Connection::rollbackTxInt()
}
void
-PQ::Connection::execute(const std::string & sql, const DB::CommandOptions *)
+PQ::Connection::execute(const std::string & sql, const DB::CommandOptionsCPtr &)
{
checkResultFree(PQexec(conn, sql.c_str()), PGRES_COMMAND_OK, PGRES_TUPLES_OK);
}
@@ -97,9 +97,9 @@ PQ::Connection::ping() const
DB::SelectCommandPtr
-PQ::Connection::select(const std::string & sql, const DB::CommandOptions * opts)
+PQ::Connection::select(const std::string & sql, const DB::CommandOptionsCPtr & opts)
{
- auto pqco = dynamic_cast<const CommandOptions *>(opts);
+ auto pqco = std::dynamic_pointer_cast<const CommandOptions>(opts);
if (pqco && !pqco->useCursor) {
return std::make_shared<BulkSelectCommand>(this, sql, pqco, opts);
}
@@ -107,7 +107,7 @@ PQ::Connection::select(const std::string & sql, const DB::CommandOptions * opts)
}
DB::ModifyCommandPtr
-PQ::Connection::modify(const std::string & sql, const DB::CommandOptions * opts)
+PQ::Connection::modify(const std::string & sql, const DB::CommandOptionsCPtr & opts)
{
return std::make_shared<ModifyCommand>(this, sql, opts);
}
@@ -176,11 +176,11 @@ PQ::Connection::bulkUploadData(const char * data, size_t len) const
}
static const std::string selectLastVal("SELECT lastval()");
-static const DB::CommandOptions selectLastValOpts(std::hash<std::string>()(selectLastVal));
+static const DB::CommandOptionsCPtr selectLastValOpts = std::make_shared<DB::CommandOptions>(std::hash<std::string>()(selectLastVal));
int64_t
PQ::Connection::insertId()
{
- BulkSelectCommand getId(this, selectLastVal, nullptr, &selectLastValOpts);
+ BulkSelectCommand getId(this, selectLastVal, nullptr, selectLastValOpts);
int64_t id = -1;
while (getId.fetch()) {
getId[0] >> id;