| QxOrm 1.2.5 C++ Object Relational Mapping library

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

- File List
- File Members

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 namespace qx {
    00052
    00053 class IxSqlQueryBuilder;
    00054
    00059 class QxSqlRelationParams
    00060 {
    00061
    00062 protected:
    00063
    00064    QVariant                      m_vId;
    00065    long                          m_lIndex;
    00066    long                          m_lIndexOwner;
    00067    long                          m_lOffset;
    00068    QString *                     m_sql;
    00069    IxSqlQueryBuilder *           m_builder;
    00070    QSqlQuery *                   m_query;
    00071    QSqlDatabase *                m_database;
    00072    void *                        m_pOwner;
    00073    qx::dao::sql_join::join_type  m_eJoinType;
    00074
    00075 public:
    00076
    00077    QxSqlRelationParams() : m_lIndex(0), m_lIndexOwner(0), m_lOffset(0), m_sql(NULL), m_builder(NULL), m_query(NULL), m_database(NULL), m_pOwner(NULL), m_eJoinType(qx::dao::sql_join::no_join) { ; }
    00078    QxSqlRelationParams(long lIndex, long lOffset, QString * sql, IxSqlQueryBuilder * builder, QSqlQuery * query, void * pOwner) : m_lIndex(lIndex), m_lIndexOwner(0), m_lOffset(lOffset), m_sql(sql), m_builder(builder), m_query(query), m_database(NULL), m_pOwner(pOwner), m_eJoinType(qx::dao::sql_join::no_join) { ; }
    00079    QxSqlRelationParams(long lIndex, long lOffset, QString * sql, IxSqlQueryBuilder * builder, QSqlQuery * query, void * pOwner, const QVariant & vId) : m_vId(vId), m_lIndex(lIndex), m_lIndexOwner(0), m_lOffset(lOffset), m_sql(sql), m_builder(builder), m_query(query), m_database(NULL), m_pOwner(pOwner), m_eJoinType(qx::dao::sql_join::no_join) { ; }
    00080    virtual ~QxSqlRelationParams() { ; }
    00081
    00082    inline QVariant id() const                            { return m_vId; }
    00083    inline long index() const                             { return m_lIndex; }
    00084    inline long indexOwner() const                        { return m_lIndexOwner; }
    00085    inline long offset() const                            { return m_lOffset; }
    00086    inline QString & sql()                                { qAssert(m_sql); return (* m_sql); }
    00087    inline const QString & sql() const                    { qAssert(m_sql); return (* m_sql); }
    00088    inline QSqlQuery & query()                            { qAssert(m_query); return (* m_query); }
    00089    inline const QSqlQuery & query() const                { qAssert(m_query); return (* m_query); }
    00090    inline QSqlDatabase & database()                      { qAssert(m_database); return (* m_database); }
    00091    inline const QSqlDatabase & database() const          { qAssert(m_database); return (* m_database); }
    00092    inline IxSqlQueryBuilder & builder()                  { qAssert(m_builder); return (* m_builder); }
    00093    inline const IxSqlQueryBuilder & builder() const      { qAssert(m_builder); return (* m_builder); }
    00094    inline void * owner() const                           { return m_pOwner; }
    00095    inline qx::dao::sql_join::join_type joinType() const  { return m_eJoinType; }
    00096
    00097    inline void setId(const QVariant & vId)                  { m_vId = vId; }
    00098    inline void setIndex(long lIndex)                        { m_lIndex = lIndex; }
    00099    inline void setIndexOwner(long lIndex)                   { m_lIndexOwner = lIndex; }
    00100    inline void setOffset(long lOffset)                      { m_lOffset = lOffset; }
    00101    inline void setSql(QString * sql)                        { m_sql = sql; }
    00102    inline void setBuilder(IxSqlQueryBuilder * builder)      { m_builder = builder; }
    00103    inline void setQuery(QSqlQuery * query)                  { m_query = query; }
    00104    inline void setDatabase(QSqlDatabase * database)         { m_database = database; }
    00105    inline void setOwner(void * pOwner)                      { m_pOwner = pOwner; }
    00106    inline void setJoinType(qx::dao::sql_join::join_type e)  { m_eJoinType = e; }
    00107
    00108 };
    00109
    00110 } // namespace qx
    00111
    00112 #endif // _QX_SQL_RELATION_PARAMS_H_