QxOrm  1.2.6
C++ Object Relational Mapping library
QxSqlRelationParams.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** http://www.qxorm.com/
00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
00005 **
00006 ** This file is part of the QxOrm library
00007 **
00008 ** This software is provided 'as-is', without any express or implied
00009 ** warranty. In no event will the authors be held liable for any
00010 ** damages arising from the use of this software
00011 **
00012 ** Commercial Usage
00013 ** Licensees holding valid commercial QxOrm licenses may use this file in
00014 ** accordance with the commercial license agreement provided with the
00015 ** Software or, alternatively, in accordance with the terms contained in
00016 ** a written agreement between you and Lionel Marty
00017 **
00018 ** GNU General Public License Usage
00019 ** Alternatively, this file may be used under the terms of the GNU
00020 ** General Public License version 3.0 as published by the Free Software
00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the
00022 ** packaging of this file. Please review the following information to
00023 ** ensure the GNU General Public License version 3.0 requirements will be
00024 ** met : http://www.gnu.org/copyleft/gpl.html
00025 **
00026 ** If you are unsure which license is appropriate for your use, or
00027 ** if you have questions regarding the use of this file, please contact :
00028 ** contact@qxorm.com
00029 **
00030 ****************************************************************************/
00031 
00032 #ifndef _QX_SQL_RELATION_PARAMS_H_
00033 #define _QX_SQL_RELATION_PARAMS_H_
00034 
00035 #ifdef _MSC_VER
00036 #pragma once
00037 #endif
00038 
00046 #include <QtSql/qsqldatabase.h>
00047 #include <QtSql/qsqlquery.h>
00048 
00049 #include <QxDao/QxSqlJoin.h>
00050 
00051 #include <QxCollection/QxCollection.h>
00052 
00053 namespace qx {
00054 
00055 class QxSqlRelationLinked;
00056 class IxSqlQueryBuilder;
00057 class IxSqlRelation;
00058 
00063 class QX_DLL_EXPORT QxSqlRelationParams
00064 {
00065 
00066 public:
00067 
00068    typedef boost::shared_ptr<QxSqlRelationLinked> type_relation_linked_ptr;
00069    typedef QHash<QString, type_relation_linked_ptr> type_lst_relation_linked;
00070 
00071 protected:
00072 
00073    QVariant                      m_vId;            
00074    long                          m_lIndex;         
00075    long                          m_lIndexOwner;    
00076    long                          m_lOffset;        
00077    QString *                     m_sql;            
00078    IxSqlQueryBuilder *           m_builder;        
00079    QSqlQuery *                   m_query;          
00080    QSqlDatabase *                m_database;       
00081    void *                        m_pOwner;         
00082    qx::dao::sql_join::join_type  m_eJoinType;      
00083    type_lst_relation_linked *    m_pRelationX;     
00084    QString                       m_sTableAlias;    
00085 
00086 public:
00087 
00088    QxSqlRelationParams();
00089    QxSqlRelationParams(long lIndex, long lOffset, QString * sql, IxSqlQueryBuilder * builder, QSqlQuery * query, void * pOwner);
00090    QxSqlRelationParams(long lIndex, long lOffset, QString * sql, IxSqlQueryBuilder * builder, QSqlQuery * query, void * pOwner, const QVariant & vId);
00091    virtual ~QxSqlRelationParams();
00092 
00093    inline QVariant id() const                            { return m_vId; }
00094    inline long index() const                             { return m_lIndex; }
00095    inline long indexOwner() const                        { return m_lIndexOwner; }
00096    inline long offset() const                            { return m_lOffset; }
00097    inline QString & sql()                                { qAssert(m_sql); return (* m_sql); }
00098    inline const QString & sql() const                    { qAssert(m_sql); return (* m_sql); }
00099    inline QSqlQuery & query()                            { qAssert(m_query); return (* m_query); }
00100    inline const QSqlQuery & query() const                { qAssert(m_query); return (* m_query); }
00101    inline QSqlDatabase & database()                      { qAssert(m_database); return (* m_database); }
00102    inline const QSqlDatabase & database() const          { qAssert(m_database); return (* m_database); }
00103    inline IxSqlQueryBuilder & builder()                  { qAssert(m_builder); return (* m_builder); }
00104    inline const IxSqlQueryBuilder & builder() const      { qAssert(m_builder); return (* m_builder); }
00105    inline void * owner() const                           { return m_pOwner; }
00106    inline qx::dao::sql_join::join_type joinType() const  { return m_eJoinType; }
00107    inline type_lst_relation_linked * relationX() const   { return m_pRelationX; }
00108    inline QString getTableAlias() const                  { return m_sTableAlias; }
00109 
00110    inline void setId(const QVariant & vId)                  { m_vId = vId; }
00111    inline void setIndex(long lIndex)                        { m_lIndex = lIndex; }
00112    inline void setIndexOwner(long lIndex)                   { m_lIndexOwner = lIndex; }
00113    inline void setOffset(long lOffset)                      { m_lOffset = lOffset; }
00114    inline void setSql(QString * sql)                        { m_sql = sql; }
00115    inline void setBuilder(IxSqlQueryBuilder * builder)      { m_builder = builder; }
00116    inline void setQuery(QSqlQuery * query)                  { m_query = query; }
00117    inline void setDatabase(QSqlDatabase * database)         { m_database = database; }
00118    inline void setOwner(void * pOwner)                      { m_pOwner = pOwner; }
00119    inline void setJoinType(qx::dao::sql_join::join_type e)  { m_eJoinType = e; }
00120    inline void setRelationX(type_lst_relation_linked * p)   { m_pRelationX = p; }
00121    inline void setTableAlias(const QString & s)             { m_sTableAlias = s; }
00122 
00123 };
00124 
00125 } // namespace qx
00126 
00127 #endif // _QX_SQL_RELATION_PARAMS_H_