Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cSQLDatabasePool Class Reference

#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
 

Detailed Description

A thread safe pool of connections to the database. like cPool<> ?

Constructor & Destructor Documentation

◆ cSQLDatabasePool()

GrayLib::cSQLDatabasePool::cSQLDatabasePool ( cStringF  sConnectionString = "",
int  nMaxConnections = 256,
TIMESYSD_t  nMaxWait = 1000 
)

◆ ~cSQLDatabasePool()

GrayLib::cSQLDatabasePool::~cSQLDatabasePool ( )

Member Function Documentation

◆ Close()

void GrayLib::cSQLDatabasePool::Close ( void  )

Close all my connections. don't clear m_sConnectionString ?

◆ ExecuteSQLAndFetch()

HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLAndFetch ( cSQLCmd oCmd,
cSQLStatement rResultSet,
cExceptionHolder pExceptionRet = nullptr,
bool  bWaitIfBusy = false 
)
  • rResultSet = .

◆ ExecuteSQLCmd()

HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLCmd ( cSQLCmd command,
cExceptionHolder pExceptionRet = nullptr 
)

Find a quick connection and exec. ASSUME we don't need to call FetchNext.

◆ ExecuteSQLOrInsert()

HRESULT GrayLib::cSQLDatabasePool::ExecuteSQLOrInsert ( cSQLCmdUpdate Update,
cExceptionHolder pExceptionRet = nullptr 
)

Update or insert whichever is needed.

Note
is this returns HRESULT_WIN32_C(ERROR_DS_BUSY) do i try again ?

◆ get_Connection()

cSQLDatabasePtr GrayLib::cSQLDatabasePool::get_Connection ( )
inline

◆ get_ConnectionCount()

ITERATE_t GrayLib::cSQLDatabasePool::get_ConnectionCount ( ) const
inline

◆ GetConnection()

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 ?

◆ isConfigured()

bool GrayLib::cSQLDatabasePool::isConfigured ( ) const
inline

◆ isOpen()

bool GrayLib::cSQLDatabasePool::isOpen ( ) const
inline

◆ OpenConnectFirst()

HRESULT GrayLib::cSQLDatabasePool::OpenConnectFirst ( cStringF  sConnectionString,
cExceptionHolder pEx = nullptr 
)

Open a new connection now.

  • sConnectionString = database name and open command string.

"DSN=SomeName" // set from DSN profile in windows control panel. "Driver={SQL Server};Server=GREEN\SQLEXPRESS;Database=sdfsdf;Uid=Dennis;Trusted_Connection=Yes;"

Member Data Documentation

◆ m_nMaxConnections

int GrayLib::cSQLDatabasePool::m_nMaxConnections

◆ m_nMaxWait

TIMESYSD_t GrayLib::cSQLDatabasePool::m_nMaxWait

◆ m_sConnectionString

cStringF GrayLib::cSQLDatabasePool::m_sConnectionString

string describing instructions of how to connect to the database. driver, URL etc.


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