| QxOrm 1.2.3 C++ Object Relational Mapping library

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

- File List
- File Members

IxRepository.h
Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** http://www.qxorm.com/
    00004 ** http://sourceforge.net/projects/qxorm/
    00005 ** Original file by Lionel Marty
    00006 **
    00007 ** This file is part of the QxOrm library
    00008 **
    00009 ** This software is provided 'as-is', without any express or implied
    00010 ** warranty. In no event will the authors be held liable for any
    00011 ** damages arising from the use of this software.
    00012 **
    00013 ** GNU Lesser General Public License Usage
    00014 ** This file must be used under the terms of the GNU Lesser
    00015 ** General Public License version 2.1 as published by the Free Software
    00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the
    00017 ** packaging of this file.  Please review the following information to
    00018 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00020 **
    00021 ** If you have questions regarding the use of this file, please contact :
    00022 ** contact@qxorm.com
    00023 **
    00024 ****************************************************************************/
    00025
    00026 #ifndef _IX_REPOSITORY_H_
    00027 #define _IX_REPOSITORY_H_
    00028
    00029 #ifdef _MSC_VER
    00030 #pragma once
    00031 #endif
    00032
    00040 #include <QtSql/qsqldatabase.h>
    00041 #include <QtSql/qsqlquery.h>
    00042 #include <QtSql/qsqlerror.h>
    00043 #include <QtSql/qsqldriver.h>
    00044
    00045 #include <QxCommon/QxBool.h>
    00046
    00047 #include <QxDao/QxSqlQuery.h>
    00048
    00049 #include <QxCollection/IxCollection.h>
    00050
    00051 namespace qx {
    00052
    00053 class IxClass;
    00054 class QxSession;
    00055
    00067 class QX_DLL_EXPORT IxRepository
    00068 {
    00069
    00070 protected:
    00071
    00072    bool m_bRegister;
    00073    QString m_sKeyRepository;
    00074    QSqlDatabase m_database;
    00075    QxSession * m_pSession;
    00076
    00077 public:
    00078
    00079    IxRepository(bool bRegister, const QString & sKey);
    00080    IxRepository(bool bRegister, const QString & sKey, const QSqlDatabase & database);
    00081    IxRepository(bool bRegister, const QString & sKey, QxSession * pSession);
    00082    virtual ~IxRepository();
    00083
    00084    QSqlDatabase * database();
    00085    QxSession * session() const;
    00086
    00087    virtual long _count(const qx::QxSqlQuery & query = qx::QxSqlQuery()) = 0;
    00088    virtual void * _fetchById(const QVariant & id, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00089    virtual QSqlError _fetchById(QObject * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00090    virtual QSqlError _fetchById(qx::IxCollection * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00091    virtual QSqlError _fetchAll(QObject * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00092    virtual QSqlError _fetchAll(qx::IxCollection * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00093    virtual QSqlError _fetchByQuery(const qx::QxSqlQuery & query, QObject * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00094    virtual QSqlError _fetchByQuery(const qx::QxSqlQuery & query, qx::IxCollection * p, const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00095    virtual QSqlError _insert(QObject * p, const QStringList & relation = QStringList()) = 0;
    00096    virtual QSqlError _insert(qx::IxCollection * p, const QStringList & relation = QStringList()) = 0;
    00097    virtual QSqlError _update(QObject * p, const qx::QxSqlQuery & query = qx::QxSqlQuery(), const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00098    virtual QSqlError _update(qx::IxCollection * p, const qx::QxSqlQuery & query = qx::QxSqlQuery(), const QStringList & columns = QStringList(), const QStringList & relation = QStringList()) = 0;
    00099    virtual QSqlError _save(QObject * p, const QStringList & relation = QStringList()) = 0;
    00100    virtual QSqlError _save(qx::IxCollection * p, const QStringList & relation = QStringList()) = 0;
    00101    virtual QSqlError _deleteById(const QVariant & id) = 0;
    00102    virtual QSqlError _deleteById(QObject * p) = 0;
    00103    virtual QSqlError _deleteById(qx::IxCollection * p) = 0;
    00104    virtual QSqlError _deleteAll() = 0;
    00105    virtual QSqlError _deleteByQuery(const qx::QxSqlQuery & query) = 0;
    00106    virtual QSqlError _destroyById(const QVariant & id) = 0;
    00107    virtual QSqlError _destroyById(QObject * p) = 0;
    00108    virtual QSqlError _destroyById(qx::IxCollection * p) = 0;
    00109    virtual QSqlError _destroyAll() = 0;
    00110    virtual QSqlError _destroyByQuery(const qx::QxSqlQuery & query) = 0;
    00111    virtual qx_bool _exist(QObject * p) = 0;
    00112    virtual qx_bool _exist(qx::IxCollection * p) = 0;
    00113    virtual qx::IxCollection_ptr _newCollection() const = 0;
    00114    virtual qx::IxClass * _getClass() const = 0;
    00115
    00116 public:
    00117
    00118    static qx::IxCollection_ptr _fetchAll(const QString & repositoryKey, const QStringList & columns = QStringList(), const QStringList & relation = QStringList());
    00119    static qx::IxCollection_ptr _fetchByQuery(const QString & repositoryKey, const qx::QxSqlQuery & query, const QStringList & columns = QStringList(), const QStringList & relation = QStringList());
    00120
    00121 };
    00122
    00123 } // namespace qx
    00124
    00125 #endif // _IX_REPOSITORY_H_