![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cSQLStatement.h>
Public Member Functions | |
cSQLStatement () | |
virtual | ~cSQLStatement () |
bool | isConnected () const |
virtual cSQLDriver * | get_SQLDriver () const |
What driver ultimately owns this? More... | |
virtual cSQLBase * | get_SQLParent () const |
virtual HRESULT | ExecuteAndFetch (cSQLDatabase *pDatabase, cSQLCmd &oCmd, cExceptionHolder *pExceptionRet=nullptr) |
virtual HRESULT | FetchNext (bool bWaitIfBusy=false) |
void | ExecCancel () |
bool | CloseStatement (bool bDrop=true, bool bThrowOnError=false) |
bool | Close () |
SQL_COLUMN_t | GetColumnCount () |
cSQLColumnInfo * | GetColumnInfo (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) |
virtual bool | GetColumnVar (SQL_COLUMN_t iColumn, OUT cVariant &vValRet) |
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) |
![]() | |
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 |
![]() | |
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 | |
cStringA | m_sFromTable |
usually the table name. used for error text. More... | |
![]() | |
bool | m_bLogOnError |
I want to log message if error. More... | |
Protected Member Functions | |
ISQLStatement * | get_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) |
![]() | |
bool | AttachISQL (ISQLBase *pSQL) |
void | FreeISQL () |
bool | FreeISQLTested () |
cSQLBase () | |
![]() | |
cNonCopyable () noexcept | |
Force the use of Factory creation via protected constructor. More... | |
~cNonCopyable () noexcept | |
Protected Attributes | |
cSQLDatabasePtr | m_pDatabase |
parent/source Database. More... | |
cArrayStruct< cSQLColumnInfo > | m_aColumnInfo |
store metadata/description of the fields selected. 1 based. More... | |
![]() | |
cIUnkPtr< ISQLBase > | m_pISQL |
ISQLBase to some SQL implementation object -> a Driver/environment, connection or recordset/statement. More... | |
Friends | |
class | cSQLDatabase |
Additional Inherited Members | |
![]() | |
static const FILECHAR_t *GRAYCALL | RemoveDriverIdentification (const FILECHAR_t *pszError) |
the results of the SQL select query command. Transient usually stack based. search for a group of records sequentially. Similar to .NET SQLReader. Raw use of SQLGetData() (must be called in sequential column order)
GrayLib::cSQLStatement::cSQLStatement | ( | ) |
|
virtual |
if the database gets reconnected the record set is screwed and this will crash!
|
protected |
bool GrayLib::cSQLStatement::Close | ( | void | ) |
Get rid of the record set. no need to disconnect from the database at this point. yet.
bool GrayLib::cSQLStatement::CloseStatement | ( | bool | bDrop = true , |
bool | bThrowOnError = false |
||
) |
Free my ISQLStatement in a different way.
void GrayLib::cSQLStatement::ExecCancel | ( | ) |
Shutdown any pending query for CRecordset's hstmt's
|
virtual |
The query command is complete. Send it to the SQL server.
Reimplemented in GrayLib::cSQLStatementQ.
|
virtual |
Fetches the next rowset of data from the result set (after exec) and returns data for all bound columns. Called after of ExecuteAndFetch() repeat calling this until we get all rows. Like MFC MoveNext(). http://msdn.microsoft.com/en-us/library/ms712424%28VS.85%29.aspx
Reimplemented in GrayLib::cSQLStatementQ.
SQL_COLUMN_t GrayLib::cSQLStatement::FindColumn | ( | const char * | pszFieldName | ) |
Find by name.
|
protected |
|
virtual |
What driver ultimately owns this?
Implements GrayLib::cSQLBase.
|
virtual |
Implements GrayLib::cSQLBase.
SQL_COLUMN_t GrayLib::cSQLStatement::GetColumnCount | ( | ) |
Number of columns. not including column 0 Lazy load. read the format info for all the columns. Info specific to the current column. i.e. Current size of variable length fields and null state is not included of course.
cSQLColumnInfo * GrayLib::cSQLStatement::GetColumnInfo | ( | SQL_COLUMN_t | iColumn = k_SQL_COL_FIRST | ) |
|
inline |
Get column by name.
int GrayLib::cSQLStatement::GetColumnInt | ( | SQL_COLUMN_t | iColumn = k_SQL_COL_FIRST | ) |
iColumn = k_SQL_COL_FIRST
|
inline |
These are slightly dangerous to use. you MUST know the order of the select in advance! (or use cSQLStatementQ)
Get column by name. like MFC GetFieldValue()
cStringA GrayLib::cSQLStatement::GetColumnStr | ( | SQL_COLUMN_t | iColumn = k_SQL_COL_FIRST | ) |
return the string immediately for this column in the current rowset returned.
bool GrayLib::cSQLStatement::GetColumnString | ( | SQL_COLUMN_t | iColumn, |
OUT cStringA & | sResult | ||
) |
Get the data. string/chars is sometimes a special case here.
|
inline |
Get column by name.
|
virtual |
Get the data for the column as a variant.
Reimplemented in GrayLib::cSQLStatementQ.
bool GrayLib::cSQLStatement::isConnected | ( | ) | const |
Is DB connected?
|
protected |
Get number of columns not including column 0. So index can be equal to this !
|
protected |
ODBC data type (SQL_C_BINARY)
Get metadata/description of the column in the current data set.
|
override |
SQL_COLUMN_t GrayLib::cSQLStatement::VerifyColumn | ( | SQL_COLUMN_t | iColumn, |
const char * | pszFieldName | ||
) |
If the select order is known. we should verify sanity.
|
friend |
|
protected |
store metadata/description of the fields selected. 1 based.
|
protected |
parent/source Database.
cStringA GrayLib::cSQLStatement::m_sFromTable |
usually the table name. used for error text.