Content


NTL
Core
CDbCondition

CDbCondition


This is a class representing query conditions. It cannot be created directly. Instead, you need to use functions db::Expression(), db::Equals(), db::NotEquals(), db::Greater(), db::GreaterEquals(), db::Less(), db::LessEquals(), db::And(), db::Or(), db::Not(), db::Between(), db::NotBetween(), db::In(), db::NotIn(), db::Like(), db::NotLike(), db::Exists(), db::NotExists() or equivalent ones from the nitisa::db namespace.

You can find more information in comments below. Overrided methods can be found in corresponding base class or interface.

class CDbCondition final :public CReleasable
{
public:
    enum class ConditionType
    {
        Expression, // Condition is a custom expression (for example, "LENGTH(name)" or "IFNULL(age, 0)") 
        Equals, // Condition is a comparison for equality 
        NotEquals, // Condition is a comparison for not equality 
        Greater, // Condition is a checking whether first operand is greater than second one 
        GreaterEquals, // Condition is a checking whether first operand is greater or equals to second one 
        Less, // Condition is a checking whether first operand is less than second one 
        LessEquals, // Condition is a checking whether first operand is less or equals to second one 
        And, // Condition is a concatenation of two other conditions with AND operator 
        Or, // Condition is a concatenation of two other conditions with OR operator 
        Not, // Condition is a negation of other condition 
        Between, // Condition is checking whether first operand is between second and third ones 
        NotBetween, // Condition is checking whether first operand is not between second and third ones 
        In, // Condition is checking whether operand is in array of allowed values 
        NotIn, // Condition is checking whether operand is not in array of allowed values 
        Like, // Condition is checking whether operand corresponds to specified pattern 
        NotLike, // Condition is checking whether operand does not correspond to specified pattern 
        Exists, // Condition is checking whether expression has data in a result 
        NotExists // Condition is checking whether expression has no data in a result  
    };

    enum class OperandType
    {
        Column, // Operand is a column name 
        Value, // Operand is a value 
        Expression // Operand is another expression 
    };
public:
    ConditionType const &Type; // Condition type 
    OperandType const &Operand1Type; // Operand1 type 
    OperandType const &Operand2Type; // Operand2 type 
    OperandType const &Operand3Type; // Operand3 type 
    String const &Column1; // Column1 name. Only relevant if Operand1Type = Column 
    String const &Column2; // Column2 name. Only relevant if Operand2Type = Column 
    String const &Column3; // Column3 name. Only relevant if Operand3Type = Column 
    DbValue const &Value1; // Value1. Only relevant if Operand1Type = Value 
    DbValue const &Value2; // Value2. Only relevant if Operand2Type = Value 
    DbValue const &Value3; // Value3. Only relevant if Operand3Type = Value 
    std::vector<DbValue> const &Values; // Array of values. Only relevant if Type = In or NotIn 
    DbCondition const &Operand1; // Expression1. Only relevant if Operand1Type = Expression 
    DbCondition const &Operand2; // Expression2. Only relevant if Operand2Type = Expression 
    DbCondition const &Operand3; // Expression3. Only relevant if Operand3Type = Expression 
};
Namespace: nitisa
Include: Nitisa/Db/DbCondition.h