DCL 3.7.4
Loading...
Searching...
No Matches
SQL.inl
Go to the documentation of this file.
1#ifndef __DCL_SQL_H__
2 #error "Never use <dcl/core/SQL.inl> directly; include <dcl/core/SQL.h> instead."
3#endif
4#ifndef __DCL_SQL_INL__
5#define __DCL_SQL_INL__
6
7#if __DCL_HAVE_THIS_FILE__
8 #undef __THIS_FILE__
9 static const wchar_t* __pszSQL_inl__ = __T("dcl/SQL.inl");
10 #define __THIS_FILE__ __pszSQL_inl__
11#endif
12
13inline SQL::Field* SQLField::handle() const
14{
15 return __handle;
16}
17
18inline const wchar_t* SQLField::dataTypeName() const
19{
20 return SQL::dataTypeName(dataType());
21}
22
23inline size_t SQLField::dataSize() __DCL_THROWS1(SQLException*)
24{
25 return getDataSize(false);
26}
27
28inline size_t SQLField::dataSizeMax() __DCL_THROWS1(SQLException*)
29{
30 return getDataSize(true);
31}
32
33inline int SQLField::asInteger() __DCL_THROWS1(SQLException*)
34{
35 if (sizeof(int) == sizeof(int64_t))
36 return (int)asInt64();
37 return asInt32();
38}
39
41inline _CONST SQLField& SQLFields::at(size_t _index) const
42{
43 __DCL_ASSERT_PARAM(_index >= 0);
44 __DCL_ASSERT_PARAM(_index < __count);
45 return __fields[_index];
46}
47
48inline _CONST SQLField& SQLFields::operator[](size_t _index) const
49{
50 __DCL_ASSERT_PARAM(_index >= 0);
51 __DCL_ASSERT_PARAM(_index < __count);
52 return __fields[_index];
53}
54
55inline size_t SQLFields::count() const
56{
57 return __count;
58}
59
60inline bool SQLFields::isEmpty() const
61{
62 return __count == 0;
63}
64
66inline SQLParam& SQLParams::at(size_t _index) const
67{
68 __DCL_ASSERT_PARAM(_index >= 0);
69 __DCL_ASSERT_PARAM(_index < __count);
70 return __params[_index];
71}
72
73inline SQLParam& SQLParams::operator[](size_t _index) const
74{
75 __DCL_ASSERT_PARAM(_index >= 0);
76 __DCL_ASSERT_PARAM(_index < __count);
77 return __params[_index];
78}
79
80inline size_t SQLParams::count() const
81{
82 return __count;
83}
84
85inline bool SQLParams::isEmpty() const
86{
87 return __count == 0;
88}
89
90// SQLQuery
91inline bool SQLQuery::eof() const
92{
93 return __handle->eof();
94}
95
96inline int64_t SQLQuery::affectedRows() const
97{
98 return __handle->affectedRows();
99}
100
102{
103 return __fields;
104}
105
107{
108 return __params;
109}
110
112{
113 return __handle;
114}
115
117{
118 return __connection;
119}
120
121// SQLConnection
123{
124 return __handle;
125}
126
128{
129 return __driver;
130}
131
132inline bool SQLConnection::connected() const
133{
134 return __connected;
135}
136
137// SQLConnectionPool
138inline size_t SQLConnectionPool::count() const
139{
140 return __allConns.size();
141}
142
143inline size_t SQLConnectionPool::idleCount() const
144{
145 return __idleConns.size();
146}
147
148#if __DCL_HAVE_THIS_FILE__
149 #undef __THIS_FILE__
150 #define __THIS_FILE__ __T(__FILE__)
151#endif
152
153#endif // __DCL_SQL_INL__
#define _CONST
Definition Config.h:325
#define __DCL_THROWS1(e)
Definition Config.h:152
#define __DCL_ASSERT_PARAM(expr)
Definition Object.h:409
#define __T(str)
Definition Object.h:60
SQLDriver * __driver
Definition SQL.h:344
bool __connected
Definition SQL.h:345
SQLDriver * driver() const
Definition SQL.inl:127
bool connected() const
Definition SQL.inl:132
SQL::Connection * handle() const
Definition SQL.inl:122
SQL::Connection * __handle
Definition SQL.h:343
PointerList __idleConns
Definition SQL.h:375
PointerArray __allConns
Definition SQL.h:376
Definition SQL.h:48
SQL::Field * __handle
Definition SQL.h:122
_CONST SQLField & at(size_t _index) const
Definition SQL.inl:41
size_t count() const
Definition SQL.inl:55
_CONST SQLField & operator[](size_t _index) const
Definition SQL.inl:48
bool isEmpty() const
Definition SQL.inl:60
static const wchar_t * dataTypeName(DataType _dataType)
Definition SQLCore.cpp:105
size_t count() const
Definition SQL.inl:80
SQLParam & operator[](size_t _index) const
Definition SQL.inl:73
SQLParam & at(size_t _index) const
Definition SQL.inl:66
bool isEmpty() const
Definition SQL.inl:85
SQL::Query * __handle
Definition SQL.h:301
_CONST SQLParams & params() _CONST
Definition SQL.inl:106
_CONST SQLFields & fields() _CONST
Definition SQL.inl:101
SQLParams __params
Definition SQL.h:304
int64_t affectedRows() const
Definition SQL.inl:96
bool eof() const
Definition SQL.inl:91
SQLConnection * connection() const
Definition SQL.inl:116
SQL::Query * handle() const
Definition SQL.inl:111
SQLFields __fields
Definition SQL.h:303
SQLConnection * __connection
Definition SQL.h:302