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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// $Id$
#include "ODBC_Parameter.h"
#if !defined (__ADBC_INLINE__)
#include "ODBC_Parameter.inl"
#endif
#include "ODBC_Query.h"
#include "ODBC_Types.h"
namespace ADBC
{
namespace ODBC
{
//
// operator =
//
const Parameter & Parameter::operator = (const Parameter & rhs)
{
if (this == &rhs)
return *this;
this->query_ = rhs.query_;
this->index_ = rhs.index_;
return *this;
}
//
// bind
//
void Parameter::bind (Date_Time * dt)
{
this->bind_i (SQL_PARAM_INPUT,
SQL_C_TYPE_TIMESTAMP,
SQL_TYPE_TIMESTAMP,
0,
0,
dt->value (),
0);
::ADBC::Parameter::bind (dt);
}
//
// bind
//
void Parameter::bind (::ADBC::Date_Time * dt)
{
Date_Time * date_time = dynamic_cast <Date_Time *> (dt);
if (0 == date_time)
throw ::ADBC::ODBC::Exception ("object is not of type ::ADBC::ODBC::Date_Time");
this->bind (date_time);
}
//
//
// bind_i
//
void Parameter::bind_i (SQLSMALLINT iotype,
SQLSMALLINT valuetype,
SQLSMALLINT paramtype,
SQLUINTEGER columnsize,
SQLSMALLINT decimals,
SQLPOINTER valueptr,
SQLINTEGER buffer_length)
{
// Initialize the intptr_ data member.
switch (valuetype)
{
case SQL_C_CHAR:
this->intptr_ = buffer_length == 0 ? SQL_NTS : buffer_length;
break;
default:
this->intptr_ = 0;
};
// Bind the parameter for the statement.
SQL_STMT_VERIFY (::SQLBindParameter (this->query_->handle (),
this->index_ + 1,
iotype,
valuetype,
paramtype,
columnsize,
decimals,
valueptr,
buffer_length,
&this->intptr_),
this->query_->handle ());
}
}
}
|