QxOrm  1.5.0
C++ Object Relational Mapping library
QxSqlQuery.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** https://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_QUERY_H_
00033 #define _QX_SQL_QUERY_H_
00034 
00035 #ifdef _MSC_VER
00036 #pragma once
00037 #endif
00038 
00046 #ifdef Q_COMPILER_INITIALIZER_LISTS
00047 #include <initializer_list>
00048 #endif // Q_COMPILER_INITIALIZER_LISTS
00049 
00050 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00051 #include <boost/serialization/serialization.hpp>
00052 #include <boost/serialization/split_free.hpp>
00053 #include <boost/serialization/nvp.hpp>
00054 #endif // _QX_ENABLE_BOOST_SERIALIZATION
00055 
00056 #include <QtCore/qdatastream.h>
00057 
00058 #ifndef _QX_NO_JSON
00059 #include <QtCore/qjsonvalue.h>
00060 #include <QtCore/qjsonobject.h>
00061 #include <QtCore/qjsonarray.h>
00062 #include <QtCore/qjsondocument.h>
00063 #endif // _QX_NO_JSON
00064 
00065 #include <QtSql/qsqlquery.h>
00066 
00067 #include <QxCollection/QxCollection.h>
00068 
00069 #include <QxDao/QxSqlElement/QxSqlElement.h>
00070 
00071 #include <QxSerialize/QxSerializeFastCompil.h>
00072 
00073 #include <QxTraits/get_class_name.h>
00074 
00075 #include <QxRegister/QxVersion.h>
00076 
00077 #include <QxConvert/QxConvert.h>
00078 
00079 namespace qx {
00080 class QxSqlQuery;
00081 } // namespace qx
00082 
00083 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00084 namespace boost {
00085 namespace serialization {
00086 
00087 template <class Archive> inline void qx_save(Archive & ar, const qx::QxSqlQuery & t, const unsigned int file_version);
00088 template <class Archive> inline void qx_load(Archive & ar, qx::QxSqlQuery & t, const unsigned int file_version);
00089 
00090 } // namespace serialization
00091 } // namespace boost
00092 #endif // _QX_ENABLE_BOOST_SERIALIZATION
00093 
00094 QX_DLL_EXPORT QDataStream & operator<< (QDataStream & stream, const qx::QxSqlQuery & t) QX_USED;
00095 QX_DLL_EXPORT QDataStream & operator>> (QDataStream & stream, qx::QxSqlQuery & t) QX_USED;
00096 
00097 #ifndef _QX_NO_JSON
00098 namespace qx {
00099 namespace cvt {
00100 namespace detail {
00101 template <> struct QxConvert_ToJson< qx::QxSqlQuery >;
00102 template <> struct QxConvert_FromJson< qx::QxSqlQuery >;
00103 QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const qx::QxSqlQuery & t, const QString & format) QX_USED;
00104 QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue & j, qx::QxSqlQuery & t, const QString & format) QX_USED;
00105 } // namespace detail
00106 } // namespace cvt
00107 } // namespace qx
00108 #endif // _QX_NO_JSON
00109 
00110 namespace qx {
00111 
00244 class QX_DLL_EXPORT QxSqlQuery
00245 {
00246 
00247 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00248    template <class Archive> friend inline void boost::serialization::qx_save(Archive & ar, const qx::QxSqlQuery & t, const unsigned int file_version);
00249    template <class Archive> friend inline void boost::serialization::qx_load(Archive & ar, qx::QxSqlQuery & t, const unsigned int file_version);
00250 #endif // _QX_ENABLE_BOOST_SERIALIZATION
00251 
00252    friend QX_DLL_EXPORT QDataStream & ::operator<< (QDataStream & stream, const qx::QxSqlQuery & t);
00253    friend QX_DLL_EXPORT QDataStream & ::operator>> (QDataStream & stream, qx::QxSqlQuery & t);
00254 
00255 #ifndef _QX_NO_JSON
00256    friend struct qx::cvt::detail::QxConvert_ToJson< qx::QxSqlQuery >;
00257    friend struct qx::cvt::detail::QxConvert_FromJson< qx::QxSqlQuery >;
00258    friend QX_DLL_EXPORT QJsonValue qx::cvt::detail::QxConvert_ToJson_Helper(const qx::QxSqlQuery & t, const QString & format);
00259    friend QX_DLL_EXPORT qx_bool qx::cvt::detail::QxConvert_FromJson_Helper(const QJsonValue & j, qx::QxSqlQuery & t, const QString & format);
00260 #endif // _QX_NO_JSON
00261 
00262 public:
00263 
00264    typedef std::function<void (QString &)> type_fct_on_before_sql_prepare;
00265 
00266 protected:
00267 
00268    struct QxSqlResult
00269    { QHash<QString, int> positionByKey; QHash<QString, int> positionByKeyUpper; QVector< QVector<QVariant> > values; };
00270 
00271    typedef std::tuple<QVariant, QSql::ParamType> type_bind_value;
00272 
00273    QStringList                                     m_sQuery;                  
00274    QxCollection<QString, type_bind_value>          m_lstValue;                
00275    qx::dao::detail::IxSqlElement_ptr               m_pSqlElementTemp;         
00276    QList<qx::dao::detail::IxSqlElement_ptr>        m_lstSqlElement;           
00277    int                                             m_iSqlElementIndex;        
00278    int                                             m_iParenthesisCount;       
00279    bool                                            m_bDistinct;               
00280    std::shared_ptr<QxSqlResult>                    m_pSqlResult;              
00281    QVariant                                        m_vResponse;               
00282    QString                                         m_sType;                   
00283    QHash<QString, std::shared_ptr<QxSqlQuery> >    m_lstJoinQueryUser;        
00284    QList<std::shared_ptr<QxSqlQuery> >             m_lstJoinQueryToResolve;   
00285    type_fct_on_before_sql_prepare                  m_fctOnBeforeSqlPrepare;   
00286 
00287 public:
00288 
00289    QxSqlQuery();
00290    QxSqlQuery(const char * query, const QVariantList & values = QVariantList());
00291    QxSqlQuery(const QString & query, const QVariantList & values = QVariantList());
00292    QxSqlQuery(const QStringList & query);
00293    QxSqlQuery(const QString & type, const QString & query);
00294    QxSqlQuery(const QString & type, const QStringList & query);
00295    virtual ~QxSqlQuery();
00296 
00297 #ifndef _QX_NO_JSON
00298 #ifdef Q_COMPILER_INITIALIZER_LISTS
00299    QxSqlQuery(std::initializer_list<QPair<QString, QJsonValue> > json);
00300    QxSqlQuery(std::initializer_list<QPair<QString, QJsonValue> > json, std::initializer_list<QPair<QString, QJsonValue> > opts);
00301    QxSqlQuery(const QString & type, std::initializer_list<QPair<QString, QJsonValue> > json);
00302    QxSqlQuery(const QString & type, std::initializer_list<QPair<QString, QJsonValue> > json, std::initializer_list<QPair<QString, QJsonValue> > opts);
00303 #endif // Q_COMPILER_INITIALIZER_LISTS
00304 #endif // _QX_NO_JSON
00305 
00306    QString query();
00307    QString queryAt(int idx) const;
00308    void queryAt(int idx, const QString & query);
00309    QVariant response() const;
00310    QString type() const;
00311    bool isEmpty() const;
00312    bool isDistinct() const;
00313    void clear();
00314    void resolve(QSqlQuery & query, qx::QxCollection<QString, QVariantList> * pLstExecBatch = NULL) const;
00315    void resolveOutput(QSqlQuery & query, bool bFetchSqlResult);
00316    void postProcess(QString & sql) const;
00317    void setResponse(const QVariant & v);
00318    void setType(const QString & s);
00319    QString getJoinQuery(const QString & relationKey, const QString & relationAlias);
00320    QString getJoinQueryHash();
00321 
00322    QxSqlQuery & query(const QString & sQuery);
00323    QxSqlQuery & bind(const QVariant & vValue, QSql::ParamType paramType = QSql::In);
00324    QxSqlQuery & bind(const QString & sKey, const QVariant & vValue, QSql::ParamType paramType = QSql::In);
00325 
00326    QVariant boundValue(const QString & sKey) const;
00327    QVariant boundValue(int iPosition) const;
00328 
00329    long getSqlResultRowCount() const;
00330    long getSqlResultColumnCount() const;
00331    QVariant getSqlResultAt(long row, long column) const;
00332    QVariant getSqlResultAt(long row, const QString & column, bool caseSensitive = false) const;
00333    QVector<QVariant> getSqlResultAt(long row) const;
00334    QVector<QString> getSqlResultAllColumns() const;
00335    void dumpSqlResult();
00336 
00337    static void dumpBoundValues(const QSqlQuery & query);
00338 
00339    QxSqlQuery & setFctOnBeforeSqlPrepare(type_fct_on_before_sql_prepare fct);
00340    void onBeforeSqlPrepare(QString & sql);
00341 
00342 private:
00343 
00344    void verifyQuery() const QX_USED;
00345    void fetchSqlResult(QSqlQuery & query);
00346 
00347 public:
00348 
00349    /* -- All methods to build SQL query using C++ syntax -- */
00350 
00351    virtual QxSqlQuery & distinct();
00352 
00353    virtual QxSqlQuery & where(const QString & column);
00354    virtual QxSqlQuery & where_OpenParenthesis(const QString & column);
00355    virtual QxSqlQuery & and_(const QString & column);
00356    virtual QxSqlQuery & and_OpenParenthesis(const QString & column);
00357    virtual QxSqlQuery & or_(const QString & column);
00358    virtual QxSqlQuery & or_OpenParenthesis(const QString & column);
00359 
00360    virtual QxSqlQuery & openParenthesis();
00361    virtual QxSqlQuery & closeParenthesis();
00362 
00363    virtual QxSqlQuery & orderAsc(const QStringList & columns);
00364    virtual QxSqlQuery & orderAsc(const QString & col1);
00365    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2);
00366    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3);
00367    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00368    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00369    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00370    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00371    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8);
00372    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9);
00373 
00374    virtual QxSqlQuery & orderDesc(const QStringList & columns);
00375    virtual QxSqlQuery & orderDesc(const QString & col1);
00376    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2);
00377    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3);
00378    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00379    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00380    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00381    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00382    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8);
00383    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9);
00384 
00385    virtual QxSqlQuery & groupBy(const QStringList & columns);
00386    virtual QxSqlQuery & groupBy(const QString & col1);
00387    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2);
00388    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3);
00389    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00390    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00391    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00392    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00393    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8);
00394    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9);
00395 
00396    virtual QxSqlQuery & limit(int rowsCount, int startRow = 0, bool withTies = false);
00397 
00398    virtual QxSqlQuery & like(const QString & val);
00399    virtual QxSqlQuery & notLike(const QString & val);
00400    virtual QxSqlQuery & startsWith(const QString & val);
00401    virtual QxSqlQuery & endsWith(const QString & val);
00402    virtual QxSqlQuery & containsString(const QString & val);
00403 
00404    virtual QxSqlQuery & isEqualTo(const QVariant & val);
00405    virtual QxSqlQuery & isNotEqualTo(const QVariant & val);
00406    virtual QxSqlQuery & isGreaterThan(const QVariant & val);
00407    virtual QxSqlQuery & isGreaterThanOrEqualTo(const QVariant & val);
00408    virtual QxSqlQuery & isLessThan(const QVariant & val);
00409    virtual QxSqlQuery & isLessThanOrEqualTo(const QVariant & val);
00410    virtual QxSqlQuery & customOperator(const QString & sCustomOperator, const QVariant & val);
00411 
00412    virtual QxSqlQuery & in(const QVariantList & values);
00413    virtual QxSqlQuery & in(const QVariant & val1);
00414    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2);
00415    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3);
00416    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4);
00417    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5);
00418    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6);
00419    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7);
00420    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8);
00421    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9);
00422 
00423    virtual QxSqlQuery & notIn(const QVariantList & values);
00424    virtual QxSqlQuery & notIn(const QVariant & val1);
00425    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2);
00426    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3);
00427    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4);
00428    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5);
00429    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6);
00430    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7);
00431    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8);
00432    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9);
00433 
00434    virtual QxSqlQuery & in_Select(const QxSqlQuery & query);
00435    virtual QxSqlQuery & notIn_Select(const QxSqlQuery & query);
00436    virtual QxSqlQuery & isEqualTo_Select(const QxSqlQuery & query);
00437    virtual QxSqlQuery & isNotEqualTo_Select(const QxSqlQuery & query);
00438 
00439    virtual QxSqlQuery & isNull();
00440    virtual QxSqlQuery & isNotNull();
00441 
00442    virtual QxSqlQuery & isBetween(const QVariant & val1, const QVariant & val2);
00443    virtual QxSqlQuery & isNotBetween(const QVariant & val1, const QVariant & val2);
00444 
00445    virtual QxSqlQuery & freeText(const QString & text, const QVariantList & values = QVariantList());
00446 
00447    virtual QxSqlQuery & addJoinQuery(const QString & relationKeyOrAlias, const QxSqlQuery & joinQuery);
00448 
00449 private:
00450 
00451    QxSqlQuery & addSqlExpression(const QString & column, qx::dao::detail::QxSqlExpression::type type);
00452    QxSqlQuery & addSqlCompare(const QVariant & val, qx::dao::detail::QxSqlCompare::type type, const QString & sCustomOperator = QString());
00453    QxSqlQuery & addSqlSort(const QStringList & columns, qx::dao::detail::QxSqlSort::type type);
00454    QxSqlQuery & addSqlIn(const QVariantList & values, qx::dao::detail::QxSqlIn::type type);
00455    QxSqlQuery & addSqlIsNull(qx::dao::detail::QxSqlIsNull::type type);
00456    QxSqlQuery & addSqlIsBetween(const QVariant & val1, const QVariant & val2, qx::dao::detail::QxSqlIsBetween::type type);
00457    QxSqlQuery & addFreeText(const QString & text, const QVariantList & values);
00458    QxSqlQuery & addEmbedQuery(const QxSqlQuery & query, qx::dao::detail::QxSqlEmbedQuery::type type, bool requirePreviousElement);
00459 
00460 };
00461 
00462 } // namespace qx
00463 
00464 typedef qx::QxSqlQuery qx_query;
00465 
00466 namespace qx {
00467 namespace dao {
00468 
00492 QX_DLL_EXPORT QSqlError call_query(qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
00493 
00498 QX_DLL_EXPORT QSqlError call_query_without_prepare(qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
00499 
00500 namespace helper {
00501 
00502 QX_DLL_EXPORT QSqlError call_query_helper(qx::QxSqlQuery & query, QSqlDatabase * pDatabase, bool bPrepare);
00503 
00504 } // namespace helper
00505 } // namespace dao
00506 } // namespace qx
00507 
00508 QX_REGISTER_CLASS_NAME(qx_query)
00509 
00510 QX_CLASS_VERSION(qx::QxSqlQuery, 0)
00511 
00512 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00513 QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, qx::QxSqlQuery)
00514 #endif // _QX_ENABLE_BOOST_SERIALIZATION
00515 
00516 #define QX_SQL_QUERY_DERIVED_IMPL_COVARIANT_RETURN_TYPE_HPP(className) \
00517 public: \
00518 \
00519 virtual className & distinct(); \
00520 \
00521 virtual className & where(const QString & column); \
00522 virtual className & where_OpenParenthesis(const QString & column); \
00523 virtual className & and_(const QString & column); \
00524 virtual className & and_OpenParenthesis(const QString & column); \
00525 virtual className & or_(const QString & column); \
00526 virtual className & or_OpenParenthesis(const QString & column); \
00527 \
00528 virtual className & openParenthesis(); \
00529 virtual className & closeParenthesis(); \
00530 \
00531 virtual className & orderAsc(const QStringList & columns); \
00532 virtual className & orderAsc(const QString & col1); \
00533 virtual className & orderAsc(const QString & col1, const QString & col2); \
00534 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3); \
00535 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00536 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00537 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00538 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00539 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8); \
00540 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9); \
00541 \
00542 virtual className & orderDesc(const QStringList & columns); \
00543 virtual className & orderDesc(const QString & col1); \
00544 virtual className & orderDesc(const QString & col1, const QString & col2); \
00545 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3); \
00546 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00547 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00548 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00549 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00550 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8); \
00551 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9); \
00552 \
00553 virtual className & groupBy(const QStringList & columns); \
00554 virtual className & groupBy(const QString & col1); \
00555 virtual className & groupBy(const QString & col1, const QString & col2); \
00556 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3); \
00557 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00558 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00559 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00560 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00561 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8); \
00562 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9); \
00563 \
00564 virtual className & limit(int rowsCount, int startRow = 0, bool withTies = false); \
00565 \
00566 virtual className & like(const QString & val); \
00567 virtual className & notLike(const QString & val); \
00568 virtual className & startsWith(const QString & val); \
00569 virtual className & endsWith(const QString & val); \
00570 virtual className & containsString(const QString & val); \
00571 \
00572 virtual className & isEqualTo(const QVariant & val); \
00573 virtual className & isNotEqualTo(const QVariant & val); \
00574 virtual className & isGreaterThan(const QVariant & val); \
00575 virtual className & isGreaterThanOrEqualTo(const QVariant & val); \
00576 virtual className & isLessThan(const QVariant & val); \
00577 virtual className & isLessThanOrEqualTo(const QVariant & val); \
00578 virtual className & customOperator(const QString & sCustomOperator, const QVariant & val); \
00579 \
00580 virtual className & in(const QVariantList & values); \
00581 virtual className & in(const QVariant & val1); \
00582 virtual className & in(const QVariant & val1, const QVariant & val2); \
00583 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3); \
00584 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4); \
00585 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5); \
00586 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6); \
00587 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7); \
00588 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8); \
00589 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9); \
00590 \
00591 virtual className & notIn(const QVariantList & values); \
00592 virtual className & notIn(const QVariant & val1); \
00593 virtual className & notIn(const QVariant & val1, const QVariant & val2); \
00594 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3); \
00595 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4); \
00596 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5); \
00597 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6); \
00598 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7); \
00599 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8); \
00600 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9); \
00601 \
00602 virtual className & in_Select(const QxSqlQuery & query); \
00603 virtual className & notIn_Select(const QxSqlQuery & query); \
00604 virtual className & isEqualTo_Select(const QxSqlQuery & query); \
00605 virtual className & isNotEqualTo_Select(const QxSqlQuery & query); \
00606 \
00607 virtual className & isNull(); \
00608 virtual className & isNotNull(); \
00609 \
00610 virtual className & isBetween(const QVariant & val1, const QVariant & val2); \
00611 virtual className & isNotBetween(const QVariant & val1, const QVariant & val2); \
00612 \
00613 virtual className & freeText(const QString & text, const QVariantList & values = QVariantList()); \
00614 \
00615 virtual className & addJoinQuery(const QString & relationKeyOrAlias, const QxSqlQuery & joinQuery);
00616 
00617 #define QX_SQL_QUERY_DERIVED_IMPL_COVARIANT_RETURN_TYPE_CPP(className) \
00618 \
00619 className & className::distinct() { return static_cast<className &>(qx::QxSqlQuery::distinct()); } \
00620 \
00621 className & className::where(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::where(column)); } \
00622 className & className::where_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::where_OpenParenthesis(column)); } \
00623 className & className::and_(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::and_(column)); } \
00624 className & className::and_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::and_OpenParenthesis(column)); } \
00625 className & className::or_(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::or_(column)); } \
00626 className & className::or_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::or_OpenParenthesis(column)); } \
00627 \
00628 className & className::openParenthesis() { return static_cast<className &>(qx::QxSqlQuery::openParenthesis()); } \
00629 className & className::closeParenthesis() { return static_cast<className &>(qx::QxSqlQuery::closeParenthesis()); } \
00630 \
00631 className & className::orderAsc(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(columns)); } \
00632 className & className::orderAsc(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1)); } \
00633 className & className::orderAsc(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2)); } \
00634 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3)); } \
00635 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4)); } \
00636 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4, col5)); } \
00637 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4, col5, col6)); } \
00638 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4, col5, col6, col7)); } \
00639 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4, col5, col6, col7, col8)); } \
00640 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3, col4, col5, col6, col7, col8, col9)); } \
00641 \
00642 className & className::orderDesc(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(columns)); } \
00643 className & className::orderDesc(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1)); } \
00644 className & className::orderDesc(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2)); } \
00645 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3)); } \
00646 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4)); } \
00647 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4, col5)); } \
00648 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4, col5, col6)); } \
00649 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4, col5, col6, col7)); } \
00650 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4, col5, col6, col7, col8)); } \
00651 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3, col4, col5, col6, col7, col8, col9)); } \
00652 \
00653 className & className::groupBy(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::groupBy(columns)); } \
00654 className & className::groupBy(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1)); } \
00655 className & className::groupBy(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2)); } \
00656 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3)); } \
00657 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4)); } \
00658 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4, col5)); } \
00659 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4, col5, col6)); } \
00660 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4, col5, col6, col7)); } \
00661 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4, col5, col6, col7, col8)); } \
00662 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7, const QString & col8, const QString & col9) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3, col4, col5, col6, col7, col8, col9)); } \
00663 \
00664 className & className::limit(int rowsCount, int startRow, bool withTies) { return static_cast<className &>(qx::QxSqlQuery::limit(rowsCount, startRow, withTies)); } \
00665 \
00666 className & className::like(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::like(val)); } \
00667 className & className::notLike(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::notLike(val)); } \
00668 className & className::startsWith(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::startsWith(val)); } \
00669 className & className::endsWith(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::endsWith(val)); } \
00670 className & className::containsString(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::containsString(val)); } \
00671 \
00672 className & className::isEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isEqualTo(val)); } \
00673 className & className::isNotEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isNotEqualTo(val)); } \
00674 className & className::isGreaterThan(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isGreaterThan(val)); } \
00675 className & className::isGreaterThanOrEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isGreaterThanOrEqualTo(val)); } \
00676 className & className::isLessThan(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isLessThan(val)); } \
00677 className & className::isLessThanOrEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isLessThanOrEqualTo(val)); } \
00678 className & className::customOperator(const QString & sCustomOperator, const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::customOperator(sCustomOperator, val)); } \
00679 \
00680 className & className::in(const QVariantList & values) { return static_cast<className &>(qx::QxSqlQuery::in(values)); } \
00681 className & className::in(const QVariant & val1) { return static_cast<className &>(qx::QxSqlQuery::in(val1)); } \
00682 className & className::in(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2)); } \
00683 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3)); } \
00684 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4)); } \
00685 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4, val5)); } \
00686 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4, val5, val6)); } \
00687 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4, val5, val6, val7)); } \
00688 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4, val5, val6, val7, val8)); } \
00689 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3, val4, val5, val6, val7, val8, val9)); } \
00690 \
00691 className & className::notIn(const QVariantList & values) { return static_cast<className &>(qx::QxSqlQuery::notIn(values)); } \
00692 className & className::notIn(const QVariant & val1) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1)); } \
00693 className & className::notIn(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2)); } \
00694 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3)); } \
00695 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4)); } \
00696 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4, val5)); } \
00697 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4, val5, val6)); } \
00698 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4, val5, val6, val7)); } \
00699 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4, val5, val6, val7, val8)); } \
00700 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7, const QVariant & val8, const QVariant & val9) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3, val4, val5, val6, val7, val8, val9)); } \
00701 \
00702 className & className::in_Select(const QxSqlQuery & query) { return static_cast<className &>(qx::QxSqlQuery::in_Select(query)); } \
00703 className & className::notIn_Select(const QxSqlQuery & query) { return static_cast<className &>(qx::QxSqlQuery::notIn_Select(query)); } \
00704 className & className::isEqualTo_Select(const QxSqlQuery & query) { return static_cast<className &>(qx::QxSqlQuery::isEqualTo_Select(query)); } \
00705 className & className::isNotEqualTo_Select(const QxSqlQuery & query) { return static_cast<className &>(qx::QxSqlQuery::isNotEqualTo_Select(query)); } \
00706 \
00707 className & className::isNull() { return static_cast<className &>(qx::QxSqlQuery::isNull()); } \
00708 className & className::isNotNull() { return static_cast<className &>(qx::QxSqlQuery::isNotNull()); } \
00709 \
00710 className & className::isBetween(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::isBetween(val1, val2)); } \
00711 className & className::isNotBetween(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::isNotBetween(val1, val2)); } \
00712 \
00713 className & className::freeText(const QString & text, const QVariantList & values) { return static_cast<className &>(qx::QxSqlQuery::freeText(text, values)); } \
00714 \
00715 className & className::addJoinQuery(const QString & relationKeyOrAlias, const QxSqlQuery & joinQuery) { return static_cast<className &>(qx::QxSqlQuery::addJoinQuery(relationKeyOrAlias, joinQuery)); }
00716 
00717 #endif // _QX_SQL_QUERY_H_