diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-10 15:17:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-07-10 15:17:12 +0200 |
commit | f3f9389365a03603c6f9bcc4d502ff4049c72fe2 (patch) | |
tree | ef7bfa4d1c2791e5bc3365649552b12c6820a1d8 /odb/mssql/query.cxx | |
parent | 7ed3669ac5c5efb5cc05ee777ed0ca1f52f0e69d (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/mssql/query.cxx')
-rw-r--r-- | odb/mssql/query.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/odb/mssql/query.cxx b/odb/mssql/query.cxx index 368cd82..07dba0e 100644 --- a/odb/mssql/query.cxx +++ b/odb/mssql/query.cxx @@ -118,10 +118,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]; @@ -258,7 +261,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: |