diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-10 15:17:14 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-10 15:17:14 +0200 |
commit | 1568e64c2135bf245de960ae614bd3533c6d157a (patch) | |
tree | fe9d13549fe51ec95a22a3e0770e2a488fa57007 /odb/sqlite/query.cxx | |
parent | 47d783b340df91a43abc36470c78f998db0b33fe (diff) |
Add support for custom database type mapping
New pragma qualifier, map, and specifiers: as, to, from. New tests:
<database>/custom.
Diffstat (limited to 'odb/sqlite/query.cxx')
-rw-r--r-- | odb/sqlite/query.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/odb/sqlite/query.cxx b/odb/sqlite/query.cxx index 0adf8d9..2c0706a 100644 --- a/odb/sqlite/query.cxx +++ b/odb/sqlite/query.cxx @@ -188,9 +188,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_->add (p); } @@ -287,7 +291,20 @@ namespace odb if (last != ' ' && last != '(') r += ' '; + // 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 += '?'; + + if (!i->part.empty ()) + r.append (i->part, p + 3, string::npos); + break; } case clause_part::native: |