DCL 4.0
Loading...
Searching...
No Matches
SQLParams Class Reference

#include <SQL.h>

Inheritance diagram for SQLParams:
Object

Public Member Functions

SQLParamat (size_t _index) const
SQLParambyName (const wchar_t *_name) _CONST __DCL_THROWS1(InvalidIndexException *)
SQLParamoperator[] (size_t _index) const
size_t count () const
bool isEmpty () const
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

 SQLParams ()
virtual ~SQLParams ()
void clear ()
void initialize (SQLQuery *_query, const StringArray _names)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Friends

class SQLQuery

Detailed Description

Definition at line 235 of file SQL.h.

Constructor & Destructor Documentation

◆ SQLParams()

SQLParams::SQLParams ( )
protected

◆ ~SQLParams()

SQLParams::~SQLParams ( )
protectedvirtual

Definition at line 119 of file SQLQuery.cpp.

120{
121 clear();
122}
void clear()
Definition SQLQuery.cpp:124

Member Function Documentation

◆ at()

SQLParam & SQLParams::at ( size_t _index) const
inline

Definition at line 104 of file SQL.inl.

105{
106 __DCL_ASSERT_PARAM(_index >= 0);
107 __DCL_ASSERT_PARAM(_index < __count);
108 return __params[_index];
109}
#define __DCL_ASSERT_PARAM(expr)
Definition Object.h:384

◆ byName()

SQLParam & SQLParams::byName ( const wchar_t * _name)

Definition at line 157 of file SQLQuery.cpp.

159{
160 __DCL_ASSERT(_name != NULL);
162
163 SQLParam* r = NULL;
164
165 if (__count >= 7) { // 순차검색 n*n/2 Hashing 3*n
166 if (__paramMap.isEmpty()) {
167 __paramMap.initBuckets(__count);
168 for (size_t i = 0; i < __count; i++) {
169 SQLParam* p = &__params[i];
170 __paramMap[p->name()] = p;
171 }
172 }
173 r = (SQLParam*)(__paramMap[_name]);
174 }
175 else {
176 for(size_t i = 0; i < __count; i++) {
177 if (String::compare(__params[i].name(), _name) == 0) {
178 r = &__params[i];
179 break;
180 }
181 }
182 }
183
184 if (r == NULL) {
185 throw new InvalidIndexException(_name);
186 }
187
188 return *r;
189}
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371
ByteString r
bool isEmpty() const
Definition SQL.inl:123

◆ clear()

void SQLParams::clear ( )
protected

Definition at line 124 of file SQLQuery.cpp.

125{
126 if (__params) {
127 __DCL_ASSERT(__count > 0);
128 delete[] __params;
129 __params = NULL;
130 __count = 0;
131 }
132 __paramMap.clear();
133}

◆ count()

size_t SQLParams::count ( ) const
inline

Definition at line 118 of file SQL.inl.

119{
120 return __count;
121}

◆ initialize()

void SQLParams::initialize ( SQLQuery * _query,
const StringArray _names )
protected

Definition at line 135 of file SQLQuery.cpp.

136{
137 SQL::Query* hQuery = _query->handle();
138
139 __DCL_ASSERT((__params == NULL) && (__count == 0));
140 __DCL_ASSERT(hQuery->paramCount() == _names.size());
141
142 __count = hQuery->paramCount();
143 __params = new SQLParam[__count];
144 __DCL_ASSERT(__params != NULL);
145
146 for(size_t i = 0; i < hQuery->paramCount(); i++) {
147 SQLParam* _param = &__params[i];
148 _param->__query = _query;
149 if (!hQuery->getParam(i, (SQL::Param**)&(_param->__handle))) {
150 throw new SQLException(_query);
151 }
152 ((SQL::Param*)(_param->__handle))->setName(_names[i]);
153 }
154}
SQL::Field * __handle
Definition SQL.h:117
SQLQuery * __query
Definition SQL.h:118
SQL::Query * handle() const
Definition SQL.inl:149

◆ isEmpty()

bool SQLParams::isEmpty ( ) const
inline

Definition at line 123 of file SQL.inl.

124{
125 return __count == 0;
126}

◆ operator[]()

SQLParam & SQLParams::operator[] ( size_t _index) const
inline

Definition at line 111 of file SQL.inl.

112{
113 __DCL_ASSERT_PARAM(_index >= 0);
114 __DCL_ASSERT_PARAM(_index < __count);
115 return __params[_index];
116}

◆ SQLQuery

friend class SQLQuery
friend

Definition at line 249 of file SQL.h.


The documentation for this class was generated from the following files: