first commit

This commit is contained in:
bing
2026-04-03 11:32:07 +08:00
commit 003be19522
1142 changed files with 185854 additions and 0 deletions

View File

@@ -0,0 +1,208 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _IX_SQL_ELEMENT_H_
#define _IX_SQL_ELEMENT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file IxSqlElement.h
* \author XDL Team
* \ingroup QxDao
* \brief Common interface for all SQL elements to build SQL query
*/
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/nvp.hpp>
#endif // _QX_ENABLE_BOOST_SERIALIZATION
#include <QtCore/qdatastream.h>
#ifndef _QX_NO_JSON
#include <QtCore/qjsonvalue.h>
#endif // _QX_NO_JSON
#include <QtSql/qsqlquery.h>
#include <QxCollection/QxCollection.h>
#include <QxDao/QxSqlGenerator/IxSqlGenerator.h>
#include <QxSerialize/Qt/QxSerialize_QList.h>
#include <QxSerialize/Qt/QxSerialize_QStringList.h>
#include <QxSerialize/Qt/QxSerialize_QVariant.h>
#include <QxConvert/QxConvert.h>
namespace qx
{
namespace dao
{
namespace detail
{
class IxSqlElement;
} // namespace detail
} // namespace dao
} // namespace qx
QX_DLL_EXPORT QDataStream &operator<<(QDataStream &stream, const qx::dao::detail::IxSqlElement &t) QX_USED;
QX_DLL_EXPORT QDataStream &operator>>(QDataStream &stream, qx::dao::detail::IxSqlElement &t) QX_USED;
#ifndef _QX_NO_JSON
namespace qx
{
namespace cvt
{
namespace detail
{
template <>
struct QxConvert_ToJson<qx::dao::detail::IxSqlElement>;
template <>
struct QxConvert_FromJson<qx::dao::detail::IxSqlElement>;
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const qx::dao::detail::IxSqlElement &t, const QString &format) QX_USED;
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, qx::dao::detail::IxSqlElement &t, const QString &format) QX_USED;
} // namespace detail
} // namespace cvt
} // namespace qx
#endif // _QX_NO_JSON
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::IxSqlElement : common interface for all SQL elements to build SQL query
*/
class QX_DLL_EXPORT IxSqlElement
{
friend QX_DLL_EXPORT QDataStream & ::operator<<(QDataStream &stream, const qx::dao::detail::IxSqlElement &t);
friend QX_DLL_EXPORT QDataStream & ::operator>>(QDataStream &stream, qx::dao::detail::IxSqlElement &t);
#ifndef _QX_NO_JSON
friend struct qx::cvt::detail::QxConvert_ToJson<qx::dao::detail::IxSqlElement>;
friend struct qx::cvt::detail::QxConvert_FromJson<qx::dao::detail::IxSqlElement>;
friend QX_DLL_EXPORT QJsonValue qx::cvt::detail::QxConvert_ToJson_Helper(const qx::dao::detail::IxSqlElement &t, const QString &format);
friend QX_DLL_EXPORT qx_bool qx::cvt::detail::QxConvert_FromJson_Helper(const QJsonValue &j, qx::dao::detail::IxSqlElement &t, const QString &format);
#endif // _QX_NO_JSON
public:
enum type_class
{
_no_type,
_sql_compare,
_sql_element_temp,
_sql_expression,
_sql_free_text,
_sql_in,
_sql_is_between,
_sql_is_null,
_sql_limit,
_sql_sort,
_sql_embed_query
};
protected:
int m_iIndex; //!< Index of SQL element to build unique string
QStringList m_lstColumns; //!< List of columns associated to SQL element
QStringList m_lstKeys; //!< List of keys associated to SQL element
QList<QVariant> m_lstValues; //!< List of values associated to SQL element
IxSqlGenerator *m_pSqlGenerator; //!< SQL generator to build SQL query specific for each database
public:
IxSqlElement(int index);
virtual ~IxSqlElement();
void setColumn(const QString &column);
void setColumns(const QStringList &columns);
void setValue(const QVariant &val);
void setValues(const QVariantList &values);
virtual IxSqlElement::type_class getTypeClass() const = 0;
virtual QString toString() const = 0;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const = 0;
virtual void postProcess(QString &sql) const = 0;
virtual void clone(IxSqlElement *other);
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
template <class Archive>
void qxSave(Archive &ar) const
{
QString sExtraSettings = getExtraSettings();
ar << boost::serialization::make_nvp("index", m_iIndex);
ar << boost::serialization::make_nvp("list_columns", m_lstColumns);
ar << boost::serialization::make_nvp("list_keys", m_lstKeys);
ar << boost::serialization::make_nvp("list_values", m_lstValues);
ar << boost::serialization::make_nvp("extra_settings", sExtraSettings);
}
#endif // _QX_ENABLE_BOOST_SERIALIZATION
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
template <class Archive>
void qxLoad(Archive &ar)
{
QString sExtraSettings;
ar >> boost::serialization::make_nvp("index", m_iIndex);
ar >> boost::serialization::make_nvp("list_columns", m_lstColumns);
ar >> boost::serialization::make_nvp("list_keys", m_lstKeys);
ar >> boost::serialization::make_nvp("list_values", m_lstValues);
ar >> boost::serialization::make_nvp("extra_settings", sExtraSettings);
setExtraSettings(sExtraSettings);
}
#endif // _QX_ENABLE_BOOST_SERIALIZATION
protected:
void updateKeys();
virtual QString getExtraSettings() const = 0;
virtual void setExtraSettings(const QString &s) = 0;
};
typedef std::shared_ptr<IxSqlElement> IxSqlElement_ptr;
QX_DLL_EXPORT IxSqlElement_ptr create_sql_element(IxSqlElement::type_class e) QX_USED;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _IX_SQL_ELEMENT_H_

View File

@@ -0,0 +1,107 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_COMPARE_H_
#define _QX_SQL_COMPARE_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlCompare.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to compare value (==, <, >, <=, >=, LIKE, NOT LIKE, etc.)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlCompare : SQL element to compare value (==, <, >, <=, >=, LIKE, NOT LIKE, etc.)
*/
class QX_DLL_EXPORT QxSqlCompare : public IxSqlElement
{
public:
enum type
{
_is_equal_to,
_is_not_equal_to,
_is_greater_than,
_is_greater_than_or_equal_to,
_is_less_than,
_is_less_than_or_equal_to,
_like,
_not_like,
_starts_with,
_ends_with,
_contains_string,
_custom_operator,
_is_equal_to_select,
_is_not_equal_to_select
};
protected:
QxSqlCompare::type m_type; //!< Compare type
QString m_sCustomOperator; //!< Possibility to define a custom operator with enum _custom_operator (for example <@ for PostgreSQL ltree type)
public:
QxSqlCompare();
QxSqlCompare(int index, QxSqlCompare::type t, const QString &sCustomOperator = QString());
virtual ~QxSqlCompare();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlCompare> QxSqlCompare_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_COMPARE_H_

View File

@@ -0,0 +1,52 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_ELEMENT_H_
#define _QX_SQL_ELEMENT_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <QxDao/QxSqlElement/IxSqlElement.h>
#include <QxDao/QxSqlElement/QxSqlCompare.h>
#include <QxDao/QxSqlElement/QxSqlElementTemp.h>
#include <QxDao/QxSqlElement/QxSqlEmbedQuery.h>
#include <QxDao/QxSqlElement/QxSqlExpression.h>
#include <QxDao/QxSqlElement/QxSqlFreeText.h>
#include <QxDao/QxSqlElement/QxSqlIn.h>
#include <QxDao/QxSqlElement/QxSqlIsBetween.h>
#include <QxDao/QxSqlElement/QxSqlIsNull.h>
#include <QxDao/QxSqlElement/QxSqlLimit.h>
#include <QxDao/QxSqlElement/QxSqlSort.h>
#endif // _QX_SQL_ELEMENT_H_

View File

@@ -0,0 +1,83 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_ELEMENT_TEMP_H_
#define _QX_SQL_ELEMENT_TEMP_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlElementTemp.h
* \author XDL Team
* \ingroup QxDao
* \brief Temporary SQL element (need to be cloned to be used)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlElementTemp : temporary SQL element (need to be cloned to be used)
*/
class QX_DLL_EXPORT QxSqlElementTemp : public IxSqlElement
{
public:
QxSqlElementTemp();
virtual ~QxSqlElementTemp();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlElementTemp> QxSqlElementTemp_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_ELEMENT_TEMP_H_

View File

@@ -0,0 +1,105 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_EMBED_QUERY_H_
#define _QX_SQL_EMBED_QUERY_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlEmbedQuery.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to embed a SQL sub-query inside a parent SQL query
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
class QxSqlQuery;
} // namespace qx
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlEmbedQuery : SQL element to embed a SQL sub-query inside a parent SQL query
*/
class QX_DLL_EXPORT QxSqlEmbedQuery : public IxSqlElement
{
public:
enum type
{
_none,
_in,
_not_in,
_is_equal_to,
_is_not_equal_to
};
private:
struct QxSqlEmbedQueryImpl;
std::unique_ptr<QxSqlEmbedQueryImpl> m_pImpl; //!< Private implementation idiom
public:
QxSqlEmbedQuery(QxSqlEmbedQuery::type type = QxSqlEmbedQuery::_none);
QxSqlEmbedQuery(int index, QxSqlEmbedQuery::type type = QxSqlEmbedQuery::_none);
virtual ~QxSqlEmbedQuery();
void setQuery(const qx::QxSqlQuery &query);
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlEmbedQuery> QxSqlEmbedQuery_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_EMBED_QUERY_H_

View File

@@ -0,0 +1,97 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_EXPRESSION_H_
#define _QX_SQL_EXPRESSION_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlExpression.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to build a SQL expression (WHERE, AND, OR, etc.)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlExpression : SQL element to build a SQL expression (WHERE, AND, OR, etc.)
*/
class QX_DLL_EXPORT QxSqlExpression : public IxSqlElement
{
public:
enum type
{
_where,
_and,
_or,
_open_parenthesis,
_close_parenthesis
};
protected:
QxSqlExpression::type m_type;
public:
QxSqlExpression();
QxSqlExpression(int index, QxSqlExpression::type t);
virtual ~QxSqlExpression();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlExpression> QxSqlExpression_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_EXPRESSION_H_

View File

@@ -0,0 +1,89 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_FREE_TEXT_H_
#define _QX_SQL_FREE_TEXT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlFreeText.h
* \author XDL Team
* \ingroup QxDao
* \brief Possibility to add free text to SQL query
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlFreeText : possibility to add free text to SQL query
*/
class QX_DLL_EXPORT QxSqlFreeText : public IxSqlElement
{
protected:
QString m_sText; //!< Custom SQL text to insert to SQL query
public:
QxSqlFreeText();
QxSqlFreeText(int index);
virtual ~QxSqlFreeText();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
void setText(const QString &txt);
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlFreeText> QxSqlFreeText_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_FREE_TEXT_H_

View File

@@ -0,0 +1,96 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_IN_H_
#define _QX_SQL_IN_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlIn.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to verify a list of values (IN, NOT IN, etc.)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlIn : SQL element to verify a list of values (IN, NOT IN, etc.)
*/
class QX_DLL_EXPORT QxSqlIn : public IxSqlElement
{
public:
enum type
{
_in,
_not_in,
_in_select,
_not_in_select
};
protected:
QxSqlIn::type m_type;
public:
QxSqlIn();
QxSqlIn(int index, QxSqlIn::type t);
virtual ~QxSqlIn();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlIn> QxSqlIn_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_IN_H_

View File

@@ -0,0 +1,94 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_IS_BETWEEN_H_
#define _QX_SQL_IS_BETWEEN_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlIsBetween.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to verify if a value is included into 2 other values
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlIsBetween : SQL element to verify if a value is included into 2 other values
*/
class QX_DLL_EXPORT QxSqlIsBetween : public IxSqlElement
{
public:
enum type
{
_is_between,
_is_not_between
};
protected:
QxSqlIsBetween::type m_type;
public:
QxSqlIsBetween();
QxSqlIsBetween(int index, QxSqlIsBetween::type t);
virtual ~QxSqlIsBetween();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlIsBetween> QxSqlIsBetween_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_IS_BETWEEN_H_

View File

@@ -0,0 +1,94 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_IS_NULL_H_
#define _QX_SQL_IS_NULL_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlIsNull.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to verify if a value is null or not null (IS NULL, IS NOT NULL)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlIsNull : SQL element to verify if a value is null or not null (IS NULL, IS NOT NULL)
*/
class QX_DLL_EXPORT QxSqlIsNull : public IxSqlElement
{
public:
enum type
{
_is_null,
_is_not_null
};
protected:
QxSqlIsNull::type m_type;
public:
QxSqlIsNull();
QxSqlIsNull(int index, QxSqlIsNull::type t);
virtual ~QxSqlIsNull();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlIsNull> QxSqlIsNull_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_IS_NULL_H_

View File

@@ -0,0 +1,93 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_LIMIT_H_
#define _QX_SQL_LIMIT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlLimit.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to limit rows count fetched from database
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlLimit : SQL element to limit rows count fetched from database
*/
class QX_DLL_EXPORT QxSqlLimit : public IxSqlElement
{
public:
QxSqlLimit();
QxSqlLimit(int index);
virtual ~QxSqlLimit();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
int getStartRow() const;
int getRowsCount() const;
int getMaxRow() const;
bool getWithTies() const;
QString getStartRow_ParamKey() const;
QString getRowsCount_ParamKey() const;
QString getMaxRow_ParamKey() const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlLimit> QxSqlLimit_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_LIMIT_H_

View File

@@ -0,0 +1,95 @@
/****************************************************************************
**
** https://www.qxorm.com/
** Copyright (C) 2013 XDL Team (ic-east.com)
**
** This file is part of the QxOrm library
**
** This software is provided 'as-is', without any express or implied
** warranty. In no event will the authors be held liable for any
** damages arising from the use of this software
**
** Commercial Usage
** Licensees holding valid commercial QxOrm licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and XDL Team
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file 'license.gpl3.txt' included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met : http://www.gnu.org/copyleft/gpl.html
**
** If you are unsure which license is appropriate for your use, or
** if you have questions regarding the use of this file, please contact :
** ic-east.com
**
****************************************************************************/
#ifndef _QX_SQL_SORT_H_
#define _QX_SQL_SORT_H_
#ifdef _MSC_VER
#pragma once
#endif
/*!
* \file QxSqlSort.h
* \author XDL Team
* \ingroup QxDao
* \brief SQL element to sort or to group list of elements fetched from database (ORDER BY, GROUP BY)
*/
#include <QxDao/QxSqlElement/IxSqlElement.h>
namespace qx
{
namespace dao
{
namespace detail
{
/*!
* \ingroup QxDao
* \brief qx::dao::detail::QxSqlSort : SQL element to sort or to group list of elements fetched from database (ORDER BY, GROUP BY)
*/
class QX_DLL_EXPORT QxSqlSort : public IxSqlElement
{
public:
enum type
{
_order_asc,
_order_desc,
_group_by
};
protected:
QxSqlSort::type m_type;
public:
QxSqlSort();
QxSqlSort(int index, QxSqlSort::type t);
virtual ~QxSqlSort();
virtual QString toString() const;
virtual void resolve(QSqlQuery &query, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
virtual void postProcess(QString &sql) const;
virtual IxSqlElement::type_class getTypeClass() const;
protected:
virtual QString getExtraSettings() const;
virtual void setExtraSettings(const QString &s);
};
typedef std::shared_ptr<QxSqlSort> QxSqlSort_ptr;
} // namespace detail
} // namespace dao
} // namespace qx
#endif // _QX_SQL_SORT_H_