diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-07 14:26:09 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-07 14:26:09 +0000 |
commit | 2a3f8ddab3542bb0b7c456780eaf53f2e4dc363e (patch) | |
tree | fa23d5779e2dc525348185a6c1755f3889f40d81 /libpqpp/modifycommand.cpp | |
parent | Improve connection failure detection (diff) | |
download | libdbpp-postgresql-2a3f8ddab3542bb0b7c456780eaf53f2e4dc363e.tar.bz2 libdbpp-postgresql-2a3f8ddab3542bb0b7c456780eaf53f2e4dc363e.tar.xz libdbpp-postgresql-2a3f8ddab3542bb0b7c456780eaf53f2e4dc363e.zip |
Merge select and modify command's SQL parserlibdbpp-postgresql-0.9.4
Diffstat (limited to 'libpqpp/modifycommand.cpp')
-rw-r--r-- | libpqpp/modifycommand.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/libpqpp/modifycommand.cpp b/libpqpp/modifycommand.cpp index 3eb41ec..460ec31 100644 --- a/libpqpp/modifycommand.cpp +++ b/libpqpp/modifycommand.cpp @@ -21,22 +21,7 @@ PQ::ModifyCommand::prepare() const if (!prepared) { std::string psql; psql.reserve(sql.length() + 20); - char buf[4]; - 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; - } - else if (*i == '\'') { - inquote = !inquote; - psql += *i; - } - else { - psql += *i; - } - } + prepareSql(psql, sql); c->checkResultFree(PQprepare( c->conn, stmntName.c_str(), psql.c_str(), values.size(), NULL), PGRES_COMMAND_OK); prepared = true; |