aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/traits.txx
blob: 6ead173de98666f001b832dfdab93464b2f1ff77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// file      : odb/oracle/traits.txx
// author    : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : ODB NCUEL; see accompanying LICENSE file

namespace odb
{
  namespace oracle
  {
    //
    // default_value_traits<char[N], id_blob>
    //

    template <std::size_t N>
    bool default_value_traits<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<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<unsigned char[N], id_blob>
    //

    template <std::size_t N>
    bool default_value_traits<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<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;
    }
  }
}