summaryrefslogtreecommitdiff
path: root/libpqpp/selectcommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/selectcommand.cpp')
-rw-r--r--libpqpp/selectcommand.cpp17
1 files changed, 1 insertions, 16 deletions
diff --git a/libpqpp/selectcommand.cpp b/libpqpp/selectcommand.cpp
index 8e3ec36..2312dbb 100644
--- a/libpqpp/selectcommand.cpp
+++ b/libpqpp/selectcommand.cpp
@@ -37,25 +37,10 @@ PQ::SelectCommand::mkdeclare() const
{
std::string psql;
psql.reserve(sql.length() + 40);
- char buf[4];
- int p = 1;
- bool inquote = false;
psql += "DECLARE ";
psql += stmntName;
psql += " CURSOR FOR ";
- 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);
return psql;
}