DCL 4.0
Loading...
Searching...
No Matches
SQLConnection.cpp File Reference
#include <dcl/Config.h>
#include <dcl/Object.h>
#include <dcl/Charset.h>
#include <dcl/Thread.h>
#include <dcl/SQL.h>

Go to the source code of this file.

Functions

__DCL_BEGIN_NAMESPACE IMPLEMENT_CLASSINFO (SQLConnection, Object) void SQLConnection
void CharsetConvertException__DCL_ASSERT (__connected==false)
 if (!__handle->open(bs, bs.length()))
 if (!__handle->execute(bstr, bstr.length()))
 if (!__handle->getServerInfo(buf->data(), &len))
buf release ()
 IMPLEMENT_CLASSINFO (SQLConnectionPool, Object) SQLConnectionPool

Variables

ByteString bs = UTF8Encoder::encode(_connString)
 __connected = true
ByteString bstr = UTF8Encoder::encode(_strSQL)
size_t len = 1024
ByteBuffer * buf = ByteBuffer::create(len)
buf __dataLength = len
ByteString r = buf

Function Documentation

◆ __DCL_ASSERT()

String CharsetConvertException * __DCL_ASSERT ( __connected = =false)
Initial value:
{
__DCL_ASSERT(__handle != NULL)
#define NULL
Definition Config.h:340
#define __DCL_ASSERT(expr)
Definition Object.h:371

◆ if() [1/3]

if ( !__handle-> executebstr, bstr.length())

Definition at line 121 of file SQLConnection.cpp.

121 {
122 throw new SQLException(this, _strSQL);
123 }

◆ if() [2/3]

if ( !__handle-> getServerInfobuf->data(), &len)

Definition at line 177 of file SQLConnection.cpp.

177 {
178 buf->release();
179 throw new SQLException(this);
180 }
ByteBuffer * buf

◆ if() [3/3]

if ( !__handle-> openbs, bs.length())

Definition at line 86 of file SQLConnection.cpp.

86 {
87#ifdef __DCL_DEBUG
88 throw new SQLException(this, _connString);
89#else
90 throw new SQLException(this);
91#endif
92 }

◆ IMPLEMENT_CLASSINFO() [1/2]

__DCL_BEGIN_NAMESPACE IMPLEMENT_CLASSINFO ( SQLConnection ,
Object  )

Definition at line 26 of file SQLConnection.cpp.

29{
30 __DCL_ASSERT_PARAM(_driver != NULL);
31
32 __handle = NULL;
33 __driver = NULL;
34 __connected = false;
35
36 SQL::Connection* _connHandle = _driver->createConnection();
37 __DCL_ASSERT(_connHandle != NULL);
38
39 __handle = _connHandle;
40 __driver = _driver;
41}
#define __DCL_ASSERT_PARAM(expr)
Definition Object.h:384
__connected

◆ IMPLEMENT_CLASSINFO() [2/2]

IMPLEMENT_CLASSINFO ( SQLConnectionPool ,
Object  )

Definition at line 195 of file SQLConnection.cpp.

202{
203 __DCL_ASSERT(!_connString.isEmpty());
204 __DCL_ASSERT(!_driverName.isEmpty());
205
206 __sqlDriver = SQLDriver::getDriver(_driverName);
207 __connString = _connString;
208 __idleMax = 0;
209 __allMax = (size_t)-1; // unlimited
210}
static SQLDriver * getDriver(const String &_name) __DCL_THROWS1(SQLDriverException *)

◆ release()

buf release ( )

Variable Documentation

◆ __connected

__connected = true

Definition at line 94 of file SQLConnection.cpp.

◆ __dataLength

buf __dataLength = len

Definition at line 181 of file SQLConnection.cpp.

◆ bs

ByteString bs = UTF8Encoder::encode(_connString)

Definition at line 84 of file SQLConnection.cpp.

◆ bstr

ByteString bstr = UTF8Encoder::encode(_strSQL)

Definition at line 119 of file SQLConnection.cpp.

◆ buf

ByteBuffer* buf = ByteBuffer::create(len)

Definition at line 176 of file SQLConnection.cpp.

◆ len

size_t len = 1024

Definition at line 175 of file SQLConnection.cpp.

◆ r

ByteString r = buf

Definition at line 182 of file SQLConnection.cpp.