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

#include <cSQLStatement.h>

Inheritance diagram for GrayLib::cSQLStatementQ:
GrayLib::cSQLStatement IScriptableGetter GrayLib::cSQLBase IScriptableEnumerator Gray::CObject Gray::cNonCopyable GrayLib::cScriptSourceSQLStatement

Public Member Functions

 cSQLStatementQ ()
 
virtual ~cSQLStatementQ ()
 
SQL_TYPE_t SetColumnType (SQL_COLUMN_t iColumn, SQL_TYPE_t eType)
 
SQL_TYPE_t RemoveColumn (SQL_COLUMN_t iColumn)
 
virtual HRESULT ExecuteAndFetch (cSQLDatabase *pDatabase, cSQLCmd &oCmd, cExceptionHolder *pExceptionRet=nullptr) override
 
virtual HRESULT FetchNext (bool bWaitIfBusy=false) override
 
virtual bool GetColumnVar (SQL_COLUMN_t iColumn, OUT cVariant &vVal) override
 
bool GetColumnVar (const char *pszFieldName, OUT cVariant &vVal)
 
STDMETHOD() s_GetEnum (ITERATE_t i, OUT cStringA &rsPropName, OUT cVariant &rvValRet) override
 
STDMETHOD() s_GetByName (const ATOMCHAR_t *pszPropName, OUT cVariant &vValRet) override
 
- Public Member Functions inherited from GrayLib::cSQLStatement
 cSQLStatement ()
 
virtual ~cSQLStatement ()
 
bool isConnected () const
 
virtual cSQLDriverget_SQLDriver () const
 What driver ultimately owns this? More...
 
virtual cSQLBaseget_SQLParent () const
 
void ExecCancel ()
 
bool CloseStatement (bool bDrop=true, bool bThrowOnError=false)
 
bool Close ()
 
SQL_COLUMN_t GetColumnCount ()
 
cSQLColumnInfoGetColumnInfo (SQL_COLUMN_t iColumn=k_SQL_COL_FIRST)
 
SQL_COLUMN_t FindColumn (const char *pszFieldName)
 
SQL_COLUMN_t VerifyColumn (SQL_COLUMN_t iColumn, const char *pszFieldName)
 
bool GetColumnString (SQL_COLUMN_t iColumn, OUT cStringA &sResult)
 Get the data. string/chars is sometimes a special case here. More...
 
cStringA GetColumnStr (SQL_COLUMN_t iColumn=k_SQL_COL_FIRST)
 
int GetColumnInt (SQL_COLUMN_t iColumn=k_SQL_COL_FIRST)
 
STDMETHOD() s_GetEnum (ITERATE_t i, OUT cStringA &rsPropName, OUT cVariant &vValRet) override
 
cStringA GetColumnStr (const char *pszFieldName)
 These are slightly dangerous to use. you MUST know the order of the select in advance! (or use cSQLStatementQ) More...
 
int GetColumnInt (const char *pszFieldName)
 
bool GetColumnVar (const char *pszFieldName, OUT cVariant &vVal)
 
- 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 Attributes

cArrayStruct< cVariantm_aColumnData
 store data values for fields/columns. SQL_COLUMN_t = 1 based array More...
 
- Public Attributes inherited from GrayLib::cSQLStatement
cStringA m_sFromTable
 usually the table name. used for error text. More...
 
- Public Attributes inherited from GrayLib::cSQLBase
bool m_bLogOnError
 I want to log message if error. More...
 

Protected Member Functions

int ReadRecordset ()
 
- Protected Member Functions inherited from GrayLib::cSQLStatement
ISQLStatementget_ISQLStatement () const
 
ITERATE_t ReadColumnCount ()
 
bool ReadColumnInfo (SQL_COLUMN_t iColumn, OUT cSQLColumnInfo &info)
 ODBC data type (SQL_C_BINARY) More...
 
bool AllocISQLStatement (const cSQLCmd &oCmd)
 
- 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::cSQLStatement
cSQLDatabasePtr m_pDatabase
 parent/source Database. More...
 
cArrayStruct< cSQLColumnInfom_aColumnInfo
 store metadata/description of the fields selected. 1 based. More...
 
- Protected Attributes inherited from GrayLib::cSQLBase
cIUnkPtr< ISQLBasem_pISQL
 ISQLBase to some SQL implementation object -> a Driver/environment, connection or recordset/statement. More...
 

Detailed Description

The results of a select query. Similar to .NET SQLTable. Queue up all the data fields returned for a Row. such that Props/Fields can be read in random order. Defeats the sequential field read requirement.

Constructor & Destructor Documentation

◆ cSQLStatementQ()

GrayLib::cSQLStatementQ::cSQLStatementQ ( )

◆ ~cSQLStatementQ()

GrayLib::cSQLStatementQ::~cSQLStatementQ ( )
virtual

Member Function Documentation

◆ ExecuteAndFetch()

HRESULT GrayLib::cSQLStatementQ::ExecuteAndFetch ( cSQLDatabase pDatabase,
cSQLCmd oCmd,
cExceptionHolder pExceptionRet = nullptr 
)
overridevirtual

Reimplemented from GrayLib::cSQLStatement.

◆ FetchNext()

HRESULT GrayLib::cSQLStatementQ::FetchNext ( bool  bWaitIfBusy = false)
overridevirtual

fetches the next rowset of data from the result set and returns data for all bound columns Called after ExecuteAndFetch() repeat calling this until we get all rows.

Reimplemented from GrayLib::cSQLStatement.

◆ GetColumnVar() [1/2]

bool GrayLib::cSQLStatementQ::GetColumnVar ( const char *  pszFieldName,
OUT cVariant vVal 
)
inline

Get column by name.

◆ GetColumnVar() [2/2]

bool GrayLib::cSQLStatementQ::GetColumnVar ( SQL_COLUMN_t  iColumn,
OUT cVariant vVal 
)
overridevirtual

Reimplemented from GrayLib::cSQLStatement.

◆ ReadRecordset()

SQL_COLUMN_t GrayLib::cSQLStatementQ::ReadRecordset ( )
protected

get all field/column results of a query row at once. cache all the data from all the columns into variants.

Returns
How many columns.

◆ RemoveColumn()

SQL_TYPE_t GrayLib::cSQLStatementQ::RemoveColumn ( SQL_COLUMN_t  iColumn)

setting to type SQL_TYPE_NULL will mean just ignore it.

◆ s_GetByName()

HRESULT GrayLib::cSQLStatementQ::s_GetByName ( const ATOMCHAR_t pszPropName,
OUT cVariant vValRet 
)
override

◆ s_GetEnum()

HRESULT GrayLib::cSQLStatementQ::s_GetEnum ( ITERATE_t  i,
OUT cStringA rsPropName,
OUT cVariant rvValRet 
)
override

TODO random access

◆ SetColumnType()

SQL_TYPE_t GrayLib::cSQLStatementQ::SetColumnType ( SQL_COLUMN_t  iColumn,
SQL_TYPE_t  eType 
)

Alter the column type as recorded. usually used for RemoveColumn()

Member Data Documentation

◆ m_aColumnData

cArrayStruct<cVariant> GrayLib::cSQLStatementQ::m_aColumnData

store data values for fields/columns. SQL_COLUMN_t = 1 based array


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