From 1fa74e93cbc6ec0cc8ca8e6b653d1b530c01744a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 24 Jan 2013 15:10:21 +0200 Subject: Add support for mapping char[N] to CHAR/VARCHAR database types Also improve query support for arrays (decaying). --- odb/query.hxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'odb/query.hxx') 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 + struct decay_traits + { + typedef const T& type; + + static type + instance (); + }; + + template + struct decay_traits + { + 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 -- cgit v1.1