diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-12-31 04:59:00 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-12-31 04:59:00 +0000 |
commit | 29269c1cf7d49dd4596cde49682e350875cb51f1 (patch) | |
tree | 21ea7c73a31caeafee3e5cd0799bfc2570ba3ceb /libpqpp/pq-connection.cpp | |
parent | More complex approach to setting tables to unlogged to handle foreign key dep... (diff) | |
download | libdbpp-postgresql-29269c1cf7d49dd4596cde49682e350875cb51f1.tar.bz2 libdbpp-postgresql-29269c1cf7d49dd4596cde49682e350875cb51f1.tar.xz libdbpp-postgresql-29269c1cf7d49dd4596cde49682e350875cb51f1.zip |
Do lots more work with compile time formatter instead runtime formatters
Diffstat (limited to 'libpqpp/pq-connection.cpp')
-rw-r--r-- | libpqpp/pq-connection.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp index 078272e..b7360e0 100644 --- a/libpqpp/pq-connection.cpp +++ b/libpqpp/pq-connection.cpp @@ -6,6 +6,7 @@ #include <unistd.h> #include <poll.h> #include <boost/assert.hpp> +#include <compileTimeFormatter.h> NAMEDFACTORY("postgresql", PQ::Connection, DB::ConnectionFactory); @@ -137,12 +138,11 @@ PQ::Connection::checkResultFree(PGresult * res, int expected, int alt) const PQclear(res); } +AdHocFormatter(PQConnectionCopyFrom, "COPY %? FROM STDIN %?"); void PQ::Connection::beginBulkUpload(const char * table, const char * extra) { - char buf[BUFSIZ]; - snprintf(buf, BUFSIZ, "COPY %s FROM STDIN %s", table, extra); - checkResultFree(PQexec(conn, buf), PGRES_COPY_IN); + checkResultFree(PQexec(conn, PQConnectionCopyFrom::get(table, extra).c_str()), PGRES_COPY_IN); } void |