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

#include <SQL.h>

Inheritance diagram for SQLQuery:
Object

Public Member Functions

 SQLQuery (SQLConnection *_conn) __DCL_THROWS1(SQLException *)
 SQLQuery (SQLConnection &_conn) __DCL_THROWS1(SQLException *)
virtual ~SQLQuery ()
void prepare (const String &_sql) __DCL_THROWS2(SQLException *
void CharsetConvertException *void execute () __DCL_THROWS1(SQLException *)
void execute (const String &_sql) __DCL_THROWS2(SQLException *
void CharsetConvertException *void fetch () __DCL_THROWS1(SQLException *)
bool nextResult () __DCL_THROWS1(SQLException *)
bool eof () const
int64_t affectedRows () const
_CONST SQLFieldsfields () _CONST
_CONST SQLParamsparams () _CONST
SQL::Queryhandle () const
SQLConnectionconnection () 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 Attributes

SQL::Query__handle
SQLConnection__connection
SQLFields __fields
SQLParams __params

Additional Inherited Members

Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Detailed Description

Definition at line 262 of file SQL.h.

Constructor & Destructor Documentation

◆ SQLQuery() [1/2]

SQLQuery::SQLQuery ( SQLConnection * _conn)

Definition at line 263 of file SQLQuery.cpp.

264{
265 initialize(_conn);
266}

◆ SQLQuery() [2/2]

SQLQuery::SQLQuery ( SQLConnection & _conn)

Definition at line 268 of file SQLQuery.cpp.

269{
270 initialize(&_conn);
271}

◆ ~SQLQuery()

SQLQuery::~SQLQuery ( )
virtual

Definition at line 273 of file SQLQuery.cpp.

274{
275 __connection->handle()->destroyQueryInstance(__handle);
276}
SQL::Query * __handle
Definition SQL.h:294
SQLConnection * __connection
Definition SQL.h:295

Member Function Documentation

◆ affectedRows()

int64_t SQLQuery::affectedRows ( ) const
inline

Definition at line 134 of file SQL.inl.

135{
136 return __handle->affectedRows();
137}

◆ connection()

SQLConnection * SQLQuery::connection ( ) const
inline

Definition at line 154 of file SQL.inl.

155{
156 return __connection;
157}

◆ eof()

bool SQLQuery::eof ( ) const
inline

Definition at line 129 of file SQL.inl.

130{
131 return __handle->eof();
132}

◆ execute() [1/2]

void SQLQuery::execute ( )

Definition at line 307 of file SQLQuery.cpp.

308{
309 if (!__handle->execute()) {
310#ifdef __DCL_DEBUG
311 throw new SQLException(this, __sql);
312#else
313 throw new SQLException(this);
314#endif
315 }
316
317 if (__handle->fieldCount() > 0 && __fields.isEmpty())
318 __fields.initialize(this);
319}
SQLFields __fields
Definition SQL.h:296

◆ execute() [2/2]

void SQLQuery::execute ( const String & _sql)

◆ fetch()

void SQLQuery::fetch ( )

Definition at line 329 of file SQLQuery.cpp.

330{
331 if (!__handle->fetch()) {
332 throw new SQLException(this);
333 }
334}

◆ fields()

_CONST SQLFields & SQLQuery::fields ( )
inline

Definition at line 139 of file SQL.inl.

140{
141 return __fields;
142}

◆ handle()

SQL::Query * SQLQuery::handle ( ) const
inline

Definition at line 149 of file SQL.inl.

150{
151 return __handle;
152}

◆ nextResult()

bool SQLQuery::nextResult ( )

Definition at line 336 of file SQLQuery.cpp.

337{
338 if (!__handle->nextResult()) {
339 throw new SQLException(this);
340 }
341
342 __fields.clear();
343 if (__handle->fieldCount() > 0)
344 __fields.initialize(this);
345
346 return !__handle->eof();
347}

◆ params()

_CONST SQLParams & SQLQuery::params ( )
inline

Definition at line 144 of file SQL.inl.

145{
146 return __params;
147}
SQLParams __params
Definition SQL.h:297

◆ prepare()

void SQLQuery::prepare ( const String & _sql)

Member Data Documentation

◆ __connection

SQLConnection* SQLQuery::__connection
protected

Definition at line 295 of file SQL.h.

◆ __fields

SQLFields SQLQuery::__fields
protected

Definition at line 296 of file SQL.h.

◆ __handle

SQL::Query* SQLQuery::__handle
protected

Definition at line 294 of file SQL.h.

◆ __params

SQLParams SQLQuery::__params
protected

Definition at line 297 of file SQL.h.


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