summaryrefslogtreecommitdiff
path: root/libpqpp/command.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/command.cpp')
-rw-r--r--libpqpp/command.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpqpp/command.cpp b/libpqpp/command.cpp
index 7617bd1..a7dd1fd 100644
--- a/libpqpp/command.cpp
+++ b/libpqpp/command.cpp
@@ -33,11 +33,16 @@ PQ::Command::prepare() const
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 == '?') {
+ if (*i == '?' && !inquote) {
snprintf(buf, 4, "$%d", p++);
psql += buf;
}
+ else if (*i == '\'') {
+ inquote = !inquote;
+ psql += *i;
+ }
else {
psql += *i;
}