aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/details
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-07-10 15:17:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-07-10 15:17:15 +0200
commit304dbce8fa2a5d033870988d17709e3eae050258 (patch)
tree7ce174a99a26025480cea4bc6ee215ab1fe6c27e /odb/oracle/details
parentc10f6d2d60d1333df2d0907b2957ff52deb203ac (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/oracle/details')
-rw-r--r--odb/oracle/details/conversion.hxx59
1 files changed, 59 insertions, 0 deletions
diff --git a/odb/oracle/details/conversion.hxx b/odb/oracle/details/conversion.hxx
new file mode 100644
index 0000000..d9ea814
--- /dev/null
+++ b/odb/oracle/details/conversion.hxx
@@ -0,0 +1,59 @@
+// file : odb/oracle/details/conversion.hxx
+// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_ORACLE_DETAILS_CONVERSION_HXX
+#define ODB_ORACLE_DETAILS_CONVERSION_HXX
+
+#include <odb/oracle/traits.hxx>
+
+#include <odb/details/meta/answer.hxx>
+
+namespace odb
+{
+ // @@ Revise this.
+ //
+ namespace details {}
+
+ namespace oracle
+ {
+ namespace details
+ {
+ using namespace odb::details;
+
+ // Detect whether conversion is specified in type_traits.
+ //
+ template <typename T>
+ meta::yes
+ conversion_p_test (typename type_traits<T>::conversion*);
+
+ template <typename T>
+ meta::no
+ conversion_p_test (...);
+
+ template <typename T>
+ struct conversion_p
+ {
+ static const bool value =
+ sizeof (conversion_p_test<T> (0)) == sizeof (meta::yes);
+ };
+
+ template <typename T, bool = conversion_p<T>::value>
+ struct conversion;
+
+ template <typename T>
+ struct conversion<T, true>
+ {
+ static const char* to () {return type_traits<T>::conversion::to ();}
+ };
+
+ template <typename T>
+ struct conversion<T, false>
+ {
+ static const char* to () {return 0;}
+ };
+ }
+ }
+}
+
+#endif // ODB_ORACLE_DETAILS_CONVERSION_HXX