diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-24 15:10:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-01-24 15:10:21 +0200 |
commit | 1fa74e93cbc6ec0cc8ca8e6b653d1b530c01744a (patch) | |
tree | bd6c172a39959b4069e648b5599db8a206c216fb /odb/query.hxx | |
parent | ec2ad3cce4c5feb1dabd1fe87dc26799722def19 (diff) |
Add support for mapping char[N] to CHAR/VARCHAR database types
Also improve query support for arrays (decaying).
Diffstat (limited to 'odb/query.hxx')
-rw-r--r-- | odb/query.hxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/odb/query.hxx b/odb/query.hxx index adea4b3..67de520 100644 --- a/odb/query.hxx +++ b/odb/query.hxx @@ -51,6 +51,30 @@ namespace odb } }; + // Query parameter decay traits. + // + template <typename T> + struct decay_traits + { + typedef const T& type; + + static type + instance (); + }; + + template <typename T, std::size_t N> + struct decay_traits<T[N]> + { + typedef const T* type; + + // Use the pointer comparability as a proxy for data comparability. + // Note that it is stricter than using element comparability (i.e., + // one can compare int to char but not int* to char*). + // + static type + instance (); + }; + // VC9 cannot handle certain cases of non-type arguments with default // values in template functions (e.g., database::query()). As a result, // we have to use the impl trick below instead of simply having kind |