// file : odb/mssql/traits.txx // copyright : Copyright (c) 2005-2012 Code Synthesis Tools CC // license : ODB NCUEL; see accompanying LICENSE file #include namespace odb { namespace mssql { // // wrapped_value_traits // template void wrapped_value_traits:: result_callback (void* context, std::size_t* position, void** buffer, std::size_t* size, chunk_type chunk, std::size_t size_left, void* tmp_buffer, std::size_t tmp_capacity) { W& v (*static_cast (context)); if (chunk == chunk_null) wtraits::set_null (v); else { long_callback& c (*static_cast (*buffer)); // Redirect all further calls. // vtraits::set_value (wtraits::set_ref (v), c.callback.result, c.context.result); // Forward this call. // c.callback.result ( c.context.result, position, buffer, size, chunk, size_left, tmp_buffer, tmp_capacity); } } // // c_array_long_binary_value_traits // template void c_array_long_binary_value_traits:: param_callback (const void* context, std::size_t*, const void** buffer, std::size_t* size, chunk_type* chunk, void*, std::size_t) { *buffer = context; *size = N; *chunk = chunk_one; } template void c_array_long_binary_value_traits:: result_callback (void* context, std::size_t*, void** buffer, std::size_t* size, chunk_type chunk, std::size_t size_left, void* tmp_buf, std::size_t tmp_capacity) { // The code is similar to the vector specialization. // switch (chunk) { case chunk_null: case chunk_one: { std::memset (context, 0, N); break; } case chunk_first: { assert (size_left != 0); *buffer = context; *size = size_left < N ? size_left : N; break; } case chunk_next: { // We can get here if total size is greater than N. There is // no way to stop until we read all the data, so dump the // remainder into the temporary buffer. // *buffer = tmp_buf; *size = tmp_capacity; break; } case chunk_last: { break; } } } #ifdef ODB_CXX11 // // array_long_binary_value_traits // template void array_long_binary_value_traits:: param_callback (const void* context, std::size_t*, const void** buffer, std::size_t* size, chunk_type* chunk, void*, std::size_t) { *buffer = context; *size = N; *chunk = chunk_one; } template void array_long_binary_value_traits:: result_callback (void* context, std::size_t*, void** buffer, std::size_t* size, chunk_type chunk, std::size_t size_left, void* tmp_buf, std::size_t tmp_capacity) { // The code is similar to the vector specialization. // switch (chunk) { case chunk_null: case chunk_one: { std::memset (context, 0, N); break; } case chunk_first: { assert (size_left != 0); *buffer = context; *size = size_left < N ? size_left : N; break; } case chunk_next: { // We can get here if total size is greater than N. There is // no way to stop until we read all the data, so dump the // remainder into the temporary buffer. // *buffer = tmp_buf; *size = tmp_capacity; break; } case chunk_last: { break; } } } #endif } }