QxOrm  1.4.5
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 protected:
00263 
00264    struct QxSqlResult
00265    { QHash<QString, int> positionByKey; QVector< QVector<QVariant> > values; };
00266 
00267    typedef std::tuple<QVariant, QSql::ParamType> type_bind_value;
00268 
00269    QStringList                               m_sQuery;               
00270    QxCollection<QString, type_bind_value>    m_lstValue;             
00271    qx::dao::detail::IxSqlElement_ptr         m_pSqlElementTemp;      
00272    QList<qx::dao::detail::IxSqlElement_ptr>  m_lstSqlElement;        
00273    int                                       m_iSqlElementIndex;     
00274    int                                       m_iParenthesisCount;    
00275    bool                                      m_bDistinct;            
00276    std::shared_ptr<QxSqlResult>              m_pSqlResult;           
00277    QVariant                                  m_vResponse;            
00278    QString                                   m_sType;                
00279 
00280 public:
00281 
00282    QxSqlQuery();
00283    QxSqlQuery(const char * query);
00284    QxSqlQuery(const QString & query);
00285    QxSqlQuery(const QStringList & query);
00286    QxSqlQuery(const QString & type, const QString & query);
00287    QxSqlQuery(const QString & type, const QStringList & query);
00288    virtual ~QxSqlQuery();
00289 
00290 #ifndef _QX_NO_JSON
00291 #ifdef Q_COMPILER_INITIALIZER_LISTS
00292    QxSqlQuery(std::initializer_list<QPair<QString, QJsonValue> > json);
00293    QxSqlQuery(std::initializer_list<QPair<QString, QJsonValue> > json, std::initializer_list<QPair<QString, QJsonValue> > opts);
00294    QxSqlQuery(const QString & type, std::initializer_list<QPair<QString, QJsonValue> > json);
00295    QxSqlQuery(const QString & type, std::initializer_list<QPair<QString, QJsonValue> > json, std::initializer_list<QPair<QString, QJsonValue> > opts);
00296 #endif // Q_COMPILER_INITIALIZER_LISTS
00297 #endif // _QX_NO_JSON
00298 
00299    QString query();
00300    QString queryAt(int idx) const;
00301    void queryAt(int idx, const QString & query);
00302    QVariant response() const;
00303    QString type() const;
00304    bool isEmpty() const;
00305    bool isDistinct() const;
00306    void clear();
00307    void resolve(QSqlQuery & query) const;
00308    void resolveOutput(QSqlQuery & query, bool bFetchSqlResult);
00309    void postProcess(QString & sql) const;
00310    void setResponse(const QVariant & v);
00311    void setType(const QString & s);
00312 
00313    QxSqlQuery & query(const QString & sQuery);
00314    QxSqlQuery & bind(const QVariant & vValue, QSql::ParamType paramType = QSql::In);
00315    QxSqlQuery & bind(const QString & sKey, const QVariant & vValue, QSql::ParamType paramType = QSql::In);
00316 
00317    QVariant boundValue(const QString & sKey) const;
00318    QVariant boundValue(int iPosition) const;
00319 
00320    long getSqlResultRowCount() const;
00321    long getSqlResultColumnCount() const;
00322    QVariant getSqlResultAt(long row, long column) const;
00323    QVariant getSqlResultAt(long row, const QString & column) const;
00324    QVector<QVariant> getSqlResultAt(long row) const;
00325    QVector<QString> getSqlResultAllColumns() const;
00326    void dumpSqlResult();
00327 
00328    static void dumpBoundValues(const QSqlQuery & query);
00329 
00330 private:
00331 
00332    void verifyQuery() const QX_USED;
00333    void fetchSqlResult(QSqlQuery & query);
00334 
00335 public:
00336 
00337    /* -- All methods to build SQL query using C++ syntax -- */
00338 
00339    virtual QxSqlQuery & distinct();
00340 
00341    virtual QxSqlQuery & where(const QString & column);
00342    virtual QxSqlQuery & where_OpenParenthesis(const QString & column);
00343    virtual QxSqlQuery & and_(const QString & column);
00344    virtual QxSqlQuery & and_OpenParenthesis(const QString & column);
00345    virtual QxSqlQuery & or_(const QString & column);
00346    virtual QxSqlQuery & or_OpenParenthesis(const QString & column);
00347 
00348    virtual QxSqlQuery & openParenthesis();
00349    virtual QxSqlQuery & closeParenthesis();
00350 
00351    virtual QxSqlQuery & orderAsc(const QStringList & columns);
00352    virtual QxSqlQuery & orderAsc(const QString & col1);
00353    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2);
00354    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3);
00355    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00356    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00357    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00358    virtual QxSqlQuery & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00359    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);
00360    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);
00361 
00362    virtual QxSqlQuery & orderDesc(const QStringList & columns);
00363    virtual QxSqlQuery & orderDesc(const QString & col1);
00364    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2);
00365    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3);
00366    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00367    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00368    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00369    virtual QxSqlQuery & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00370    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);
00371    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);
00372 
00373    virtual QxSqlQuery & groupBy(const QStringList & columns);
00374    virtual QxSqlQuery & groupBy(const QString & col1);
00375    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2);
00376    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3);
00377    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4);
00378    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5);
00379    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6);
00380    virtual QxSqlQuery & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7);
00381    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);
00382    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);
00383 
00384    virtual QxSqlQuery & limit(int rowsCount, int startRow = 0, bool withTies = false);
00385 
00386    virtual QxSqlQuery & like(const QString & val);
00387    virtual QxSqlQuery & notLike(const QString & val);
00388    virtual QxSqlQuery & startsWith(const QString & val);
00389    virtual QxSqlQuery & endsWith(const QString & val);
00390    virtual QxSqlQuery & containsString(const QString & val);
00391 
00392    virtual QxSqlQuery & isEqualTo(const QVariant & val);
00393    virtual QxSqlQuery & isNotEqualTo(const QVariant & val);
00394    virtual QxSqlQuery & isGreaterThan(const QVariant & val);
00395    virtual QxSqlQuery & isGreaterThanOrEqualTo(const QVariant & val);
00396    virtual QxSqlQuery & isLessThan(const QVariant & val);
00397    virtual QxSqlQuery & isLessThanOrEqualTo(const QVariant & val);
00398    virtual QxSqlQuery & customOperator(const QString & sCustomOperator, const QVariant & val);
00399 
00400    virtual QxSqlQuery & in(const QVariantList & values);
00401    virtual QxSqlQuery & in(const QVariant & val1);
00402    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2);
00403    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3);
00404    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4);
00405    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5);
00406    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6);
00407    virtual QxSqlQuery & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7);
00408    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);
00409    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);
00410 
00411    virtual QxSqlQuery & notIn(const QVariantList & values);
00412    virtual QxSqlQuery & notIn(const QVariant & val1);
00413    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2);
00414    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3);
00415    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4);
00416    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5);
00417    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6);
00418    virtual QxSqlQuery & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7);
00419    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);
00420    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);
00421 
00422    virtual QxSqlQuery & in_Select(const QString & sql);
00423    virtual QxSqlQuery & notIn_Select(const QString & sql);
00424 
00425    virtual QxSqlQuery & isNull();
00426    virtual QxSqlQuery & isNotNull();
00427 
00428    virtual QxSqlQuery & isBetween(const QVariant & val1, const QVariant & val2);
00429    virtual QxSqlQuery & isNotBetween(const QVariant & val1, const QVariant & val2);
00430 
00431    virtual QxSqlQuery & freeText(const QString & text);
00432 
00433 private:
00434 
00435    QxSqlQuery & addSqlExpression(const QString & column, qx::dao::detail::QxSqlExpression::type type);
00436    QxSqlQuery & addSqlCompare(const QVariant & val, qx::dao::detail::QxSqlCompare::type type, const QString & sCustomOperator = QString());
00437    QxSqlQuery & addSqlSort(const QStringList & columns, qx::dao::detail::QxSqlSort::type type);
00438    QxSqlQuery & addSqlIn(const QVariantList & values, qx::dao::detail::QxSqlIn::type type);
00439    QxSqlQuery & addSqlIsNull(qx::dao::detail::QxSqlIsNull::type type);
00440    QxSqlQuery & addSqlIsBetween(const QVariant & val1, const QVariant & val2, qx::dao::detail::QxSqlIsBetween::type type);
00441 
00442 };
00443 
00444 } // namespace qx
00445 
00446 typedef qx::QxSqlQuery qx_query;
00447 
00448 namespace qx {
00449 namespace dao {
00450 
00474 QX_DLL_EXPORT QSqlError call_query(qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
00475 
00480 QX_DLL_EXPORT QSqlError call_query_without_prepare(qx::QxSqlQuery & query, QSqlDatabase * pDatabase = NULL);
00481 
00482 namespace helper {
00483 
00484 QX_DLL_EXPORT QSqlError call_query_helper(qx::QxSqlQuery & query, QSqlDatabase * pDatabase, bool bPrepare);
00485 
00486 } // namespace helper
00487 } // namespace dao
00488 } // namespace qx
00489 
00490 QX_REGISTER_CLASS_NAME(qx_query)
00491 
00492 QX_CLASS_VERSION(qx::QxSqlQuery, 0)
00493 
00494 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00495 QX_SERIALIZE_FAST_COMPIL_SAVE_LOAD_HPP(QX_DLL_EXPORT, qx::QxSqlQuery)
00496 #endif // _QX_ENABLE_BOOST_SERIALIZATION
00497 
00498 #define QX_SQL_QUERY_DERIVED_IMPL_COVARIANT_RETURN_TYPE_HPP(className) \
00499 public: \
00500 \
00501 virtual className & distinct(); \
00502 \
00503 virtual className & where(const QString & column); \
00504 virtual className & where_OpenParenthesis(const QString & column); \
00505 virtual className & and_(const QString & column); \
00506 virtual className & and_OpenParenthesis(const QString & column); \
00507 virtual className & or_(const QString & column); \
00508 virtual className & or_OpenParenthesis(const QString & column); \
00509 \
00510 virtual className & openParenthesis(); \
00511 virtual className & closeParenthesis(); \
00512 \
00513 virtual className & orderAsc(const QStringList & columns); \
00514 virtual className & orderAsc(const QString & col1); \
00515 virtual className & orderAsc(const QString & col1, const QString & col2); \
00516 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3); \
00517 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00518 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00519 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00520 virtual className & orderAsc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00521 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); \
00522 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); \
00523 \
00524 virtual className & orderDesc(const QStringList & columns); \
00525 virtual className & orderDesc(const QString & col1); \
00526 virtual className & orderDesc(const QString & col1, const QString & col2); \
00527 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3); \
00528 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00529 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00530 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00531 virtual className & orderDesc(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00532 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); \
00533 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); \
00534 \
00535 virtual className & groupBy(const QStringList & columns); \
00536 virtual className & groupBy(const QString & col1); \
00537 virtual className & groupBy(const QString & col1, const QString & col2); \
00538 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3); \
00539 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4); \
00540 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5); \
00541 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6); \
00542 virtual className & groupBy(const QString & col1, const QString & col2, const QString & col3, const QString & col4, const QString & col5, const QString & col6, const QString & col7); \
00543 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); \
00544 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); \
00545 \
00546 virtual className & limit(int rowsCount, int startRow = 0, bool withTies = false); \
00547 \
00548 virtual className & like(const QString & val); \
00549 virtual className & notLike(const QString & val); \
00550 virtual className & startsWith(const QString & val); \
00551 virtual className & endsWith(const QString & val); \
00552 virtual className & containsString(const QString & val); \
00553 \
00554 virtual className & isEqualTo(const QVariant & val); \
00555 virtual className & isNotEqualTo(const QVariant & val); \
00556 virtual className & isGreaterThan(const QVariant & val); \
00557 virtual className & isGreaterThanOrEqualTo(const QVariant & val); \
00558 virtual className & isLessThan(const QVariant & val); \
00559 virtual className & isLessThanOrEqualTo(const QVariant & val); \
00560 virtual className & customOperator(const QString & sCustomOperator, const QVariant & val); \
00561 \
00562 virtual className & in(const QVariantList & values); \
00563 virtual className & in(const QVariant & val1); \
00564 virtual className & in(const QVariant & val1, const QVariant & val2); \
00565 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3); \
00566 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4); \
00567 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5); \
00568 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6); \
00569 virtual className & in(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7); \
00570 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); \
00571 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); \
00572 \
00573 virtual className & notIn(const QVariantList & values); \
00574 virtual className & notIn(const QVariant & val1); \
00575 virtual className & notIn(const QVariant & val1, const QVariant & val2); \
00576 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3); \
00577 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4); \
00578 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5); \
00579 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6); \
00580 virtual className & notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3, const QVariant & val4, const QVariant & val5, const QVariant & val6, const QVariant & val7); \
00581 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); \
00582 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); \
00583 \
00584 virtual className & in_Select(const QString & sql); \
00585 virtual className & notIn_Select(const QString & sql); \
00586 \
00587 virtual className & isNull(); \
00588 virtual className & isNotNull(); \
00589 \
00590 virtual className & isBetween(const QVariant & val1, const QVariant & val2); \
00591 virtual className & isNotBetween(const QVariant & val1, const QVariant & val2); \
00592 \
00593 virtual className & freeText(const QString & text);
00594 
00595 #define QX_SQL_QUERY_DERIVED_IMPL_COVARIANT_RETURN_TYPE_CPP(className) \
00596 \
00597 className & className::distinct() { return static_cast<className &>(qx::QxSqlQuery::distinct()); } \
00598 \
00599 className & className::where(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::where(column)); } \
00600 className & className::where_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::where_OpenParenthesis(column)); } \
00601 className & className::and_(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::and_(column)); } \
00602 className & className::and_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::and_OpenParenthesis(column)); } \
00603 className & className::or_(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::or_(column)); } \
00604 className & className::or_OpenParenthesis(const QString & column) { return static_cast<className &>(qx::QxSqlQuery::or_OpenParenthesis(column)); } \
00605 \
00606 className & className::openParenthesis() { return static_cast<className &>(qx::QxSqlQuery::openParenthesis()); } \
00607 className & className::closeParenthesis() { return static_cast<className &>(qx::QxSqlQuery::closeParenthesis()); } \
00608 \
00609 className & className::orderAsc(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(columns)); } \
00610 className & className::orderAsc(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1)); } \
00611 className & className::orderAsc(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2)); } \
00612 className & className::orderAsc(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::orderAsc(col1, col2, col3)); } \
00613 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)); } \
00614 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)); } \
00615 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)); } \
00616 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)); } \
00617 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)); } \
00618 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)); } \
00619 \
00620 className & className::orderDesc(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(columns)); } \
00621 className & className::orderDesc(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1)); } \
00622 className & className::orderDesc(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2)); } \
00623 className & className::orderDesc(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::orderDesc(col1, col2, col3)); } \
00624 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)); } \
00625 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)); } \
00626 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)); } \
00627 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)); } \
00628 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)); } \
00629 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)); } \
00630 \
00631 className & className::groupBy(const QStringList & columns) { return static_cast<className &>(qx::QxSqlQuery::groupBy(columns)); } \
00632 className & className::groupBy(const QString & col1) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1)); } \
00633 className & className::groupBy(const QString & col1, const QString & col2) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2)); } \
00634 className & className::groupBy(const QString & col1, const QString & col2, const QString & col3) { return static_cast<className &>(qx::QxSqlQuery::groupBy(col1, col2, col3)); } \
00635 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)); } \
00636 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)); } \
00637 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)); } \
00638 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)); } \
00639 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)); } \
00640 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)); } \
00641 \
00642 className & className::limit(int rowsCount, int startRow, bool withTies) { return static_cast<className &>(qx::QxSqlQuery::limit(rowsCount, startRow, withTies)); } \
00643 \
00644 className & className::like(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::like(val)); } \
00645 className & className::notLike(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::notLike(val)); } \
00646 className & className::startsWith(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::startsWith(val)); } \
00647 className & className::endsWith(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::endsWith(val)); } \
00648 className & className::containsString(const QString & val) { return static_cast<className &>(qx::QxSqlQuery::containsString(val)); } \
00649 \
00650 className & className::isEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isEqualTo(val)); } \
00651 className & className::isNotEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isNotEqualTo(val)); } \
00652 className & className::isGreaterThan(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isGreaterThan(val)); } \
00653 className & className::isGreaterThanOrEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isGreaterThanOrEqualTo(val)); } \
00654 className & className::isLessThan(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isLessThan(val)); } \
00655 className & className::isLessThanOrEqualTo(const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::isLessThanOrEqualTo(val)); } \
00656 className & className::customOperator(const QString & sCustomOperator, const QVariant & val) { return static_cast<className &>(qx::QxSqlQuery::customOperator(sCustomOperator, val)); } \
00657 \
00658 className & className::in(const QVariantList & values) { return static_cast<className &>(qx::QxSqlQuery::in(values)); } \
00659 className & className::in(const QVariant & val1) { return static_cast<className &>(qx::QxSqlQuery::in(val1)); } \
00660 className & className::in(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2)); } \
00661 className & className::in(const QVariant & val1, const QVariant & val2, const QVariant & val3) { return static_cast<className &>(qx::QxSqlQuery::in(val1, val2, val3)); } \
00662 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)); } \
00663 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)); } \
00664 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)); } \
00665 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)); } \
00666 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)); } \
00667 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)); } \
00668 \
00669 className & className::notIn(const QVariantList & values) { return static_cast<className &>(qx::QxSqlQuery::notIn(values)); } \
00670 className & className::notIn(const QVariant & val1) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1)); } \
00671 className & className::notIn(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2)); } \
00672 className & className::notIn(const QVariant & val1, const QVariant & val2, const QVariant & val3) { return static_cast<className &>(qx::QxSqlQuery::notIn(val1, val2, val3)); } \
00673 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)); } \
00674 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)); } \
00675 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)); } \
00676 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)); } \
00677 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)); } \
00678 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)); } \
00679 \
00680 className & className::in_Select(const QString & sql) { return static_cast<className &>(qx::QxSqlQuery::in_Select(sql)); } \
00681 className & className::notIn_Select(const QString & sql) { return static_cast<className &>(qx::QxSqlQuery::notIn_Select(sql)); } \
00682 \
00683 className & className::isNull() { return static_cast<className &>(qx::QxSqlQuery::isNull()); } \
00684 className & className::isNotNull() { return static_cast<className &>(qx::QxSqlQuery::isNotNull()); } \
00685 \
00686 className & className::isBetween(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::isBetween(val1, val2)); } \
00687 className & className::isNotBetween(const QVariant & val1, const QVariant & val2) { return static_cast<className &>(qx::QxSqlQuery::isNotBetween(val1, val2)); } \
00688 \
00689 className & className::freeText(const QString & text) { return static_cast<className &>(qx::QxSqlQuery::freeText(text)); }
00690 
00691 #endif // _QX_SQL_QUERY_H_