diff options
Diffstat (limited to 'odb/pgsql/query.cxx')
-rw-r--r-- | odb/pgsql/query.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/odb/pgsql/query.cxx b/odb/pgsql/query.cxx index e3e4d24..9d50c3b 100644 --- a/odb/pgsql/query.cxx +++ b/odb/pgsql/query.cxx @@ -187,10 +187,13 @@ namespace odb } void query:: - add (details::shared_ptr<query_param> p) + add (details::shared_ptr<query_param> p, const char* conv) { clause_.push_back (clause_part (clause_part::param)); + if (conv != 0) + clause_.back ().part = conv; + parameters_.push_back (p); bind_.push_back (bind ()); binding_.bind = &bind_[0]; @@ -354,8 +357,22 @@ namespace odb ostringstream os; os << param++; + + // Add the conversion expression, if any. + // + string::size_type p; + if (!i->part.empty ()) + { + p = i->part.find ("(?)"); + r.append (i->part, 0, p); + } + r += '$'; r += os.str (); + + if (!i->part.empty ()) + r.append (i->part, p + 3, string::npos); + break; } case clause_part::native: |