aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/traits.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-09-11 13:55:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-09-11 13:55:47 +0200
commit80b80d1cbffe1c230d39cad1e2b7ac452da197cd (patch)
tree16cdcc875d2f7a6577a4a59ea14ffe00b8bee2a6 /odb/oracle/traits.txx
parent2d725c335afc7f051e3f461f498b6f1bdbdc5a4d (diff)
Add support for mapping std::array to BLOB and char[16] to UUID types
Diffstat (limited to 'odb/oracle/traits.txx')
-rw-r--r--odb/oracle/traits.txx62
1 files changed, 62 insertions, 0 deletions
diff --git a/odb/oracle/traits.txx b/odb/oracle/traits.txx
index 7916ef7..f620e18 100644
--- a/odb/oracle/traits.txx
+++ b/odb/oracle/traits.txx
@@ -65,5 +65,67 @@ namespace odb
*b = c;
return true;
}
+
+#ifdef ODB_CXX11
+ //
+ // default_value_traits<std::array<char, N>, id_blob>
+ //
+
+ template <std::size_t N>
+ bool default_value_traits<std::array<char, N>, id_blob>::
+ result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position)
+ {
+ ub4 n (*position + s < N ? s : N - *position);
+ std::memcpy (static_cast<char*> (c) + *position, b, n);
+ *position += n;
+ return true;
+ }
+
+ template <std::size_t N>
+ bool default_value_traits<std::array<char, N>, id_blob>::
+ param_callback (const void* c,
+ ub4*,
+ const void** b,
+ ub4* s,
+ chunk_position* p,
+ void*,
+ ub4)
+ {
+ *p = chunk_one;
+ *s = static_cast<ub4> (N);
+ *b = c;
+ return true;
+ }
+
+ //
+ // default_value_traits<std::array<unsigned char, N>, id_blob>
+ //
+
+ template <std::size_t N>
+ bool default_value_traits<std::array<unsigned char, N>, id_blob>::
+ result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position)
+ {
+ ub4 n (*position + s < N ? s : N - *position);
+ std::memcpy (static_cast<unsigned char*> (c) + *position, b, n);
+ *position += n;
+ return true;
+ }
+
+ template <std::size_t N>
+ bool default_value_traits<std::array<unsigned char, N>, id_blob>::
+ param_callback (const void* c,
+ ub4*,
+ const void** b,
+ ub4* s,
+ chunk_position* p,
+ void*,
+ ub4)
+ {
+ *p = chunk_one;
+ *s = static_cast<ub4> (N);
+ *b = c;
+ return true;
+ }
+#endif
}
}