Main Page
Namespaces
Classes
Files
File List
File Members
libism
ISM
soci
src
core
use-type.cpp
Go to the documentation of this file.
1
//
2
// Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
//
7
8
#define SOCI_SOURCE
9
#include "
use-type.h
"
10
#include "
statement.h
"
11
12
using namespace
soci
;
13
using namespace
soci::details
;
14
15
standard_use_type::~standard_use_type
()
16
{
17
delete
backEnd_
;
18
}
19
20
void
standard_use_type::bind
(
statement_impl
& st,
int
& position)
21
{
22
if
(
backEnd_
== NULL)
23
{
24
backEnd_
= st.
make_use_type_backend
();
25
}
26
if
(
name_
.empty())
27
{
28
backEnd_
->
bind_by_pos
(position,
data_
,
type_
,
readOnly_
);
29
}
30
else
31
{
32
backEnd_
->
bind_by_name
(
name_
,
data_
,
type_
,
readOnly_
);
33
}
34
}
35
36
void
standard_use_type::pre_use
()
37
{
38
// Handle IN direction of parameters of SQL statements and procedures
39
convert_to_base
();
40
backEnd_
->
pre_use
(
ind_
);
41
}
42
43
void
standard_use_type::post_use
(
bool
gotData)
44
{
45
// Handle OUT direction of IN/OUT parameters of stored procedures
46
backEnd_
->
post_use
(gotData,
ind_
);
47
convert_from_base
();
48
49
// IMPORTANT:
50
// This treatment of input ("use") parameter as output data sink may be
51
// confusing, but it is necessary to store OUT data back in the same
52
// object as IN, of IN/OUT parameter.
53
// As there is no symmetry for IN/OUT in SQL and there are no OUT/IN
54
// we do not perform convert_to_base() for output ("into") parameter.
55
// See conversion_use_type<T>::convert_from_base() for more details.
56
}
57
58
void
standard_use_type::clean_up
()
59
{
60
if
(
backEnd_
!= NULL)
61
{
62
backEnd_
->
clean_up
();
63
}
64
}
65
66
vector_use_type::~vector_use_type
()
67
{
68
delete
backEnd_
;
69
}
70
71
void
vector_use_type::bind
(
statement_impl
& st,
int
& position)
72
{
73
if
(
backEnd_
== NULL)
74
{
75
backEnd_
= st.
make_vector_use_type_backend
();
76
}
77
if
(
name_
.empty())
78
{
79
backEnd_
->
bind_by_pos
(position,
data_
,
type_
);
80
}
81
else
82
{
83
backEnd_
->
bind_by_name
(
name_
,
data_
,
type_
);
84
}
85
}
86
87
void
vector_use_type::pre_use
()
88
{
89
convert_to_base
();
90
91
backEnd_
->
pre_use
(
ind_
? &
ind_
->at(0) : NULL);
92
}
93
94
std::size_t
vector_use_type::size
()
const
95
{
96
return
backEnd_
->size();
97
}
98
99
void
vector_use_type::clean_up
()
100
{
101
if
(
backEnd_
!= NULL)
102
{
103
backEnd_
->
clean_up
();
104
}
105
}
soci::details::statement_impl::make_use_type_backend
standard_use_type_backend * make_use_type_backend()
Definition:
core/statement.cpp:684
soci::details::standard_use_type_backend::bind_by_pos
virtual void bind_by_pos(int &position, void *data, exchange_type type, bool readOnly)=0
statement.h
soci::details::standard_use_type_backend::post_use
virtual void post_use(bool gotData, indicator *ind)=0
soci::details::standard_use_type::pre_use
virtual void pre_use()
Definition:
use-type.cpp:36
soci::details
Definition:
db2/common.h:15
soci::details::statement_impl::make_vector_use_type_backend
vector_use_type_backend * make_vector_use_type_backend()
Definition:
core/statement.cpp:696
soci::details::standard_use_type::clean_up
virtual void clean_up()
Definition:
use-type.cpp:58
soci::details::standard_use_type::name_
std::string name_
Definition:
use-type.h:92
soci::details::vector_use_type::size
virtual std::size_t size() const
Definition:
use-type.cpp:94
soci::details::standard_use_type_backend::clean_up
virtual void clean_up()=0
soci::details::standard_use_type::backEnd_
standard_use_type_backend * backEnd_
Definition:
use-type.h:94
soci::details::vector_use_type::~vector_use_type
~vector_use_type()
Definition:
use-type.cpp:66
use-type.h
soci::details::standard_use_type::data_
void * data_
Definition:
use-type.h:88
soci::details::standard_use_type::bind
virtual void bind(statement_impl &st, int &position)
Definition:
use-type.cpp:20
soci::details::standard_use_type::convert_to_base
virtual void convert_to_base()
Definition:
use-type.h:77
soci::details::standard_use_type::~standard_use_type
virtual ~standard_use_type()
Definition:
use-type.cpp:15
soci::details::vector_use_type::bind
virtual void bind(statement_impl &st, int &position)
Definition:
use-type.cpp:71
soci::details::standard_use_type_backend::bind_by_name
virtual void bind_by_name(std::string const &name, void *data, exchange_type type, bool readOnly)=0
soci::details::standard_use_type_backend::pre_use
virtual void pre_use(indicator const *ind)=0
soci::details::statement_impl
Definition:
statement.h:37
soci::details::standard_use_type::convert_from_base
virtual void convert_from_base()
Definition:
use-type.h:78
soci::details::standard_use_type::type_
exchange_type type_
Definition:
use-type.h:89
soci::details::standard_use_type::ind_
indicator * ind_
Definition:
use-type.h:90
soci::details::vector_use_type::pre_use
virtual void pre_use()
Definition:
use-type.cpp:87
soci
Definition:
db2/common.h:15
soci::details::standard_use_type::post_use
virtual void post_use(bool gotData)
Definition:
use-type.cpp:43
soci::details::standard_use_type::readOnly_
bool readOnly_
Definition:
use-type.h:91
soci::details::vector_use_type::clean_up
virtual void clean_up()
Definition:
use-type.cpp:99
asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41