first commit
This commit is contained in:
105
include/QxDao/QxSqlGenerator/IxSqlGenerator.h
Normal file
105
include/QxDao/QxSqlGenerator/IxSqlGenerator.h
Normal 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 _IX_SQL_GENERATOR_H_
|
||||
#define _IX_SQL_GENERATOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file IxSqlGenerator.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief Common interface for all SQL generators to build SQL query specific for each database
|
||||
*/
|
||||
|
||||
#include <QtSql/qsqlquery.h>
|
||||
|
||||
#include <QxCollection/QxCollection.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class IxDao_Helper;
|
||||
class IxSqlElement;
|
||||
class QxSqlCompare;
|
||||
class QxSqlElementTemp;
|
||||
class QxSqlEmbedQuery;
|
||||
class QxSqlExpression;
|
||||
class QxSqlFreeText;
|
||||
class QxSqlIn;
|
||||
class QxSqlIsBetween;
|
||||
class QxSqlIsNull;
|
||||
class QxSqlLimit;
|
||||
class QxSqlSort;
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::IxSqlGenerator : common interface for all SQL generators to build SQL query specific for each database
|
||||
*/
|
||||
class QX_DLL_EXPORT IxSqlGenerator
|
||||
{
|
||||
|
||||
public:
|
||||
IxSqlGenerator();
|
||||
virtual ~IxSqlGenerator();
|
||||
|
||||
virtual void init() = 0;
|
||||
virtual QString getAutoIncrement() const = 0;
|
||||
virtual QString getWildCard() const = 0;
|
||||
virtual QString getTableAliasSep() const = 0;
|
||||
virtual QString getLimit(const QxSqlLimit *pLimit) const = 0;
|
||||
virtual void resolveLimit(QSqlQuery &query, const QxSqlLimit *pLimit, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const = 0;
|
||||
virtual void postProcess(QString &sql, const QxSqlLimit *pLimit) const = 0;
|
||||
virtual void onBeforeInsert(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void onAfterInsert(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void onBeforeUpdate(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void onAfterUpdate(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void onBeforeDelete(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void onAfterDelete(IxDao_Helper *pDaoHelper, void *pOwner) const = 0;
|
||||
virtual void checkSqlInsert(IxDao_Helper *pDaoHelper, QString &sql) const = 0;
|
||||
virtual void onBeforeSqlPrepare(IxDao_Helper *pDaoHelper, QString &sql) const = 0;
|
||||
virtual void formatSqlQuery(IxDao_Helper *pDaoHelper, QString &sql) const = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<IxSqlGenerator> IxSqlGenerator_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _IX_SQL_GENERATOR_H_
|
||||
48
include/QxDao/QxSqlGenerator/QxSqlGenerator.h
Normal file
48
include/QxDao/QxSqlGenerator/QxSqlGenerator.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_H_
|
||||
#define _QX_SQL_GENERATOR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxDao/QxSqlGenerator/IxSqlGenerator.h>
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_MySQL.h>
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Oracle.h>
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_PostgreSQL.h>
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_SQLite.h>
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_MSSQLServer.h>
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_H_
|
||||
81
include/QxDao/QxSqlGenerator/QxSqlGenerator_MSSQLServer.h
Normal file
81
include/QxDao/QxSqlGenerator/QxSqlGenerator_MSSQLServer.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_MSSQLSERVER_H_
|
||||
#define _QX_SQL_GENERATOR_MSSQLSERVER_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_MSSQLServer.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator for Microsoft SQL Server database
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_MSSQLServer : SQL generator for Microsoft SQL Server database
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_MSSQLServer : public QxSqlGenerator_Standard
|
||||
{
|
||||
|
||||
public:
|
||||
QxSqlGenerator_MSSQLServer();
|
||||
virtual ~QxSqlGenerator_MSSQLServer();
|
||||
|
||||
virtual void init();
|
||||
virtual QString getLimit(const QxSqlLimit *pLimit) const;
|
||||
virtual void resolveLimit(QSqlQuery &query, const QxSqlLimit *pLimit, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
|
||||
virtual void postProcess(QString &sql, const QxSqlLimit *pLimit) const;
|
||||
|
||||
private:
|
||||
void initSqlTypeByClassName() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_MSSQLServer> QxSqlGenerator_MSSQLServer_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_MSSQLSERVER_H_
|
||||
78
include/QxDao/QxSqlGenerator/QxSqlGenerator_MySQL.h
Normal file
78
include/QxDao/QxSqlGenerator/QxSqlGenerator_MySQL.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_MYSQL_H_
|
||||
#define _QX_SQL_GENERATOR_MYSQL_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_MySQL.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator for MySQL database
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_MySQL : SQL generator for MySQL database
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_MySQL : public QxSqlGenerator_Standard
|
||||
{
|
||||
|
||||
public:
|
||||
QxSqlGenerator_MySQL();
|
||||
virtual ~QxSqlGenerator_MySQL();
|
||||
|
||||
virtual QString getAutoIncrement() const;
|
||||
|
||||
private:
|
||||
void initSqlTypeByClassName() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_MySQL> QxSqlGenerator_MySQL_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_MYSQL_H_
|
||||
95
include/QxDao/QxSqlGenerator/QxSqlGenerator_Oracle.h
Normal file
95
include/QxDao/QxSqlGenerator/QxSqlGenerator_Oracle.h
Normal 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_GENERATOR_ORACLE_H_
|
||||
#define _QX_SQL_GENERATOR_ORACLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_Oracle.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator for Oracle database
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_Oracle : SQL generator for Oracle database
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_Oracle : public QxSqlGenerator_Standard
|
||||
{
|
||||
|
||||
protected:
|
||||
bool m_bOldLimitSyntax; //!< Use old limit syntax (for Oracle version < 12.1), more details here : https://stackoverflow.com/questions/470542/how-do-i-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering
|
||||
bool m_bManageLastInsertId; //!< Manage last insert id using RETURNING INTO syntax (thx to Romain Macureau and Abdennour Boutrig)
|
||||
|
||||
public:
|
||||
QxSqlGenerator_Oracle();
|
||||
QxSqlGenerator_Oracle(bool bManageLastInsertId);
|
||||
virtual ~QxSqlGenerator_Oracle();
|
||||
|
||||
virtual QString getTableAliasSep() const;
|
||||
virtual QString getLimit(const QxSqlLimit *pLimit) const;
|
||||
virtual void resolveLimit(QSqlQuery &query, const QxSqlLimit *pLimit, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
|
||||
virtual void postProcess(QString &sql, const QxSqlLimit *pLimit) const;
|
||||
virtual void checkSqlInsert(IxDao_Helper *pDaoHelper, QString &sql) const;
|
||||
virtual void onBeforeInsert(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onAfterInsert(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
|
||||
bool getOldLimitSyntax() const;
|
||||
void setOldLimitSyntax(bool b);
|
||||
|
||||
bool getManageLastInsertId() const;
|
||||
void setManageLastInsertId(bool b);
|
||||
|
||||
private:
|
||||
void initSqlTypeByClassName() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_Oracle> QxSqlGenerator_Oracle_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_ORACLE_H_
|
||||
79
include/QxDao/QxSqlGenerator/QxSqlGenerator_PostgreSQL.h
Normal file
79
include/QxDao/QxSqlGenerator/QxSqlGenerator_PostgreSQL.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_POSTGRESQL_H_
|
||||
#define _QX_SQL_GENERATOR_POSTGRESQL_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_PostgreSQL.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator for PostgreSQL database
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_PostgreSQL : SQL generator for PostgreSQL database
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_PostgreSQL : public QxSqlGenerator_Standard
|
||||
{
|
||||
|
||||
public:
|
||||
QxSqlGenerator_PostgreSQL();
|
||||
virtual ~QxSqlGenerator_PostgreSQL();
|
||||
|
||||
virtual void checkSqlInsert(IxDao_Helper *pDaoHelper, QString &sql) const;
|
||||
virtual void onAfterInsert(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
|
||||
private:
|
||||
void initSqlTypeByClassName() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_PostgreSQL> QxSqlGenerator_PostgreSQL_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_POSTGRESQL_H_
|
||||
76
include/QxDao/QxSqlGenerator/QxSqlGenerator_SQLite.h
Normal file
76
include/QxDao/QxSqlGenerator/QxSqlGenerator_SQLite.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_SQLITE_H_
|
||||
#define _QX_SQL_GENERATOR_SQLITE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_SQLite.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator for SQLite database
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_SQLite : SQL generator for SQLite database
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_SQLite : public QxSqlGenerator_Standard
|
||||
{
|
||||
|
||||
public:
|
||||
QxSqlGenerator_SQLite();
|
||||
virtual ~QxSqlGenerator_SQLite();
|
||||
|
||||
private:
|
||||
void initSqlTypeByClassName() const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_SQLite> QxSqlGenerator_SQLite_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_SQLITE_H_
|
||||
92
include/QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h
Normal file
92
include/QxDao/QxSqlGenerator/QxSqlGenerator_Standard.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** 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_GENERATOR_STANDARD_H_
|
||||
#define _QX_SQL_GENERATOR_STANDARD_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file QxSqlGenerator_Standard.h
|
||||
* \author XDL Team
|
||||
* \ingroup QxDao
|
||||
* \brief SQL generator to build standard SQL query
|
||||
*/
|
||||
|
||||
#include <QxDao/QxSqlGenerator/IxSqlGenerator.h>
|
||||
|
||||
#include <QxDao/QxSqlElement/QxSqlElement.h>
|
||||
|
||||
namespace qx
|
||||
{
|
||||
namespace dao
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/*!
|
||||
* \ingroup QxDao
|
||||
* \brief qx::dao::detail::QxSqlGenerator_Standard : SQL generator to build standard SQL query
|
||||
*/
|
||||
class QX_DLL_EXPORT QxSqlGenerator_Standard : public IxSqlGenerator
|
||||
{
|
||||
|
||||
public:
|
||||
QxSqlGenerator_Standard();
|
||||
virtual ~QxSqlGenerator_Standard();
|
||||
|
||||
virtual void init();
|
||||
virtual QString getAutoIncrement() const;
|
||||
virtual QString getWildCard() const;
|
||||
virtual QString getTableAliasSep() const;
|
||||
virtual QString getLimit(const QxSqlLimit *pLimit) const;
|
||||
virtual void resolveLimit(QSqlQuery &query, const QxSqlLimit *pLimit, qx::QxCollection<QString, QVariantList> *pLstExecBatch = NULL) const;
|
||||
virtual void postProcess(QString &sql, const QxSqlLimit *pLimit) const;
|
||||
virtual void onBeforeInsert(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onAfterInsert(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onBeforeUpdate(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onAfterUpdate(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onBeforeDelete(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void onAfterDelete(IxDao_Helper *pDaoHelper, void *pOwner) const;
|
||||
virtual void checkSqlInsert(IxDao_Helper *pDaoHelper, QString &sql) const;
|
||||
virtual void onBeforeSqlPrepare(IxDao_Helper *pDaoHelper, QString &sql) const;
|
||||
virtual void formatSqlQuery(IxDao_Helper *pDaoHelper, QString &sql) const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<QxSqlGenerator_Standard> QxSqlGenerator_Standard_ptr;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dao
|
||||
} // namespace qx
|
||||
|
||||
#endif // _QX_SQL_GENERATOR_STANDARD_H_
|
||||
Reference in New Issue
Block a user