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

#include <cSQLCmd.h>

Inheritance diagram for GrayLib::cSQLCmdSelect:
GrayLib::cSQLCmd

Public Member Functions

 cSQLCmdSelect (cStringA sFromTable)
 
virtual ~cSQLCmdSelect ()
 
virtual SQLCMD_TYPE get_CmdType () const override
 
virtual bool isResultsExpected () const
 
void SetCount (const char *pszColumnName=nullptr)
 
void SetCountWhereInt (const char *pszColumnName, int iValue)
 
void AddSelectCol (const char *pszColumnName)
 
void _cdecl SetSelectColsF (const char *pszColumnName,...)
 
void put_Select (cStringA sSelect)
 
void put_GroupBy (cStringA sColumnName)
 
void put_OrderBy (cStringA sColumnName)
 
void put_Limit (int iLimit=1)
 
virtual void ResetCommand () override
 
virtual void MakeCommand (const cSQLConfigCmd &cfg) override
 build the string from our args. More...
 
- Public Member Functions inherited from GrayLib::cSQLCmd
 cSQLCmd (cStringA sTableName="", cStringA sCommand="")
 
virtual ~cSQLCmd ()
 
cStringA get_Table () const
 
void put_Table (cStringA sTable)
 
bool isCommandMade () const
 
cStringA get_Command () const
 
void put_Command (cStringA sCommand)
 
void ResetCommand0 ()
 

Public Attributes

cSQLCmdWhere m_Where
 

Protected Attributes

cStringA m_sSelect
 What fields should be returned from Table and joins? More...
 
cStringA m_sGroupBy
 
cStringA m_sOrderBy
 
ITERATE_t m_iLimit
 'TOP' if MSSQL or 'LIMIT' if MySQL. Should always be used with 'order by'. m_sOrderBy More...
 
- Protected Attributes inherited from GrayLib::cSQLCmd
cStringA m_sTable
 The table ( 'From' if select ), delete, create. More...
 
cStringA m_sCommand
 The resultant full SQL command. use MakeCommand() to build this up. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cSQLCmd
static bool GRAYCALL IsValueTime (const char *pszVal)
 
static cStringA GRAYCALL MakeValueTime (const cSQLConfigCmd &cfg, const cTimeDouble &date)
 
static cStringA GRAYCALL MakeValueStr (const cSQLConfigCmd &cfg, const cVariant &vVal)
 
- Static Public Attributes inherited from GrayLib::cSQLCmd
static const char * k_pszNULL = "NULL"
 

Detailed Description

full 'select' query to be used for cSQLStatement. override MakeCommand() SQLCMD_Select

Constructor & Destructor Documentation

◆ cSQLCmdSelect()

GrayLib::cSQLCmdSelect::cSQLCmdSelect ( cStringA  sFromTable)

◆ ~cSQLCmdSelect()

GrayLib::cSQLCmdSelect::~cSQLCmdSelect ( )
virtual

Member Function Documentation

◆ AddSelectCol()

void GrayLib::cSQLCmdSelect::AddSelectCol ( const char *  pszColumnName)

◆ get_CmdType()

virtual SQLCMD_TYPE GrayLib::cSQLCmdSelect::get_CmdType ( ) const
inlineoverridevirtual

Implements GrayLib::cSQLCmd.

◆ isResultsExpected()

virtual bool GrayLib::cSQLCmdSelect::isResultsExpected ( ) const
inlinevirtual

Reimplemented from GrayLib::cSQLCmd.

◆ MakeCommand()

void GrayLib::cSQLCmdSelect::MakeCommand ( const cSQLConfigCmd cfg)
overridevirtual

build the string from our args.

Override cSQLCmdWhere

sCommandPrefix = "Delete" etc.

Implements GrayLib::cSQLCmd.

◆ put_GroupBy()

void GrayLib::cSQLCmdSelect::put_GroupBy ( cStringA  sColumnName)

◆ put_Limit()

void GrayLib::cSQLCmdSelect::put_Limit ( int  iLimit = 1)

limit how many rows to get back. sm_bUseLIMITCommand LIMIT and OFFSET commands are only used by MySQL and PostgreSQL MSSQL uses 'TOP' clause ?

◆ put_OrderBy()

void GrayLib::cSQLCmdSelect::put_OrderBy ( cStringA  sColumnName)

◆ put_Select()

void GrayLib::cSQLCmdSelect::put_Select ( cStringA  sSelect)

set the select set command string. TODO Use SetSelectColsF instead.

◆ ResetCommand()

void GrayLib::cSQLCmdSelect::ResetCommand ( )
overridevirtual

Reimplemented from GrayLib::cSQLCmd.

◆ SetCount()

void GrayLib::cSQLCmdSelect::SetCount ( const char *  pszColumnName = nullptr)

Count rows.

◆ SetCountWhereInt()

void GrayLib::cSQLCmdSelect::SetCountWhereInt ( const char *  pszColumnName,
int  iValue 
)

Count if current table has any matches in this field. This Works for both MySQL and MSSQL - sCount like sm_szSQLSelect

◆ SetSelectColsF()

void _cdecl GrayLib::cSQLCmdSelect::SetSelectColsF ( const char *  pszColumnName,
  ... 
)

nullptr terminated list.

Member Data Documentation

◆ m_iLimit

ITERATE_t GrayLib::cSQLCmdSelect::m_iLimit
protected

'TOP' if MSSQL or 'LIMIT' if MySQL. Should always be used with 'order by'. m_sOrderBy

◆ m_sGroupBy

cStringA GrayLib::cSQLCmdSelect::m_sGroupBy
protected

◆ m_sOrderBy

cStringA GrayLib::cSQLCmdSelect::m_sOrderBy
protected

◆ m_sSelect

cStringA GrayLib::cSQLCmdSelect::m_sSelect
protected

What fields should be returned from Table and joins?

◆ m_Where

cSQLCmdWhere GrayLib::cSQLCmdSelect::m_Where

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