| QxOrm 1.1.6 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

IxSqlRelation.h
Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** http://www.qxorm.com/
    00004 ** http://sourceforge.net/projects/qxorm/
    00005 ** Original file by Lionel Marty
    00006 **
    00007 ** This file is part of the QxOrm library
    00008 **
    00009 ** This software is provided 'as-is', without any express or implied
    00010 ** warranty. In no event will the authors be held liable for any
    00011 ** damages arising from the use of this software.
    00012 **
    00013 ** GNU Lesser General Public License Usage
    00014 ** This file must be used under the terms of the GNU Lesser
    00015 ** General Public License version 2.1 as published by the Free Software
    00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the
    00017 ** packaging of this file.  Please review the following information to
    00018 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00020 **
    00021 ** If you have questions regarding the use of this file, please contact :
    00022 ** contact@qxorm.com
    00023 **
    00024 ****************************************************************************/
    00025
    00026 #ifndef _IX_SQL_RELATION_H_
    00027 #define _IX_SQL_RELATION_H_
    00028
    00029 #ifdef _MSC_VER
    00030 #pragma once
    00031 #endif
    00032
    00040 #include <QxDao/QxSqlRelationParams.h>
    00041
    00042 #include <QxCollection/QxCollection.h>
    00043
    00044 namespace qx {
    00045
    00046 class IxDataMember;
    00047 class IxDataMemberX;
    00048 class IxSqlRelation;
    00049
    00050 typedef QxCollection<QString, IxSqlRelation *> IxSqlRelationX;
    00051
    00056 class QX_DLL_EXPORT IxSqlRelation
    00057 {
    00058
    00059 public:
    00060
    00061    enum join_type { left_outer_join, inner_join };
    00062
    00063 protected:
    00064
    00065    IxDataMember *    m_pDataMember;
    00066    IxDataMemberX *   m_pDataMemberX;
    00067    IxDataMember *    m_pDataMemberId;
    00068    long              m_lOffsetRelation;
    00069    join_type         m_eJoinType;
    00070
    00071    QxCollection<QString, IxDataMember *> * m_lstDataMemberPtr;
    00072    IxSqlRelationX * m_lstSqlRelationPtr;
    00073
    00074 public:
    00075
    00076    IxSqlRelation(IxDataMember * p) : m_pDataMember(p), m_pDataMemberX(NULL), m_pDataMemberId(NULL), m_lOffsetRelation(100), m_eJoinType(left_outer_join), m_lstDataMemberPtr(NULL), m_lstSqlRelationPtr(NULL) { qAssert(p); }
    00077    virtual ~IxSqlRelation() = 0;
    00078
    00079    inline QxCollection<QString, IxDataMember *> * getLstDataMember() const { return m_lstDataMemberPtr; }
    00080    inline IxSqlRelationX * getLstRelation() const                          { return m_lstSqlRelationPtr; }
    00081
    00082    inline void setSqlJoinType(join_type e)         { m_eJoinType = e; }
    00083    inline join_type getSqlJoinType() const         { return m_eJoinType; }
    00084    inline IxDataMember * getDataMember() const     { return m_pDataMember; }
    00085    inline IxDataMemberX * getDataMemberX() const   { return m_pDataMemberX; }
    00086    inline IxDataMember * getDataId() const         { return m_pDataMemberId; }
    00087
    00088    QString getKey() const;
    00089    long getDataCount() const;
    00090    long getRelationCount() const;
    00091    IxDataMember * getDataByKey(const QString & sKey) const;
    00092    IxDataMember * nextData(long & lIndex) const;
    00093    IxSqlRelation * nextRelation(long & lIndex) const;
    00094    QString table() const;
    00095    QString tableAlias(QxSqlRelationParams & params) const;
    00096    QString getSqlJoin() const;
    00097
    00098    virtual void init() = 0;
    00099    virtual bool getCartesianProduct() const = 0;
    00100    virtual QVariant getIdFromQuery(bool bEager, QxSqlRelationParams & params) const = 0;
    00101    virtual void updateOffset(bool bEager, QxSqlRelationParams & params) const = 0;
    00102    virtual void createTable(QxSqlRelationParams & params) const = 0;
    00103    virtual void lazySelect(QxSqlRelationParams & params) const = 0;
    00104    virtual void eagerSelect(QxSqlRelationParams & params) const = 0;
    00105    virtual void lazyFrom(QxSqlRelationParams & params) const = 0;
    00106    virtual void eagerFrom(QxSqlRelationParams & params) const = 0;
    00107    virtual void lazyJoin(QxSqlRelationParams & params) const = 0;
    00108    virtual void eagerJoin(QxSqlRelationParams & params) const = 0;
    00109    virtual void lazyWhere(QxSqlRelationParams & params) const = 0;
    00110    virtual void eagerWhere(QxSqlRelationParams & params) const = 0;
    00111    virtual void lazyFetch_ResolveInput(QxSqlRelationParams & params) const = 0;
    00112    virtual void eagerFetch_ResolveInput(QxSqlRelationParams & params) const = 0;
    00113    virtual void lazyFetch_ResolveOutput(QxSqlRelationParams & params) const = 0;
    00114    virtual void eagerFetch_ResolveOutput(QxSqlRelationParams & params) const = 0;
    00115    virtual void lazyInsert(QxSqlRelationParams & params) const = 0;
    00116    virtual void lazyInsert_Values(QxSqlRelationParams & params) const = 0;
    00117    virtual void lazyUpdate(QxSqlRelationParams & params) const = 0;
    00118    virtual void lazyInsert_ResolveInput(QxSqlRelationParams & params) const = 0;
    00119    virtual void lazyUpdate_ResolveInput(QxSqlRelationParams & params) const = 0;
    00120    virtual QSqlError onBeforeSave(QxSqlRelationParams & params) const = 0;
    00121    virtual QSqlError onAfterSave(QxSqlRelationParams & params) const = 0;
    00122    virtual QSqlError createExtraTable(QxSqlRelationParams & params) const = 0;
    00123
    00124 #ifndef NDEBUG
    00125    bool verifyOffset(QxSqlRelationParams & params, bool bId) const;
    00126 #else
    00127    inline bool verifyOffset(QxSqlRelationParams & params, bool bId) const { Q_UNUSED(params); Q_UNUSED(bId); return true; }
    00128 #endif // NDEBUG
    00129
    00130 };
    00131
    00132 } // namespace qx
    00133
    00134 #endif // _IX_SQL_RELATION_H_

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines