summaryrefslogtreecommitdiff
path: root/libpqpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-05-24 21:47:17 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-05-24 21:47:17 +0100
commit0829f52f9d9de7e2aa442224a01723c9a02856d8 (patch)
tree775112195507f196f2125a9432846725f73de9c6 /libpqpp
parentUse prepared statements for bulk selects (diff)
downloadlibdbpp-postgresql-1.0.5.tar.bz2
libdbpp-postgresql-1.0.5.tar.xz
libdbpp-postgresql-1.0.5.zip
Don't truncate and create random breakage with over 100 paramslibdbpp-postgresql-1.0.5
Diffstat (limited to 'libpqpp')
-rw-r--r--libpqpp/pq-command.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libpqpp/pq-command.cpp b/libpqpp/pq-command.cpp
index 790c7f7..14efa77 100644
--- a/libpqpp/pq-command.cpp
+++ b/libpqpp/pq-command.cpp
@@ -27,13 +27,12 @@ PQ::Command::~Command()
void
PQ::Command::prepareSql(std::string & psql, const std::string & sql)
{
- char buf[4];
+ char buf[10];
int p = 1;
bool inquote = false;
for(std::string::const_iterator i = sql.begin(); i != sql.end(); ++i) {
if (*i == '?' && !inquote) {
- snprintf(buf, 4, "$%d", p++);
- psql += buf;
+ psql.append(buf, snprintf(buf, 10, "$%d", p++));
}
else if (*i == '\'') {
inquote = !inquote;