![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cSQLDatabasePool.h>
Public Member Functions | |
cSQLDatabasePool (cStringF sConnectionString="", int nMaxConnections=256, TIMESYSD_t nMaxWait=1000) | |
~cSQLDatabasePool () | |
HRESULT | OpenConnectFirst (cStringF sConnectionString, cExceptionHolder *pEx=nullptr) |
void | Close () |
ITERATE_t | get_ConnectionCount () const |
bool | isOpen () const |
bool | isConfigured () const |
HRESULT | GetConnection (cSQLDatabasePtr &pConnection) |
cSQLDatabasePtr | get_Connection () |
HRESULT | ExecuteSQLCmd (cSQLCmd &command, cExceptionHolder *pExceptionRet=nullptr) |
HRESULT | ExecuteSQLAndFetch (cSQLCmd &oCmd, cSQLStatement &rResultSet, cExceptionHolder *pExceptionRet=nullptr, bool bWaitIfBusy=false) |
HRESULT | ExecuteSQLOrInsert (cSQLCmdUpdate &Update, cExceptionHolder *pExceptionRet=nullptr) |
Public Attributes | |
cStringF | m_sConnectionString |
string describing instructions of how to connect to the database. driver, URL etc. More... | |
int | m_nMaxConnections |
TIMESYSD_t | m_nMaxWait |
A thread safe pool of connections to the database. like cPool<> ?
GrayLib::cSQLDatabasePool::cSQLDatabasePool | ( | cStringF | sConnectionString = "" , |
int | nMaxConnections = 256 , |
||
TIMESYSD_t | nMaxWait = 1000 |
||
) |
GrayLib::cSQLDatabasePool::~cSQLDatabasePool | ( | ) |
void GrayLib::cSQLDatabasePool::Close | ( | void | ) |
Close all my connections. don't clear m_sConnectionString ?
HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLAndFetch | ( | cSQLCmd & | oCmd, |
cSQLStatement & | rResultSet, | ||
cExceptionHolder * | pExceptionRet = nullptr , |
||
bool | bWaitIfBusy = false |
||
) |
HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLCmd | ( | cSQLCmd & | command, |
cExceptionHolder * | pExceptionRet = nullptr |
||
) |
Find a quick connection and exec. ASSUME we don't need to call FetchNext.
HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLOrInsert | ( | cSQLCmdUpdate & | Update, |
cExceptionHolder * | pExceptionRet = nullptr |
||
) |
Update or insert whichever is needed.
|
inline |
|
inline |
HRESULT GrayLib::cSQLDatabasePool::GetConnection | ( | cSQLDatabasePtr & | pConnection | ) |
Get a free connection (if we have one) else create a new one. wait for a connection to become free ?
|
inline |
|
inline |
HRESULT GrayLib::cSQLDatabasePool::OpenConnectFirst | ( | cStringF | sConnectionString, |
cExceptionHolder * | pEx = nullptr |
||
) |
Open a new connection now.
"DSN=SomeName" // set from DSN profile in windows control panel. "Driver={SQL Server};Server=GREEN\SQLEXPRESS;Database=sdfsdf;Uid=Dennis;Trusted_Connection=Yes;"
int GrayLib::cSQLDatabasePool::m_nMaxConnections |
TIMESYSD_t GrayLib::cSQLDatabasePool::m_nMaxWait |
cStringF GrayLib::cSQLDatabasePool::m_sConnectionString |
string describing instructions of how to connect to the database. driver, URL etc.