![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cSQLDatabase.h>
Public Member Functions | |
| cSQLDatabase () | |
| virtual | ~cSQLDatabase () |
| ISQLDatabase * | get_ISQLDatabase () const |
| bool | isConnected () const |
| bool | IsExtReferenced (int nCheckVal=1) const |
| virtual cSQLDriver * | get_SQLDriver () const |
| What driver ultimately owns this? More... | |
| virtual cSQLBase * | get_SQLParent () const |
| HRESULT | OpenConnect (cStringF sConnectionString, cExceptionHolder *pExceptionHolder=nullptr, int iMaxRetries=3) |
| HRESULT | RetryOpenConnect (cExceptionHolder *pExceptionHolder=nullptr, int iMaxRetries=100) |
| bool | Close (bool bDestroyHandle) |
| bool | get_AutoCommit () const |
| void | put_AutoCommit (bool bAutoCommit) |
| const cSQLConfigDB & | GetConfigDB () |
| HRESULT | ExecuteSQLCmd (cSQLCmd &oCmd, cExceptionHolder *pExceptionRet=nullptr) |
| HRESULT | ExecuteSQLAndFetch (cSQLCmd &oCmd, cSQLStatement &rResultSet, cExceptionHolder *pExceptionRet=nullptr, bool bWaitIfBusy=false) |
| HRESULT | ExecuteSQLOrInsert (cSQLCmdUpdate &oCmdUpdate, cExceptionHolder *pExceptionRet) |
| HRESULT | EndTransaction (bool bCommit) |
Public Member Functions inherited from GrayLib::cSQLBase | |
| virtual | ~cSQLBase () |
| HRESULT | FillException (cExceptionHolder &exh, cStringA sCommand, const cDebugSourceLine &src) const |
| HRESULT | ReturnError1 (cExceptionHolder &exh) const |
| HRESULT | ReturnError2 (cStringA sCommand, const cDebugSourceLine &src) const |
| bool | isISQLValid () const |
| The SQL handle. More... | |
| ITERATE_t | get_ChildHandleCount () const noexcept |
Public Member Functions inherited from Gray::CObject | |
| virtual | ~CObject () |
| virtual bool | isValidCheck () const noexcept |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | AssertValid () const |
| < memory allocation and structure definitions are valid. More... | |
| virtual void | Serialize (cArchive &a) |
Public Member Functions inherited from Gray::cRefBase | |
| cRefBase (int iRefCount=0) noexcept | |
| virtual | ~cRefBase () |
| int | get_RefCount () const noexcept |
| HASHCODE_t | get_HashCode () const noexcept |
| STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept | |
| virtual void | onFinalRelease () |
| bool | isValidObj () const noexcept |
| STDMETHOD_ (ULONG, AddRef)(void) override | |
| STDMETHOD_ (ULONG, Release)(void) override | |
| STDMETHOD() | QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override |
| void | IncRefCount () |
| void | DecRefCount () |
| bool | isStaticConstruct () const noexcept |
| void | StaticConstruct () |
| void | StaticDestruct () |
| bool | isDestructing () noexcept |
| void | SetDestructing () |
Public Attributes | |
| cSQLDriver * | m_pSQLDriver |
| My parent. Not set until after OpenConnect and m_bIsConnected. More... | |
Public Attributes inherited from GrayLib::cSQLBase | |
| bool | m_bLogOnError |
| I want to log message if error. More... | |
Protected Member Functions | |
| void | ChangeCriticalWait (int iDelta) |
| HRESULT | ReadConfigDB () |
| bool | AllocISQLDatabase (cSQLDriver *pSQLDriver) |
| HRESULT | OpenConnectInt (cExceptionHolder *pExceptionHolder, int iMaxRetries, TIMESYS_t nTimeStart) |
Protected Member Functions inherited from GrayLib::cSQLBase | |
| bool | AttachISQL (ISQLBase *pSQL) |
| void | FreeISQL () |
| bool | FreeISQLTested () |
| cSQLBase () | |
Protected Member Functions inherited from Gray::cNonCopyable | |
| cNonCopyable () noexcept | |
| Force the use of Factory creation via protected constructor. More... | |
| ~cNonCopyable () noexcept | |
Additional Inherited Members | |
Static Public Member Functions inherited from GrayLib::cSQLBase | |
| static const FILECHAR_t *GRAYCALL | RemoveDriverIdentification (const FILECHAR_t *pszError) |
Protected Attributes inherited from GrayLib::cSQLBase | |
| cIUnkPtr< ISQLBase > | m_pISQL |
| ISQLBase to some SQL implementation object -> a Driver/environment, connection or recordset/statement. More... | |
A connection to a database. Like System.Data.Common.DbConnection or System.Data.Odbc::OdbcConnection.
| GrayLib::cSQLDatabase::cSQLDatabase | ( | ) |
|
virtual |
|
protected |
Create to the DB ISQLDriver interface object.
|
protected |
Warn the thread that this operation may take a long time.
| bool GrayLib::cSQLDatabase::Close | ( | bool | bDestroyHandle | ) |
Close this connection to the DB.
| HRESULT GrayLib::cSQLDatabase::EndTransaction | ( | bool | bCommit | ) |
may be part of put_AutoCommit(), Execute or called manually. SQLEndTran() replaces obsolete SQLTransact()
| HRESULT GrayLib::cSQLDatabase::ExecuteSQLAndFetch | ( | cSQLCmd & | oCmd, |
| cSQLStatement & | rResultSet, | ||
| cExceptionHolder * | pExceptionRet = nullptr, |
||
| bool | bWaitIfBusy = false |
||
| ) |
| HRESULT GrayLib::cSQLDatabase::ExecuteSQLCmd | ( | cSQLCmd & | oCmd, |
| cExceptionHolder * | pExceptionRet = nullptr |
||
| ) |
Exec the SQL command. ASSUME no result set is expected. (Insert,delete,etc) Similar to MFC CDatabase::ExecuteSQL()
| HRESULT GrayLib::cSQLDatabase::ExecuteSQLOrInsert | ( | cSQLCmdUpdate & | oCmdUpdate, |
| cExceptionHolder * | pExceptionRet | ||
| ) |
Update or insert whichever is needed.
| bool GrayLib::cSQLDatabase::get_AutoCommit | ( | ) | const |
| ISQLDatabase * GrayLib::cSQLDatabase::get_ISQLDatabase | ( | ) | const |
|
inlinevirtual |
What driver ultimately owns this?
Implements GrayLib::cSQLBase.
|
virtual |
Implements GrayLib::cSQLBase.
| const cSQLConfigDB & GrayLib::cSQLDatabase::GetConfigDB | ( | ) |
|
inline |
Is DB connected?
| bool GrayLib::cSQLDatabase::IsExtReferenced | ( | int | nCheckVal = 1 | ) | const |
is this connection in use? (in a pool) May or may not be open connection.
| HRESULT GrayLib::cSQLDatabase::OpenConnect | ( | cStringF | sConnectionString, |
| cExceptionHolder * | pExceptionHolder = nullptr, |
||
| int | iMaxRetries = 3 |
||
| ) |
Open a connection to a database using the driver that matches the sConnectionString. see: http://www.codeguru.com/mfc/comments/44221.shtml –for details Similar to MFC CDatabase::OpenEx()
|
protected |
| void GrayLib::cSQLDatabase::put_AutoCommit | ( | bool | bAutoCommit | ) |
auto SQL_COMMIT after Execute? makes all transactions COMMIT immediately. else we need to call EndTransaction(true) manually
|
protected |
Ask the DB/Driver about its capabilities. Populate m_ConfigDB.
| HRESULT GrayLib::cSQLDatabase::RetryOpenConnect | ( | cExceptionHolder * | pExceptionHolder = nullptr, |
| int | iMaxRetries = 100 |
||
| ) |
Seems the connect has been broken! Try to re-open it. reconnect
| cSQLDriver* GrayLib::cSQLDatabase::m_pSQLDriver |
My parent. Not set until after OpenConnect and m_bIsConnected.