Content


NTL
Core
IDbQuery

IDbQuery


This interface describes minimum required functionality from high level abstraction of database query.

You can find more information in comments below.

class IDbQuery : public virtual IReleasable
{
public:
    struct DbJoin // Join description 
    {
        String Table;
        String Alias;
        DbCondition On;
    };

    using DbJoins = std::vector<DbJoin>;

    struct DbUnion // Union description 
    {
        ReleasablePtr<IDbQuery> Query;
        bool All;
    };

    using DbUnions = std::vector<DbUnion>;
protected:
    StringKeyValueArray m_aSelect; // [{ column|expression, alias }, ...] 
    bool m_bDistinct;
    StringKeyValueArray m_aFrom; // [{ table, alias }, ...] 
    DbJoins m_aInnerJoins; // [ { { table, alias }, on_condition }, ...] 
    DbJoins m_aLeftJoins; // [ { { table, alias }, on_condition }, ...] 
    DbJoins m_aRightJoins; // [ { { table, alias }, on_condition }, ...] 
    DbCondition m_pWhere;
    StringArray m_aGroupBy;
    DbCondition m_pHaving;
    DbOrderByArray m_aOrderBy; // [{ column, DbOrderBy }, ...] 
    int64 m_iLimit;
    int64 m_iOffset;
    DbUnions m_aUnions;
    String m_sInto;
    String m_sTable;

    // Following helper methods are used to modify Active Record model 
    void setActiveRecordNew(CDbBaseActiveRecord *model, const bool value);
    void setActiveRecordPrimaryKey(CDbBaseActiveRecord *model, const DbActiveRecordPrimaryKey &value) const;
    void setAttributeValue(IDbAttribute *attr, const DbValue &value);
public:
    // Read-only references to the protected members 
    StringKeyValueArray const &aSelect;
    bool const &bDistinct;
    StringKeyValueArray const &aFrom;
    DbJoins const &aInnerJoin;
    DbJoins const &aLeftJoin;
    DbJoins const &aRightJoin;
    DbCondition const &pWhere;
    StringArray const &aGroupBy;
    DbCondition const &pHaving;
    DbOrderByArray const &aOrderBy;
    int64 const &iLimit;
    int64 const &iOffset;
    DbUnions const &aUnion;
    String const &sInto;
    String const &sTable;
};
Namespace: nitisa
Include: Nitisa/Interfaces/IDbQuery.h