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

#include <cSQLCmd.h>

Public Member Functions

 cSQLCmdWhere ()
 
void SetWhereParenthesis ()
 
void AddWhereCmd (const char *pszWhereCmd, bool bUseOr=false)
 
void AddWhereV (const char *pszColumnName, const char *pszValue=nullptr, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_IS_NULL, bool bUseOr=false)
 
void AddWhereInt (const char *pszColumnName, int value, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_Equals, bool bUseOr=false)
 
void AddWhereUInt (const char *pszColumnName, UINT value, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_Equals, bool bUseOr=false)
 
void AddWhereDouble (const char *pszColumnName, double value, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_Equals, bool bUseOr=false)
 
void AddWhereTime (const char *pszColumnName, const cTimeDouble &date, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_Equals, bool bUseOr=false)
 
void AddWhereStr (const char *pszColumnName, const char *pszValue, SQL_COMPARE_TYPE eCmp=SQL_COMPARE_Equals, bool bUseOr=false)
 
cStringA MakeCommandWhere (const cSQLConfigCmd &cmd, bool bIncludeWhereLiteral=true)
 
void ResetCommandWhere ()
 

Static Public Attributes

static const char *const k_SQLCompares [SQL_COMPARE_QTY]
 
static const char *const k_Param = "?"
 

Detailed Description

Any cSQLCmd that needs a "where" criteria/search/filter operation. Use for class cSQLCmdSelect, cSQLCmdDelete, cSQLCmdUpdate

Constructor & Destructor Documentation

◆ cSQLCmdWhere()

GrayLib::cSQLCmdWhere::cSQLCmdWhere ( )

Member Function Documentation

◆ AddWhereCmd()

void GrayLib::cSQLCmdWhere::AddWhereCmd ( const char *  pszWhereCmd,
bool  bUseOr = false 
)

◆ AddWhereDouble()

void GrayLib::cSQLCmdWhere::AddWhereDouble ( const char *  pszColumnName,
double  value,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_Equals,
bool  bUseOr = false 
)

◆ AddWhereInt()

void GrayLib::cSQLCmdWhere::AddWhereInt ( const char *  pszColumnName,
int  value,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_Equals,
bool  bUseOr = false 
)

◆ AddWhereStr()

void GrayLib::cSQLCmdWhere::AddWhereStr ( const char *  pszColumnName,
const char *  pszValue,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_Equals,
bool  bUseOr = false 
)

Test for 'NULL' immediately because it has a different syntax.

◆ AddWhereTime()

void GrayLib::cSQLCmdWhere::AddWhereTime ( const char *  pszColumnName,
const cTimeDouble date,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_Equals,
bool  bUseOr = false 
)

◆ AddWhereUInt()

void GrayLib::cSQLCmdWhere::AddWhereUInt ( const char *  pszColumnName,
UINT  value,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_Equals,
bool  bUseOr = false 
)
Note
SQL doesn't do native UINT! convert to Int. ASSUME it will fit.

◆ AddWhereV()

void GrayLib::cSQLCmdWhere::AddWhereV ( const char *  pszColumnName,
const char *  pszValue = nullptr,
SQL_COMPARE_TYPE  eCmp = SQL_COMPARE_IS_NULL,
bool  bUseOr = false 
)

Add where (col=val) conditional value to the query.

◆ MakeCommandWhere()

cStringA GrayLib::cSQLCmdWhere::MakeCommandWhere ( const cSQLConfigCmd cmd,
bool  bIncludeWhereLiteral = true 
)

Resolve the m_sWhere + m_aParams to a true command string once we know cSQLConfigCmd.

Note
Use cSQLConfigCmd to determine how a specific Db driver wants its arguments. e.g. MSSQL, MySQL or SQLite, etc.

◆ ResetCommandWhere()

void GrayLib::cSQLCmdWhere::ResetCommandWhere ( )

◆ SetWhereParenthesis()

void GrayLib::cSQLCmdWhere::SetWhereParenthesis ( )

Parenthesis on everything added so far. Must be called after calls to AddWhereCmd() obviously.

Member Data Documentation

◆ k_Param

const char *const GrayLib::cSQLCmdWhere::k_Param = "?"
static

◆ k_SQLCompares

const char *const GrayLib::cSQLCmdWhere::k_SQLCompares
static
Initial value:
=
{
"=",
">",
"<",
"<=",
">=",
"<>",
" like ",
" IS NULL",
" IS NOT NULL",
}

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