5 #ifndef ODB_ORACLE_TRAITS_HXX
6 #define ODB_ORACLE_TRAITS_HXX
10 #include <odb/details/config.hxx>
27 #include <odb/details/buffer.hxx>
28 #include <odb/details/wrapper-p.hxx>
30 #include <odb/oracle/details/export.hxx>
31 #include <odb/oracle/details/number.hxx>
103 template <
typename T, database_type_
id>
108 template <
bool unsign>
125 template <
typename T>
132 template <
bool unsign>
149 template <
typename T>
156 template <
typename T>
164 template <
typename T>
167 template <
typename T>
170 template <
typename T>
178 template <
typename T>
187 template <
typename T>
193 template <
typename T>
199 template <
typename T>
205 template <
typename T>
208 template <
typename T>
211 template <
typename T>
214 template <
typename T>
217 template <
typename T>
220 template <
typename T>
227 template <
typename W, database_type_
id,
bool null_handler>
230 template <
typename T, database_type_
id>
233 template <typename T, database_type_id, bool w = details::wrapper_p<T>::r>
236 template <
typename T, database_type_
id ID>
242 template <
typename W, database_type_
id ID>
250 template <
typename T, database_type_
id ID>
259 template <
typename W, database_type_
id ID>
274 vtraits::set_value (wtraits::set_ref (v), i, is_null);
280 vtraits::set_image (i, is_null, wtraits::get_ref (v));
286 set_value (W& v,
const char* i, std::size_t n,
bool is_null)
288 vtraits::set_value (wtraits::set_ref (v), i, n, is_null);
300 vtraits::set_image (i, c, n, is_null, wtraits::get_ref (v));
306 set_image (
char* i, std::size_t& n,
bool& is_null,
const W& v)
308 vtraits::set_image (i, n, is_null, wtraits::get_ref (v));
316 vtraits::set_value (wtraits::set_ref (v), cb, context, is_null);
321 const void*& context,
325 vtraits::set_image (cb, context, is_null, wtraits::get_ref (v));
329 template <
typename W, database_type_
id ID>
345 wtraits::set_null (v);
347 vtraits::set_value (wtraits::set_ref (v), i, is_null);
353 is_null = wtraits::get_null (v);
356 vtraits::set_image (i, is_null, wtraits::get_ref (v));
362 set_value (W& v,
const char* i, std::size_t n,
bool is_null)
365 wtraits::set_null (v);
367 vtraits::set_value (wtraits::set_ref (v), i, n, is_null);
379 is_null = wtraits::get_null (v);
382 vtraits::set_image (i, c, n, is_null, wtraits::get_ref (v));
388 set_image (
char* i, std::size_t& n,
bool& is_null,
const W& v)
390 is_null = wtraits::get_null (v);
393 vtraits::set_image (i, n, is_null, wtraits::get_ref (v));
402 wtraits::set_null (v);
404 vtraits::set_value (wtraits::set_ref (v), cb, context, is_null);
409 const void*& context,
413 is_null = wtraits::get_null (v);
416 vtraits::set_image (cb, context, is_null, wtraits::get_ref (v));
420 template <
typename T, database_type_
id ID>
421 struct default_value_traits
446 template <
typename T,
bool unsign>
449 template <
typename T>
453 set_value (T& v,
const char* b, std::size_t n,
bool is_null)
456 v =
static_cast<T
> (details::number_to_int64 (b, n));
465 details::int64_to_number (b, n, static_cast<long long> (v));
469 template <
typename T>
473 set_value (T& v,
const char* b, std::size_t n,
bool is_null)
476 v =
static_cast<T
> (details::number_to_uint64 (b, n));
485 details::uint64_to_number (b, n, static_cast<unsigned long long> (v));
489 template <
typename T>
524 const std::string& v)
533 std::memcpy (b, v.c_str (), n);
575 std::memcpy (b, v, n);
600 set_value (
char*
const& v,
615 template <std::
size_t N>
642 template <std::
size_t N>
646 template <std::
size_t N>
653 template <std::
size_t N>
654 struct std_array_value_traits
656 typedef std::array<char, N> value_type;
657 typedef std::array<char, N> query_type;
658 typedef details::buffer image_type;
661 set_value (value_type& v,
680 template <std::
size_t N>
681 struct default_value_traits<std::array<char, N>,
id_string>:
682 std_array_value_traits<N> {};
684 template <std::
size_t N>
685 struct default_value_traits<std::array<char, N>,
id_nstring>:
686 std_array_value_traits<N> {};
760 std::memcpy (b, &v.front (), n);
767 struct LIBODB_ORACLE_EXPORT
779 const unsigned char* ub (reinterpret_cast<const unsigned char*> (b));
780 v.assign (ub, ub + n);
802 std::memcpy (b, &v.front (), n);
808 template <std::
size_t N>
816 set_value (
char*
const& v,
const char* b, std::size_t n,
bool is_null)
819 std::memcpy (v, b, (n < N ? n : N));
821 std::memset (v, 0, N);
833 std::memcpy (b, v, n);
839 template <std::
size_t N>
853 std::memcpy (v, b, (n < N ? n : N));
855 std::memset (v, 0, N);
863 const unsigned char* v)
867 std::memcpy (b, v, n);
874 template <std::
size_t N>
875 struct default_value_traits<std::array<char, N>,
id_raw>
886 std::memcpy (v.data (), b, (n < N ? n : N));
888 std::memset (v.data (), 0, N);
900 std::memcpy (b, v.data (), n);
906 template <std::
size_t N>
907 struct default_value_traits<std::array<unsigned char, N>,
id_raw>
910 typedef std::array<unsigned char, N>
value_type;
918 std::memcpy (v.data (), b, (n < N ? n : N));
920 std::memset (v.data (), 0, N);
932 std::memcpy (b, v.data (), n);
954 cb = &result_callback;
963 const void*& context,
965 const std::string& v)
968 cb = ¶m_callback;
973 result_callback (
void* context,
974 ub4* position_context,
980 param_callback (
const void* context,
981 ub4* position_context,
1020 cb = &result_callback;
1029 const void*& context,
1034 cb = ¶m_callback;
1039 result_callback (
void* context,
1040 ub4* position_context,
1046 param_callback (
const void* context,
1047 ub4* position_context,
1048 const void** buffer,
1058 struct LIBODB_ORACLE_EXPORT
1074 cb = &result_callback;
1083 const void*& context,
1088 cb = ¶m_callback;
1093 result_callback (
void* context,
1094 ub4* position_context,
1100 param_callback (
const void* context,
1101 ub4* position_context,
1102 const void** buffer,
1111 template <std::
size_t N>
1127 cb = &result_callback;
1131 std::memset (v, 0, N);
1136 const void*& context,
1141 cb = ¶m_callback;
1146 result_callback (
void* context,
1147 ub4* position_context,
1153 param_callback (
const void* context,
1154 ub4* position_context,
1155 const void** buffer,
1164 template <std::
size_t N>
1180 cb = &result_callback;
1184 std::memset (v, 0, N);
1189 const void*& context,
1191 const unsigned char* v)
1194 cb = ¶m_callback;
1199 result_callback (
void* context,
1200 ub4* position_context,
1206 param_callback (
const void* context,
1207 ub4* position_context,
1208 const void** buffer,
1218 template <std::
size_t N>
1219 struct default_value_traits<std::array<char, N>,
id_blob>
1234 cb = &result_callback;
1235 context = v.data ();
1238 std::memset (v.data (), 0, N);
1243 const void*& context,
1248 cb = ¶m_callback;
1249 context = v.data ();
1253 result_callback (
void* context,
1254 ub4* position_context,
1260 param_callback (
const void* context,
1261 ub4* position_context,
1262 const void** buffer,
1271 template <std::
size_t N>
1272 struct default_value_traits<std::array<unsigned char, N>,
id_blob>
1275 typedef std::array<unsigned char, N>
value_type;
1287 cb = &result_callback;
1288 context = v.data ();
1291 std::memset (v.data (), 0, N);
1296 const void*& context,
1301 cb = ¶m_callback;
1302 context = v.data ();
1306 result_callback (
void* context,
1307 ub4* position_context,
1313 param_callback (
const void* context,
1314 ub4* position_context,
1315 const void** buffer,
1327 template <
typename T>
1330 template <
typename T>
1437 template <std::
size_t N>
1444 template <std::
size_t N>
1460 template <std::
size_t N>
1479 template <std::
size_t N>
1488 #include <odb/oracle/traits.txx>
1492 #endif // ODB_ORACLE_TRAITS_HXX
T value_type
Definition: traits.hxx:493
static void set_image(char *b, std::size_t &n, bool &is_null, T v)
Definition: traits.hxx:482
Definition: oracle-types.hxx:92
Definition: traits.hxx:60
Definition: traits.hxx:251
W value_type
Definition: traits.hxx:335
Definition: traits.hxx:109
char * image_type
Definition: traits.hxx:175
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const value_type &v)
Definition: traits.hxx:1082
char * image_type
Definition: traits.hxx:772
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const value_type &v)
Definition: traits.hxx:745
Definition: oracle-types.hxx:63
char * image_type
Definition: traits.hxx:161
buffer_type
Definition: oracle-types.hxx:90
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const W &v)
Definition: traits.hxx:320
bool(* result_callback_type)(void *context, ub4 *position_context, void *buffer, ub4 size, chunk_position)
Definition: oracle-types.hxx:53
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const char *v)
Definition: traits.hxx:825
lob_callback image_type
Definition: traits.hxx:944
chunk_position
Definition: oracle-types.hxx:22
std::string value_type
Definition: traits.hxx:503
Definition: traits.hxx:42
static void set_image(char *i, std::size_t &n, bool &is_null, const W &v)
Definition: traits.hxx:388
std::vector< char > query_type
Definition: traits.hxx:732
T value_type
Definition: traits.hxx:423
wtraits::unrestricted_wrapped_type wrapped_type
Definition: traits.hxx:333
double image_type
Definition: traits.hxx:168
char * value_type
Definition: traits.hxx:1115
wrapper_traits< W > wtraits
Definition: traits.hxx:332
lob_callback image_type
Definition: traits.hxx:221
static const bool unsign
Definition: traits.hxx:81
Definition: oracle-types.hxx:93
database_type_id
Definition: traits.hxx:37
Definition: traits.hxx:555
char * image_type
Definition: traits.hxx:844
char * image_type
Definition: traits.hxx:813
Definition: traits.hxx:40
Definition: traits.hxx:939
char * image_type
Definition: traits.hxx:733
image_traits< T, ID >::image_type image_type
Definition: traits.hxx:425
image_traits< wrapped_type, ID >::image_type image_type
Definition: traits.hxx:337
lob_callback image_type
Definition: traits.hxx:1170
wrapped_type query_type
Definition: traits.hxx:336
static void set_value(unsigned char *const &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:847
static void set_image(char *b, std::size_t &n, bool &is_null, T v)
Definition: traits.hxx:462
lob_callback image_type
Definition: traits.hxx:1117
static void set_image(char *i, std::size_t c, std::size_t &n, bool &is_null, const W &v)
Definition: traits.hxx:294
char * image_type
Definition: traits.hxx:206
details::buffer image_type
Definition: traits.hxx:620
unsigned int ub4
Definition: oracle-fwd.hxx:20
default_value_traits< T, ID > type
Definition: traits.hxx:239
static void set_value(unsigned char *const &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:1173
static void set_value(W &v, const char *i, std::size_t n, bool is_null)
Definition: traits.hxx:362
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const char *v, std::size_t N)
lob_callback image_type
Definition: traits.hxx:1010
unsigned char * value_type
Definition: traits.hxx:842
char * image_type
Definition: traits.hxx:559
char value_type
Definition: traits.hxx:693
static void set_value(value_type &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:1013
static void set_value(std::string &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:508
unsigned char * value_type
Definition: traits.hxx:1168
static void set_value(char *const &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:1120
std::vector< unsigned char > value_type
Definition: traits.hxx:1062
Definition: traits.hxx:63
char * image_type
Definition: traits.hxx:505
Definition: traits.hxx:54
wrapped_value_traits< W, ID, wrapper_traits< W >::null_handler > type
Definition: traits.hxx:247
static void set_value(char *const &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:816
float image_type
Definition: traits.hxx:165
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const value_type &v)
Definition: traits.hxx:1028
unsigned int image_type
Definition: traits.hxx:122
static void set_image(image_type &i, bool &is_null, T v)
Definition: traits.hxx:437
Definition: traits.hxx:45
static void set_value(T &v, const image_type &i, bool is_null)
Definition: traits.hxx:428
interval_ym image_type
Definition: traits.hxx:196
lob_callback image_type
Definition: traits.hxx:218
char * image_type
Definition: traits.hxx:209
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const unsigned char *v)
Definition: traits.hxx:859
Definition: traits.hxx:1331
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const char *v)
Definition: traits.hxx:632
static void set_image(image_type &i, bool &is_null, const W &v)
Definition: traits.hxx:278
static void set_value(T &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:453
static void set_value(W &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:399
T query_type
Definition: traits.hxx:424
Definition: traits.hxx:53
Definition: traits.hxx:447
Definition: traits.hxx:57
static void set_value(char &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:698
std::vector< unsigned char > query_type
Definition: traits.hxx:1063
Definition: traits.hxx:597
W value_type
Definition: traits.hxx:265
Definition: traits.hxx:228
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const std::string &v)
Definition: traits.hxx:520
wtraits::unrestricted_wrapped_type wrapped_type
Definition: traits.hxx:263
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const std::string &v)
Definition: traits.hxx:962
static void set_value(value_type &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:775
unsigned long long image_type
Definition: traits.hxx:146
static void set_value(char *const &v, const char *b, std::size_t n, bool is_null, std::size_t N)
Definition: traits.hxx:39
Definition: traits.hxx:62
char * value_type
Definition: traits.hxx:811
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const W &v)
Definition: traits.hxx:408
Definition: oracle-types.hxx:174
static void set_value(std::string &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:947
std::vector< char > query_type
Definition: traits.hxx:1009
int image_type
Definition: traits.hxx:115
static void set_value(W &v, const image_type &i, bool is_null)
Definition: traits.hxx:342
static void set_image(image_type &i, bool &is_null, const W &v)
Definition: traits.hxx:351
wrapped_type query_type
Definition: traits.hxx:266
std::vector< unsigned char > value_type
Definition: traits.hxx:770
lob_callback image_type
Definition: traits.hxx:1064
long long image_type
Definition: traits.hxx:139
static void set_value(char *const &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:623
static void set_value(W &v, const image_type &i, bool is_null)
Definition: traits.hxx:272
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const char *v)
Definition: traits.hxx:562
static void set_value(W &v, const char *i, std::size_t n, bool is_null)
Definition: traits.hxx:286
Definition: traits.hxx:231
std::vector< unsigned char > query_type
Definition: traits.hxx:771
char * image_type
Definition: traits.hxx:212
Definition: traits.hxx:44
value_traits< wrapped_type, ID > vtraits
Definition: traits.hxx:269
Definition: traits.hxx:1328
Definition: traits.hxx:55
static void set_image(char *i, std::size_t c, std::size_t &n, bool &is_null, const W &v)
Definition: traits.hxx:373
Definition: oracle-types.hxx:253
image_traits< wrapped_type, ID >::image_type image_type
Definition: traits.hxx:267
Definition: traits.hxx:133
std::string query_type
Definition: traits.hxx:943
static void set_value(W &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:314
Definition: traits.hxx:64
char query_type
Definition: traits.hxx:694
char * image_type
Definition: traits.hxx:184
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, const value_type &v)
Definition: traits.hxx:787
Definition: oracle-types.hxx:222
Definition: traits.hxx:50
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const unsigned char *v)
Definition: traits.hxx:1188
static void set_value(value_type &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:736
static void set_image(char *b, std::size_t c, std::size_t &n, bool &is_null, char v)
Definition: traits.hxx:707
const char * value_type
Definition: traits.hxx:558
std::string query_type
Definition: traits.hxx:504
char query_type[N]
Definition: traits.hxx:619
datetime image_type
Definition: traits.hxx:190
T query_type
Definition: traits.hxx:494
Definition: traits.hxx:616
wrapper_traits< W > wtraits
Definition: traits.hxx:262
value_traits< wrapped_type, ID > vtraits
Definition: traits.hxx:339
interval_ds image_type
Definition: traits.hxx:202
char * value_type
Definition: traits.hxx:618
Definition: traits.hxx:500
Definition: traits.hxx:104
std::string value_type
Definition: traits.hxx:942
image_traits< T, id_big_int >::image_type image_type
Definition: traits.hxx:495
Definition: traits.hxx:52
static void set_value(value_type &v, result_callback_type &cb, void *&context, bool is_null)
Definition: traits.hxx:1067
Definition: traits.hxx:58
bool(* param_callback_type)(const void *context, ub4 *position_context, const void **buffer, ub4 *size, chunk_position *, void *temp_buffer, ub4 capacity)
Definition: oracle-types.hxx:34
Definition: traits.hxx:691
static void set_value(T &v, const char *b, std::size_t n, bool is_null)
Definition: traits.hxx:473
Definition: traits.hxx:81
details::buffer image_type
Definition: traits.hxx:695
std::vector< char > value_type
Definition: traits.hxx:1008
Definition: traits.hxx:234
std::vector< char > value_type
Definition: traits.hxx:731
static void set_image(char *i, std::size_t &n, bool &is_null, const W &v)
Definition: traits.hxx:306
static void set_image(param_callback_type &cb, const void *&context, bool &is_null, const char *v)
Definition: traits.hxx:1135
lob_callback image_type
Definition: traits.hxx:215