Version: 1.0.0
src
database
postgresql
postgresql_preparedstatement_parameter_collection.cpp
Go to the documentation of this file.
1
#include "
wx/database/wxprec.h
"
2
3
#if wxUSE_DATABASE_POSTGRESQL
4
5
#include "wx/arrimpl.cpp"
6
WX_DEFINE_OBJARRAY(ArrayOfPostgresParameters);
7
8
wxPostgresPreparedStatementParameterCollection::~wxPostgresPreparedStatementParameterCollection
()
9
{
10
m_Parameters
.Clear();
11
}
12
13
int
wxPostgresPreparedStatementParameterCollection::GetSize
()
14
{
15
return
m_Parameters
.size();
16
}
17
18
char
**
wxPostgresPreparedStatementParameterCollection::GetParamValues
()
19
{
20
char
** paramValues =
new
char
*[
m_Parameters
.size()];
21
22
for
(
unsigned
int
i=0; i<
m_Parameters
.size(); i++)
23
{
24
// Get a pointer to the appropriate data member variable for this parameter
25
paramValues[i] = (
char
*)(
m_Parameters
[i].GetDataPtr());
26
}
27
28
return
paramValues;
29
}
30
31
int
*
wxPostgresPreparedStatementParameterCollection::GetParamLengths
()
32
{
33
int
* paramLengths =
new
int
[
m_Parameters
.size()];
34
35
for
(
unsigned
int
i=0; i<
m_Parameters
.size(); i++)
36
{
37
// Get a pointer to the m_nBufferLength member variable for this parameter
38
paramLengths[i] =
m_Parameters
[i].GetDataLength();
39
}
40
41
return
paramLengths;
42
}
43
44
int
*
wxPostgresPreparedStatementParameterCollection::GetParamFormats
()
45
{
46
int
* paramFormats =
new
int
[
m_Parameters
.size()];
47
48
for
(
unsigned
int
i=0; i<
m_Parameters
.size(); i++)
49
{
50
paramFormats[i] = (
m_Parameters
[i].IsBinary()) ? 1 : 0;
51
}
52
53
return
paramFormats;
54
}
55
56
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
int
nValue)
57
{
58
wxPostgresParameter
Parameter(nValue);
59
SetParam
(nPosition, Parameter);
60
}
61
62
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
double
dblValue)
63
{
64
wxPostgresParameter
Parameter(dblValue);
65
SetParam
(nPosition, Parameter);
66
}
67
68
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
const
wxString& strValue)
69
{
70
wxPostgresParameter
Parameter(strValue);
71
SetParam
(nPosition, Parameter);
72
}
73
74
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition)
75
{
76
wxPostgresParameter
Parameter;
77
SetParam
(nPosition, Parameter);
78
}
79
80
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
const
void
* pData,
long
nDataLength)
81
{
82
wxPostgresParameter
Parameter(pData, nDataLength);
83
SetParam
(nPosition, Parameter);
84
}
85
86
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
const
wxDateTime& dateValue)
87
{
88
wxPostgresParameter
Parameter(dateValue);
89
SetParam
(nPosition, Parameter);
90
}
91
92
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
bool
bValue)
93
{
94
wxPostgresParameter
Parameter(bValue);
95
SetParam
(nPosition, Parameter);
96
}
97
98
void
wxPostgresPreparedStatementParameterCollection::SetParam
(
int
nPosition,
wxPostgresParameter
& Parameter)
99
{
100
// First make sure that there are enough elements in the collection
101
while
(
m_Parameters
.size() < (
unsigned
int)(nPosition))
102
{
103
wxPostgresParameter
EmptyParameter;
104
m_Parameters
.push_back(EmptyParameter);
105
}
106
m_Parameters
[nPosition-1] = Parameter;
107
}
108
109
#endif//wxUSE_DATABASE_POSTGRESQL
wxprec.h
wxPostgresPreparedStatementParameterCollection::GetParamFormats
int * GetParamFormats()
wxPostgresPreparedStatementParameterCollection::m_Parameters
ArrayOfPostgresParameters m_Parameters
Definition:
postgresql_preparedstatement_parameter_collection.h:30
wxPostgresPreparedStatementParameterCollection::~wxPostgresPreparedStatementParameterCollection
virtual ~wxPostgresPreparedStatementParameterCollection()
wxPostgresPreparedStatementParameterCollection::GetParamValues
char ** GetParamValues()
wxPostgresPreparedStatementParameterCollection::SetParam
void SetParam(int nPosition, int nValue)
wxPostgresPreparedStatementParameterCollection::GetParamLengths
int * GetParamLengths()
wxPostgresPreparedStatementParameterCollection::GetSize
int GetSize()
wxPostgresParameter
Definition:
postgresql_param.h:6
Generated on Mon Aug 19 2019 16:14:37 for wxDatabase by
Doxygen
1.8.15