From a35c9f8ffbbf40d90c1d5d0cbb38c53e39aed0c6 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 7 Oct 2017 09:08:09 +0330 Subject: [PATCH 01/47] version text (int, int) => (QString) --- nut.pri | 6 ++++-- src/changelogtable.h | 4 +--- src/database.cpp | 29 ++++++++++++----------------- src/database.h | 3 +-- src/databasemodel.cpp | 22 ++++++---------------- src/databasemodel.h | 9 +++------ src/dbgeography.cpp | 21 ++++++++++++++++++++- src/dbgeography.h | 10 +++++----- src/defines.h | 11 ----------- src/defines_p.h | 2 ++ src/serializableobject.cpp | 6 ++++++ src/serializableobject.h | 15 +++++++++++++++ 12 files changed, 75 insertions(+), 63 deletions(-) create mode 100644 src/serializableobject.cpp create mode 100644 src/serializableobject.h diff --git a/nut.pri b/nut.pri index fc794ff..99fa96a 100644 --- a/nut.pri +++ b/nut.pri @@ -22,7 +22,8 @@ HEADERS += \ $$PWD/src/table.h \ $$PWD/src/database.h \ $$PWD/src/database_p.h \ - $$PWD/src/dbgeography.h + $$PWD/src/dbgeography.h \ + $$PWD/src/serializableobject.h SOURCES += \ $$PWD/src/tableset.cpp \ @@ -40,4 +41,5 @@ SOURCES += \ $$PWD/src/wherephrase.cpp \ $$PWD/src/table.cpp \ $$PWD/src/database.cpp \ - $$PWD/src/dbgeography.cpp + $$PWD/src/dbgeography.cpp \ + $$PWD/src/serializableobject.cpp diff --git a/src/changelogtable.h b/src/changelogtable.h index 4b9f618..aa1f34d 100644 --- a/src/changelogtable.h +++ b/src/changelogtable.h @@ -35,9 +35,7 @@ class ChangeLogTable : public Table NUT_DECLARE_FIELD(QString, data, data, setData) - NUT_DECLARE_FIELD(int, versionMajor, versionMajor, setVersionMajor) - - NUT_DECLARE_FIELD(int, versionMinor, versionMinor, setVersionMinor) + NUT_DECLARE_FIELD(QString, version, version, setVersion) public: ChangeLogTable(); diff --git a/src/database.cpp b/src/database.cpp index 5abe025..98b33c2 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -136,17 +136,13 @@ bool DatabasePrivate::updateDatabase() if (db.lastError().type() == QSqlError::NoError) { - q->databaseUpdated(last.versionMajor(), last.versionMinor(), - current.versionMajor(), current.versionMinor()); - QString versionText = QString::number(current.versionMajor()) + "_" - + QString::number(current.versionMinor()); + q->databaseUpdated(last.version(), current.version()); for (int i = 0; i < q->metaObject()->methodCount(); i++) { QMetaMethod m = q->metaObject()->method(i); - if (m.name() == "update" + versionText) { + if (m.name() == "update" + current.version()) { m.invoke(q, Qt::DirectConnection, - Q_ARG(int, current.versionMajor()), - Q_ARG(int, current.versionMinor())); + Q_ARG(QString, current.version())); break; } } @@ -187,11 +183,14 @@ bool DatabasePrivate::getCurrectScheema() tables.insert(ciName.split(" ").at(1), ci.value()); if (ciName == __nut_DB_VERSION) { + currentModel.setVersion(QString(ci.value())); + + /* TODO: remove QStringList version = QString(ci.value()).replace("\"", "").split('.'); bool ok = false; if (version.length() == 1) { - currentModel.setVersionMajor(version.at(0).toInt(&ok)); + currentModel.setVersion(version.at(0).toInt(&ok)); } else if (version.length() == 2) { currentModel.setVersionMajor(version.at(0).toInt(&ok)); currentModel.setVersionMinor(version.at(1).toInt(&ok)); @@ -199,7 +198,7 @@ bool DatabasePrivate::getCurrectScheema() if (!ok) qFatal("NUT_DB_VERSION macro accept version in format 'x' or " - "'x[.y]' only, and x,y must be integer values\n"); + "'x[.y]' only, and x,y must be integer values\n");*/ } } @@ -270,8 +269,7 @@ bool DatabasePrivate::storeScheemaInDB() ChangeLogTable *changeLog = new ChangeLogTable(); changeLog->setData(QJsonDocument(current.toJson()).toJson()); - changeLog->setVersionMajor(current.versionMajor()); - changeLog->setVersionMinor(current.versionMinor()); + changeLog->setVersion(current.version()); changeLogs->append(changeLog); q->saveChanges(); changeLog->deleteLater(); @@ -443,13 +441,10 @@ SqlGeneratorBase *Database::sqlGenertor() const return d->sqlGenertor; } -void Database::databaseUpdated(int oldMajor, int oldMinor, int newMajor, - int newMinor) +void Database::databaseUpdated(QString oldVersion, QString newVersion) { - Q_UNUSED(oldMajor); - Q_UNUSED(oldMinor); - Q_UNUSED(newMajor); - Q_UNUSED(newMinor); + Q_UNUSED(oldVersion); + Q_UNUSED(newVersion); } diff --git a/src/database.h b/src/database.h index 4166e69..8c4ade7 100644 --- a/src/database.h +++ b/src/database.h @@ -71,8 +71,7 @@ public: protected: //remove minor version - virtual void databaseUpdated(int oldMajor, int oldMinor, int newMajor, - int newMinor); + virtual void databaseUpdated(QString oldVersion, QString newVersion); public slots: void setDatabaseName(QString databaseName); diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 3cea9da..f9db4da 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -27,12 +27,12 @@ NUT_BEGIN_NAMESPACE QMap DatabaseModel::_models; -DatabaseModel::DatabaseModel(const QString &name) : QList(), _databaseClassName(name), _versionMajor(0), _versionMinor(0) +DatabaseModel::DatabaseModel(const QString &name) : QList(), _databaseClassName(name), _version(QString::null) { _models.insert(name, this); } -DatabaseModel::DatabaseModel(const DatabaseModel &other) : QList(other), _versionMajor(0), _versionMinor(0) +DatabaseModel::DatabaseModel(const DatabaseModel &other) : QList(other), _version(QString::null) { } @@ -145,24 +145,14 @@ DatabaseModel DatabaseModel::fromJson(QJsonObject &json) return model; } -int DatabaseModel::versionMajor() const +QString DatabaseModel::version() const { - return _versionMajor; + return _version; } -void DatabaseModel::setVersionMajor(int versionMajor) +void DatabaseModel::setVersion(QString version) { - _versionMajor = versionMajor; -} - -int DatabaseModel::versionMinor() const -{ - return _versionMinor; -} - -void DatabaseModel::setVersionMinor(int versionMinor) -{ - _versionMinor = versionMinor; + _version = version; } bool DatabaseModel::remove(const QString &tableName) diff --git a/src/databasemodel.h b/src/databasemodel.h index 8a57f7d..d827370 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -33,7 +33,7 @@ struct RelationModel; class DatabaseModel : public QList { QString _databaseClassName; - int _versionMajor, _versionMinor; + QString _version; static QMap _models; public: @@ -53,11 +53,8 @@ public: static DatabaseModel fromJson(QJsonObject &json); QJsonObject toJson() const; - int versionMajor() const; - void setVersionMajor(int versionMajor); - - int versionMinor() const; - void setVersionMinor(int versionMinor); + QString version() const; + void setVersion(QString version); bool remove(const QString &tableName); diff --git a/src/dbgeography.cpp b/src/dbgeography.cpp index 67d28b8..a5524b2 100644 --- a/src/dbgeography.cpp +++ b/src/dbgeography.cpp @@ -22,7 +22,7 @@ NUT_BEGIN_NAMESPACE -DbGeography::DbGeography(QObject *parent) +DbGeography::DbGeography(QObject *parent) : m_longitude(0), m_latitude(0) { } @@ -33,6 +33,20 @@ DbGeography::DbGeography(const DbGeography &other) setLongitude(other.longitude()); } +DbGeography::DbGeography(const QVariant &value) +{ + QStringList parts = value.toString().split(','); + if (parts.count() == 2) { + setLongitude(parts[0].toDouble()); + setLatitude(parts[1].toDouble()); + } else { + qWarning("Input value for DbGeography is invalid: %s", + qPrintable(value.toString())); + setLongitude(0); + setLatitude(0); + } +} + qreal DbGeography::latitude() const { return m_latitude; @@ -59,6 +73,11 @@ void DbGeography::setLongitude(qreal longitude) m_longitude = longitude; } +/*QVariant Nut::DbGeography::operator QVariant() +{ + return QVariant::fromValue(QString("%1,%2").arg(longitude()).arg(latitude())); +}*/ + QString DbGeography::toString() { return QString("%1,%2").arg(longitude()).arg(latitude()); diff --git a/src/dbgeography.h b/src/dbgeography.h index 6cc9160..c0a82ac 100644 --- a/src/dbgeography.h +++ b/src/dbgeography.h @@ -24,6 +24,7 @@ #include "defines.h" #include #include +#include NUT_BEGIN_NAMESPACE @@ -35,6 +36,7 @@ class NUT_EXPORT DbGeography //: public QObject public: explicit DbGeography(QObject *parent = 0); DbGeography(const DbGeography &other); + DbGeography(const QVariant &value); qreal latitude() const; qreal longitude() const; @@ -42,16 +44,14 @@ public: void setLatitude(qreal latitude); void setLongitude(qreal longitude); + //QVariant operator QVariant(); + QString toString(); void fromString(const QString &s); }; NUT_END_NAMESPACE -#ifdef NUT_NAMESPACE - Q_DECLARE_METATYPE(NUT_NAMESPACE::DbGeography) -#else - Q_DECLARE_METATYPE(DbGeography) -#endif +Q_DECLARE_METATYPE(NUT_WRAP_NAMESPACE(DbGeography)) #endif // DBGEOGRAPHY_H diff --git a/src/defines.h b/src/defines.h index 5dc0b89..2d4e22e 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,17 +33,6 @@ # define NUT_EXPORT Q_DECL_EXPORT #endif - -#ifdef NUT_NAMESPACE -//TODO: remove unused macro -# define __NUT_NAMESPACE_PERFIX NUT_NAMESPACE:: -# define NUT_WRAP_NAMESPACE(x) NUT_NAMESPACE::x -#else -//TODO: remove unused macro -# define __NUT_NAMESPACE_PERFIX -# define NUT_WRAP_NAMESPACE(x) x -#endif - // Database //TODO: remove minor version #define NUT_DB_VERSION(major, minor) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), QT_STRINGIFY(#major "." #minor)) diff --git a/src/defines_p.h b/src/defines_p.h index 425d02c..e2ed9c9 100644 --- a/src/defines_p.h +++ b/src/defines_p.h @@ -46,9 +46,11 @@ #ifdef NUT_NAMESPACE # define NUT_BEGIN_NAMESPACE namespace NUT_NAMESPACE{ # define NUT_END_NAMESPACE } +# define NUT_WRAP_NAMESPACE(x) NUT_NAMESPACE::x #else # define NUT_BEGIN_NAMESPACE # define NUT_END_NAMESPACE +# define NUT_WRAP_NAMESPACE(x) x #endif #endif // DEFINES_P_H diff --git a/src/serializableobject.cpp b/src/serializableobject.cpp new file mode 100644 index 0000000..667c57b --- /dev/null +++ b/src/serializableobject.cpp @@ -0,0 +1,6 @@ +#include "serializableobject.h" + +SerializableObject::SerializableObject() +{ + +} diff --git a/src/serializableobject.h b/src/serializableobject.h new file mode 100644 index 0000000..ffc65b1 --- /dev/null +++ b/src/serializableobject.h @@ -0,0 +1,15 @@ +#ifndef SERIALIZABLEOBJECT_H +#define SERIALIZABLEOBJECT_H + +#include + +class SerializableObject +{ +public: + SerializableObject(); + + virtual void load(const QVariant &value) = 0; + virtual QVariant save() = 0; +}; + +#endif // SERIALIZABLEOBJECT_H From d6a9e7c58d4d4fa511f2a12d39786d68b8cf5188 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 7 Oct 2017 13:56:05 +0330 Subject: [PATCH 02/47] generatotrs moved to seprate folder --- nut.pri | 20 +++++----- src/database.cpp | 8 ++-- src/databasemodel.cpp | 21 +++++++++- src/databasemodel.h | 3 ++ src/dbgeography.cpp | 42 +++++++------------- src/dbgeography.h | 15 +++---- src/{ => generators}/mysqlgenerator.cpp | 2 +- src/{ => generators}/mysqlgenerator.h | 0 src/{ => generators}/postgresqlgenerator.cpp | 4 +- src/{ => generators}/postgresqlgenerator.h | 0 src/{ => generators}/sqlgeneratorbase.cpp | 10 ++--- src/{ => generators}/sqlgeneratorbase_p.h | 4 +- src/{ => generators}/sqlitegenerator.cpp | 4 +- src/{ => generators}/sqlitegenerator.h | 0 src/{ => generators}/sqlservergenerator.cpp | 4 +- src/{ => generators}/sqlservergenerator.h | 0 src/query.h | 2 +- src/table.cpp | 2 +- 18 files changed, 71 insertions(+), 70 deletions(-) rename src/{ => generators}/mysqlgenerator.cpp (99%) rename src/{ => generators}/mysqlgenerator.h (100%) rename src/{ => generators}/postgresqlgenerator.cpp (98%) rename src/{ => generators}/postgresqlgenerator.h (100%) rename src/{ => generators}/sqlgeneratorbase.cpp (99%) rename src/{ => generators}/sqlgeneratorbase_p.h (98%) rename src/{ => generators}/sqlitegenerator.cpp (97%) rename src/{ => generators}/sqlitegenerator.h (100%) rename src/{ => generators}/sqlservergenerator.cpp (98%) rename src/{ => generators}/sqlservergenerator.h (100%) diff --git a/nut.pri b/nut.pri index 99fa96a..92c44de 100644 --- a/nut.pri +++ b/nut.pri @@ -3,20 +3,20 @@ QT += core sql INCLUDEPATH += $$PWD/include HEADERS += \ + $$PWD/src/generators/sqlgeneratorbase_p.h \ + $$PWD/src/generators/postgresqlgenerator.h \ + $$PWD/src/generators/mysqlgenerator.h \ + $$PWD/src/generators/sqlitegenerator.h \ + $$PWD/src/generators/sqlservergenerator.h \ $$PWD/src/tableset.h \ $$PWD/src/defines_p.h \ $$PWD/src/defines.h \ $$PWD/src/query.h \ $$PWD/src/databasemodel.h \ - $$PWD/src/sqlgeneratorbase_p.h \ - $$PWD/src/postgresqlgenerator.h \ $$PWD/src/changelogtable.h \ $$PWD/src/tablesetbase_p.h \ $$PWD/src/querybase_p.h \ - $$PWD/src/mysqlgenerator.h \ - $$PWD/src/sqlitegenerator.h \ $$PWD/src/tablemodel.h \ - $$PWD/src/sqlservergenerator.h \ $$PWD/src/wherephrase.h \ $$PWD/src/query_p.h \ $$PWD/src/table.h \ @@ -26,18 +26,18 @@ HEADERS += \ $$PWD/src/serializableobject.h SOURCES += \ + $$PWD/src/generators/sqlgeneratorbase.cpp \ + $$PWD/src/generators/postgresqlgenerator.cpp \ + $$PWD/src/generators/mysqlgenerator.cpp \ + $$PWD/src/generators/sqlitegenerator.cpp \ + $$PWD/src/generators/sqlservergenerator.cpp \ $$PWD/src/tableset.cpp \ $$PWD/src/query.cpp \ $$PWD/src/databasemodel.cpp \ $$PWD/src/tablesetbase.cpp \ - $$PWD/src/sqlgeneratorbase.cpp \ - $$PWD/src/postgresqlgenerator.cpp \ $$PWD/src/changelogtable.cpp \ $$PWD/src/querybase.cpp \ - $$PWD/src/mysqlgenerator.cpp \ - $$PWD/src/sqlitegenerator.cpp \ $$PWD/src/tablemodel.cpp \ - $$PWD/src/sqlservergenerator.cpp \ $$PWD/src/wherephrase.cpp \ $$PWD/src/table.cpp \ $$PWD/src/database.cpp \ diff --git a/src/database.cpp b/src/database.cpp index 98b33c2..fc4e1a0 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -34,10 +34,10 @@ #include "database_p.h" #include "defines.h" #include "tablemodel.h" -#include "postgresqlgenerator.h" -#include "mysqlgenerator.h" -#include "sqlitegenerator.h" -#include "sqlservergenerator.h" +#include "generators/postgresqlgenerator.h" +#include "generators/mysqlgenerator.h" +#include "generators/sqlitegenerator.h" +#include "generators/sqlservergenerator.h" #include "query.h" #include diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index f9db4da..71b4531 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -37,6 +37,19 @@ DatabaseModel::DatabaseModel(const DatabaseModel &other) : QList(ot } +DatabaseModel::DatabaseModel(const QJsonObject &json) : QList() +{ + setVersion(json.value(QT_STRINGIFY(version)).toString()); + + foreach (QString key, json.keys()) { + if(!json.value(key).isObject()) + continue; + + TableModel *sch = new TableModel(json.value(key).toObject(), key); + append(sch); + } +} + TableModel *DatabaseModel::tableByName(QString tableName) const { for(int i = 0; i < size(); i++){ @@ -89,8 +102,7 @@ QJsonObject DatabaseModel::toJson() const { QJsonObject obj; -// obj.insert(QT_STRINGIFY(versionMajor), QJsonValue(_versionMajor)); -// obj.insert(QT_STRINGIFY(versionMinor), QJsonValue(_versionMinor)); + obj.insert(QT_STRINGIFY(version), QJsonValue(_version)); for(int i = 0; i < size(); i++){ TableModel *s = at(i); @@ -100,6 +112,11 @@ QJsonObject DatabaseModel::toJson() const return obj; } +DatabaseModel::operator QJsonObject() +{ + return toJson(); +} + RelationModel *DatabaseModel::relationByClassNames(const QString &masterClassName, const QString &childClassName) { TableModel *childTable = tableByClassName(childClassName); diff --git a/src/databasemodel.h b/src/databasemodel.h index d827370..6e575d6 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -39,6 +39,7 @@ class DatabaseModel : public QList public: DatabaseModel(const QString &name = QString::null); DatabaseModel(const DatabaseModel &other); + DatabaseModel(const QJsonObject &json); TableModel *tableByName(QString tableName) const; TableModel *tableByClassName(QString className) const; @@ -50,8 +51,10 @@ public: bool operator==(const DatabaseModel &other) const; + Q_DECL_DEPRECATED static DatabaseModel fromJson(QJsonObject &json); QJsonObject toJson() const; + operator QJsonObject(); QString version() const; void setVersion(QString version); diff --git a/src/dbgeography.cpp b/src/dbgeography.cpp index a5524b2..11d4407 100644 --- a/src/dbgeography.cpp +++ b/src/dbgeography.cpp @@ -22,15 +22,15 @@ NUT_BEGIN_NAMESPACE -DbGeography::DbGeography(QObject *parent) : m_longitude(0), m_latitude(0) +DbGeography::DbGeography() : m_longitude(0), m_latitude(0) { } DbGeography::DbGeography(const DbGeography &other) { - setLatitude(other.latitude()); setLongitude(other.longitude()); + setLatitude(other.latitude()); } DbGeography::DbGeography(const QVariant &value) @@ -47,14 +47,23 @@ DbGeography::DbGeography(const QVariant &value) } } +qreal DbGeography::longitude() const +{ + return m_longitude; +} + qreal DbGeography::latitude() const { return m_latitude; } -qreal DbGeography::longitude() const +void DbGeography::setLongitude(qreal longitude) + { - return m_longitude; + if (qFuzzyCompare(m_longitude, longitude)) + return; + + m_longitude = longitude; } void DbGeography::setLatitude(qreal latitude) @@ -64,32 +73,9 @@ void DbGeography::setLatitude(qreal latitude) m_latitude = latitude; } - -void DbGeography::setLongitude(qreal longitude) -{ - if (qFuzzyCompare(m_longitude, longitude)) - return; - - m_longitude = longitude; -} - -/*QVariant Nut::DbGeography::operator QVariant() +DbGeography::operator QVariant() { return QVariant::fromValue(QString("%1,%2").arg(longitude()).arg(latitude())); -}*/ - -QString DbGeography::toString() -{ - return QString("%1,%2").arg(longitude()).arg(latitude()); -} - -void DbGeography::fromString(const QString &s) -{ - QStringList parts = s.split(','); - if (parts.count() == 2) { - setLongitude(parts[0].toDouble()); - setLatitude(parts[1].toDouble()); - } } NUT_END_NAMESPACE diff --git a/src/dbgeography.h b/src/dbgeography.h index c0a82ac..58d0196 100644 --- a/src/dbgeography.h +++ b/src/dbgeography.h @@ -28,26 +28,23 @@ NUT_BEGIN_NAMESPACE -class NUT_EXPORT DbGeography //: public QObject +class NUT_EXPORT DbGeography { - qreal m_latitude; qreal m_longitude; + qreal m_latitude; public: - explicit DbGeography(QObject *parent = 0); + explicit DbGeography(); DbGeography(const DbGeography &other); DbGeography(const QVariant &value); - qreal latitude() const; qreal longitude() const; + qreal latitude() const; - void setLatitude(qreal latitude); void setLongitude(qreal longitude); + void setLatitude(qreal latitude); - //QVariant operator QVariant(); - - QString toString(); - void fromString(const QString &s); + operator QVariant(); }; NUT_END_NAMESPACE diff --git a/src/mysqlgenerator.cpp b/src/generators/mysqlgenerator.cpp similarity index 99% rename from src/mysqlgenerator.cpp rename to src/generators/mysqlgenerator.cpp index f2d4c1a..e1ecb12 100644 --- a/src/mysqlgenerator.cpp +++ b/src/generators/mysqlgenerator.cpp @@ -19,7 +19,7 @@ **************************************************************************/ #include "mysqlgenerator.h" -#include "tablemodel.h" +#include "../tablemodel.h" #include #include diff --git a/src/mysqlgenerator.h b/src/generators/mysqlgenerator.h similarity index 100% rename from src/mysqlgenerator.h rename to src/generators/mysqlgenerator.h diff --git a/src/postgresqlgenerator.cpp b/src/generators/postgresqlgenerator.cpp similarity index 98% rename from src/postgresqlgenerator.cpp rename to src/generators/postgresqlgenerator.cpp index 0ff4b46..105e663 100644 --- a/src/postgresqlgenerator.cpp +++ b/src/generators/postgresqlgenerator.cpp @@ -19,8 +19,8 @@ **************************************************************************/ #include "postgresqlgenerator.h" -#include "table.h" -#include "tablemodel.h" +#include "../table.h" +#include "../tablemodel.h" NUT_BEGIN_NAMESPACE diff --git a/src/postgresqlgenerator.h b/src/generators/postgresqlgenerator.h similarity index 100% rename from src/postgresqlgenerator.h rename to src/generators/postgresqlgenerator.h diff --git a/src/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp similarity index 99% rename from src/sqlgeneratorbase.cpp rename to src/generators/sqlgeneratorbase.cpp index fa1c0cb..f845d4f 100644 --- a/src/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -24,12 +24,12 @@ #include #include -#include "database.h" -#include "databasemodel.h" #include "sqlgeneratorbase_p.h" -#include "table.h" -#include "tablemodel.h" -#include "wherephrase.h" +#include "../database.h" +#include "../table.h" +#include "../databasemodel.h" +#include "../tablemodel.h" +#include "../wherephrase.h" NUT_BEGIN_NAMESPACE diff --git a/src/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h similarity index 98% rename from src/sqlgeneratorbase_p.h rename to src/generators/sqlgeneratorbase_p.h index 9714948..a2bc6fe 100644 --- a/src/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -24,7 +24,7 @@ #include #include #include -#include "wherephrase.h" +#include "../wherephrase.h" NUT_BEGIN_NAMESPACE @@ -33,8 +33,6 @@ struct FieldModel; class DatabaseModel; class TableModel; class Database; -//struct PhraseData; -//class WherePhrase; class SqlGeneratorBase : public QObject { // Q_OBJECT diff --git a/src/sqlitegenerator.cpp b/src/generators/sqlitegenerator.cpp similarity index 97% rename from src/sqlitegenerator.cpp rename to src/generators/sqlitegenerator.cpp index 744bb27..5219a61 100644 --- a/src/sqlitegenerator.cpp +++ b/src/generators/sqlitegenerator.cpp @@ -19,8 +19,8 @@ **************************************************************************/ #include "sqlitegenerator.h" -#include "table.h" -#include "tablemodel.h" +#include "../table.h" +#include "../tablemodel.h" NUT_BEGIN_NAMESPACE diff --git a/src/sqlitegenerator.h b/src/generators/sqlitegenerator.h similarity index 100% rename from src/sqlitegenerator.h rename to src/generators/sqlitegenerator.h diff --git a/src/sqlservergenerator.cpp b/src/generators/sqlservergenerator.cpp similarity index 98% rename from src/sqlservergenerator.cpp rename to src/generators/sqlservergenerator.cpp index cdca934..9a4198f 100644 --- a/src/sqlservergenerator.cpp +++ b/src/generators/sqlservergenerator.cpp @@ -19,8 +19,8 @@ **************************************************************************/ #include "sqlservergenerator.h" -#include "table.h" -#include "tablemodel.h" +#include "../table.h" +#include "../tablemodel.h" #include #include diff --git a/src/sqlservergenerator.h b/src/generators/sqlservergenerator.h similarity index 100% rename from src/sqlservergenerator.h rename to src/generators/sqlservergenerator.h diff --git a/src/query.h b/src/query.h index a14b845..f70d7dc 100644 --- a/src/query.h +++ b/src/query.h @@ -31,7 +31,7 @@ #include "database.h" #include "databasemodel.h" #include "tablesetbase_p.h" -#include "sqlgeneratorbase_p.h" +#include "generators/sqlgeneratorbase_p.h" #include "querybase_p.h" #include "wherephrase.h" #include "tablemodel.h" diff --git a/src/table.cpp b/src/table.cpp index 75eb7bc..47af793 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -22,7 +22,7 @@ #include #include "table.h" #include "database.h" -#include "sqlgeneratorbase_p.h" +#include "generators/sqlgeneratorbase_p.h" NUT_BEGIN_NAMESPACE From 0cad43f95998e010ea0a52da9a11b59ecad9da19 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 7 Oct 2017 15:15:20 +0330 Subject: [PATCH 03/47] version text fix --- include/header_copier | 41 ++++++++++++++++++--------- src/defines.h | 3 +- src/generators/sqlservergenerator.cpp | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) mode change 100644 => 100755 include/header_copier diff --git a/include/header_copier b/include/header_copier old mode 100644 new mode 100755 index 6265d12..e228c19 --- a/include/header_copier +++ b/include/header_copier @@ -1,27 +1,42 @@ #!/bin/bash -exec 3< <(egrep -o "class\sNUT_EXPORT\s(\S+)" ../src -R 2>&1) +src_dir="src" +namespace_name="nut" -pattern="\.\.\/src\/([a-z]+)\.h\:class\sNUT_EXPORT\s(\w+)" +ns=$(echo $namespace_name|awk '{print tolower($0)}') +Ns="Nut" +NS=$(echo $namespace_name|awk '{print toupper($0)}') +echo $NS +exit -echo "" > "Nut" -echo "" > "nut.h" +create_sub_folder=true -#mkdir -p Nut +exec 3< <(egrep -o "class\s${NS}_EXPORT\s(\S+)" "../$src_dir" -R 2>&1) + +pattern="\.\.\/$src_dir\/([a-z]+)\.h\:class\s${NS}_EXPORT\s(\w+)" + +echo "" > "$Ns" +echo "" > "$ns.h" + +if [[ -z create_sub_folder ]]; then + mkdir -p $Ns +fi while read line; do if [[ $line =~ $pattern ]]; then header=${BASH_REMATCH[1]} class=${BASH_REMATCH[2]} - echo "#include \"../src/$header.h\"" > $class - echo "#include \"../src/$header.h\"" > "$header.h" - - #echo "#include \"../src/$header.h\"" > "Nut/$class" - #echo "#include \"../src/$header.h\"" > "Nut/$header.h" - - echo "#include \"../src/$header.h\"" >> "Nut" - echo "#include \"../src/$header.h\"" >> "nut.h" + echo "#include \"../$src_dir/$header.h\"" > $class + echo "#include \"../$src_dir/$header.h\"" > "$header.h" + + if [[ -z create_sub_folder ]]; then + echo "#include \"../$src_dir/$header.h\"" > "$Ns/$class" + echo "#include \"../$src_dir/$header.h\"" > "$Ns/$header.h" + fi + + echo "#include \"../$src_dir/$header.h\"" >> "$Ns" + echo "#include \"../$src_dir/$header.h\"" >> "$ns.h" fi done <&3 exec 3<&- diff --git a/src/defines.h b/src/defines.h index 2d4e22e..1184a11 100644 --- a/src/defines.h +++ b/src/defines.h @@ -35,7 +35,8 @@ // Database //TODO: remove minor version -#define NUT_DB_VERSION(major, minor) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), QT_STRINGIFY(#major "." #minor)) +#define NUT_DB_VERSION(version) \ + Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version)) #define NUT_DECLARE_TABLE(type, name) \ Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ diff --git a/src/generators/sqlservergenerator.cpp b/src/generators/sqlservergenerator.cpp index 9a4198f..a051d6d 100644 --- a/src/generators/sqlservergenerator.cpp +++ b/src/generators/sqlservergenerator.cpp @@ -141,7 +141,7 @@ QString SqlServerGenerator::selectCommand( QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, tableName, joinClassName, skip, take); if (take != -1 && skip != -1) - command.append(QString("OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY") + command.append(QString("OFFSET %1 ROWS FETCH NEXT %2 ROWS ONLY") .arg(skip) .arg(take)); return command; From e12f5fbea79373f8b958fff51fa31927d2ba8c16 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 7 Oct 2017 15:15:20 +0330 Subject: [PATCH 04/47] version text fix --- include/header_copier | 41 ++++++++++++++++++--------- src/defines.h | 3 +- src/generators/sqlservergenerator.cpp | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) mode change 100644 => 100755 include/header_copier diff --git a/include/header_copier b/include/header_copier old mode 100644 new mode 100755 index 6265d12..e228c19 --- a/include/header_copier +++ b/include/header_copier @@ -1,27 +1,42 @@ #!/bin/bash -exec 3< <(egrep -o "class\sNUT_EXPORT\s(\S+)" ../src -R 2>&1) +src_dir="src" +namespace_name="nut" -pattern="\.\.\/src\/([a-z]+)\.h\:class\sNUT_EXPORT\s(\w+)" +ns=$(echo $namespace_name|awk '{print tolower($0)}') +Ns="Nut" +NS=$(echo $namespace_name|awk '{print toupper($0)}') +echo $NS +exit -echo "" > "Nut" -echo "" > "nut.h" +create_sub_folder=true -#mkdir -p Nut +exec 3< <(egrep -o "class\s${NS}_EXPORT\s(\S+)" "../$src_dir" -R 2>&1) + +pattern="\.\.\/$src_dir\/([a-z]+)\.h\:class\s${NS}_EXPORT\s(\w+)" + +echo "" > "$Ns" +echo "" > "$ns.h" + +if [[ -z create_sub_folder ]]; then + mkdir -p $Ns +fi while read line; do if [[ $line =~ $pattern ]]; then header=${BASH_REMATCH[1]} class=${BASH_REMATCH[2]} - echo "#include \"../src/$header.h\"" > $class - echo "#include \"../src/$header.h\"" > "$header.h" - - #echo "#include \"../src/$header.h\"" > "Nut/$class" - #echo "#include \"../src/$header.h\"" > "Nut/$header.h" - - echo "#include \"../src/$header.h\"" >> "Nut" - echo "#include \"../src/$header.h\"" >> "nut.h" + echo "#include \"../$src_dir/$header.h\"" > $class + echo "#include \"../$src_dir/$header.h\"" > "$header.h" + + if [[ -z create_sub_folder ]]; then + echo "#include \"../$src_dir/$header.h\"" > "$Ns/$class" + echo "#include \"../$src_dir/$header.h\"" > "$Ns/$header.h" + fi + + echo "#include \"../$src_dir/$header.h\"" >> "$Ns" + echo "#include \"../$src_dir/$header.h\"" >> "$ns.h" fi done <&3 exec 3<&- diff --git a/src/defines.h b/src/defines.h index 2d4e22e..1184a11 100644 --- a/src/defines.h +++ b/src/defines.h @@ -35,7 +35,8 @@ // Database //TODO: remove minor version -#define NUT_DB_VERSION(major, minor) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), QT_STRINGIFY(#major "." #minor)) +#define NUT_DB_VERSION(version) \ + Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version)) #define NUT_DECLARE_TABLE(type, name) \ Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ diff --git a/src/generators/sqlservergenerator.cpp b/src/generators/sqlservergenerator.cpp index 9a4198f..a051d6d 100644 --- a/src/generators/sqlservergenerator.cpp +++ b/src/generators/sqlservergenerator.cpp @@ -141,7 +141,7 @@ QString SqlServerGenerator::selectCommand( QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, tableName, joinClassName, skip, take); if (take != -1 && skip != -1) - command.append(QString("OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY") + command.append(QString("OFFSET %1 ROWS FETCH NEXT %2 ROWS ONLY") .arg(skip) .arg(take)); return command; From 7316439a4ce3323fad63593fa00c28eee777a40e Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:38:10 +0330 Subject: [PATCH 05/47] database creation polish --- include/DbGeography | 2 +- include/Nut | 1 - include/dbgeography.h | 2 +- nut.pri | 4 +- src/database.cpp | 38 +++++++++----- src/database_p.h | 12 ++++- src/databasemodel.cpp | 38 ++++++++++---- src/databasemodel.h | 1 + src/defines.h | 6 +-- src/generators/sqlgeneratorbase.cpp | 17 +++--- src/query.h | 1 - src/types/dbgeography.cpp | 81 +++++++++++++++++++++++++++++ src/types/dbgeography.h | 54 +++++++++++++++++++ src/wherephrase.h | 2 +- 14 files changed, 212 insertions(+), 47 deletions(-) create mode 100644 src/types/dbgeography.cpp create mode 100644 src/types/dbgeography.h diff --git a/include/DbGeography b/include/DbGeography index 7e8c4fa..66d3f2d 100644 --- a/include/DbGeography +++ b/include/DbGeography @@ -1 +1 @@ -#include "../src/dbgeography.h" +#include "../src/types/dbgeography.h" diff --git a/include/Nut b/include/Nut index 2dfb0b9..5b89c95 100644 --- a/include/Nut +++ b/include/Nut @@ -2,5 +2,4 @@ #include "../src/table.h" #include "../src/database.h" #include "../src/tableset.h" -#include "../src/dbgeography.h" #include "../src/query.h" diff --git a/include/dbgeography.h b/include/dbgeography.h index 7e8c4fa..66d3f2d 100644 --- a/include/dbgeography.h +++ b/include/dbgeography.h @@ -1 +1 @@ -#include "../src/dbgeography.h" +#include "../src/types/dbgeography.h" diff --git a/nut.pri b/nut.pri index 92c44de..4932d79 100644 --- a/nut.pri +++ b/nut.pri @@ -8,6 +8,7 @@ HEADERS += \ $$PWD/src/generators/mysqlgenerator.h \ $$PWD/src/generators/sqlitegenerator.h \ $$PWD/src/generators/sqlservergenerator.h \ + $$PWD/src/types/dbgeography.h \ $$PWD/src/tableset.h \ $$PWD/src/defines_p.h \ $$PWD/src/defines.h \ @@ -22,7 +23,6 @@ HEADERS += \ $$PWD/src/table.h \ $$PWD/src/database.h \ $$PWD/src/database_p.h \ - $$PWD/src/dbgeography.h \ $$PWD/src/serializableobject.h SOURCES += \ @@ -31,6 +31,7 @@ SOURCES += \ $$PWD/src/generators/mysqlgenerator.cpp \ $$PWD/src/generators/sqlitegenerator.cpp \ $$PWD/src/generators/sqlservergenerator.cpp \ + $$PWD/src/types/dbgeography.cpp \ $$PWD/src/tableset.cpp \ $$PWD/src/query.cpp \ $$PWD/src/databasemodel.cpp \ @@ -41,5 +42,4 @@ SOURCES += \ $$PWD/src/wherephrase.cpp \ $$PWD/src/table.cpp \ $$PWD/src/database.cpp \ - $$PWD/src/dbgeography.cpp \ $$PWD/src/serializableobject.cpp diff --git a/src/database.cpp b/src/database.cpp index fc4e1a0..c2e1149 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -47,7 +47,7 @@ NUT_BEGIN_NAMESPACE -int DatabasePrivate::lastId = 0; +qulonglong DatabasePrivate::lastId = 0; QMap DatabasePrivate::allTableMaps; DatabasePrivate::DatabasePrivate(Database *parent) : q_ptr(parent) @@ -58,8 +58,6 @@ bool DatabasePrivate::open(bool update) { Q_Q(Database); // if (update) - bool isNew = getCurrectScheema(); - connectionName = q->metaObject()->className() + QString::number(DatabasePrivate::lastId); @@ -79,6 +77,8 @@ bool DatabasePrivate::open(bool update) || db.lastError().text().contains("Cannot open database") || db.lastError().text().contains("Unknown database '" + databaseName + "'")) { + + db.close(); db.setDatabaseName(sqlGenertor->masterDatabaseName(databaseName)); ok = db.open(); qDebug("Creating database"); @@ -86,10 +86,13 @@ bool DatabasePrivate::open(bool update) db.exec("CREATE DATABASE " + databaseName); db.close(); - if (db.lastError().type() != QSqlError::NoError) + if (db.lastError().type() != QSqlError::NoError) { qWarning("Creating database error: %s", db.lastError().text().toLatin1().data()); + return false; + } + _databaseStatus = New; return open(update); } else { qWarning("Unknown error detecting change logs, %s", @@ -99,7 +102,7 @@ bool DatabasePrivate::open(bool update) return false; } - if(isNew) + if(update) return updateDatabase(); else return true; @@ -109,7 +112,10 @@ bool DatabasePrivate::updateDatabase() { Q_Q(Database); - DatabaseModel last = getLastScheema(); + if (!getCurrectScheema()) + return true; + + DatabaseModel last = _databaseStatus == New ? DatabaseModel() : getLastScheema(); DatabaseModel current = currentModel; if (last == current) { @@ -123,15 +129,17 @@ bool DatabasePrivate::updateDatabase() qDebug("Databse is changed"); QStringList sql = sqlGenertor->diff(last, current); + db.transaction(); foreach (QString s, sql) { db.exec(s); if (db.lastError().type() != QSqlError::NoError) - qWarning("Error executing sql command, %s", + qWarning("Error executing sql command `%s`, %s", + qPrintable(s), db.lastError().text().toLatin1().data()); } - storeScheemaInDB(); + putModelToDatabase(); bool ok = db.commit(); if (db.lastError().type() == QSqlError::NoError) { @@ -160,6 +168,7 @@ bool DatabasePrivate::getCurrectScheema() if (allTableMaps.contains(q->metaObject()->className())) { currentModel = allTableMaps[q->metaObject()->className()]; + qDebug() << "******************"; return false; } @@ -229,21 +238,22 @@ DatabaseModel DatabasePrivate::getLastScheema() ->orderBy(!ChangeLogTable::idField()) ->first(); - DatabaseModel ret(q->metaObject()->className()); +// DatabaseModel ret(q->metaObject()->className()); if (u) { QJsonObject json = QJsonDocument::fromJson( QByteArray(u->data().toLocal8Bit().data())).object(); + DatabaseModel ret = json; + return ret; + /* foreach (QString key, json.keys()) { TableModel *sch = new TableModel(json.value(key).toObject(), key); ret.append(sch); - } - - u->deleteLater(); + }*/ } - return ret; + return DatabaseModel(); // QSqlQuery query = q->exec("select * from __change_logs order by id // desc limit 1"); @@ -261,7 +271,7 @@ DatabaseModel DatabasePrivate::getLastScheema() // return ret; } -bool DatabasePrivate::storeScheemaInDB() +bool DatabasePrivate::putModelToDatabase() { Q_Q(Database); DatabaseModel current = currentModel; diff --git a/src/database_p.h b/src/database_p.h index 33c4b05..605864b 100644 --- a/src/database_p.h +++ b/src/database_p.h @@ -41,7 +41,7 @@ public: bool updateDatabase(); void createChangeLogs(); - bool storeScheemaInDB(); + bool putModelToDatabase(); DatabaseModel getLastScheema(); bool getCurrectScheema(); @@ -63,9 +63,17 @@ public: QT_DEPRECATED QHash tables; static QMap allTableMaps; - static int lastId; + static qulonglong lastId; QSet tableSets; + + + enum DatabaseStatus{ + New, + Modified, + NotChanged + }; + DatabaseStatus _databaseStatus; }; NUT_END_NAMESPACE diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 71b4531..36f682e 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -21,12 +21,15 @@ #include "databasemodel.h" #include "tablemodel.h" +#include #include NUT_BEGIN_NAMESPACE QMap DatabaseModel::_models; +#define NODE_VERSION "version" +#define NODE_TABLES "tables" DatabaseModel::DatabaseModel(const QString &name) : QList(), _databaseClassName(name), _version(QString::null) { _models.insert(name, this); @@ -39,13 +42,14 @@ DatabaseModel::DatabaseModel(const DatabaseModel &other) : QList(ot DatabaseModel::DatabaseModel(const QJsonObject &json) : QList() { - setVersion(json.value(QT_STRINGIFY(version)).toString()); + setVersion(json.value(NODE_VERSION).toString()); - foreach (QString key, json.keys()) { - if(!json.value(key).isObject()) + QJsonObject tables = json.value(NODE_TABLES).toObject(); + foreach (QString key, tables.keys()) { + if(!tables.value(key).isObject()) continue; - TableModel *sch = new TableModel(json.value(key).toObject(), key); + TableModel *sch = new TableModel(tables.value(key).toObject(), key); append(sch); } } @@ -98,17 +102,33 @@ bool DatabaseModel::operator ==(const DatabaseModel &other) const return true; } +DatabaseModel DatabaseModel::operator +(const DatabaseModel &other) +{ + DatabaseModel model; + DatabaseModel::const_iterator i; + + for (i = constBegin(); i != constEnd(); ++i) + model.append(*i); + + for (i = other.constBegin(); i != other.constEnd(); ++i) + model.append(*i); + + return model; +} + QJsonObject DatabaseModel::toJson() const { QJsonObject obj; obj.insert(QT_STRINGIFY(version), QJsonValue(_version)); - + QJsonObject tables; for(int i = 0; i < size(); i++){ TableModel *s = at(i); - obj.insert(s->name(), s->toJson()); + tables.insert(s->name(), s->toJson()); } + obj.insert(NODE_TABLES, tables); + return obj; } @@ -149,10 +169,10 @@ DatabaseModel DatabaseModel::fromJson(QJsonObject &json) { DatabaseModel model(QString::null); -// model.setVersionMajor(json.value(QT_STRINGIFY(versionMajor)).toInt()); -// model.setVersionMinor(json.value(QT_STRINGIFY(versionMinor)).toInt()); + model.setVersion(json.value(NODE_VERSION).toString()); - foreach (QString key, json.keys()) { + QJsonObject tables = json.value(NODE_TABLES).toObject(); + foreach (QString key, tables.keys()) { if(!json.value(key).isObject()) continue; diff --git a/src/databasemodel.h b/src/databasemodel.h index 6e575d6..40d5373 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -50,6 +50,7 @@ public: const QString &childClassName); bool operator==(const DatabaseModel &other) const; + DatabaseModel operator +(const DatabaseModel &other); Q_DECL_DEPRECATED static DatabaseModel fromJson(QJsonObject &json); diff --git a/src/defines.h b/src/defines.h index 1184a11..c386a17 100644 --- a/src/defines.h +++ b/src/defines.h @@ -26,7 +26,6 @@ #include "defines_p.h" #include "qglobal.h" - #ifdef NUT_COMPILE_STATIC # define NUT_EXPORT #else @@ -36,7 +35,7 @@ // Database //TODO: remove minor version #define NUT_DB_VERSION(version) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version)) + Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version) #define NUT_DECLARE_TABLE(type, name) \ Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ @@ -90,7 +89,6 @@ public: \ return m_##n; \ } - #define NUT_INDEX(name, field, order) #define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) #define NUT_AUTO_INCREMENT(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_AUTO_INCREMENT), #x) @@ -114,6 +112,4 @@ public: \ # define FIRST() ->first() #endif // NUT_NO_KEYWORDS - - #endif // SYNTAX_DEFINES_H diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index f845d4f..d186d4c 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -81,18 +81,15 @@ QStringList SqlGeneratorBase::diff(DatabaseModel lastModel, { QStringList ret; - QSet tableNames; - foreach (TableModel *table, lastModel) - tableNames.insert(table->name()); + DatabaseModel unionModel = lastModel + newModel; - foreach (TableModel *table, newModel) - tableNames.insert(table->name()); - - foreach (QString tableName, tableNames) { - TableModel *oldTable = lastModel.tableByName(tableName); - TableModel *newTable = newModel.tableByName(tableName); + foreach (TableModel *table, unionModel) { + TableModel *oldTable = lastModel.tableByName(table->name()); + TableModel *newTable = newModel.tableByName(table->name()); QString sql = diff(oldTable, newTable); - ret << sql; + + if (!sql.isEmpty()) + ret << sql; } return ret; diff --git a/src/query.h b/src/query.h index f70d7dc..62e298f 100644 --- a/src/query.h +++ b/src/query.h @@ -109,7 +109,6 @@ template Q_OUTOFLINE_TEMPLATE Query::~Query() { Q_D(Query); - delete d; } diff --git a/src/types/dbgeography.cpp b/src/types/dbgeography.cpp new file mode 100644 index 0000000..11d4407 --- /dev/null +++ b/src/types/dbgeography.cpp @@ -0,0 +1,81 @@ +/************************************************************************** +** +** This file is part of Nut project. +** https://github.com/HamedMasafi/Nut +** +** Nut is free software: you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** Nut is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with Nut. If not, see . +** +**************************************************************************/ + +#include "dbgeography.h" + +NUT_BEGIN_NAMESPACE + +DbGeography::DbGeography() : m_longitude(0), m_latitude(0) +{ + +} + +DbGeography::DbGeography(const DbGeography &other) +{ + setLongitude(other.longitude()); + setLatitude(other.latitude()); +} + +DbGeography::DbGeography(const QVariant &value) +{ + QStringList parts = value.toString().split(','); + if (parts.count() == 2) { + setLongitude(parts[0].toDouble()); + setLatitude(parts[1].toDouble()); + } else { + qWarning("Input value for DbGeography is invalid: %s", + qPrintable(value.toString())); + setLongitude(0); + setLatitude(0); + } +} + +qreal DbGeography::longitude() const +{ + return m_longitude; +} + +qreal DbGeography::latitude() const +{ + return m_latitude; +} + +void DbGeography::setLongitude(qreal longitude) + +{ + if (qFuzzyCompare(m_longitude, longitude)) + return; + + m_longitude = longitude; +} + +void DbGeography::setLatitude(qreal latitude) +{ + if (qFuzzyCompare(m_latitude, latitude)) + return; + + m_latitude = latitude; +} +DbGeography::operator QVariant() +{ + return QVariant::fromValue(QString("%1,%2").arg(longitude()).arg(latitude())); +} + +NUT_END_NAMESPACE diff --git a/src/types/dbgeography.h b/src/types/dbgeography.h new file mode 100644 index 0000000..9a7dfd0 --- /dev/null +++ b/src/types/dbgeography.h @@ -0,0 +1,54 @@ +/************************************************************************** +** +** This file is part of Nut project. +** https://github.com/HamedMasafi/Nut +** +** Nut is free software: you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** Nut is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with Nut. If not, see . +** +**************************************************************************/ + +#ifndef DBGEOGRAPHY_H +#define DBGEOGRAPHY_H + +#include "../defines.h" +#include +#include +#include + +NUT_BEGIN_NAMESPACE + +class NUT_EXPORT DbGeography +{ + qreal m_longitude; + qreal m_latitude; + +public: + explicit DbGeography(); + DbGeography(const DbGeography &other); + DbGeography(const QVariant &value); + + qreal longitude() const; + qreal latitude() const; + + void setLongitude(qreal longitude); + void setLatitude(qreal latitude); + + operator QVariant(); +}; + +NUT_END_NAMESPACE + +Q_DECLARE_METATYPE(NUT_WRAP_NAMESPACE(DbGeography)) + +#endif // DBGEOGRAPHY_H diff --git a/src/wherephrase.h b/src/wherephrase.h index f7eada9..233e493 100644 --- a/src/wherephrase.h +++ b/src/wherephrase.h @@ -30,7 +30,7 @@ #include #include #include "defines.h" -#include "dbgeography.h" +#include "types/dbgeography.h" #include From e4e13cd82746809af17870ade4849fea0b5d1146 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:38:23 +0330 Subject: [PATCH 06/47] qbs file added --- nut.qbs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 nut.qbs diff --git a/nut.qbs b/nut.qbs new file mode 100644 index 0000000..d7e3dc1 --- /dev/null +++ b/nut.qbs @@ -0,0 +1,39 @@ +import qbs + +Product { + type: "staticlibrary" + name: "nut" + Depends { name: 'cpp' } + Depends { name: "Qt.core" } + Depends { name: "Qt.sql" } + + Export { + Depends { name: "cpp" } + Depends { name: "Qt.core" } + Depends { name: "Qt.sql" } + cpp.includePaths: [ + product.sourceDirectory + "/src", + product.sourceDirectory + "/include" + ] + } + + files: [ + "src/tableset.cpp", + "src/query.cpp", + "src/databasemodel.cpp", + "src/tablesetbase.cpp", + "src/changelogtable.cpp", + "src/querybase.cpp", + "src/tablemodel.cpp", + "src/wherephrase.cpp", + "src/table.cpp", + "src/database.cpp", + "src/generators/sqlgeneratorbase.cpp", + "src/generators/postgresqlgenerator.cpp", + "src/generators/mysqlgenerator.cpp", + "src/generators/sqlitegenerator.cpp", + "src/generators/sqlservergenerator.cpp", + "src/types/dbgeography.cpp", + "src/serializableobject.cpp" + ] +} From 8dc8c54608776e3b9184b28032a35bb40fe554c4 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:46:48 +0330 Subject: [PATCH 07/47] travis ci builds --- travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 travis.yml diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..528bb2a --- /dev/null +++ b/travis.yml @@ -0,0 +1,9 @@ +before_install: + - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa + - sudo apt-get update -qq + - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev + - sudo apt-get install qt5-default qttools5-dev-tools + +script: + - qmake nut.pro + - make From b715d59785b893c412ac3da0f58a8a8833b8e0d8 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:47:55 +0330 Subject: [PATCH 08/47] added dot to begginig of travis.yml file --- travis.yml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 travis.yml diff --git a/travis.yml b/travis.yml deleted file mode 100644 index 528bb2a..0000000 --- a/travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -before_install: - - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa - - sudo apt-get update -qq - - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev - - sudo apt-get install qt5-default qttools5-dev-tools - -script: - - qmake nut.pro - - make From 58baf7f122979674df4ebd5aa78e161ce96dcb9e Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:49:24 +0330 Subject: [PATCH 09/47] ammend --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..528bb2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +before_install: + - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa + - sudo apt-get update -qq + - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev + - sudo apt-get install qt5-default qttools5-dev-tools + +script: + - qmake nut.pro + - make From 14df61c82bc468918d25a39cf77d39f931923f10 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 12:49:24 +0330 Subject: [PATCH 10/47] ammend --- .travis.yml | 9 +++++++++ nut.pro | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 .travis.yml create mode 100644 nut.pro diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..528bb2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +before_install: + - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa + - sudo apt-get update -qq + - sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev + - sudo apt-get install qt5-default qttools5-dev-tools + +script: + - qmake nut.pro + - make diff --git a/nut.pro b/nut.pro new file mode 100644 index 0000000..2bfebcc --- /dev/null +++ b/nut.pro @@ -0,0 +1,9 @@ +QT += sql +QT -= gui + +TARGET = nut +TEMPLATE = lib + +DEFINES += QT_DEPRECATED_WARNINGS + +include(nut.pri) From 1f1cd29fc231009a9b2cd18fda6612d5d6eaa20b Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 13:05:26 +0330 Subject: [PATCH 11/47] travis ci icon on readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index adabd9a..38cbb4c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Nut +[![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=master)](https://travis-ci.org/HamedMasafi/Nut) + ## Advanced, Powerful and easy to use ORM for Qt5 @@ -54,4 +56,4 @@ if(post) { } ``` -For more information read [Wiki](wiki). \ No newline at end of file +For more information read [Wiki](wiki). From da876f37b29a0e80e2b524e23a41c338660582ad Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 15:22:04 +0330 Subject: [PATCH 12/47] macro guard for checking std::initializer_list --- src/generators/sqlgeneratorbase.cpp | 12 ++++-------- src/wherephrase.h | 4 ++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index d186d4c..4c90641 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -271,14 +271,10 @@ QString SqlGeneratorBase::fromTableText(const QString &tableName, .arg(rel->localColumn); orderBy = tableName + "." + pk; } else { - qWarning( - QString( - "Relation between table %1 and class %2 (%3) not exists!") - .arg(tableName) - .arg(joinClassName) - .arg(joinTableName.isNull() ? "NULL" : joinTableName) - .toLatin1() - .data()); + qWarning("Relation between table %s and class %s (%s) not exists!", + qPrintable(tableName), + qPrintable(joinClassName), + qPrintable(joinTableName.isNull() ? "NULL" : joinTableName)); joinClassName = QString::null; } } diff --git a/src/wherephrase.h b/src/wherephrase.h index 233e493..4529d0e 100644 --- a/src/wherephrase.h +++ b/src/wherephrase.h @@ -32,7 +32,9 @@ #include "defines.h" #include "types/dbgeography.h" +#if __cplusplus >= 201103L #include +#endif NUT_BEGIN_NAMESPACE @@ -448,11 +450,13 @@ public: return WherePhrase(this, PhraseData::In, vlist); } +#if __cplusplus >= 201103L template WherePhrase in(std::initializer_list list) { return in(QList(list)); } +#endif WherePhrase in(int count, ...) { From 90a540033e88fd204869ac235a433f02ab704d59 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 15:26:58 +0330 Subject: [PATCH 13/47] trying to resolve travis build errors --- src/databasemodel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/databasemodel.h b/src/databasemodel.h index 40d5373..6fc251d 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -22,6 +22,9 @@ #define DATABASEMODEL_H #include +#include +#include + #include "defines.h" class QJsonObject; From c341fd758ecb805f1483db1964b4591933c159d4 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 15:26:58 +0330 Subject: [PATCH 14/47] trying to resolve travis build errors --- src/databasemodel.cpp | 10 +++++----- src/databasemodel.h | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 36f682e..3b203a4 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -63,8 +63,8 @@ TableModel *DatabaseModel::tableByName(QString tableName) const return s; } - qWarning("Table with name '%s' not found in model", - qUtf8Printable(tableName)); +// qWarning("Table with name '%s' not found in model", +// qUtf8Printable(tableName)); return 0; } @@ -77,8 +77,8 @@ TableModel *DatabaseModel::tableByClassName(QString className) const return s; } - qWarning("Table with class name '%s' not found in model", - qUtf8Printable(className)); +// qWarning("Table with class name '%s' not found in model", +// qUtf8Printable(className)); // Q_UNREACHABLE(); return 0; } @@ -120,7 +120,7 @@ QJsonObject DatabaseModel::toJson() const { QJsonObject obj; - obj.insert(QT_STRINGIFY(version), QJsonValue(_version)); + obj.insert(NODE_VERSION, QJsonValue(_version)); QJsonObject tables; for(int i = 0; i < size(); i++){ TableModel *s = at(i); diff --git a/src/databasemodel.h b/src/databasemodel.h index 40d5373..6fc251d 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -22,6 +22,9 @@ #define DATABASEMODEL_H #include +#include +#include + #include "defines.h" class QJsonObject; From 2e9aac5204dfa4c3c83da89002c372783f5f505e Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 15:34:37 +0330 Subject: [PATCH 15/47] update readme for travis icon --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38cbb4c..98aaafc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nut -[![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=master)](https://travis-ci.org/HamedMasafi/Nut) +[![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) ## Advanced, Powerful and easy to use ORM for Qt5 From 6417d78634cc3cc8b807d07500b8e0892394ab2b Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 18:24:06 +0330 Subject: [PATCH 16/47] create constructor with accepting QSqlDatabase --- nut.pro | 42 +++++++++++++++++++++++++++++++++++++++++- src/database.cpp | 26 ++++++++++++++++++++------ src/database.h | 1 + src/database_p.h | 8 +------- 4 files changed, 63 insertions(+), 14 deletions(-) diff --git a/nut.pro b/nut.pro index 2bfebcc..9603a19 100644 --- a/nut.pro +++ b/nut.pro @@ -6,4 +6,44 @@ TEMPLATE = lib DEFINES += QT_DEPRECATED_WARNINGS -include(nut.pri) +HEADERS += \ + $$PWD/src/generators/sqlgeneratorbase_p.h \ + $$PWD/src/generators/postgresqlgenerator.h \ + $$PWD/src/generators/mysqlgenerator.h \ + $$PWD/src/generators/sqlitegenerator.h \ + $$PWD/src/generators/sqlservergenerator.h \ + $$PWD/src/types/dbgeography.h \ + $$PWD/src/tableset.h \ + $$PWD/src/defines_p.h \ + $$PWD/src/defines.h \ + $$PWD/src/query.h \ + $$PWD/src/databasemodel.h \ + $$PWD/src/changelogtable.h \ + $$PWD/src/tablesetbase_p.h \ + $$PWD/src/querybase_p.h \ + $$PWD/src/tablemodel.h \ + $$PWD/src/wherephrase.h \ + $$PWD/src/query_p.h \ + $$PWD/src/table.h \ + $$PWD/src/database.h \ + $$PWD/src/database_p.h \ + $$PWD/src/serializableobject.h + +SOURCES += \ + $$PWD/src/generators/sqlgeneratorbase.cpp \ + $$PWD/src/generators/postgresqlgenerator.cpp \ + $$PWD/src/generators/mysqlgenerator.cpp \ + $$PWD/src/generators/sqlitegenerator.cpp \ + $$PWD/src/generators/sqlservergenerator.cpp \ + $$PWD/src/types/dbgeography.cpp \ + $$PWD/src/tableset.cpp \ + $$PWD/src/query.cpp \ + $$PWD/src/databasemodel.cpp \ + $$PWD/src/tablesetbase.cpp \ + $$PWD/src/changelogtable.cpp \ + $$PWD/src/querybase.cpp \ + $$PWD/src/tablemodel.cpp \ + $$PWD/src/wherephrase.cpp \ + $$PWD/src/table.cpp \ + $$PWD/src/database.cpp \ + $$PWD/src/serializableobject.cpp diff --git a/src/database.cpp b/src/database.cpp index c2e1149..b267ef5 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -50,7 +50,7 @@ NUT_BEGIN_NAMESPACE qulonglong DatabasePrivate::lastId = 0; QMap DatabasePrivate::allTableMaps; -DatabasePrivate::DatabasePrivate(Database *parent) : q_ptr(parent) +DatabasePrivate::DatabasePrivate(Database *parent) : q_ptr(parent), isDatabaseNew(false) { } @@ -63,6 +63,7 @@ bool DatabasePrivate::open(bool update) db = QSqlDatabase::addDatabase(driver, connectionName); db.setHostName(hostName); + db.setPort(port); db.setDatabaseName(databaseName); db.setUserName(userName); db.setPassword(password); @@ -92,7 +93,7 @@ bool DatabasePrivate::open(bool update) return false; } - _databaseStatus = New; + isDatabaseNew = true; return open(update); } else { qWarning("Unknown error detecting change logs, %s", @@ -115,7 +116,7 @@ bool DatabasePrivate::updateDatabase() if (!getCurrectScheema()) return true; - DatabaseModel last = _databaseStatus == New ? DatabaseModel() : getLastScheema(); + DatabaseModel last = isDatabaseNew ? DatabaseModel() : getLastScheema(); DatabaseModel current = currentModel; if (last == current) { @@ -166,9 +167,9 @@ bool DatabasePrivate::getCurrectScheema() { Q_Q(Database); + //is not first instanicate of this class if (allTableMaps.contains(q->metaObject()->className())) { currentModel = allTableMaps[q->metaObject()->className()]; - qDebug() << "******************"; return false; } @@ -316,13 +317,26 @@ Database::Database(QObject *parent) DatabasePrivate::lastId++; } -Database::Database(const Database &other, QObject *parent) - : QObject(parent), d_ptr(new DatabasePrivate(this)) +Database::Database(const Database &other) + : QObject(other.parent()), d_ptr(new DatabasePrivate(this)) { DatabasePrivate::lastId++; setDriver(other.driver()); setHostName(other.hostName()); + setPort(other.port()); + setDatabaseName(other.databaseName()); + setUserName(other.userName()); + setPassword(other.password()); +} + +Database::Database(const QSqlDatabase &other) +{ + DatabasePrivate::lastId++; + + setDriver(other.driver()); + setHostName(other.hostName()); + setPort(other.port()); setDatabaseName(other.databaseName()); setUserName(other.userName()); setPassword(other.password()); diff --git a/src/database.h b/src/database.h index 8c4ade7..60d5a63 100644 --- a/src/database.h +++ b/src/database.h @@ -43,6 +43,7 @@ class NUT_EXPORT Database : public QObject Q_DECLARE_PRIVATE(Database) public: + //TODO: create constructor with accepting QSqlDatabase Database(QObject *parent = 0); Database(const Database &other, QObject *parent = 0); ~Database(); diff --git a/src/database_p.h b/src/database_p.h index 605864b..17669bc 100644 --- a/src/database_p.h +++ b/src/database_p.h @@ -67,13 +67,7 @@ public: QSet tableSets; - - enum DatabaseStatus{ - New, - Modified, - NotChanged - }; - DatabaseStatus _databaseStatus; + bool isDatabaseNew; }; NUT_END_NAMESPACE From 5394816999e11488ce2059031b1ea2429df0ea4c Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 20:29:16 +0330 Subject: [PATCH 17/47] wip --- src/database.cpp | 8 ++++++-- src/database.h | 4 ++-- src/database_p.h | 2 +- src/defines.h | 10 +++++----- src/query.h | 25 ++++++++++++++--------- src/tableset.h | 31 +++++++++++++++++------------ test/basic/maintest.cpp | 16 ++++++++++++++- test/basic/maintest.h | 1 + test/basic/tst_basic.pro | 2 ++ test/commands/maintest.cpp | 8 ++++++++ test/commands/maintest.h | 1 + test/commands/tst_commands.pro | 6 ++++-- test/common/comment.h | 4 ++++ test/common/consts.h | 2 +- test/common/post.cpp | 2 +- test/common/post.h | 3 ++- test/common/user.cpp | 7 +++++++ test/common/user.h | 36 ++++++++++++++++++++++++++++++++++ test/common/weblogdatabase.cpp | 6 +++++- test/common/weblogdatabase.h | 5 +++-- 20 files changed, 138 insertions(+), 41 deletions(-) create mode 100644 test/common/user.cpp create mode 100644 test/common/user.h diff --git a/src/database.cpp b/src/database.cpp index b267ef5..b80546a 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -56,6 +56,8 @@ DatabasePrivate::DatabasePrivate(Database *parent) : q_ptr(parent), isDatabaseNe bool DatabasePrivate::open(bool update) { + if (db.isOpen()) + return true; Q_Q(Database); // if (update) connectionName = q->metaObject()->className() @@ -182,7 +184,7 @@ bool DatabasePrivate::getCurrectScheema() tables.insert(ChangeLogTable::staticMetaObject.className(), __CHANGE_LOG_TABLE_NAME); - changeLogs = new TableSet(q); + changeLogs = new TableSet(q); for (int i = 0; i < q->metaObject()->classInfoCount(); i++) { QMetaClassInfo ci = q->metaObject()->classInfo(i); @@ -321,6 +323,7 @@ Database::Database(const Database &other) : QObject(other.parent()), d_ptr(new DatabasePrivate(this)) { DatabasePrivate::lastId++; + Q_D(Database); setDriver(other.driver()); setHostName(other.hostName()); @@ -332,9 +335,10 @@ Database::Database(const Database &other) Database::Database(const QSqlDatabase &other) { + //TODO: make a polish here DatabasePrivate::lastId++; - setDriver(other.driver()); +// setDriver(other.driver()); setHostName(other.hostName()); setPort(other.port()); setDatabaseName(other.databaseName()); diff --git a/src/database.h b/src/database.h index 60d5a63..455d491 100644 --- a/src/database.h +++ b/src/database.h @@ -43,9 +43,9 @@ class NUT_EXPORT Database : public QObject Q_DECLARE_PRIVATE(Database) public: - //TODO: create constructor with accepting QSqlDatabase Database(QObject *parent = 0); - Database(const Database &other, QObject *parent = 0); + Database(const Database &other); + Database(const QSqlDatabase &other); ~Database(); bool open(); diff --git a/src/database_p.h b/src/database_p.h index 17669bc..b9b11d8 100644 --- a/src/database_p.h +++ b/src/database_p.h @@ -58,7 +58,7 @@ public: SqlGeneratorBase *sqlGenertor; DatabaseModel currentModel; - TableSet *changeLogs; + TableSet *changeLogs; QT_DEPRECATED QHash tables; diff --git a/src/defines.h b/src/defines.h index c386a17..54f8d70 100644 --- a/src/defines.h +++ b/src/defines.h @@ -40,13 +40,13 @@ #define NUT_DECLARE_TABLE(type, name) \ Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ Q_PROPERTY(type* name READ name) \ - Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##s READ name##s) \ + Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##s READ name##s) \ type* m_##name; \ - NUT_WRAP_NAMESPACE(TableSet) *m_##name##s; \ + NUT_WRAP_NAMESPACE(TableSet) *m_##name##s; \ public: \ static const type _##name; \ type* name() const{ return m_##name; } \ - NUT_WRAP_NAMESPACE(TableSet) *name##s() const { return m_##name##s; } + NUT_WRAP_NAMESPACE(TableSet) *name##s() const { return m_##name##s; } //Table #define NUT_DECLARE_FIELD(type, name, read, write) \ @@ -79,13 +79,13 @@ public: \ #define NUT_DECLARE_CHILD_TABLE(type, n) \ private: \ - NUT_WRAP_NAMESPACE(TableSet) *m_##n; \ + NUT_WRAP_NAMESPACE(TableSet) *m_##n; \ public: \ static type *n##Table(){ \ static type *f = new type(); \ return f; \ } \ - NUT_WRAP_NAMESPACE(TableSet) *n(){ \ + NUT_WRAP_NAMESPACE(TableSet) *n(){ \ return m_##n; \ } diff --git a/src/query.h b/src/query.h index 62e298f..d4ce1b2 100644 --- a/src/query.h +++ b/src/query.h @@ -60,6 +60,13 @@ public: return this; } + template + Query *join() + { + join(TABLE::staticMetaObject.className()); + return this; + } + // Query *orderBy(QString fieldName, QString type); Query *skip(int &n); Query *take(int &n); @@ -71,8 +78,8 @@ public: QVariant max(FieldPhrase &f); QVariant min(FieldPhrase &f); QVariant average(FieldPhrase &f); - T *first(); - QList toList(int count = -1); + T first(); + QList toList(int count = -1); template QList select(const FieldPhrase f); @@ -101,7 +108,7 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->tableName = // TableModel::findByClassName(T::staticMetaObject.className())->name(); d->database->model() - .tableByClassName(T::staticMetaObject.className()) + .tableByClassName(std::remove_pointer::type::staticMetaObject.className()) ->name(); } @@ -113,10 +120,10 @@ Q_OUTOFLINE_TEMPLATE Query::~Query() } template -Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) +Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) { Q_D(Query); - QList result; + QList result; d->select = "*"; // QSqlQuery q = @@ -131,7 +138,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); QVariant lastPkValue = QVariant(); int childTypeId = 0; - T *lastRow = 0; + T lastRow = 0; TableSetBase *childTableSet = Q_NULLPTR; // FIXME: getting table error @@ -157,7 +164,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) while (q.next()) { if (lastPkValue != q.value(pk)) { - T *t = new T(); + T t = T();//new std::remove_pointer::type(); foreach (QString field, masterFields) t->setProperty(field.toLatin1().data(), q.value(field)); // for (int i = 0; i < t->metaObject()->propertyCount(); @@ -237,9 +244,9 @@ Q_OUTOFLINE_TEMPLATE QList Query::select(const FieldPhrase f) } template -Q_OUTOFLINE_TEMPLATE T *Query::first() +Q_OUTOFLINE_TEMPLATE T Query::first() { - QList list = toList(1); + QList list = toList(1); if (list.count()) return list.first(); diff --git a/src/tableset.h b/src/tableset.h index c315098..e51cd10 100644 --- a/src/tableset.h +++ b/src/tableset.h @@ -24,8 +24,11 @@ #include #include #include +#include #include +#include + #include "tablesetbase_p.h" //#include "database.h" #include "table.h" @@ -42,15 +45,15 @@ public: TableSet(Database *parent); TableSet(Table *parent); - void append(T *t); - void append(QList t); - void remove(T *t); - void remove(QList t); + void append(T t); + void append(QList t); + void remove(T t); + void remove(QList t); inline T type() const {} int length() const; - T *at(int i) const; + T at(int i) const; const T &operator[](int i) const; Query *query(); Query *query(bool autoDelete); @@ -59,13 +62,15 @@ public: template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Database *parent) : TableSetBase(parent) { - _childClassName = T::staticMetaObject.className(); + auto t = new QMetaType(qRegisterMetaType()); + _childClassName = t->metaObject()->className(); } template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Table *parent) : TableSetBase(parent) { - _childClassName = T::staticMetaObject.className(); + auto t = new QMetaType(qRegisterMetaType()); + _childClassName = t->metaObject()->className(); } template @@ -91,9 +96,9 @@ Q_OUTOFLINE_TEMPLATE int TableSet::length() const } template -Q_OUTOFLINE_TEMPLATE T *TableSet::at(int i) const +Q_OUTOFLINE_TEMPLATE T TableSet::at(int i) const { - return (T*)_tablesList.at(i); + return (T)_tablesList.at(i); } template @@ -103,7 +108,7 @@ Q_OUTOFLINE_TEMPLATE const T &TableSet::operator[](int i) const } template -Q_OUTOFLINE_TEMPLATE void TableSet::append(T *t) +Q_OUTOFLINE_TEMPLATE void TableSet::append(T t) { _tables.insert(t); _tablesList.append(t); @@ -114,21 +119,21 @@ Q_OUTOFLINE_TEMPLATE void TableSet::append(T *t) } template -Q_OUTOFLINE_TEMPLATE void TableSet::append(QList t) +Q_OUTOFLINE_TEMPLATE void TableSet::append(QList t) { foreach (T* i, t) append(i); } template -Q_OUTOFLINE_TEMPLATE void TableSet::remove(T *t) +Q_OUTOFLINE_TEMPLATE void TableSet::remove(T t) { _tables.remove(t); t->setStatus(Table::Deleted); } template -Q_OUTOFLINE_TEMPLATE void TableSet::remove(QList t) +Q_OUTOFLINE_TEMPLATE void TableSet::remove(QList t) { foreach (T* i, t) remove(i); diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5365825..5558843 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -12,6 +12,7 @@ #include "post.h" #include "comment.h" +#include "user.h" MainTest::MainTest(QObject *parent) : QObject(parent) { @@ -45,7 +46,7 @@ void MainTest::dataScheema() // qDebug() << model.toJson(); // qDebug() << db.model().toJson(); - QTEST_ASSERT(model == db.model()); +// QTEST_ASSERT(model == db.model()); } void MainTest::createPost() @@ -151,6 +152,19 @@ void MainTest::testDate() QTEST_ASSERT(q->saveDate() == d); } +void MainTest::join() +{ + auto q = db.comments()->query() +// ->join(Comment::author()) +// ->join(Comment::post()) + ->join() + ->setWhere(Comment::saveDateField() < QDateTime::currentDateTime().addDays(-1)) + ->orderBy(Comment::saveDateField()); + + q->toList(); + qDebug() << q->sqlCommand(); +} + void MainTest::selectWithInvalidRelation() { diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 2d55666..cdc9615 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -27,6 +27,7 @@ private slots: void selectPostsWithoutTitle(); void selectPostIds(); void testDate(); + void join(); void selectWithInvalidRelation(); void select10NewstPosts(); void modifyPost(); diff --git a/test/basic/tst_basic.pro b/test/basic/tst_basic.pro index b072765..2a11746 100644 --- a/test/basic/tst_basic.pro +++ b/test/basic/tst_basic.pro @@ -12,6 +12,7 @@ SOURCES += \ maintest.cpp \ ../common/comment.cpp \ ../common/post.cpp \ + ../common/user.cpp \ ../common/weblogdatabase.cpp HEADERS += \ @@ -19,4 +20,5 @@ HEADERS += \ ../common/consts.h \ ../common/comment.h \ ../common/post.h \ + ../common/user.h \ ../common/weblogdatabase.h diff --git a/test/commands/maintest.cpp b/test/commands/maintest.cpp index fab0c86..a5c46fd 100644 --- a/test/commands/maintest.cpp +++ b/test/commands/maintest.cpp @@ -56,4 +56,12 @@ void MainTest::cmd2() qDebug() << q->sqlCommand(); } +void MainTest::join() +{ + auto q = db.posts()->query() + ->join() + ->toList(); + +} + QTEST_MAIN(MainTest) diff --git a/test/commands/maintest.h b/test/commands/maintest.h index e54c53f..b8753b3 100644 --- a/test/commands/maintest.h +++ b/test/commands/maintest.h @@ -23,6 +23,7 @@ private slots: void cmd1(); void cmd2(); + void join(); }; #endif // MAINTEST_H diff --git a/test/commands/tst_commands.pro b/test/commands/tst_commands.pro index 6400e16..a1d0878 100644 --- a/test/commands/tst_commands.pro +++ b/test/commands/tst_commands.pro @@ -12,10 +12,12 @@ SOURCES += \ maintest.cpp \ ../common/comment.cpp \ ../common/post.cpp \ - ../common/weblogdatabase.cpp + ../common/weblogdatabase.cpp \ + ../common/user.cpp HEADERS += \ maintest.h \ ../common/comment.h \ ../common/post.h \ - ../common/weblogdatabase.h + ../common/weblogdatabase.h \ + ../common/user.h diff --git a/test/common/comment.h b/test/common/comment.h index 4869c35..b221083 100644 --- a/test/common/comment.h +++ b/test/common/comment.h @@ -10,6 +10,7 @@ using namespace NUT_NAMESPACE; #endif class Post; +class User; class Comment : public Table { Q_OBJECT @@ -21,9 +22,12 @@ class Comment : public Table NUT_DECLARE_FIELD(qreal, point, point, setPoint) NUT_FOREGION_KEY(Post, int, post, post, setPost) + NUT_FOREGION_KEY(User, int, author, author, setAuthor) public: Q_INVOKABLE explicit Comment(QObject *tableSet = 0); }; +Q_DECLARE_METATYPE(Comment*) + #endif // COMMENT_H diff --git a/test/common/consts.h b/test/common/consts.h index 9475fa9..40ca178 100644 --- a/test/common/consts.h +++ b/test/common/consts.h @@ -7,7 +7,7 @@ //#define USERNAME "postgres" //#define PASSWORD "856856" -#define DRIVER "QMYSQL" +#define DRIVER "QSQLITE" #define HOST "127.0.0.1" #define DATABASE "nutdb" #define USERNAME "root" diff --git a/test/common/post.cpp b/test/common/post.cpp index e4f6c06..3ba5574 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -3,7 +3,7 @@ #include "post.h" Post::Post(QObject *parent) : Table(parent), - m_comments(new TableSet(this)), m_id(0), m_title("") + m_comments(new TableSet(this)), m_id(0), m_title("") { } diff --git a/test/common/post.h b/test/common/post.h index de81702..fc5de47 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -36,5 +36,6 @@ signals: public slots: }; -//Q_DECLARE_METATYPE(User*) +Q_DECLARE_METATYPE(Post*) + #endif // USER_H diff --git a/test/common/user.cpp b/test/common/user.cpp new file mode 100644 index 0000000..76c8340 --- /dev/null +++ b/test/common/user.cpp @@ -0,0 +1,7 @@ +#include "user.h" + +User::User(QObject *tableSet) : Table(tableSet), + m_comments(new TableSet(this)) +{ + +} diff --git a/test/common/user.h b/test/common/user.h new file mode 100644 index 0000000..f158c81 --- /dev/null +++ b/test/common/user.h @@ -0,0 +1,36 @@ +#ifndef USER_H +#define USER_H + +#include +#include "table.h" +#include "tableset.h" +#include "comment.h" + +#ifdef NUT_NAMESPACE +using namespace NUT_NAMESPACE; +#endif + +class User : public Table +{ + Q_OBJECT + + NUT_PRIMARY_AUTO_INCREMENT(id) + NUT_DECLARE_FIELD(QUuid, id, id, setId) + + NUT_NOT_NULL(username) + NUT_LEN(username, 50) + NUT_DECLARE_FIELD(QString, username, username, setUsername) + + NUT_NOT_NULL(password) + NUT_LEN(password, 50) + NUT_DECLARE_FIELD(QString, password, password, setPassword) + + NUT_DECLARE_CHILD_TABLE(Comment, comments) + +public: + User(QObject *tableSet = 0); +}; + +Q_DECLARE_METATYPE(User*) + +#endif // USER_H diff --git a/test/common/weblogdatabase.cpp b/test/common/weblogdatabase.cpp index ef77234..4fc87ee 100644 --- a/test/common/weblogdatabase.cpp +++ b/test/common/weblogdatabase.cpp @@ -1,9 +1,13 @@ #include +#include "user.h" #include "post.h" #include "comment.h" #include "weblogdatabase.h" -WeblogDatabase::WeblogDatabase() : Database(), m_posts(new TableSet(this)), m_comments(new TableSet(this)) +WeblogDatabase::WeblogDatabase() : Database(), + m_posts(new TableSet(this)), + m_comments(new TableSet(this)), + m_users(new TableSet(this)) { } diff --git a/test/common/weblogdatabase.h b/test/common/weblogdatabase.h index 911c0cf..b7ece47 100644 --- a/test/common/weblogdatabase.h +++ b/test/common/weblogdatabase.h @@ -9,15 +9,16 @@ using namespace NUT_NAMESPACE; class Post; class Comment; +class User; class WeblogDatabase : public Database { Q_OBJECT - NUT_DB_VERSION(1, 1) + NUT_DB_VERSION(1) NUT_DECLARE_TABLE(Post, post) - NUT_DECLARE_TABLE(Comment, comment) + NUT_DECLARE_TABLE(User, user) public: WeblogDatabase(); From 01614a2b3c0eb047f0cff8a9171ec49991d60698 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 20:37:26 +0330 Subject: [PATCH 18/47] 2 --- src/defines.h | 4 ---- test/common/post.cpp | 2 +- test/common/post.h | 3 ++- test/common/user.cpp | 2 ++ test/common/user.h | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/defines.h b/src/defines.h index 54f8d70..15921b5 100644 --- a/src/defines.h +++ b/src/defines.h @@ -81,10 +81,6 @@ public: \ private: \ NUT_WRAP_NAMESPACE(TableSet) *m_##n; \ public: \ - static type *n##Table(){ \ - static type *f = new type(); \ - return f; \ - } \ NUT_WRAP_NAMESPACE(TableSet) *n(){ \ return m_##n; \ } diff --git a/test/common/post.cpp b/test/common/post.cpp index 3ba5574..f4f871c 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -1,6 +1,6 @@ +#include "post.h" #include "comment.h" #include "tableset.h" -#include "post.h" Post::Post(QObject *parent) : Table(parent), m_comments(new TableSet(this)), m_id(0), m_title("") diff --git a/test/common/post.h b/test/common/post.h index fc5de47..d7b2492 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -4,13 +4,14 @@ #include #include "table.h" #include "database.h" -#include "comment.h" +//#include "comment.h" #include "databasemodel.h" #ifdef NUT_NAMESPACE using namespace NUT_NAMESPACE; #endif +class Comment; class Post : public Table { Q_OBJECT diff --git a/test/common/user.cpp b/test/common/user.cpp index 76c8340..d318923 100644 --- a/test/common/user.cpp +++ b/test/common/user.cpp @@ -1,5 +1,7 @@ #include "user.h" +#include "comment.h" + User::User(QObject *tableSet) : Table(tableSet), m_comments(new TableSet(this)) { diff --git a/test/common/user.h b/test/common/user.h index f158c81..d1f6ed8 100644 --- a/test/common/user.h +++ b/test/common/user.h @@ -4,12 +4,13 @@ #include #include "table.h" #include "tableset.h" -#include "comment.h" +//#include "comment.h" #ifdef NUT_NAMESPACE using namespace NUT_NAMESPACE; #endif +class Comment; class User : public Table { Q_OBJECT From d0fb2803b8ece5166e0b02e5f0b287b70b616d8d Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 8 Jan 2018 20:44:50 +0330 Subject: [PATCH 19/47] 3 --- src/defines.h | 4 ++++ src/tableset.h | 8 ++++---- test/basic/maintest.cpp | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/defines.h b/src/defines.h index 15921b5..fc17d57 100644 --- a/src/defines.h +++ b/src/defines.h @@ -84,6 +84,10 @@ public: \ NUT_WRAP_NAMESPACE(TableSet) *n(){ \ return m_##n; \ } +//static type *n##Table(){ \ +// /*static type *f = new type();*/ \ +// /*return f;*/ \ +//} \ #define NUT_INDEX(name, field, order) #define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) diff --git a/src/tableset.h b/src/tableset.h index e51cd10..e567ede 100644 --- a/src/tableset.h +++ b/src/tableset.h @@ -62,15 +62,15 @@ public: template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Database *parent) : TableSetBase(parent) { - auto t = new QMetaType(qRegisterMetaType()); - _childClassName = t->metaObject()->className(); +// auto t = new QMetaType(qRegisterMetaType()); +// _childClassName = t->metaObject()->className(); } template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Table *parent) : TableSetBase(parent) { - auto t = new QMetaType(qRegisterMetaType()); - _childClassName = t->metaObject()->className(); +// auto t = new QMetaType(qRegisterMetaType()); +// _childClassName = t->metaObject()->className(); } template diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5558843..366f805 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -16,12 +16,12 @@ MainTest::MainTest(QObject *parent) : QObject(parent) { - } void MainTest::initTestCase() { - qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "Post type id:" << qRegisterMetaType(); qDebug() << "Comment type id:" << qRegisterMetaType(); qDebug() << "DB type id:" << qRegisterMetaType(); @@ -96,7 +96,7 @@ void MainTest::createPost2() void MainTest::selectPosts() { auto q = db.posts()->query(); - q->join(Post::commentsTable()); +// q->join(Post::commentsTable()); q->orderBy(!Post::saveDateField() & Post::bodyField()); q->setWhere(Post::idField() == postId); From 10a304961558872c45c8fc1bcc936ca9d9baf01a Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 01:14:01 +0330 Subject: [PATCH 20/47] removed include from table headers --- src/defines.h | 24 ++++++++++++++---------- src/defines_p.h | 8 ++++---- src/query.h | 8 ++++++++ test/basic/maintest.cpp | 7 +++++-- test/basic/tst_basic.pro | 2 ++ test/common/consts.h | 2 +- test/common/post.cpp | 2 ++ test/common/post.h | 2 +- test/common/user.cpp | 10 ++++++++++ test/common/user.h | 32 ++++++++++++++++++++++++++++++++ test/common/weblogdatabase.cpp | 6 +++++- test/common/weblogdatabase.h | 5 +++-- 12 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 test/common/user.cpp create mode 100644 test/common/user.h diff --git a/src/defines.h b/src/defines.h index c386a17..4aca24c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -81,23 +81,27 @@ public: \ private: \ NUT_WRAP_NAMESPACE(TableSet) *m_##n; \ public: \ - static type *n##Table(){ \ - static type *f = new type(); \ - return f; \ - } \ - NUT_WRAP_NAMESPACE(TableSet) *n(){ \ - return m_##n; \ - } + static type *n##Table(); \ + NUT_WRAP_NAMESPACE(TableSet) *n(); + +#define NUT_IMPLEMENT_CHILD_TABLE(class, type, n) \ + type *class::n##Table(){ \ + static type *f = new type(); \ + return f; \ + } \ + NUT_WRAP_NAMESPACE(TableSet) *class::n(){ \ + return m_##n; \ + } -#define NUT_INDEX(name, field, order) #define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) #define NUT_AUTO_INCREMENT(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_AUTO_INCREMENT), #x) -#define NUT_PRIMARY_AUTO_INCREMENT(x) NUT_PRIMARY_KEY(x) \ - NUT_AUTO_INCREMENT(x) +#define NUT_PRIMARY_AUTO_INCREMENT(x) NUT_PRIMARY_KEY(x) \ + NUT_AUTO_INCREMENT(x) #define NUT_UNIQUE(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_UNIQUE), #x) #define NUT_LEN(field, len) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #field " " __nut_LEN), #len) #define NUT_DEFAULT_VALUE(x, n) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_DEFAULT_VALUE), #n) #define NUT_NOT_NULL(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_NOT_NULL), "1") +#define NUT_INDEX(name, field, order) #ifndef NUT_NO_KEYWORDS # define FROM(x) (x->query()) diff --git a/src/defines_p.h b/src/defines_p.h index e2ed9c9..4c9bea2 100644 --- a/src/defines_p.h +++ b/src/defines_p.h @@ -44,13 +44,13 @@ #define __nut_CHANGE "change" #ifdef NUT_NAMESPACE -# define NUT_BEGIN_NAMESPACE namespace NUT_NAMESPACE{ -# define NUT_END_NAMESPACE } -# define NUT_WRAP_NAMESPACE(x) NUT_NAMESPACE::x +# define NUT_BEGIN_NAMESPACE namespace NUT_NAMESPACE{ +# define NUT_END_NAMESPACE } +# define NUT_WRAP_NAMESPACE(x) NUT_NAMESPACE::x #else # define NUT_BEGIN_NAMESPACE # define NUT_END_NAMESPACE -# define NUT_WRAP_NAMESPACE(x) x +# define NUT_WRAP_NAMESPACE(x) x #endif #endif // DEFINES_P_H diff --git a/src/query.h b/src/query.h index 62e298f..424e342 100644 --- a/src/query.h +++ b/src/query.h @@ -60,6 +60,14 @@ public: return this; } + template + Query *join() + { + join(TABLE::staticMetaObject.className()); + return this; + } + + // Query *orderBy(QString fieldName, QString type); Query *skip(int &n); Query *take(int &n); diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5365825..1d3283d 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -12,6 +12,7 @@ #include "post.h" #include "comment.h" +#include "user.h" MainTest::MainTest(QObject *parent) : QObject(parent) { @@ -20,7 +21,8 @@ MainTest::MainTest(QObject *parent) : QObject(parent) void MainTest::initTestCase() { - qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "Post type id:" << qRegisterMetaType(); +// qDebug() << "User type id:" << qRegisterMetaType(); qDebug() << "Comment type id:" << qRegisterMetaType(); qDebug() << "DB type id:" << qRegisterMetaType(); @@ -45,7 +47,7 @@ void MainTest::dataScheema() // qDebug() << model.toJson(); // qDebug() << db.model().toJson(); - QTEST_ASSERT(model == db.model()); +// QTEST_ASSERT(model == db.model()); } void MainTest::createPost() @@ -96,6 +98,7 @@ void MainTest::selectPosts() { auto q = db.posts()->query(); q->join(Post::commentsTable()); + q->join(); q->orderBy(!Post::saveDateField() & Post::bodyField()); q->setWhere(Post::idField() == postId); diff --git a/test/basic/tst_basic.pro b/test/basic/tst_basic.pro index b072765..2a11746 100644 --- a/test/basic/tst_basic.pro +++ b/test/basic/tst_basic.pro @@ -12,6 +12,7 @@ SOURCES += \ maintest.cpp \ ../common/comment.cpp \ ../common/post.cpp \ + ../common/user.cpp \ ../common/weblogdatabase.cpp HEADERS += \ @@ -19,4 +20,5 @@ HEADERS += \ ../common/consts.h \ ../common/comment.h \ ../common/post.h \ + ../common/user.h \ ../common/weblogdatabase.h diff --git a/test/common/consts.h b/test/common/consts.h index 9475fa9..40ca178 100644 --- a/test/common/consts.h +++ b/test/common/consts.h @@ -7,7 +7,7 @@ //#define USERNAME "postgres" //#define PASSWORD "856856" -#define DRIVER "QMYSQL" +#define DRIVER "QSQLITE" #define HOST "127.0.0.1" #define DATABASE "nutdb" #define USERNAME "root" diff --git a/test/common/post.cpp b/test/common/post.cpp index e4f6c06..7ae52fd 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -7,3 +7,5 @@ Post::Post(QObject *parent) : Table(parent), { } + +NUT_IMPLEMENT_CHILD_TABLE(Post, Comment, comments) diff --git a/test/common/post.h b/test/common/post.h index de81702..c6c1f18 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -4,13 +4,13 @@ #include #include "table.h" #include "database.h" -#include "comment.h" #include "databasemodel.h" #ifdef NUT_NAMESPACE using namespace NUT_NAMESPACE; #endif +class Comment; class Post : public Table { Q_OBJECT diff --git a/test/common/user.cpp b/test/common/user.cpp new file mode 100644 index 0000000..d0a4763 --- /dev/null +++ b/test/common/user.cpp @@ -0,0 +1,10 @@ +#include "user.h" + +#include "comment.h" + +User::User(QObject *parent) : Nut::Table(parent) +{ + +} + +NUT_IMPLEMENT_CHILD_TABLE(User, Comment, comments) diff --git a/test/common/user.h b/test/common/user.h new file mode 100644 index 0000000..b8c8cda --- /dev/null +++ b/test/common/user.h @@ -0,0 +1,32 @@ +#ifndef USER_H +#define USER_H + +#include "table.h" +#include "tableset.h" + +#include +#include + +#ifdef NUT_NAMESPACE +using namespace NUT_NAMESPACE; +#endif + +class Comment; +class User : public Nut::Table +{ + Q_OBJECT + + NUT_PRIMARY_AUTO_INCREMENT(id) + NUT_DECLARE_FIELD(QUuid, id, id, setId) + + NUT_DECLARE_FIELD(QString, username, username, setUsername) + NUT_DECLARE_FIELD(QString, password, password, setPassword) + + NUT_DECLARE_CHILD_TABLE(Comment, comments) +public: + Q_INVOKABLE User(QObject *tableSet = 0); +}; + +Q_DECLARE_METATYPE(User*) + +#endif // USER_H diff --git a/test/common/weblogdatabase.cpp b/test/common/weblogdatabase.cpp index ef77234..829f5e9 100644 --- a/test/common/weblogdatabase.cpp +++ b/test/common/weblogdatabase.cpp @@ -2,8 +2,12 @@ #include "post.h" #include "comment.h" +#include "user.h" #include "weblogdatabase.h" -WeblogDatabase::WeblogDatabase() : Database(), m_posts(new TableSet(this)), m_comments(new TableSet(this)) +WeblogDatabase::WeblogDatabase() : Database(), + m_posts(new TableSet(this)), + m_comments(new TableSet(this)), + m_users(new TableSet(this)) { } diff --git a/test/common/weblogdatabase.h b/test/common/weblogdatabase.h index 911c0cf..b7ece47 100644 --- a/test/common/weblogdatabase.h +++ b/test/common/weblogdatabase.h @@ -9,15 +9,16 @@ using namespace NUT_NAMESPACE; class Post; class Comment; +class User; class WeblogDatabase : public Database { Q_OBJECT - NUT_DB_VERSION(1, 1) + NUT_DB_VERSION(1) NUT_DECLARE_TABLE(Post, post) - NUT_DECLARE_TABLE(Comment, comment) + NUT_DECLARE_TABLE(User, user) public: WeblogDatabase(); From 4ebde50b684d0c68c918ad2fc49b8a59ef8a4238 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 13:27:31 +0330 Subject: [PATCH 21/47] change log made metatype --- src/changelogtable.cpp | 2 +- src/changelogtable.h | 4 +++- src/database.cpp | 11 ++++++++--- src/database_p.h | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/changelogtable.cpp b/src/changelogtable.cpp index b66c4df..93e096c 100644 --- a/src/changelogtable.cpp +++ b/src/changelogtable.cpp @@ -22,7 +22,7 @@ NUT_BEGIN_NAMESPACE -ChangeLogTable::ChangeLogTable() +ChangeLogTable::ChangeLogTable(QObject *tableSet) : Table(tableSet) { diff --git a/src/changelogtable.h b/src/changelogtable.h index aa1f34d..23861f9 100644 --- a/src/changelogtable.h +++ b/src/changelogtable.h @@ -38,9 +38,11 @@ class ChangeLogTable : public Table NUT_DECLARE_FIELD(QString, version, version, setVersion) public: - ChangeLogTable(); + ChangeLogTable(QObject *tableSet = Q_NULLPTR); }; NUT_END_NAMESPACE +Q_DECLARE_METATYPE(Nut::ChangeLogTable*) + #endif // CHANGELOGTABLE_H diff --git a/src/database.cpp b/src/database.cpp index 40b7be7..6551903 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -39,6 +39,7 @@ #include "generators/sqlitegenerator.h" #include "generators/sqlservergenerator.h" #include "query.h" +#include "changelogtable.h" #include #include @@ -188,9 +189,10 @@ bool DatabasePrivate::getCurrectScheema() for (int i = 0; i < q->metaObject()->classInfoCount(); i++) { QMetaClassInfo ci = q->metaObject()->classInfo(i); - QString ciName - = QString(ci.name()).replace(__nut_NAME_PERFIX, "").replace("\"", - ""); + QString ciName = QString(ci.name()) + .replace(__nut_NAME_PERFIX, "") + .replace("\"", ""); + if (ciName.startsWith(__nut_TABLE)) tables.insert(ciName.split(" ").at(1), ci.value()); @@ -317,6 +319,7 @@ Database::Database(QObject *parent) : QObject(parent), d_ptr(new DatabasePrivate(this)) { DatabasePrivate::lastId++; + qRegisterMetaType(); } Database::Database(const Database &other) @@ -331,6 +334,7 @@ Database::Database(const Database &other) setDatabaseName(other.databaseName()); setUserName(other.userName()); setPassword(other.password()); + qRegisterMetaType(); } Database::Database(const QSqlDatabase &other) @@ -344,6 +348,7 @@ Database::Database(const QSqlDatabase &other) setDatabaseName(other.databaseName()); setUserName(other.userName()); setPassword(other.password()); + qRegisterMetaType(); } Database::~Database() diff --git a/src/database_p.h b/src/database_p.h index 17669bc..4a64be7 100644 --- a/src/database_p.h +++ b/src/database_p.h @@ -23,12 +23,12 @@ #include "database.h" #include "databasemodel.h" -#include "changelogtable.h" #include NUT_BEGIN_NAMESPACE +class ChangeLogTable; class DatabasePrivate { Database *q_ptr; From 5184639bbadae02093b51eb93ec31326ac66b3d1 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 16:34:21 +0330 Subject: [PATCH 22/47] minor polish --- doc/PaxHeader/html | 3 - doc/html/annotated.html | 78 -- doc/html/bc_s.png | Bin 680 -> 0 bytes doc/html/bdwn.png | Bin 147 -> 0 bytes doc/html/changelogtable_8h_source.html | 107 -- doc/html/class_change_log_table-members.html | 81 -- doc/html/class_change_log_table.html | 115 -- doc/html/class_change_log_table.png | Bin 475 -> 0 bytes .../class_change_log_table__coll__graph.dot | 8 - .../class_change_log_table__coll__graph.md5 | 1 - ...class_change_log_table__inherit__graph.dot | 8 - ...class_change_log_table__inherit__graph.md5 | 1 - doc/html/class_database-members.html | 86 -- doc/html/class_database.html | 169 --- doc/html/class_database_model-members.html | 73 -- doc/html/class_database_model.html | 95 -- doc/html/class_database_private-members.html | 118 -- doc/html/class_database_private.html | 149 --- .../class_database_private__coll__graph.dot | 18 - .../class_database_private__coll__graph.md5 | 1 - doc/html/class_field_phrase-members.html | 98 -- doc/html/class_field_phrase.html | 155 --- doc/html/class_field_phrase.png | Bin 453 -> 0 bytes doc/html/class_field_phrase__coll__graph.dot | 11 - doc/html/class_field_phrase__coll__graph.md5 | 1 - .../class_field_phrase__inherit__graph.dot | 8 - .../class_field_phrase__inherit__graph.md5 | 1 - doc/html/class_my_sql_generator-members.html | 63 - doc/html/class_my_sql_generator.html | 73 -- doc/html/class_my_sql_generator.png | Bin 583 -> 0 bytes .../class_my_sql_generator__coll__graph.dot | 8 - .../class_my_sql_generator__coll__graph.md5 | 1 - ...class_my_sql_generator__inherit__graph.dot | 8 - ...class_my_sql_generator__inherit__graph.md5 | 1 - doc/html/class_phrase_data-members.html | 100 -- doc/html/class_phrase_data.html | 132 -- doc/html/class_phrase_data__coll__graph.dot | 7 - doc/html/class_phrase_data__coll__graph.md5 | 1 - .../class_postgre_sql_generator-members.html | 64 - doc/html/class_postgre_sql_generator.html | 75 -- doc/html/class_postgre_sql_generator.png | Bin 613 -> 0 bytes ...ass_postgre_sql_generator__coll__graph.dot | 8 - ...ass_postgre_sql_generator__coll__graph.md5 | 1 - ..._postgre_sql_generator__inherit__graph.dot | 8 - ..._postgre_sql_generator__inherit__graph.md5 | 1 - doc/html/class_query-members.html | 75 -- doc/html/class_query.html | 194 --- doc/html/class_query.png | Bin 463 -> 0 bytes doc/html/class_query__coll__graph.dot | 8 - doc/html/class_query__coll__graph.md5 | 1 - doc/html/class_query__inherit__graph.dot | 8 - doc/html/class_query__inherit__graph.md5 | 1 - doc/html/class_query_base-members.html | 100 -- doc/html/class_query_base.html | 118 -- doc/html/class_query_base.png | Bin 468 -> 0 bytes doc/html/class_query_base__inherit__graph.dot | 8 - doc/html/class_query_base__inherit__graph.md5 | 1 - doc/html/class_query_private-members.html | 108 -- doc/html/class_query_private.html | 154 --- doc/html/class_query_private__coll__graph.dot | 13 - doc/html/class_query_private__coll__graph.md5 | 1 - .../class_sql_generator_base-members.html | 130 -- doc/html/class_sql_generator_base.html | 175 --- doc/html/class_sql_generator_base.png | Bin 1309 -> 0 bytes ...ass_sql_generator_base__inherit__graph.dot | 14 - ...ass_sql_generator_base__inherit__graph.md5 | 1 - .../class_sql_server_generator-members.html | 66 - doc/html/class_sql_server_generator.html | 79 -- doc/html/class_sql_server_generator.png | Bin 598 -> 0 bytes ...lass_sql_server_generator__coll__graph.dot | 8 - ...lass_sql_server_generator__coll__graph.md5 | 1 - ...s_sql_server_generator__inherit__graph.dot | 8 - ...s_sql_server_generator__inherit__graph.md5 | 1 - doc/html/class_sqlite_generator-members.html | 63 - doc/html/class_sqlite_generator.html | 73 -- doc/html/class_sqlite_generator.png | Bin 585 -> 0 bytes .../class_sqlite_generator__coll__graph.dot | 8 - .../class_sqlite_generator__coll__graph.md5 | 1 - ...class_sqlite_generator__inherit__graph.dot | 8 - ...class_sqlite_generator__inherit__graph.md5 | 1 - doc/html/class_table-members.html | 81 -- doc/html/class_table.html | 127 -- doc/html/class_table.png | Bin 479 -> 0 bytes doc/html/class_table__inherit__graph.dot | 8 - doc/html/class_table__inherit__graph.md5 | 1 - doc/html/class_table_model-members.html | 83 -- doc/html/class_table_model.html | 117 -- doc/html/class_table_set-members.html | 72 - doc/html/class_table_set.html | 90 -- doc/html/class_table_set.png | Bin 490 -> 0 bytes doc/html/class_table_set__coll__graph.dot | 12 - doc/html/class_table_set__coll__graph.md5 | 1 - doc/html/class_table_set__inherit__graph.dot | 8 - doc/html/class_table_set__inherit__graph.md5 | 1 - doc/html/class_table_set_base-members.html | 113 -- doc/html/class_table_set_base.html | 148 --- doc/html/class_table_set_base.png | Bin 495 -> 0 bytes .../class_table_set_base__coll__graph.dot | 10 - .../class_table_set_base__coll__graph.md5 | 1 - .../class_table_set_base__inherit__graph.dot | 10 - .../class_table_set_base__inherit__graph.md5 | 1 - doc/html/class_where_phrase-members.html | 91 -- doc/html/class_where_phrase.html | 140 -- doc/html/class_where_phrase.png | Bin 454 -> 0 bytes doc/html/class_where_phrase__coll__graph.dot | 9 - doc/html/class_where_phrase__coll__graph.md5 | 1 - .../class_where_phrase__inherit__graph.dot | 8 - .../class_where_phrase__inherit__graph.md5 | 1 - doc/html/classes.html | 83 -- doc/html/closed.png | Bin 132 -> 0 bytes doc/html/database_8h_source.html | 146 --- doc/html/database__p_8h_source.html | 166 --- doc/html/databasemodel_8h_source.html | 116 -- doc/html/defines_8h_source.html | 175 --- doc/html/defines__p_8h_source.html | 143 -- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 86 -- ...r_68267d1309a1af8e8297ef4c3efbcdba_dep.dot | 6 - ...r_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 | 1 - doc/html/doxygen.css | 1163 ----------------- doc/html/doxygen.png | Bin 3779 -> 0 bytes doc/html/dynsections.js | 78 -- doc/html/files.html | 73 -- doc/html/ftv2blank.png | Bin 86 -> 0 bytes doc/html/ftv2cl.png | Bin 453 -> 0 bytes doc/html/ftv2doc.png | Bin 746 -> 0 bytes doc/html/ftv2folderclosed.png | Bin 616 -> 0 bytes doc/html/ftv2folderopen.png | Bin 597 -> 0 bytes doc/html/ftv2lastnode.png | Bin 86 -> 0 bytes doc/html/ftv2link.png | Bin 746 -> 0 bytes doc/html/ftv2mlastnode.png | Bin 246 -> 0 bytes doc/html/ftv2mnode.png | Bin 246 -> 0 bytes doc/html/ftv2mo.png | Bin 403 -> 0 bytes doc/html/ftv2node.png | Bin 86 -> 0 bytes doc/html/ftv2ns.png | Bin 388 -> 0 bytes doc/html/ftv2plastnode.png | Bin 229 -> 0 bytes doc/html/ftv2pnode.png | Bin 229 -> 0 bytes doc/html/ftv2splitbar.png | Bin 314 -> 0 bytes doc/html/ftv2vertline.png | Bin 86 -> 0 bytes doc/html/functions.html | 77 -- doc/html/functions_func.html | 77 -- doc/html/graph_legend.dot | 22 - doc/html/graph_legend.html | 152 --- doc/html/graph_legend.md5 | 1 - doc/html/hierarchy.html | 78 -- doc/html/index.html | 50 - doc/html/inherit_graph_0.dot | 7 - doc/html/inherit_graph_0.md5 | 1 - doc/html/inherit_graph_1.dot | 7 - doc/html/inherit_graph_1.md5 | 1 - doc/html/inherit_graph_10.dot | 7 - doc/html/inherit_graph_10.md5 | 1 - doc/html/inherit_graph_11.dot | 9 - doc/html/inherit_graph_11.md5 | 1 - doc/html/inherit_graph_12.dot | 9 - doc/html/inherit_graph_12.md5 | 1 - doc/html/inherit_graph_2.dot | 7 - doc/html/inherit_graph_2.md5 | 1 - doc/html/inherit_graph_3.dot | 7 - doc/html/inherit_graph_3.md5 | 1 - doc/html/inherit_graph_4.dot | 7 - doc/html/inherit_graph_4.md5 | 1 - doc/html/inherit_graph_5.dot | 9 - doc/html/inherit_graph_5.md5 | 1 - doc/html/inherit_graph_6.dot | 7 - doc/html/inherit_graph_6.md5 | 1 - doc/html/inherit_graph_7.dot | 7 - doc/html/inherit_graph_7.md5 | 1 - doc/html/inherit_graph_8.dot | 15 - doc/html/inherit_graph_8.md5 | 1 - doc/html/inherit_graph_9.dot | 9 - doc/html/inherit_graph_9.md5 | 1 - doc/html/inherits.html | 152 --- doc/html/jquery.js | 8 - doc/html/mysqlgenerator_8h_source.html | 99 -- doc/html/nav_f.png | Bin 153 -> 0 bytes doc/html/nav_g.png | Bin 95 -> 0 bytes doc/html/nav_h.png | Bin 98 -> 0 bytes doc/html/open.png | Bin 123 -> 0 bytes doc/html/postgresqlgenerator_8h_source.html | 100 -- doc/html/query_8h_source.html | 320 ----- doc/html/query__p_8h_source.html | 146 --- doc/html/querybase__p_8h_source.html | 115 -- doc/html/search/all_63.html | 25 - doc/html/search/all_63.js | 5 - doc/html/search/all_64.html | 25 - doc/html/search/all_64.js | 5 - doc/html/search/all_66.html | 25 - doc/html/search/all_66.js | 5 - doc/html/search/all_6d.html | 25 - doc/html/search/all_6d.js | 5 - doc/html/search/all_6f.html | 25 - doc/html/search/all_6f.js | 4 - doc/html/search/all_70.html | 25 - doc/html/search/all_70.js | 5 - doc/html/search/all_71.html | 25 - doc/html/search/all_71.js | 4 - doc/html/search/all_72.html | 25 - doc/html/search/all_72.js | 4 - doc/html/search/all_73.html | 25 - doc/html/search/all_73.js | 6 - doc/html/search/all_74.html | 25 - doc/html/search/all_74.js | 7 - doc/html/search/all_77.html | 25 - doc/html/search/all_77.js | 4 - doc/html/search/classes_63.html | 25 - doc/html/search/classes_63.js | 4 - doc/html/search/classes_64.html | 25 - doc/html/search/classes_64.js | 5 - doc/html/search/classes_66.html | 25 - doc/html/search/classes_66.js | 5 - doc/html/search/classes_6d.html | 25 - doc/html/search/classes_6d.js | 4 - doc/html/search/classes_70.html | 25 - doc/html/search/classes_70.js | 5 - doc/html/search/classes_71.html | 25 - doc/html/search/classes_71.js | 4 - doc/html/search/classes_72.html | 25 - doc/html/search/classes_72.js | 4 - doc/html/search/classes_73.html | 25 - doc/html/search/classes_73.js | 5 - doc/html/search/classes_74.html | 25 - doc/html/search/classes_74.js | 6 - doc/html/search/classes_77.html | 25 - doc/html/search/classes_77.js | 4 - doc/html/search/close.png | Bin 273 -> 0 bytes doc/html/search/functions_63.html | 25 - doc/html/search/functions_63.js | 4 - doc/html/search/functions_6d.html | 25 - doc/html/search/functions_6d.js | 4 - doc/html/search/functions_6f.html | 25 - doc/html/search/functions_6f.js | 4 - doc/html/search/functions_71.html | 25 - doc/html/search/functions_71.js | 4 - doc/html/search/functions_73.html | 25 - doc/html/search/functions_73.js | 4 - doc/html/search/functions_74.html | 25 - doc/html/search/functions_74.js | 4 - doc/html/search/mag_sel.png | Bin 563 -> 0 bytes doc/html/search/nomatches.html | 12 - doc/html/search/search.css | 238 ---- doc/html/search/search.js | 799 ----------- doc/html/search/search_l.png | Bin 604 -> 0 bytes doc/html/search/search_m.png | Bin 158 -> 0 bytes doc/html/search/search_r.png | Bin 612 -> 0 bytes doc/html/sqlgeneratorbase__p_8h_source.html | 200 --- doc/html/sqlitegenerator_8h_source.html | 94 -- doc/html/sqlservergenerator_8h_source.html | 103 -- doc/html/struct_field_model-members.html | 72 - doc/html/struct_field_model.html | 92 -- doc/html/struct_relation_model-members.html | 65 - doc/html/struct_relation_model.html | 76 -- .../struct_relation_model__coll__graph.dot | 8 - .../struct_relation_model__coll__graph.md5 | 1 - doc/html/sync_off.png | Bin 853 -> 0 bytes doc/html/sync_on.png | Bin 845 -> 0 bytes doc/html/tab_a.png | Bin 142 -> 0 bytes doc/html/tab_b.png | Bin 167 -> 0 bytes doc/html/tab_h.png | Bin 192 -> 0 bytes doc/html/tab_s.png | Bin 184 -> 0 bytes doc/html/table_8h_source.html | 145 -- doc/html/tablemodel_8h_source.html | 174 --- doc/html/tableset_8h_source.html | 189 --- doc/html/tablesetbase__p_8h_source.html | 153 --- doc/html/tabs.css | 60 - doc/html/wherephrase_8h_source.html | 219 ---- src/database.cpp | 11 +- src/tableset.h | 8 +- test/basic/maintest.cpp | 6 +- 268 files changed, 12 insertions(+), 11762 deletions(-) delete mode 100644 doc/PaxHeader/html delete mode 100644 doc/html/annotated.html delete mode 100644 doc/html/bc_s.png delete mode 100644 doc/html/bdwn.png delete mode 100644 doc/html/changelogtable_8h_source.html delete mode 100644 doc/html/class_change_log_table-members.html delete mode 100644 doc/html/class_change_log_table.html delete mode 100644 doc/html/class_change_log_table.png delete mode 100644 doc/html/class_change_log_table__coll__graph.dot delete mode 100644 doc/html/class_change_log_table__coll__graph.md5 delete mode 100644 doc/html/class_change_log_table__inherit__graph.dot delete mode 100644 doc/html/class_change_log_table__inherit__graph.md5 delete mode 100644 doc/html/class_database-members.html delete mode 100644 doc/html/class_database.html delete mode 100644 doc/html/class_database_model-members.html delete mode 100644 doc/html/class_database_model.html delete mode 100644 doc/html/class_database_private-members.html delete mode 100644 doc/html/class_database_private.html delete mode 100644 doc/html/class_database_private__coll__graph.dot delete mode 100644 doc/html/class_database_private__coll__graph.md5 delete mode 100644 doc/html/class_field_phrase-members.html delete mode 100644 doc/html/class_field_phrase.html delete mode 100644 doc/html/class_field_phrase.png delete mode 100644 doc/html/class_field_phrase__coll__graph.dot delete mode 100644 doc/html/class_field_phrase__coll__graph.md5 delete mode 100644 doc/html/class_field_phrase__inherit__graph.dot delete mode 100644 doc/html/class_field_phrase__inherit__graph.md5 delete mode 100644 doc/html/class_my_sql_generator-members.html delete mode 100644 doc/html/class_my_sql_generator.html delete mode 100644 doc/html/class_my_sql_generator.png delete mode 100644 doc/html/class_my_sql_generator__coll__graph.dot delete mode 100644 doc/html/class_my_sql_generator__coll__graph.md5 delete mode 100644 doc/html/class_my_sql_generator__inherit__graph.dot delete mode 100644 doc/html/class_my_sql_generator__inherit__graph.md5 delete mode 100644 doc/html/class_phrase_data-members.html delete mode 100644 doc/html/class_phrase_data.html delete mode 100644 doc/html/class_phrase_data__coll__graph.dot delete mode 100644 doc/html/class_phrase_data__coll__graph.md5 delete mode 100644 doc/html/class_postgre_sql_generator-members.html delete mode 100644 doc/html/class_postgre_sql_generator.html delete mode 100644 doc/html/class_postgre_sql_generator.png delete mode 100644 doc/html/class_postgre_sql_generator__coll__graph.dot delete mode 100644 doc/html/class_postgre_sql_generator__coll__graph.md5 delete mode 100644 doc/html/class_postgre_sql_generator__inherit__graph.dot delete mode 100644 doc/html/class_postgre_sql_generator__inherit__graph.md5 delete mode 100644 doc/html/class_query-members.html delete mode 100644 doc/html/class_query.html delete mode 100644 doc/html/class_query.png delete mode 100644 doc/html/class_query__coll__graph.dot delete mode 100644 doc/html/class_query__coll__graph.md5 delete mode 100644 doc/html/class_query__inherit__graph.dot delete mode 100644 doc/html/class_query__inherit__graph.md5 delete mode 100644 doc/html/class_query_base-members.html delete mode 100644 doc/html/class_query_base.html delete mode 100644 doc/html/class_query_base.png delete mode 100644 doc/html/class_query_base__inherit__graph.dot delete mode 100644 doc/html/class_query_base__inherit__graph.md5 delete mode 100644 doc/html/class_query_private-members.html delete mode 100644 doc/html/class_query_private.html delete mode 100644 doc/html/class_query_private__coll__graph.dot delete mode 100644 doc/html/class_query_private__coll__graph.md5 delete mode 100644 doc/html/class_sql_generator_base-members.html delete mode 100644 doc/html/class_sql_generator_base.html delete mode 100644 doc/html/class_sql_generator_base.png delete mode 100644 doc/html/class_sql_generator_base__inherit__graph.dot delete mode 100644 doc/html/class_sql_generator_base__inherit__graph.md5 delete mode 100644 doc/html/class_sql_server_generator-members.html delete mode 100644 doc/html/class_sql_server_generator.html delete mode 100644 doc/html/class_sql_server_generator.png delete mode 100644 doc/html/class_sql_server_generator__coll__graph.dot delete mode 100644 doc/html/class_sql_server_generator__coll__graph.md5 delete mode 100644 doc/html/class_sql_server_generator__inherit__graph.dot delete mode 100644 doc/html/class_sql_server_generator__inherit__graph.md5 delete mode 100644 doc/html/class_sqlite_generator-members.html delete mode 100644 doc/html/class_sqlite_generator.html delete mode 100644 doc/html/class_sqlite_generator.png delete mode 100644 doc/html/class_sqlite_generator__coll__graph.dot delete mode 100644 doc/html/class_sqlite_generator__coll__graph.md5 delete mode 100644 doc/html/class_sqlite_generator__inherit__graph.dot delete mode 100644 doc/html/class_sqlite_generator__inherit__graph.md5 delete mode 100644 doc/html/class_table-members.html delete mode 100644 doc/html/class_table.html delete mode 100644 doc/html/class_table.png delete mode 100644 doc/html/class_table__inherit__graph.dot delete mode 100644 doc/html/class_table__inherit__graph.md5 delete mode 100644 doc/html/class_table_model-members.html delete mode 100644 doc/html/class_table_model.html delete mode 100644 doc/html/class_table_set-members.html delete mode 100644 doc/html/class_table_set.html delete mode 100644 doc/html/class_table_set.png delete mode 100644 doc/html/class_table_set__coll__graph.dot delete mode 100644 doc/html/class_table_set__coll__graph.md5 delete mode 100644 doc/html/class_table_set__inherit__graph.dot delete mode 100644 doc/html/class_table_set__inherit__graph.md5 delete mode 100644 doc/html/class_table_set_base-members.html delete mode 100644 doc/html/class_table_set_base.html delete mode 100644 doc/html/class_table_set_base.png delete mode 100644 doc/html/class_table_set_base__coll__graph.dot delete mode 100644 doc/html/class_table_set_base__coll__graph.md5 delete mode 100644 doc/html/class_table_set_base__inherit__graph.dot delete mode 100644 doc/html/class_table_set_base__inherit__graph.md5 delete mode 100644 doc/html/class_where_phrase-members.html delete mode 100644 doc/html/class_where_phrase.html delete mode 100644 doc/html/class_where_phrase.png delete mode 100644 doc/html/class_where_phrase__coll__graph.dot delete mode 100644 doc/html/class_where_phrase__coll__graph.md5 delete mode 100644 doc/html/class_where_phrase__inherit__graph.dot delete mode 100644 doc/html/class_where_phrase__inherit__graph.md5 delete mode 100644 doc/html/classes.html delete mode 100644 doc/html/closed.png delete mode 100644 doc/html/database_8h_source.html delete mode 100644 doc/html/database__p_8h_source.html delete mode 100644 doc/html/databasemodel_8h_source.html delete mode 100644 doc/html/defines_8h_source.html delete mode 100644 doc/html/defines__p_8h_source.html delete mode 100644 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html delete mode 100644 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.dot delete mode 100644 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 delete mode 100644 doc/html/doxygen.css delete mode 100644 doc/html/doxygen.png delete mode 100644 doc/html/dynsections.js delete mode 100644 doc/html/files.html delete mode 100644 doc/html/ftv2blank.png delete mode 100644 doc/html/ftv2cl.png delete mode 100644 doc/html/ftv2doc.png delete mode 100644 doc/html/ftv2folderclosed.png delete mode 100644 doc/html/ftv2folderopen.png delete mode 100644 doc/html/ftv2lastnode.png delete mode 100644 doc/html/ftv2link.png delete mode 100644 doc/html/ftv2mlastnode.png delete mode 100644 doc/html/ftv2mnode.png delete mode 100644 doc/html/ftv2mo.png delete mode 100644 doc/html/ftv2node.png delete mode 100644 doc/html/ftv2ns.png delete mode 100644 doc/html/ftv2plastnode.png delete mode 100644 doc/html/ftv2pnode.png delete mode 100644 doc/html/ftv2splitbar.png delete mode 100644 doc/html/ftv2vertline.png delete mode 100644 doc/html/functions.html delete mode 100644 doc/html/functions_func.html delete mode 100644 doc/html/graph_legend.dot delete mode 100644 doc/html/graph_legend.html delete mode 100644 doc/html/graph_legend.md5 delete mode 100644 doc/html/hierarchy.html delete mode 100644 doc/html/index.html delete mode 100644 doc/html/inherit_graph_0.dot delete mode 100644 doc/html/inherit_graph_0.md5 delete mode 100644 doc/html/inherit_graph_1.dot delete mode 100644 doc/html/inherit_graph_1.md5 delete mode 100644 doc/html/inherit_graph_10.dot delete mode 100644 doc/html/inherit_graph_10.md5 delete mode 100644 doc/html/inherit_graph_11.dot delete mode 100644 doc/html/inherit_graph_11.md5 delete mode 100644 doc/html/inherit_graph_12.dot delete mode 100644 doc/html/inherit_graph_12.md5 delete mode 100644 doc/html/inherit_graph_2.dot delete mode 100644 doc/html/inherit_graph_2.md5 delete mode 100644 doc/html/inherit_graph_3.dot delete mode 100644 doc/html/inherit_graph_3.md5 delete mode 100644 doc/html/inherit_graph_4.dot delete mode 100644 doc/html/inherit_graph_4.md5 delete mode 100644 doc/html/inherit_graph_5.dot delete mode 100644 doc/html/inherit_graph_5.md5 delete mode 100644 doc/html/inherit_graph_6.dot delete mode 100644 doc/html/inherit_graph_6.md5 delete mode 100644 doc/html/inherit_graph_7.dot delete mode 100644 doc/html/inherit_graph_7.md5 delete mode 100644 doc/html/inherit_graph_8.dot delete mode 100644 doc/html/inherit_graph_8.md5 delete mode 100644 doc/html/inherit_graph_9.dot delete mode 100644 doc/html/inherit_graph_9.md5 delete mode 100644 doc/html/inherits.html delete mode 100644 doc/html/jquery.js delete mode 100644 doc/html/mysqlgenerator_8h_source.html delete mode 100644 doc/html/nav_f.png delete mode 100644 doc/html/nav_g.png delete mode 100644 doc/html/nav_h.png delete mode 100644 doc/html/open.png delete mode 100644 doc/html/postgresqlgenerator_8h_source.html delete mode 100644 doc/html/query_8h_source.html delete mode 100644 doc/html/query__p_8h_source.html delete mode 100644 doc/html/querybase__p_8h_source.html delete mode 100644 doc/html/search/all_63.html delete mode 100644 doc/html/search/all_63.js delete mode 100644 doc/html/search/all_64.html delete mode 100644 doc/html/search/all_64.js delete mode 100644 doc/html/search/all_66.html delete mode 100644 doc/html/search/all_66.js delete mode 100644 doc/html/search/all_6d.html delete mode 100644 doc/html/search/all_6d.js delete mode 100644 doc/html/search/all_6f.html delete mode 100644 doc/html/search/all_6f.js delete mode 100644 doc/html/search/all_70.html delete mode 100644 doc/html/search/all_70.js delete mode 100644 doc/html/search/all_71.html delete mode 100644 doc/html/search/all_71.js delete mode 100644 doc/html/search/all_72.html delete mode 100644 doc/html/search/all_72.js delete mode 100644 doc/html/search/all_73.html delete mode 100644 doc/html/search/all_73.js delete mode 100644 doc/html/search/all_74.html delete mode 100644 doc/html/search/all_74.js delete mode 100644 doc/html/search/all_77.html delete mode 100644 doc/html/search/all_77.js delete mode 100644 doc/html/search/classes_63.html delete mode 100644 doc/html/search/classes_63.js delete mode 100644 doc/html/search/classes_64.html delete mode 100644 doc/html/search/classes_64.js delete mode 100644 doc/html/search/classes_66.html delete mode 100644 doc/html/search/classes_66.js delete mode 100644 doc/html/search/classes_6d.html delete mode 100644 doc/html/search/classes_6d.js delete mode 100644 doc/html/search/classes_70.html delete mode 100644 doc/html/search/classes_70.js delete mode 100644 doc/html/search/classes_71.html delete mode 100644 doc/html/search/classes_71.js delete mode 100644 doc/html/search/classes_72.html delete mode 100644 doc/html/search/classes_72.js delete mode 100644 doc/html/search/classes_73.html delete mode 100644 doc/html/search/classes_73.js delete mode 100644 doc/html/search/classes_74.html delete mode 100644 doc/html/search/classes_74.js delete mode 100644 doc/html/search/classes_77.html delete mode 100644 doc/html/search/classes_77.js delete mode 100644 doc/html/search/close.png delete mode 100644 doc/html/search/functions_63.html delete mode 100644 doc/html/search/functions_63.js delete mode 100644 doc/html/search/functions_6d.html delete mode 100644 doc/html/search/functions_6d.js delete mode 100644 doc/html/search/functions_6f.html delete mode 100644 doc/html/search/functions_6f.js delete mode 100644 doc/html/search/functions_71.html delete mode 100644 doc/html/search/functions_71.js delete mode 100644 doc/html/search/functions_73.html delete mode 100644 doc/html/search/functions_73.js delete mode 100644 doc/html/search/functions_74.html delete mode 100644 doc/html/search/functions_74.js delete mode 100644 doc/html/search/mag_sel.png delete mode 100644 doc/html/search/nomatches.html delete mode 100644 doc/html/search/search.css delete mode 100644 doc/html/search/search.js delete mode 100644 doc/html/search/search_l.png delete mode 100644 doc/html/search/search_m.png delete mode 100644 doc/html/search/search_r.png delete mode 100644 doc/html/sqlgeneratorbase__p_8h_source.html delete mode 100644 doc/html/sqlitegenerator_8h_source.html delete mode 100644 doc/html/sqlservergenerator_8h_source.html delete mode 100644 doc/html/struct_field_model-members.html delete mode 100644 doc/html/struct_field_model.html delete mode 100644 doc/html/struct_relation_model-members.html delete mode 100644 doc/html/struct_relation_model.html delete mode 100644 doc/html/struct_relation_model__coll__graph.dot delete mode 100644 doc/html/struct_relation_model__coll__graph.md5 delete mode 100644 doc/html/sync_off.png delete mode 100644 doc/html/sync_on.png delete mode 100644 doc/html/tab_a.png delete mode 100644 doc/html/tab_b.png delete mode 100644 doc/html/tab_h.png delete mode 100644 doc/html/tab_s.png delete mode 100644 doc/html/table_8h_source.html delete mode 100644 doc/html/tablemodel_8h_source.html delete mode 100644 doc/html/tableset_8h_source.html delete mode 100644 doc/html/tablesetbase__p_8h_source.html delete mode 100644 doc/html/tabs.css delete mode 100644 doc/html/wherephrase_8h_source.html diff --git a/doc/PaxHeader/html b/doc/PaxHeader/html deleted file mode 100644 index e4f8396..0000000 --- a/doc/PaxHeader/html +++ /dev/null @@ -1,3 +0,0 @@ -20 ctime=1465132049 -20 atime=1495727196 -23 SCHILY.fflags=btree diff --git a/doc/html/annotated.html b/doc/html/annotated.html deleted file mode 100644 index 1c3c3a0..0000000 --- a/doc/html/annotated.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - -Nut: Class List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Class List
-
-
-
Here are the classes, structs, unions and interfaces with brief descriptions:
-
- - - - diff --git a/doc/html/bc_s.png b/doc/html/bc_s.png deleted file mode 100644 index 25e3beb4cc756e7e822c731ecc959f571bbfa472..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 680 zcmV;Z0$2TsP)Ceo%=%;!Gz5w7Jp0q90LGKsJm}`8_(gPV3p$++55>YzbWAC zZR5~bjaQO5GkfZTtPU3f_^D2%*m#{Z5u)PLKd9Itl=k4it<0p*1B%3)4!f z5k)V*1OQ3`%c8I37KW6(6?I&C0RXVlu8@+$4jVU$+Alr>09a`acB?t+DYt!L00368 zCekn|n*|viyzmqND2aO8Yy3`QMo`=NCjda{s7n%BOC=#OGp9A9ecg`%fYM~ZoKX`_?umbyKKKu@`=$bvD`uckBOMyp%89^{f_7?85Q zO48$Cd|opKnB82PzoA{S^OXXRCuZl<1NnJ~#O~+f*+8X3Z*$A1WI8`2Y-sy#-Pa2o zZWe7^h9qOuOg0@K(fy#i%oel=ctB33Z&1Ll&XE%G)s%oo)b~C)xu{V<_E)H!3HEvS)PKZC{Gv1kP61Pb5HX&C2wk~_T - - - - -Nut: src/changelogtable.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
changelogtable.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef CHANGELOGTABLE_H
-
22 #define CHANGELOGTABLE_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include "table.h"
-
26 
-
27 QT_BEGIN_NAMESPACE
-
28 
-
29 class ChangeLogTable : public Table
-
30 {
-
31  Q_OBJECT
-
32 
-
33  NUT_PRIMARY_AUTO_INCREMENT(id)
-
34  NUT_DECLARE_FIELD(int, id, id, setId)
-
35 
-
36  NUT_DECLARE_FIELD(QString, data, data, setData)
-
37 
-
38  NUT_DECLARE_FIELD(int, versionMajor, versionMajor, setVersionMajor)
-
39 
-
40  NUT_DECLARE_FIELD(int, versionMinor, versionMinor, setVersionMinor)
-
41 
-
42 public:
- -
44 };
-
45 
-
46 QT_END_NAMESPACE
-
47 
-
48 #endif // CHANGELOGTABLE_H
-
- - - - diff --git a/doc/html/class_change_log_table-members.html b/doc/html/class_change_log_table-members.html deleted file mode 100644 index 3e9fb2b..0000000 --- a/doc/html/class_change_log_table-members.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
ChangeLogTable Member List
-
-
- -

This is the complete list of members for ChangeLogTable, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
add(TableSetBase *) (defined in Table)Table
Added enum value (defined in Table)Table
changedProperties() const (defined in Table)Table
ChangeLogTable() (defined in ChangeLogTable)ChangeLogTable
Deleted enum value (defined in Table)Table
FeatchedFromDB enum value (defined in Table)Table
isPrimaryKeyAutoIncrement() const (defined in Table)Table
Modified enum value (defined in Table)Table
NewCreated enum value (defined in Table)Table
primaryKey() const (defined in Table)Table
primaryValue() const (defined in Table)Table
propertyChanged(QString propName) (defined in Table)Tableprotected
save(Database *db) (defined in Table)Table
setParentTable(Table *master) (defined in Table)Table
setStatus(const Status &status) (defined in Table)Table
setTableSet(TableSetBase *tableSet) (defined in Table)Table
Status enum name (defined in Table)Table
status() const (defined in Table)Table
Table(QObject *tableSet=0) (defined in Table)Tableexplicit
tableSet() const (defined in Table)Table
- - - - diff --git a/doc/html/class_change_log_table.html b/doc/html/class_change_log_table.html deleted file mode 100644 index 7e5b42a..0000000 --- a/doc/html/class_change_log_table.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Nut: ChangeLogTable Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
ChangeLogTable Class Reference
-
-
-
-Inheritance diagram for ChangeLogTable:
-
-
- - -Table - -
- - - - - - - - - - - - - - - - - - - -

-Additional Inherited Members

- Public Types inherited from Table
enum  Status {
-  NewCreated, -FeatchedFromDB, -Added, -Modified, -
-  Deleted -
- }
- Public Member Functions inherited from Table
Table (QObject *tableSet=0)
-void add (TableSetBase *)
-void save (Database *db)
-QString primaryKey () const
-bool isPrimaryKeyAutoIncrement () const
-QVariant primaryValue () const
-Status status () const
-void setStatus (const Status &status)
-TableSetBase * tableSet () const
-void setTableSet (TableSetBase *tableSet)
-QSet< QString > changedProperties () const
-bool setParentTable (Table *master)
- Protected Member Functions inherited from Table
-void propertyChanged (QString propName)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_change_log_table.png b/doc/html/class_change_log_table.png deleted file mode 100644 index c7da9be710da59cdb22006e16d0cbee9e1227444..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 475 zcmV<10VMv3P)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d0004MNkl^dh~)byRs83*$YdXhm2oIYUx#2M%)39z1!fG%UBTahNYMon9YqOHFWhdR?Z}; zN1uJq?iX#{-kU~A8ql7{6Ci!nwg0bI}xz)PO6+s%>Y30qixG*{Rcr*Xmn z#x-F8!?tO)}c)`S6e4|3N0)_S#czII-4X5K^qm0HJuvd_O5fMI<#EQAo8^aBTx7xlqH R@jL(k002ovPDHLkV1i}d(Ru&? diff --git a/doc/html/class_change_log_table__coll__graph.dot b/doc/html/class_change_log_table__coll__graph.dot deleted file mode 100644 index ef9e341..0000000 --- a/doc/html/class_change_log_table__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "ChangeLogTable" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="ChangeLogTable",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; -} diff --git a/doc/html/class_change_log_table__coll__graph.md5 b/doc/html/class_change_log_table__coll__graph.md5 deleted file mode 100644 index a9ad158..0000000 --- a/doc/html/class_change_log_table__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -86ebfa9f18d32319833b08908ecc8329 \ No newline at end of file diff --git a/doc/html/class_change_log_table__inherit__graph.dot b/doc/html/class_change_log_table__inherit__graph.dot deleted file mode 100644 index ef9e341..0000000 --- a/doc/html/class_change_log_table__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "ChangeLogTable" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="ChangeLogTable",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; -} diff --git a/doc/html/class_change_log_table__inherit__graph.md5 b/doc/html/class_change_log_table__inherit__graph.md5 deleted file mode 100644 index a9ad158..0000000 --- a/doc/html/class_change_log_table__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -86ebfa9f18d32319833b08908ecc8329 \ No newline at end of file diff --git a/doc/html/class_database-members.html b/doc/html/class_database-members.html deleted file mode 100644 index 6721027..0000000 --- a/doc/html/class_database-members.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Database Member List
-
-
- -

This is the complete list of members for Database, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
add(TableSetBase *) (defined in Database)Database
cleanUp() (defined in Database)Database
close() (defined in Database)Database
connectionName() const Database
Database(QObject *parent=0) (defined in Database)Database
databaseName() const (defined in Database)Database
databaseUpdated(int oldMajor, int oldMinor, int newMajor, int newMinor) (defined in Database)Databaseprotectedvirtual
driver() const (defined in Database)Database
exec(QString sql) (defined in Database)Database
hostName() const (defined in Database)Database
model() const Database
open() (defined in Database)Database
password() const (defined in Database)Database
port() const (defined in Database)Database
saveChanges() (defined in Database)Database
setConnectionName(QString connectionName) (defined in Database)Databaseslot
setDatabaseName(QString databaseName) (defined in Database)Databaseslot
setDriver(QString driver) (defined in Database)Databaseslot
setHostName(QString hostName) (defined in Database)Databaseslot
setPassword(QString password) (defined in Database)Databaseslot
setPort(int port) (defined in Database)Databaseslot
setUserName(QString userName) (defined in Database)Databaseslot
sqlGenertor() const (defined in Database)Database
tableName(QString className) (defined in Database)Database
userName() const (defined in Database)Database
- - - - diff --git a/doc/html/class_database.html b/doc/html/class_database.html deleted file mode 100644 index f2c3e71..0000000 --- a/doc/html/class_database.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - -Nut: Database Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
- -
- -

Database class. - More...

- - - - - - - - - -

-Public Slots

-void setDatabaseName (QString databaseName)
-void setHostName (QString hostName)
-void setPort (int port)
-void setUserName (QString userName)
-void setPassword (QString password)
-void setConnectionName (QString connectionName)
-void setDriver (QString driver)
- - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

Database (QObject *parent=0)
-bool open ()
-void close ()
-QSqlQuery exec (QString sql)
-void add (TableSetBase *)
-void saveChanges ()
-void cleanUp ()
-QString databaseName () const
-QString hostName () const
-int port () const
-QString userName () const
-QString password () const
QString connectionName () const
 Database::connectionName.
-QString driver () const
DatabaseModel model () const
 Database::model.
-QString tableName (QString className)
-SqlGeneratorBase * sqlGenertor () const
- - -

-Protected Member Functions

-virtual void databaseUpdated (int oldMajor, int oldMinor, int newMajor, int newMinor)
-

Detailed Description

-

Database class.

-

Member Function Documentation

- -
-
- - - - - - - -
QString Database::connectionName () const
-
- -

Database::connectionName.

-
Returns
Connection name of current Database QSqlDatabase::connectionName
- -
-
- -
-
- - - - - - - -
DatabaseModel Database::model () const
-
- -

Database::model.

-
Returns
The model of this database
- -
-
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_database_model-members.html b/doc/html/class_database_model-members.html deleted file mode 100644 index c3c9603..0000000 --- a/doc/html/class_database_model-members.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
DatabaseModel Member List
-
-
- -

This is the complete list of members for DatabaseModel, including all inherited members.

- - - - - - - - - - - - - -
DatabaseModel() (defined in DatabaseModel)DatabaseModel
fromJson(QJsonObject &json) (defined in DatabaseModel)DatabaseModelstatic
model(QString tableName) const (defined in DatabaseModel)DatabaseModel
modelByClass(QString className) const (defined in DatabaseModel)DatabaseModel
operator==(const DatabaseModel &other) const (defined in DatabaseModel)DatabaseModel
relationByClassNames(QString masterClassName, QString childClassName) (defined in DatabaseModel)DatabaseModel
relationByTableNames(QString masterTableName, QString childTableName) (defined in DatabaseModel)DatabaseModel
setVersionMajor(int versionMajor) (defined in DatabaseModel)DatabaseModel
setVersionMinor(int versionMinor) (defined in DatabaseModel)DatabaseModel
toJson() const (defined in DatabaseModel)DatabaseModel
versionMajor() const (defined in DatabaseModel)DatabaseModel
versionMinor() const (defined in DatabaseModel)DatabaseModel
- - - - diff --git a/doc/html/class_database_model.html b/doc/html/class_database_model.html deleted file mode 100644 index e1096d9..0000000 --- a/doc/html/class_database_model.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - -Nut: DatabaseModel Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
- -
- - - - - - - - - - - - -

-Public Member Functions

-TableModelmodel (QString tableName) const
-TableModelmodelByClass (QString className) const
-RelationModelrelationByClassNames (QString masterClassName, QString childClassName)
-RelationModelrelationByTableNames (QString masterTableName, QString childTableName)
-bool operator== (const DatabaseModel &other) const
-QJsonObject toJson () const
-int versionMajor () const
-void setVersionMajor (int versionMajor)
-int versionMinor () const
-void setVersionMinor (int versionMinor)
- - -

-Static Public Member Functions

-static DatabaseModel fromJson (QJsonObject &json)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_database_private-members.html b/doc/html/class_database_private-members.html deleted file mode 100644 index 687cd94..0000000 --- a/doc/html/class_database_private-members.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - -Nut: Member List - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
-
-
DatabasePrivate Member List
-
-
- -

This is the complete list of members for DatabasePrivate, including all inherited members.

- - - - - - - - - - - - - - - - - - - - -
changeLogs (defined in DatabasePrivate)DatabasePrivate
connectionName (defined in DatabasePrivate)DatabasePrivate
createChangeLogs() (defined in DatabasePrivate)DatabasePrivate
currentModel (defined in DatabasePrivate)DatabasePrivate
databaseName (defined in DatabasePrivate)DatabasePrivate
DatabasePrivate(Database *parent) (defined in DatabasePrivate)DatabasePrivate
db (defined in DatabasePrivate)DatabasePrivate
driver (defined in DatabasePrivate)DatabasePrivate
getCurrectScheema() (defined in DatabasePrivate)DatabasePrivate
getLastScheema() (defined in DatabasePrivate)DatabasePrivate
hostName (defined in DatabasePrivate)DatabasePrivate
open() (defined in DatabasePrivate)DatabasePrivate
password (defined in DatabasePrivate)DatabasePrivate
port (defined in DatabasePrivate)DatabasePrivate
sqlGenertor (defined in DatabasePrivate)DatabasePrivate
storeScheemaInDB() (defined in DatabasePrivate)DatabasePrivate
tables (defined in DatabasePrivate)DatabasePrivate
updateDatabase() (defined in DatabasePrivate)DatabasePrivate
userName (defined in DatabasePrivate)DatabasePrivate
- - - - diff --git a/doc/html/class_database_private.html b/doc/html/class_database_private.html deleted file mode 100644 index 8f0654a..0000000 --- a/doc/html/class_database_private.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - -Nut: DatabasePrivate Class Reference - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
- -
-
DatabasePrivate Class Reference
-
-
- - - - - - - - - -

-Public Member Functions

DatabasePrivate (Database *parent)
-bool open ()
-bool updateDatabase ()
-void createChangeLogs ()
-bool storeScheemaInDB ()
-DatabaseModel getLastScheema ()
-QVariantMap getCurrectScheema ()
- - - - - - - - - - - - - -

-Public Attributes

-QSqlDatabase db
-QString hostName
-QString databaseName
-int port
-QString userName
-QString password
-QString connectionName
-QString driver
-QHash< QString, QString > tables
-SqlGeneratorBasesqlGenertor
-DatabaseModel currentModel
-TableSet< ChangeLogTable > * changeLogs
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_database_private__coll__graph.dot b/doc/html/class_database_private__coll__graph.dot deleted file mode 100644 index 03212f6..0000000 --- a/doc/html/class_database_private__coll__graph.dot +++ /dev/null @@ -1,18 +0,0 @@ -digraph "DatabasePrivate" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="DatabasePrivate",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sqlGenertor" ,fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; - Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" changeLogs" ,fontname="Helvetica"]; - Node3 [label="TableSet\< ChangeLogTable \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set.html"]; - Node4 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set_base.html"]; - Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _table" ,fontname="Helvetica"]; - Node5 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; - Node6 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _database" ,fontname="Helvetica"]; - Node6 [label="Database",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database.html",tooltip="Database class."]; - Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" currentModel" ,fontname="Helvetica"]; - Node7 [label="DatabaseModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database_model.html"]; -} diff --git a/doc/html/class_database_private__coll__graph.md5 b/doc/html/class_database_private__coll__graph.md5 deleted file mode 100644 index 4bae6b8..0000000 --- a/doc/html/class_database_private__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -8fe5281708ddfa2961f57abd25880e3a \ No newline at end of file diff --git a/doc/html/class_field_phrase-members.html b/doc/html/class_field_phrase-members.html deleted file mode 100644 index 4143f80..0000000 --- a/doc/html/class_field_phrase-members.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
FieldPhrase Member List
-
-
- -

This is the complete list of members for FieldPhrase, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_data (defined in WherePhrase)WherePhraseprotected
_dataPointer (defined in WherePhrase)WherePhraseprotected
data() const (defined in WherePhrase)WherePhrase
FieldPhrase(const char *className, const char *s) (defined in FieldPhrase)FieldPhrase
in(QVariantList list) (defined in FieldPhrase)FieldPhrase
in(QStringList list) (defined in FieldPhrase)FieldPhrase
isNull() (defined in FieldPhrase)FieldPhrase
like(QString pattern) (defined in FieldPhrase)FieldPhrase
operator!() (defined in FieldPhrase)FieldPhrase
operator!=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator!=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator&(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator&&(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator*(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator+(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator-(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator/(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<(const QVariant &other) (defined in WherePhrase)WherePhrase
operator<=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator=(const QVariant &other) (defined in FieldPhrase)FieldPhrase
operator=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator==(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator==(const QVariant &other) (defined in WherePhrase)WherePhrase
operator>(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator>(const QVariant &other) (defined in WherePhrase)WherePhrase
operator>=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator>=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator||(const WherePhrase &other) (defined in WherePhrase)WherePhrase
WherePhrase(const char *className, const char *s) (defined in WherePhrase)WherePhrase
WherePhrase(const WherePhrase &l) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o, WherePhrase *r) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o, QVariant r) (defined in WherePhrase)WherePhrase
~WherePhrase() (defined in WherePhrase)WherePhrase
- - - - diff --git a/doc/html/class_field_phrase.html b/doc/html/class_field_phrase.html deleted file mode 100644 index 34460f4..0000000 --- a/doc/html/class_field_phrase.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - -Nut: FieldPhrase Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
FieldPhrase Class Reference
-
-
-
-Inheritance diagram for FieldPhrase:
-
-
- - -WherePhrase - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

FieldPhrase (const char *className, const char *s)
-WherePhrase operator= (const QVariant &other)
-WherePhrase operator! ()
-WherePhrase isNull ()
-WherePhrase in (QVariantList list)
-WherePhrase in (QStringList list)
-WherePhrase like (QString pattern)
- Public Member Functions inherited from WherePhrase
WherePhrase (const char *className, const char *s)
WherePhrase (const WherePhrase &l)
WherePhrase (WherePhrase *l)
WherePhrase (WherePhrase *l, PhraseData::Condition o)
WherePhrase (WherePhrase *l, PhraseData::Condition o, WherePhrase *r)
WherePhrase (WherePhrase *l, PhraseData::Condition o, QVariant r)
-WherePhrase operator== (const WherePhrase &other)
-WherePhrase operator!= (const WherePhrase &other)
-WherePhrase operator< (const WherePhrase &other)
-WherePhrase operator> (const WherePhrase &other)
-WherePhrase operator<= (const WherePhrase &other)
-WherePhrase operator>= (const WherePhrase &other)
-WherePhrase operator= (const WherePhrase &other)
-WherePhrase operator+ (const WherePhrase &other)
-WherePhrase operator- (const WherePhrase &other)
-WherePhrase operator* (const WherePhrase &other)
-WherePhrase operator/ (const WherePhrase &other)
-WherePhrase operator&& (const WherePhrase &other)
-WherePhrase operator|| (const WherePhrase &other)
-WherePhrase operator& (const WherePhrase &other)
-WherePhrase operator== (const QVariant &other)
-WherePhrase operator!= (const QVariant &other)
-WherePhrase operator< (const QVariant &other)
-WherePhrase operator> (const QVariant &other)
-WherePhrase operator<= (const QVariant &other)
-WherePhrase operator>= (const QVariant &other)
-PhraseDatadata () const
- - - - -

-Additional Inherited Members

- Protected Attributes inherited from WherePhrase
-PhraseData_data
-QSharedPointer< PhraseData_dataPointer
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_field_phrase.png b/doc/html/class_field_phrase.png deleted file mode 100644 index b70309da109e35519b568c6879ef8f56da9ea87e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 453 zcmeAS@N?(olHy`uVBq!ia0vp^kw6^4!3-o_Z)t`CDTx4|5ZC|z{{xvX-h3_XKQsZz z0^5KkA!kP61PbGiFoEAY7X_fGk%U#a#m zox}Ii@+!CdCuZ9Na`?_2 zdt!B~<)-ytqjKH&d#l;z7i%7`Gk#kiy_P*k)Tmmm=pWw<&ui(g%Z*I@o-M0Seh0jiIMh6s}w<#Z(JMGEhZDEP;&iL6eRVMqb(yrX0ES^)Tvy;u=^RoB+ z+PDen^L3X Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="WherePhrase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_where_phrase.html"]; - Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _data" ,fontname="Helvetica"]; - Node3 [label="PhraseData",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_phrase_data.html"]; - Node3 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" right\nleft" ,fontname="Helvetica"]; -} diff --git a/doc/html/class_field_phrase__coll__graph.md5 b/doc/html/class_field_phrase__coll__graph.md5 deleted file mode 100644 index b839634..0000000 --- a/doc/html/class_field_phrase__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -103b0aad8cc915f43947192bd3805964 \ No newline at end of file diff --git a/doc/html/class_field_phrase__inherit__graph.dot b/doc/html/class_field_phrase__inherit__graph.dot deleted file mode 100644 index 81f363a..0000000 --- a/doc/html/class_field_phrase__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "FieldPhrase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="FieldPhrase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="WherePhrase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_where_phrase.html"]; -} diff --git a/doc/html/class_field_phrase__inherit__graph.md5 b/doc/html/class_field_phrase__inherit__graph.md5 deleted file mode 100644 index 388ba91..0000000 --- a/doc/html/class_field_phrase__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -87684cbcf043d65b5350df79356e5068 \ No newline at end of file diff --git a/doc/html/class_my_sql_generator-members.html b/doc/html/class_my_sql_generator-members.html deleted file mode 100644 index 7caa644..0000000 --- a/doc/html/class_my_sql_generator-members.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
MySqlGenerator Member List
-
-
- -

This is the complete list of members for MySqlGenerator, including all inherited members.

- - - -
fieldType(FieldModel *field) (defined in MySqlGenerator)MySqlGenerator
MySqlGenerator(Database *parent=0) (defined in MySqlGenerator)MySqlGenerator
- - - - diff --git a/doc/html/class_my_sql_generator.html b/doc/html/class_my_sql_generator.html deleted file mode 100644 index 32e7f0b..0000000 --- a/doc/html/class_my_sql_generator.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -Nut: MySqlGenerator Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
MySqlGenerator Class Reference
-
-
- - - - -

-Public Member Functions

MySqlGenerator (Database *parent=0)
-QString fieldType (FieldModel *field)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_my_sql_generator.png b/doc/html/class_my_sql_generator.png deleted file mode 100644 index 8be461ed4ffac111d7a89ed66522d06d1cafc93d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 583 zcmeAS@N?(olHy`uVBq!ia0vp^ML-t<74`jZ0^R=}9&;%e0 zj1L?*z}k679?0b=3GxeO04f53tEWPY7#J9@dAc};R4~4sd%N$j0*?#7+pGWepVSze z3!U<#PB=$qY8jc@neDh4p43ygu0u)5cb-`Z|_JA49X z(&jCF9Uks-Ka=9SeO&WizdgC7Mr7~ITh(3nlfRYz^~iHvmA-vvbLbaF+tM19b$_29 z&#Am#k=r0W|4vWYf~8m2`hJRm&q4qy}fkKvFA)T z=dG9CV7JNan$Iy+qq|R!_QtB#ch(e5zqQjZXV*!q%4e(I=$rd*Dm*Ru?C;;sxBoA= zxcm#W?-3D{T;2*K7F16#JZ2HfaQ`KvLHOs1{l`n5)jV;Vb9N8oPi5iV6Bv}YOkiNf zfood@4#fyEq-7~Gvb`u>wFoSG#s6@MMBbT@P1k|3&fw|l=d#Wzp$Pz! C>kile diff --git a/doc/html/class_my_sql_generator__coll__graph.dot b/doc/html/class_my_sql_generator__coll__graph.dot deleted file mode 100644 index a7fc54f..0000000 --- a/doc/html/class_my_sql_generator__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "MySqlGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="MySqlGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_my_sql_generator__coll__graph.md5 b/doc/html/class_my_sql_generator__coll__graph.md5 deleted file mode 100644 index 3fd78db..0000000 --- a/doc/html/class_my_sql_generator__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -023ffb099946dfc3a779f5f02af55273 \ No newline at end of file diff --git a/doc/html/class_my_sql_generator__inherit__graph.dot b/doc/html/class_my_sql_generator__inherit__graph.dot deleted file mode 100644 index a7fc54f..0000000 --- a/doc/html/class_my_sql_generator__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "MySqlGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="MySqlGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_my_sql_generator__inherit__graph.md5 b/doc/html/class_my_sql_generator__inherit__graph.md5 deleted file mode 100644 index 3fd78db..0000000 --- a/doc/html/class_my_sql_generator__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -023ffb099946dfc3a779f5f02af55273 \ No newline at end of file diff --git a/doc/html/class_phrase_data-members.html b/doc/html/class_phrase_data-members.html deleted file mode 100644 index 5e53e48..0000000 --- a/doc/html/class_phrase_data-members.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
PhraseData Member List
-
-
- -

This is the complete list of members for PhraseData, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Add enum value (defined in PhraseData)PhraseData
And enum value (defined in PhraseData)PhraseData
Append enum value (defined in PhraseData)PhraseData
Condition enum name (defined in PhraseData)PhraseData
Divide enum value (defined in PhraseData)PhraseData
Equal enum value (defined in PhraseData)PhraseData
Field enum value (defined in PhraseData)PhraseData
Greater enum value (defined in PhraseData)PhraseData
GreaterEqual enum value (defined in PhraseData)PhraseData
In enum value (defined in PhraseData)PhraseData
left (defined in PhraseData)PhraseData
Less enum value (defined in PhraseData)PhraseData
LessEqual enum value (defined in PhraseData)PhraseData
Like enum value (defined in PhraseData)PhraseData
Minus enum value (defined in PhraseData)PhraseData
Multiple enum value (defined in PhraseData)PhraseData
Not enum value (defined in PhraseData)PhraseData
NotAssign enum value (defined in PhraseData)PhraseData
NotEqual enum value (defined in PhraseData)PhraseData
NotIn enum value (defined in PhraseData)PhraseData
NotLike enum value (defined in PhraseData)PhraseData
NotNull enum value (defined in PhraseData)PhraseData
Null enum value (defined in PhraseData)PhraseData
operand (defined in PhraseData)PhraseData
operatorCond (defined in PhraseData)PhraseData
Or enum value (defined in PhraseData)PhraseData
PhraseData(const char *className, const char *s) (defined in PhraseData)PhraseData
PhraseData(PhraseData *l, Condition o) (defined in PhraseData)PhraseData
PhraseData(PhraseData *l, Condition o, const PhraseData *r) (defined in PhraseData)PhraseData
PhraseData(PhraseData *l, Condition o, QVariant r) (defined in PhraseData)PhraseData
right (defined in PhraseData)PhraseData
Set enum value (defined in PhraseData)PhraseData
text (defined in PhraseData)PhraseData
type (defined in PhraseData)PhraseData
Type enum name (defined in PhraseData)PhraseData
WithOther enum value (defined in PhraseData)PhraseData
WithoutOperand enum value (defined in PhraseData)PhraseData
WithVariant enum value (defined in PhraseData)PhraseData
~PhraseData() (defined in PhraseData)PhraseData
- - - - diff --git a/doc/html/class_phrase_data.html b/doc/html/class_phrase_data.html deleted file mode 100644 index fc5b12e..0000000 --- a/doc/html/class_phrase_data.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - -Nut: PhraseData Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
PhraseData Class Reference
-
-
- - - - -

-Public Types

enum  Condition {
-  NotAssign = 0, -Equal, -Less, -LessEqual, -
-  Null, -In, -Like, -Not = 10, -
-  NotEqual, -GreaterEqual, -Greater, -NotNull, -
-  NotIn, -NotLike, -And = 20, -Or, -
-  Append, -Set, -Add, -Minus, -
-  Multiple, -Divide -
- }
enum  Type { Field, -WithVariant, -WithOther, -WithoutOperand - }
- - - - - -

-Public Member Functions

PhraseData (const char *className, const char *s)
PhraseData (PhraseData *l, Condition o)
PhraseData (PhraseData *l, Condition o, const PhraseData *r)
PhraseData (PhraseData *l, Condition o, QVariant r)
- - - - - - - -

-Public Attributes

-Type type
-Condition operatorCond
-QString text
-const PhraseDataleft
-const PhraseDataright
-QVariant operand
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_phrase_data__coll__graph.dot b/doc/html/class_phrase_data__coll__graph.dot deleted file mode 100644 index a3d5701..0000000 --- a/doc/html/class_phrase_data__coll__graph.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "PhraseData" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="PhraseData",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" right\nleft" ,fontname="Helvetica"]; -} diff --git a/doc/html/class_phrase_data__coll__graph.md5 b/doc/html/class_phrase_data__coll__graph.md5 deleted file mode 100644 index 712393d..0000000 --- a/doc/html/class_phrase_data__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -51ab63e19ea2a4c75af258b7766c1d05 \ No newline at end of file diff --git a/doc/html/class_postgre_sql_generator-members.html b/doc/html/class_postgre_sql_generator-members.html deleted file mode 100644 index bf4734d..0000000 --- a/doc/html/class_postgre_sql_generator-members.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
PostgreSqlGenerator Member List
-
-
- -

This is the complete list of members for PostgreSqlGenerator, including all inherited members.

- - - - -
diff(FieldModel *oldField, FieldModel *newField) (defined in PostgreSqlGenerator)PostgreSqlGenerator
fieldType(FieldModel *field) (defined in PostgreSqlGenerator)PostgreSqlGenerator
PostgreSqlGenerator(Database *parent) (defined in PostgreSqlGenerator)PostgreSqlGenerator
- - - - diff --git a/doc/html/class_postgre_sql_generator.html b/doc/html/class_postgre_sql_generator.html deleted file mode 100644 index d80f7cf..0000000 --- a/doc/html/class_postgre_sql_generator.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - -Nut: PostgreSqlGenerator Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
PostgreSqlGenerator Class Reference
-
-
- - - - - -

-Public Member Functions

PostgreSqlGenerator (Database *parent)
-QString fieldType (FieldModel *field)
-QString diff (FieldModel *oldField, FieldModel *newField)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_postgre_sql_generator.png b/doc/html/class_postgre_sql_generator.png deleted file mode 100644 index 543a4cc6051a6b7cb6bcf599324ac36b2f18d31c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 613 zcmeAS@N?(olHy`uVBq!ia0vp^jX)g0!3-ohWuCnNQW60^A+G=b{|7Q(y!l$%e`o@b z1;z&s9ANFdBM;Z`oalzIKwQ}l_?%YbvIN`9wZzE<=)N^OSK+i!cgCqGHqapmzH_f^Jn z?WeM*o|Cefe`MmTGx<&4Dx0T&uv|Nj`CLk`!_iCgl$E9@nYE^06<(otW|zz3O7l*} z#@x2qSF4#kZ~I*3a-841;P%Bhea>so6Q*U(YqeuFy1eS_uWrM09hZs@w*UVWxx@Z} zi_3lm&k6r~JwLQ_0NuZw;eh)mhK9A9=05m%qj$sH2MjlQHq2Kz?K1a!xuR@MR;*g7wl?$yMu=(iuJoNpL!*2)J)umMdt*+%R3WX`=7$ z`KJpL&R5r~&o)mDe*LQCcBJIJ+$MvnsGn00zGaKyx@uat*+)RJo%b{A=Teh*`2r#i zdhQE3Dtv0U=S%HyT5$f5g}|!=AA9^~KeYe<=#0+EE1O#_x$|p;=g+A5=UVHTV8_6a x@RXZna|VOJ33CpH2j)PJBnV6iI_3A1ag&tvPP6W1GQc#!;OXk;vd$@?2>`^|4(I>? diff --git a/doc/html/class_postgre_sql_generator__coll__graph.dot b/doc/html/class_postgre_sql_generator__coll__graph.dot deleted file mode 100644 index 26f74b4..0000000 --- a/doc/html/class_postgre_sql_generator__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "PostgreSqlGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="PostgreSqlGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_postgre_sql_generator__coll__graph.md5 b/doc/html/class_postgre_sql_generator__coll__graph.md5 deleted file mode 100644 index 6fca22b..0000000 --- a/doc/html/class_postgre_sql_generator__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -c6b3185ef84ad7bb3cf2a81c2b2832b6 \ No newline at end of file diff --git a/doc/html/class_postgre_sql_generator__inherit__graph.dot b/doc/html/class_postgre_sql_generator__inherit__graph.dot deleted file mode 100644 index 26f74b4..0000000 --- a/doc/html/class_postgre_sql_generator__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "PostgreSqlGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="PostgreSqlGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_postgre_sql_generator__inherit__graph.md5 b/doc/html/class_postgre_sql_generator__inherit__graph.md5 deleted file mode 100644 index 6fca22b..0000000 --- a/doc/html/class_postgre_sql_generator__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -c6b3185ef84ad7bb3cf2a81c2b2832b6 \ No newline at end of file diff --git a/doc/html/class_query-members.html b/doc/html/class_query-members.html deleted file mode 100644 index 21e969d..0000000 --- a/doc/html/class_query-members.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Query< T > Member List
-
-
- -

This is the complete list of members for Query< T >, including all inherited members.

- - - - - - - - - - - - - - - -
average(FieldPhrase &f) (defined in Query< T >)Query< T >
count() (defined in Query< T >)Query< T >
first() (defined in Query< T >)Query< T >
join(const QString &tableName) (defined in Query< T >)Query< T >
join(Table *c) (defined in Query< T >)Query< T >
max(FieldPhrase &f) (defined in Query< T >)Query< T >
min(FieldPhrase &f) (defined in Query< T >)Query< T >
orderBy(QString fieldName, QString type) (defined in Query< T >)Query< T >
orderBy(WherePhrase phrase)Query< T >
Query(Database *database, TableSetBase *tableSet) (defined in Query< T >)Query< T >
remove() (defined in Query< T >)Query< T >
setWhere(WherePhrase where)Query< T >
toList(int count=-1)Query< T >
~Query() (defined in Query< T >)Query< T >
- - - - diff --git a/doc/html/class_query.html b/doc/html/class_query.html deleted file mode 100644 index 8fe2163..0000000 --- a/doc/html/class_query.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - -Nut: Query< T > Class Template Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
Query< T > Class Template Reference
-
-
- -

This class hold a query. - More...

- - - - - - - - - - - - - - - - -

-Public Member Functions

Query (Database *database, TableSetBase *tableSet)
QList< T * > toList (int count=-1)
-int remove ()
-T * first ()
-int count ()
-QVariant max (FieldPhrase &f)
-QVariant min (FieldPhrase &f)
-QVariant average (FieldPhrase &f)
-Query< T > * join (const QString &tableName)
Query< T > * setWhere (WherePhrase where)
 Where phrase is a phrase using table's static field methods.
-Query< T > * join (Table *c)
-Query< T > * orderBy (QString fieldName, QString type)
Query< T > * orderBy (WherePhrase phrase)
-

Detailed Description

-

template<class T>
-class Query< T >

- -

This class hold a query.

-

A query can be used for getting database rows, editing or deleting without row fetching. A query can be used for getting data from database.

-
auto q = db.posts()->createQuery();
-
q->join(Post::commentsTable());
-
q->orderBy(!Post::saveDateField() & Post::bodyField());
-
q->setWhere(Post::idField() > 5);
-
-
auto posts = q->toList();
-

In below code posts is a QList<Post> that contain rows from database from this query:

-
SELECT * FROM post WHERE post.id>5 ORDER BY post.saveDate DESC, post.body
-

Member Function Documentation

- -
-
-
-template<class T >
- - - - - - - - -
Q_OUTOFLINE_TEMPLATE Query< T > * Query< T >::orderBy (WherePhrase phrase)
-
-
Parameters
- - -
phraseOrder phrase
-
-
-
Returns
This function return class itself orderBy set a new order for this query. Order can be a hrase like that:
query->orderBy(Post::idField());
-
If you need more than one order field seprate them by & operator, example:
query->orderBy(Post::idField() & Post::bodyField());
-
Order can be also DESC, for that put exclamation mark near field
query->orderBy(!Post::idField & Post::bodyField());
-
- -
-
- -
-
-
-template<class T >
- - - - - - - - -
Q_OUTOFLINE_TEMPLATE Query< T > * Query< T >::setWhere (WherePhrase where)
-
- -

Where phrase is a phrase using table's static field methods.

-
q->setWhere(Post::idField() == 4 || Post::titleField().isNull());
-

In sql this is like below code:

-
... WHERE post.id=4 OR post.title IS NULL
-
Parameters
- - -
whereWhere phrase
-
-
-
Returns
This function return class itself
- -
-
- -
-
-
-template<class T >
- - - - - - - - -
Q_OUTOFLINE_TEMPLATE QList< T * > Query< T >::toList (int count = -1)
-
-
Parameters
- - -
countTotal rows must be returned
-
-
-
Returns
This function return class itself This function return rows
- -
-
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_query.png b/doc/html/class_query.png deleted file mode 100644 index 5d08006255a591aff71210e28824e9ae4b25f158..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 463 zcmV;=0WkiFP)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d0004ANklLVBbHR&&lR^+zjccaPqFTncNpI=Pi5=Z@I9W}u>JUi zZ~3;+eUnb{l}g#<+`>6u@4M`8iOuKwn%AvgO`@jZ`m4LO)T*=BUlEax-kkKiyg}S3 zZxpwle0K&9*0P`}u(j9;iwQd6Lqr5WS3HGJ;$5}j&=*s&rP0U zb$(p^ Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="QueryBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query_base.html"]; -} diff --git a/doc/html/class_query__coll__graph.md5 b/doc/html/class_query__coll__graph.md5 deleted file mode 100644 index 477486e..0000000 --- a/doc/html/class_query__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -547c306758686aa02e5e961a8060cf85 \ No newline at end of file diff --git a/doc/html/class_query__inherit__graph.dot b/doc/html/class_query__inherit__graph.dot deleted file mode 100644 index 78d39cf..0000000 --- a/doc/html/class_query__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "Query< T >" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="Query\< T \>",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="QueryBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query_base.html"]; -} diff --git a/doc/html/class_query__inherit__graph.md5 b/doc/html/class_query__inherit__graph.md5 deleted file mode 100644 index 477486e..0000000 --- a/doc/html/class_query__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -547c306758686aa02e5e961a8060cf85 \ No newline at end of file diff --git a/doc/html/class_query_base-members.html b/doc/html/class_query_base-members.html deleted file mode 100644 index 3a75f94..0000000 --- a/doc/html/class_query_base-members.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - -Nut: Member List - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
-
-
QueryBase Member List
-
-
- -

This is the complete list of members for QueryBase, including all inherited members.

- - -
QueryBase(QObject *parent=0) (defined in QueryBase)QueryBaseexplicit
- - - - diff --git a/doc/html/class_query_base.html b/doc/html/class_query_base.html deleted file mode 100644 index e894d0d..0000000 --- a/doc/html/class_query_base.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - -Nut: QueryBase Class Reference - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
- -
-
QueryBase Class Reference
-
-
-
-Inheritance diagram for QueryBase:
-
-
- - -Query< T > - -
- - - -

-Public Member Functions

QueryBase (QObject *parent=0)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_query_base.png b/doc/html/class_query_base.png deleted file mode 100644 index 7622f376ab20fe3b719187d5bcda9c8fe0208c2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmV;_0W1EAP)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d0004FNkls8#{d75t9%@ZRWC=mnLcoxtsrqti26)QDNTd~FpcE{7{~f@djM`J z9R#?;`10Ug^t+JmtH=Ftj4~ycBcz^s`Px$bZ)&{vb*($)BTQV_*RlK8^iMu_!*=mW z-|B6t`zD?8%TrsNTR7M2<8J$#bMv)c`yThN7E#M^{q1*arPau%{sKG@4vPgw-^!pb z{F1NlAHXKksu&JsBKt)8Rv3w#T;}~Dsex)?c*~0Uz_#)6A>Bb3qDoVdHev_#u1ntK%&I}0000< KMNUMnLSTa7LFGpP diff --git a/doc/html/class_query_base__inherit__graph.dot b/doc/html/class_query_base__inherit__graph.dot deleted file mode 100644 index e03320d..0000000 --- a/doc/html/class_query_base__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "QueryBase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="QueryBase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="Query\< T \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query.html",tooltip="This class hold a query."]; -} diff --git a/doc/html/class_query_base__inherit__graph.md5 b/doc/html/class_query_base__inherit__graph.md5 deleted file mode 100644 index b2c3f58..0000000 --- a/doc/html/class_query_base__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -60beaff9fc8b9df9e32a7857286bb1d1 \ No newline at end of file diff --git a/doc/html/class_query_private-members.html b/doc/html/class_query_private-members.html deleted file mode 100644 index 011d2c9..0000000 --- a/doc/html/class_query_private-members.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - -Nut: Member List - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
-
-
QueryPrivate Member List
-
-
- -

This is the complete list of members for QueryPrivate, including all inherited members.

- - - - - - - - - - -
database (defined in QueryPrivate)QueryPrivate
joinClassName (defined in QueryPrivate)QueryPrivate
orderPhrases (defined in QueryPrivate)QueryPrivate
orders (defined in QueryPrivate)QueryPrivate
QueryPrivate(QueryBase *parent)QueryPrivate
select (defined in QueryPrivate)QueryPrivate
tableName (defined in QueryPrivate)QueryPrivate
tableSet (defined in QueryPrivate)QueryPrivate
wheres (defined in QueryPrivate)QueryPrivate
- - - - diff --git a/doc/html/class_query_private.html b/doc/html/class_query_private.html deleted file mode 100644 index 7945552..0000000 --- a/doc/html/class_query_private.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - -Nut: QueryPrivate Class Reference - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
- -
-
QueryPrivate Class Reference
-
-
- - - - -

-Public Member Functions

 QueryPrivate (QueryBase *parent)
 
-
- - - - - - - - - -

-Public Attributes

-QString tableName
-QString select
-Databasedatabase
-TableSetBasetableSet
-QString joinClassName
-QList< WherePhrasewheres
-QHash< QString, QString > orders
-QList< WherePhraseorderPhrases
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - -
QT_BEGIN_NAMESPACE QueryPrivate::QueryPrivate (QueryBaseparent)
-
- -


-

-

This file is part of Nut project. https://github.com/HamedMasafi/Nut

-

Nut is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

-

Nut is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

-

You should have received a copy of the GNU Lesser General Public License along with Nut. If not, see http://www.gnu.org/licenses/.

- -
-
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_query_private__coll__graph.dot b/doc/html/class_query_private__coll__graph.dot deleted file mode 100644 index 3354695..0000000 --- a/doc/html/class_query_private__coll__graph.dot +++ /dev/null @@ -1,13 +0,0 @@ -digraph "QueryPrivate" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="QueryPrivate",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" database" ,fontname="Helvetica"]; - Node2 [label="Database",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database.html",tooltip="Database class."]; - Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tableSet" ,fontname="Helvetica"]; - Node3 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set_base.html"]; - Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _table" ,fontname="Helvetica"]; - Node4 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; - Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _database" ,fontname="Helvetica"]; -} diff --git a/doc/html/class_query_private__coll__graph.md5 b/doc/html/class_query_private__coll__graph.md5 deleted file mode 100644 index 191c2ee..0000000 --- a/doc/html/class_query_private__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -60f83570a399e28206ec50e1e049a435 \ No newline at end of file diff --git a/doc/html/class_sql_generator_base-members.html b/doc/html/class_sql_generator_base-members.html deleted file mode 100644 index bd42605..0000000 --- a/doc/html/class_sql_generator_base-members.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - -Nut: Member List - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
-
-
SqlGeneratorBase Member List
-
-
- -

This is the complete list of members for SqlGeneratorBase, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AgregateType enum name (defined in SqlGeneratorBase)SqlGeneratorBase
Average enum value (defined in SqlGeneratorBase)SqlGeneratorBase
CommandType enum name (defined in SqlGeneratorBase)SqlGeneratorBase
Count enum value (defined in SqlGeneratorBase)SqlGeneratorBase
Delete enum value (defined in SqlGeneratorBase)SqlGeneratorBase
deleteCommand(QList< WherePhrase > &wheres, QString tableName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
deleteRecord(Table *t, QString tableName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
deleteRecords(QString tableName, QString where) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
diff(DatabaseModel lastModel, DatabaseModel newModel) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
diff(FieldModel *oldField, FieldModel *newField) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
diff(TableModel *oldTable, TableModel *newTable) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
escapeValue(const QVariant &v) const (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
fieldDeclare(FieldModel *field) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
fieldType(FieldModel *field)=0 (defined in SqlGeneratorBase)SqlGeneratorBasepure virtual
Insert enum value (defined in SqlGeneratorBase)SqlGeneratorBase
insertRecord(Table *t, QString tableName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
masterDatabaseName(QString databaseName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
Max enum value (defined in SqlGeneratorBase)SqlGeneratorBase
Min enum value (defined in SqlGeneratorBase)SqlGeneratorBase
operatorString(const PhraseData::Condition &cond) const (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
phrase(const PhraseData *d) const (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
saveRecord(Table *t, QString tableName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
Select enum value (defined in SqlGeneratorBase)SqlGeneratorBase
SelectALl enum value (defined in SqlGeneratorBase)SqlGeneratorBase
selectCommand(AgregateType t, QString agregateArg, QList< WherePhrase > &wheres, QList< WherePhrase > &orders, QString tableName, QString joinClassName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
selectCommand(QList< WherePhrase > &wheres, QHash< QString, QString > &orders, QString tableName, QString joinClassName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
selectCommand(QString selectPhrase, QList< WherePhrase > &wheres, QHash< QString, QString > &orders, QString tableName, QString joinClassName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
SqlGeneratorBase(Database *parent) (defined in SqlGeneratorBase)SqlGeneratorBase
Update enum value (defined in SqlGeneratorBase)SqlGeneratorBase
updateRecord(Table *t, QString tableName) (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
~SqlGeneratorBase() (defined in SqlGeneratorBase)SqlGeneratorBasevirtual
- - - - diff --git a/doc/html/class_sql_generator_base.html b/doc/html/class_sql_generator_base.html deleted file mode 100644 index f241b52..0000000 --- a/doc/html/class_sql_generator_base.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - -Nut: SqlGeneratorBase Class Reference - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
- -
-
SqlGeneratorBase Class Reference
-
-
-
-Inheritance diagram for SqlGeneratorBase:
-
-
- - -MySqlGenerator -PostgreSqlGenerator -SqliteGenerator -SqlServerGenerator - -
- - - - -

-Public Types

enum  CommandType { Select, -Insert, -Update, -Delete - }
enum  AgregateType {
-  SelectALl, -Count, -Min, -Max, -
-  Average -
- }
- - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

SqlGeneratorBase (Database *parent)
-virtual QString masterDatabaseName (QString databaseName)
-virtual QString fieldType (FieldModel *field)=0
-virtual QString fieldDeclare (FieldModel *field)
-virtual QStringList diff (DatabaseModel lastModel, DatabaseModel newModel)
-virtual QString diff (FieldModel *oldField, FieldModel *newField)
-virtual QString diff (TableModel *oldTable, TableModel *newTable)
-virtual QString saveRecord (Table *t, QString tableName)
-virtual QString insertRecord (Table *t, QString tableName)
-virtual QString updateRecord (Table *t, QString tableName)
-virtual QString deleteRecord (Table *t, QString tableName)
-virtual QString deleteRecords (QString tableName, QString where)
-virtual QString selectCommand (AgregateType t, QString agregateArg, QList< WherePhrase > &wheres, QList< WherePhrase > &orders, QString tableName, QString joinClassName)
-virtual QString selectCommand (QList< WherePhrase > &wheres, QHash< QString, QString > &orders, QString tableName, QString joinClassName)
-virtual QString selectCommand (QString selectPhrase, QList< WherePhrase > &wheres, QHash< QString, QString > &orders, QString tableName, QString joinClassName)
-virtual QString deleteCommand (QList< WherePhrase > &wheres, QString tableName)
-virtual QString escapeValue (const QVariant &v) const
-virtual QString phrase (const PhraseData *d) const
-virtual QString operatorString (const PhraseData::Condition &cond) const
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_sql_generator_base.png b/doc/html/class_sql_generator_base.png deleted file mode 100644 index 7982eaa8862fd61f0f0cead2cab3ff700d1d1dd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1309 zcmeAS@N?(olHy`uVBq!ia0y~yU{V6I12~w0q_F(E-#|(tz$e7@|Ns9$=8HF9OZyK^ z0J6aNz<~p-op3MfWB5z;1y@un!_6@7~vtLI~y4(3lOmUw6 z>FY~Z=J?+F#0NAo`bO@>qKGx>M}ECJzV=*7$6}GSmwj({Zd{q>%CN8ZlvwWUxp{9l zJ-wZ{>Dt_*ZF`kG7e@L|J0q>l^nv$D^pxrCJ`?xcd-8O7S=W~p)4|GpNxm|0TD7B%a+xDK^(Q9j$>3lz~?@$ye*wDXhuj~Kw z&p@nWT?`TpY+)=17)&avx`9r2PX>hrvo=!#gH(hd1M`IgU=@cAc=~}t|3cjum=hSj zfn);GW!?em>3uz3~f#DK%tWf5xMc?D)OdmAlzg)BA za_AH-6lvfKI}*rX6(Q)(_#(kohIK(RIf60$LQWjv63!eCx%z-C)%hZ-9+#SzbSrxD zKhl^KlH@AmItgUQ#3dl>R91p4@q85!nxgTqzIM*PPxm*Ad1e({$=oloeqwpKY1>ZI z>mT<`xqLSKZ#q!?&Pu7&?;Dms-#uydx)XOwxBrOTRowqe+cj(Z)%Km{*B2`Ne);M9 zi*=?e-EW?)E8Ca7vri;4%$7}h+4-Bhjk&E%*S-H>bA9#s>V~)TmxczFm5M~>cOTZN z+@|>cY^mSGnq4V#eqUR%*yC&B$JOzV~;9KnzVYY zhuMK5(dPTJU;8Y)=^I|%ziyr9<_k|YtMg8k+_a2)=Q*uS@BFUq>lgVw<*8Nu*V{bLvIJh6!JQ|zg4x%bZdUU+imZr#t7 zN;|*YHWKOIQ&|_i&baH%veVCZrTbb1Ub@-+^V(zc*!fRFf90-IcAfO<+KsM1Jlf^o z`CPLOt6aV}{dK^^TO~hZzOV7L_4=FGEqRG|^_qwJMO#HYHAEs$Cv5%3JBdqA+sNbN zsyWNQKmFCI^tnW|{C&h^XV+~vwUgJby?HG5MCpnXVV|EB|DBs_J1c4G>FhY0J#llN z8|&V!_WYQoz3J{Y+oV^of8Flg*~jf`c{k~8)R%WrlijA=J$$UKWc8-4yXUQ5)v=`F z?YxB_115cu?)(1q$&>5Fe>F~>J*}X*w{Ov(w{Ipr0@`7BI=QRlT&lK`XZ_)cN>eq? z&sBO|spna}rbFfK`ND-0m+XI%-s(2#9}h6G2x$XT&y|B+7F{Z(8D>7pch_8(1D0hBp00i_>zopr0Fp9aT>t<8 diff --git a/doc/html/class_sql_generator_base__inherit__graph.dot b/doc/html/class_sql_generator_base__inherit__graph.dot deleted file mode 100644 index f9c50d3..0000000 --- a/doc/html/class_sql_generator_base__inherit__graph.dot +++ /dev/null @@ -1,14 +0,0 @@ -digraph "SqlGeneratorBase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="MySqlGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_my_sql_generator.html"]; - Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="PostgreSqlGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_postgre_sql_generator.html"]; - Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="SqliteGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sqlite_generator.html"]; - Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="SqlServerGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_server_generator.html"]; -} diff --git a/doc/html/class_sql_generator_base__inherit__graph.md5 b/doc/html/class_sql_generator_base__inherit__graph.md5 deleted file mode 100644 index 52e844a..0000000 --- a/doc/html/class_sql_generator_base__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -ea9d48b9acc84881c74f50d8a6f0671e \ No newline at end of file diff --git a/doc/html/class_sql_server_generator-members.html b/doc/html/class_sql_server_generator-members.html deleted file mode 100644 index f9c7c84..0000000 --- a/doc/html/class_sql_server_generator-members.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
SqlServerGenerator Member List
-
-
- -

This is the complete list of members for SqlServerGenerator, including all inherited members.

- - - - - - -
diff(FieldModel *oldField, FieldModel *newField) (defined in SqlServerGenerator)SqlServerGenerator
escapeValue(const QVariant &v) const (defined in SqlServerGenerator)SqlServerGenerator
fieldType(FieldModel *field) (defined in SqlServerGenerator)SqlServerGenerator
masterDatabaseName(QString databaseName) (defined in SqlServerGenerator)SqlServerGenerator
SqlServerGenerator(Database *parent=0) (defined in SqlServerGenerator)SqlServerGenerator
- - - - diff --git a/doc/html/class_sql_server_generator.html b/doc/html/class_sql_server_generator.html deleted file mode 100644 index ff67967..0000000 --- a/doc/html/class_sql_server_generator.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - -Nut: SqlServerGenerator Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
SqlServerGenerator Class Reference
-
-
- - - - - - - -

-Public Member Functions

SqlServerGenerator (Database *parent=0)
-QString masterDatabaseName (QString databaseName)
-QString fieldType (FieldModel *field)
-QString diff (FieldModel *oldField, FieldModel *newField)
-QString escapeValue (const QVariant &v) const
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_sql_server_generator.png b/doc/html/class_sql_server_generator.png deleted file mode 100644 index 1645b698ce9075f7319fe415931f9f5aa3e1201b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 598 zcmV-c0;&CpP)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d0005yNklsX8iL+w_jx@%@pRQYW@ZbG^hbFUdfNJNeXOJq=TQ!`R3yc}W8T;8C%Khg zJWX3yzU<=UU+Qo&T2=BgTcaypAF!Ufe8h6Dvf=iWj??xwxZ3x6ihH^|N3-(NY6(gs z>RgU=seGx&brk1QH=*|p80K63?bgbxtL>-(nv|zXN~V@ntlLDFRqib5Wq2xG4G9U+N(!3@@XCIT?%+sc>Mw#>X3@=}$7P^(VqWfofH^SjU`F1~et_W9d% k01s_CfQQ`aA%x(iFT_F`(ET%h6951J07*qoM6N<$f+4^nR{#J2 diff --git a/doc/html/class_sql_server_generator__coll__graph.dot b/doc/html/class_sql_server_generator__coll__graph.dot deleted file mode 100644 index 19f0792..0000000 --- a/doc/html/class_sql_server_generator__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "SqlServerGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="SqlServerGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_sql_server_generator__coll__graph.md5 b/doc/html/class_sql_server_generator__coll__graph.md5 deleted file mode 100644 index 6d35e14..0000000 --- a/doc/html/class_sql_server_generator__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -6acaf3703929fe49ea862deaca14b8c1 \ No newline at end of file diff --git a/doc/html/class_sql_server_generator__inherit__graph.dot b/doc/html/class_sql_server_generator__inherit__graph.dot deleted file mode 100644 index 19f0792..0000000 --- a/doc/html/class_sql_server_generator__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "SqlServerGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="SqlServerGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_sql_server_generator__inherit__graph.md5 b/doc/html/class_sql_server_generator__inherit__graph.md5 deleted file mode 100644 index 6d35e14..0000000 --- a/doc/html/class_sql_server_generator__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -6acaf3703929fe49ea862deaca14b8c1 \ No newline at end of file diff --git a/doc/html/class_sqlite_generator-members.html b/doc/html/class_sqlite_generator-members.html deleted file mode 100644 index 0d437f0..0000000 --- a/doc/html/class_sqlite_generator-members.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
SqliteGenerator Member List
-
-
- -

This is the complete list of members for SqliteGenerator, including all inherited members.

- - - -
fieldType(FieldModel *field) (defined in SqliteGenerator)SqliteGenerator
SqliteGenerator(Database *parent=0) (defined in SqliteGenerator)SqliteGenerator
- - - - diff --git a/doc/html/class_sqlite_generator.html b/doc/html/class_sqlite_generator.html deleted file mode 100644 index 03f0a00..0000000 --- a/doc/html/class_sqlite_generator.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -Nut: SqliteGenerator Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
SqliteGenerator Class Reference
-
-
- - - - -

-Public Member Functions

SqliteGenerator (Database *parent=0)
-QString fieldType (FieldModel *field)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_sqlite_generator.png b/doc/html/class_sqlite_generator.png deleted file mode 100644 index 27c38fd3203e10ffbfdeb0e883c6d2a74947f39f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 585 zcmeAS@N?(olHy`uVBq!ia0vp^ML-t<74`jZ0^R=}9&;%e0 zj1L?*z}k679?0b=3GxeO04f53tEWPY7#J9Dc)B=-R4~4s`?l}30uL*@^4Guem6s)& z6(`(Vr&qEx=8S;?#Xr)5sX~fD2ZQ$3i44MD#3w9YdMe}BYkp>)662Mw^8)=|HqQpE-YuJiZI&9<8;uHC-xs95-7v1{2m$E|-qsru!id*Eo^=WfsgjgRz210>-X(u{hzNhzwF)ubQTB$y~v@cbCrMPQHd0r@<|53cxUi*^>bP0l+XkK DJZ~3M diff --git a/doc/html/class_sqlite_generator__coll__graph.dot b/doc/html/class_sqlite_generator__coll__graph.dot deleted file mode 100644 index 4b007b0..0000000 --- a/doc/html/class_sqlite_generator__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "SqliteGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="SqliteGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_sqlite_generator__coll__graph.md5 b/doc/html/class_sqlite_generator__coll__graph.md5 deleted file mode 100644 index 463b4b5..0000000 --- a/doc/html/class_sqlite_generator__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -ebb557040f1fe0a7998308b6c508cbbc \ No newline at end of file diff --git a/doc/html/class_sqlite_generator__inherit__graph.dot b/doc/html/class_sqlite_generator__inherit__graph.dot deleted file mode 100644 index 4b007b0..0000000 --- a/doc/html/class_sqlite_generator__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "SqliteGenerator" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="SqliteGenerator",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; -} diff --git a/doc/html/class_sqlite_generator__inherit__graph.md5 b/doc/html/class_sqlite_generator__inherit__graph.md5 deleted file mode 100644 index 463b4b5..0000000 --- a/doc/html/class_sqlite_generator__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -ebb557040f1fe0a7998308b6c508cbbc \ No newline at end of file diff --git a/doc/html/class_table-members.html b/doc/html/class_table-members.html deleted file mode 100644 index 8003ef3..0000000 --- a/doc/html/class_table-members.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Table Member List
-
-
- -

This is the complete list of members for Table, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
add(TableSetBase *) (defined in Table)Table
Added enum value (defined in Table)Table
changedProperties() const (defined in Table)Table
Deleted enum value (defined in Table)Table
FeatchedFromDB enum value (defined in Table)Table
isPrimaryKeyAutoIncrement() const (defined in Table)Table
Modified enum value (defined in Table)Table
NewCreated enum value (defined in Table)Table
primaryKey() const (defined in Table)Table
primaryValue() const (defined in Table)Table
propertyChanged(QString propName) (defined in Table)Tableprotected
Query (defined in Table)Tablefriend
save(Database *db) (defined in Table)Table
setParentTable(Table *master) (defined in Table)Table
setStatus(const Status &status) (defined in Table)Table
setTableSet(TableSetBase *tableSet) (defined in Table)Table
status() const (defined in Table)Table
Status enum name (defined in Table)Table
Table(QObject *tableSet=0) (defined in Table)Tableexplicit
tableSet() const (defined in Table)Table
- - - - diff --git a/doc/html/class_table.html b/doc/html/class_table.html deleted file mode 100644 index 658c228..0000000 --- a/doc/html/class_table.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - -Nut: Table Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
- -
-
-Inheritance diagram for Table:
-
-
- - -ChangeLogTable - -
- - - -

-Public Types

enum  Status {
-  NewCreated, -FeatchedFromDB, -Added, -Modified, -
-  Deleted -
- }
- - - - - - - - - - - - - -

-Public Member Functions

Table (QObject *tableSet=0)
-void add (TableSetBase *)
-void save (Database *db)
-QString primaryKey () const
-bool isPrimaryKeyAutoIncrement () const
-QVariant primaryValue () const
-Status status () const
-void setStatus (const Status &status)
-TableSetBase * tableSet () const
-void setTableSet (TableSetBase *tableSet)
-QSet< QString > changedProperties () const
-bool setParentTable (Table *master)
- - -

-Protected Member Functions

-void propertyChanged (QString propName)
- - -

-Friends

-class Query
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_table.png b/doc/html/class_table.png deleted file mode 100644 index ca9f7649557dcf30c778dc3ddb36ce253304d135..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 479 zcmeAS@N?(olHy`uVBq!ia0vp^IY1o1!3-o%GbCsNDTx4|5ZC|z{{xvX-h3_XKQsZz z0^JWm(LkP61Pb01D>R^VZq-YTl8a#&eqO}H}^5FDEMxar^TG{aQFMjsNMGWdKv86cn+MM zz_{b3F1KQfAH$slrWdaMH%&^ne4TQ3UEQ{Io9gfMIAuj%TLI&Y#+mGvfQ_s$8|?s!UnVnRCKy(}`&xe?DH8V;(bo zX0g}v?bmk7=?dO{RIK`QyUm`H+Lr2@LSp%J-G9#3+$WQ|QdXxj_0!^0Z*tOpb)5;@ z)}J$J>FvFnryLBvX?On1*_Cf%J<~T$XSu9={BFgT-)F10Ri3-1c1rihrQYlpk>+~u zz0AFW=H6ny@u6Vb=`3&W$D4{58f_Nxywr9pf6^(le@QAQ&+eagR3cfujv=F0Y{T}p SU8jMu!QkoY=d#Wzp$P!bfZNaj diff --git a/doc/html/class_table__inherit__graph.dot b/doc/html/class_table__inherit__graph.dot deleted file mode 100644 index c245cf6..0000000 --- a/doc/html/class_table__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "Table" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="Table",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ChangeLogTable",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_change_log_table.html"]; -} diff --git a/doc/html/class_table__inherit__graph.md5 b/doc/html/class_table__inherit__graph.md5 deleted file mode 100644 index a4ad1ae..0000000 --- a/doc/html/class_table__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -9dea5dc195855e66af5a7e705fd500de \ No newline at end of file diff --git a/doc/html/class_table_model-members.html b/doc/html/class_table_model-members.html deleted file mode 100644 index d462177..0000000 --- a/doc/html/class_table_model-members.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
TableModel Member List
-
-
- -

This is the complete list of members for TableModel, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - -
className() const (defined in TableModel)TableModel
field(QString name) const (defined in TableModel)TableModel
fields() const (defined in TableModel)TableModel
fieldsNames() const (defined in TableModel)TableModel
findByClassName(QString className) (defined in TableModel)TableModelstatic
findByName(QString name) (defined in TableModel)TableModelstatic
findByTypeId(int typeId) (defined in TableModel)TableModelstatic
foregionKey(QString otherTable) const (defined in TableModel)TableModel
foregionKeys() const (defined in TableModel)TableModel
model(QString className) (defined in TableModel)TableModelstatic
name() const (defined in TableModel)TableModel
operator!=(const TableModel &t) const (defined in TableModel)TableModel
operator==(const TableModel &t) const (defined in TableModel)TableModel
primaryKey() const (defined in TableModel)TableModel
setClassName(const QString &className) (defined in TableModel)TableModel
setName(const QString &name) (defined in TableModel)TableModel
setTypeId(const int &typeId) (defined in TableModel)TableModel
TableModel(int typeId, QString tableName) (defined in TableModel)TableModel
TableModel(QJsonObject json, QString tableName) (defined in TableModel)TableModel
toJson() const (defined in TableModel)TableModel
toString() const (defined in TableModel)TableModel
typeId() const (defined in TableModel)TableModel
- - - - diff --git a/doc/html/class_table_model.html b/doc/html/class_table_model.html deleted file mode 100644 index 0c4509b..0000000 --- a/doc/html/class_table_model.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - -Nut: TableModel Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

TableModel (int typeId, QString tableName)
TableModel (QJsonObject json, QString tableName)
-QJsonObject toJson () const
-FieldModelfield (QString name) const
-RelationModelforegionKey (QString otherTable) const
-QString toString () const
-QString primaryKey () const
-QString name () const
-void setName (const QString &name)
-QString className () const
-void setClassName (const QString &className)
-int typeId () const
-void setTypeId (const int &typeId)
-QList< FieldModel * > fields () const
-QList< RelationModel * > foregionKeys () const
-QStringList fieldsNames () const
-bool operator== (const TableModel &t) const
-bool operator!= (const TableModel &t) const
- - - - - -

-Static Public Member Functions

-static TableModelmodel (QString className)
-static TableModelfindByTypeId (int typeId)
-static TableModelfindByName (QString name)
-static TableModelfindByClassName (QString className)
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_table_set-members.html b/doc/html/class_table_set-members.html deleted file mode 100644 index 5f5e953..0000000 --- a/doc/html/class_table_set-members.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
TableSet< T > Member List
-
-
- -

This is the complete list of members for TableSet< T >, including all inherited members.

- - - - - - - - - - - - -
append(T *t) (defined in TableSet< T >)TableSet< T >
append(QList< T * > t) (defined in TableSet< T >)TableSet< T >
at(int i) const (defined in TableSet< T >)TableSet< T >
createQuery() (defined in TableSet< T >)TableSet< T >
length() const (defined in TableSet< T >)TableSet< T >
operator[](int i) const (defined in TableSet< T >)TableSet< T >
remove(T *t) (defined in TableSet< T >)TableSet< T >
remove(QList< T * > t) (defined in TableSet< T >)TableSet< T >
TableSet(Database *parent) (defined in TableSet< T >)TableSet< T >
TableSet(Table *parent) (defined in TableSet< T >)TableSet< T >
type() const (defined in TableSet< T >)TableSet< T >
- - - - diff --git a/doc/html/class_table_set.html b/doc/html/class_table_set.html deleted file mode 100644 index f712144..0000000 --- a/doc/html/class_table_set.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - -Nut: TableSet< T > Class Template Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
TableSet< T > Class Template Reference
-
-
- - - - - - - - - - - - - -

-Public Member Functions

TableSet (Database *parent)
TableSet (Table *parent)
-void append (T *t)
-void append (QList< T * > t)
-void remove (T *t)
-void remove (QList< T * > t)
-T type () const
-int length () const
-T * at (int i) const
-const T & operator[] (int i) const
-Query< T > * createQuery ()
-
The documentation for this class was generated from the following file: -
- - - - diff --git a/doc/html/class_table_set.png b/doc/html/class_table_set.png deleted file mode 100644 index a52c7279bf552913b4e7621061805fd3fafccde1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 490 zcmeAS@N?(olHy`uVBq!ia0vp^F+d!^!3-o9e|{tgq$C1-LR|m<{|{uoc=NTi|Ih>= z3ycpOIKbL@M;^%KC<*clW&kPzfvcxNj2IXgD?MEtLn;{G&b`?8T7k!fzxm4l|4-I3 zS+JSkoqcuJrK>@uQU=eC@Py4@x%HY(psJ?3w4SHq{Ko0uBtP11sPrz_yw7=(-c#-G zGa2i8mc103xWrZP-YL!V>HNJ1Dx1C~f2eEtSiMjGfb|Q7h(_K-&*x3vGd8c!jV!-0 zGi}G`nmwx{#T)L$@rmvnVhZYKl$?0ZOksY77iEM zm|0M%zmgT2OH(?TCM@P<=lI1@6SKbcZ?ejdTzx6Ngh{LK=(GJWj9O;Qo)Fluoon91 zZx+nyQVw3*8H~CS?R93P39E)VqNu12Y>6a&tEnFSn{V+( Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set_base.html"]; - Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _table" ,fontname="Helvetica"]; - Node3 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; - Node4 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _database" ,fontname="Helvetica"]; - Node4 [label="Database",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database.html",tooltip="Database class."]; -} diff --git a/doc/html/class_table_set__coll__graph.md5 b/doc/html/class_table_set__coll__graph.md5 deleted file mode 100644 index 5633186..0000000 --- a/doc/html/class_table_set__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -90264495d23d131df80ff722d3f65da4 \ No newline at end of file diff --git a/doc/html/class_table_set__inherit__graph.dot b/doc/html/class_table_set__inherit__graph.dot deleted file mode 100644 index aabd13a..0000000 --- a/doc/html/class_table_set__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "TableSet< T >" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="TableSet\< T \>",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set_base.html"]; -} diff --git a/doc/html/class_table_set__inherit__graph.md5 b/doc/html/class_table_set__inherit__graph.md5 deleted file mode 100644 index 2491ae5..0000000 --- a/doc/html/class_table_set__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -f21d19525cb44d8b50ee7d327a2f06ea \ No newline at end of file diff --git a/doc/html/class_table_set_base-members.html b/doc/html/class_table_set_base-members.html deleted file mode 100644 index 446ca14..0000000 --- a/doc/html/class_table_set_base-members.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - -Nut: Member List - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
-
-
TableSetBase Member List
-
-
- -

This is the complete list of members for TableSetBase, including all inherited members.

- - - - - - - - - - - - - - - -
_childClassName (defined in TableSetBase)TableSetBaseprotected
_database (defined in TableSetBase)TableSetBaseprotected
_table (defined in TableSetBase)TableSetBaseprotected
_tableName (defined in TableSetBase)TableSetBaseprotected
_tables (defined in TableSetBase)TableSetBaseprotected
_tablesList (defined in TableSetBase)TableSetBaseprotected
add(Table *t) (defined in TableSetBase)TableSetBase
childClassName() const (defined in TableSetBase)TableSetBase
clearChilds() (defined in TableSetBase)TableSetBase
database() const (defined in TableSetBase)TableSetBase
save(Database *db) (defined in TableSetBase)TableSetBasevirtual
setDatabase(Database *database) (defined in TableSetBase)TableSetBase
TableSetBase(Database *parent) (defined in TableSetBase)TableSetBase
TableSetBase(Table *parent) (defined in TableSetBase)TableSetBase
- - - - diff --git a/doc/html/class_table_set_base.html b/doc/html/class_table_set_base.html deleted file mode 100644 index 849c974..0000000 --- a/doc/html/class_table_set_base.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - -Nut: TableSetBase Class Reference - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- -
-
- -
-
TableSetBase Class Reference
-
-
-
-Inheritance diagram for TableSetBase:
-
-
- - -TableSet< T > - -
- - - - - - - - - - -

-Public Member Functions

TableSetBase (Database *parent)
TableSetBase (Table *parent)
-virtual void save (Database *db)
-void clearChilds ()
-void add (Table *t)
-QString childClassName () const
-Databasedatabase () const
-void setDatabase (Database *database)
- - - - - - - -

-Protected Attributes

-QSet< Table * > _tables
-QList< Table * > _tablesList
-QString _tableName
-Database_database
-Table_table
-QString _childClassName
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_table_set_base.png b/doc/html/class_table_set_base.png deleted file mode 100644 index 363fb34694f87553926e805b63adf43a7c38bb1f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 495 zcmeAS@N?(olHy`uVBq!ia0vp^F+d!^!3-o9e|{tgq$C1-LR|m<{|{uoc=NTi|Ih>= z3ycpOIKbL@M;^%KC<*clW&kPzfvcxNj2IXg>pWc?Ln;{G&gITKtRUbb-~8ma{LYm> zb=P=4)^b_p^=M-v@A=(_B2<|UNab2ITuy)Rv?lwG-6^Ks`fnL#oJz|JxB6lE zYMC=j!i4taC2}9XWHg33?h38YTX0ABgVN68@{{Xo7wcu|pJ}T5dS_ap``VT5(&tZa zuWMSaTkKYwpSyA?Z>-_QrR(>ZFSHK`zEyBQzq;<_hurhQ$~*E_*2dYc;Cphd@}4e3 z{?#^S3y=e{DmWB%gbwh^GOXSrR42pzQu`tQH>+PkKjhy{<7NMFtAJrSFM9zh^~?N& zL~>26dynBhokc2ZFSdD4y6pZy@voN!|0^3^17pv(QfBd~dGSE6NG+3%pX6p)aZ15v zo@EG=?rEXjyyq884p{f6cbA5Hc8-t{?|9?a)=^XxgjPkQ>vsk*jzWI|`B-F~M2 z=gKs_;?I|S-lyArzH_Ml{m=5N&-cHdcI)}h%6DbmDtp7F^*sGRc=bcWV>>+J%Zo&8 UYJ_Lb2F4D9r>mdKI;Vst0HS!=p8x;= diff --git a/doc/html/class_table_set_base__coll__graph.dot b/doc/html/class_table_set_base__coll__graph.dot deleted file mode 100644 index bed16e2..0000000 --- a/doc/html/class_table_set_base__coll__graph.dot +++ /dev/null @@ -1,10 +0,0 @@ -digraph "TableSetBase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _table" ,fontname="Helvetica"]; - Node2 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; - Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _database" ,fontname="Helvetica"]; - Node3 [label="Database",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database.html",tooltip="Database class."]; -} diff --git a/doc/html/class_table_set_base__coll__graph.md5 b/doc/html/class_table_set_base__coll__graph.md5 deleted file mode 100644 index 076fc07..0000000 --- a/doc/html/class_table_set_base__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -84029e71d91ab60f169ee476e2c01af7 \ No newline at end of file diff --git a/doc/html/class_table_set_base__inherit__graph.dot b/doc/html/class_table_set_base__inherit__graph.dot deleted file mode 100644 index 25e8f4c..0000000 --- a/doc/html/class_table_set_base__inherit__graph.dot +++ /dev/null @@ -1,10 +0,0 @@ -digraph "TableSetBase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="TableSet\< T \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set.html"]; - Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="TableSet\< ChangeLogTable \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set.html"]; -} diff --git a/doc/html/class_table_set_base__inherit__graph.md5 b/doc/html/class_table_set_base__inherit__graph.md5 deleted file mode 100644 index 600fa5f..0000000 --- a/doc/html/class_table_set_base__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -92dcbf78b057869573baa6087debe2ad \ No newline at end of file diff --git a/doc/html/class_where_phrase-members.html b/doc/html/class_where_phrase-members.html deleted file mode 100644 index 4364cb6..0000000 --- a/doc/html/class_where_phrase-members.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
WherePhrase Member List
-
-
- -

This is the complete list of members for WherePhrase, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_data (defined in WherePhrase)WherePhraseprotected
_dataPointer (defined in WherePhrase)WherePhraseprotected
data() const (defined in WherePhrase)WherePhrase
operator!=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator!=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator&(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator&&(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator*(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator+(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator-(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator/(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<(const QVariant &other) (defined in WherePhrase)WherePhrase
operator<=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator<=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator==(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator==(const QVariant &other) (defined in WherePhrase)WherePhrase
operator>(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator>(const QVariant &other) (defined in WherePhrase)WherePhrase
operator>=(const WherePhrase &other) (defined in WherePhrase)WherePhrase
operator>=(const QVariant &other) (defined in WherePhrase)WherePhrase
operator||(const WherePhrase &other) (defined in WherePhrase)WherePhrase
WherePhrase(const char *className, const char *s) (defined in WherePhrase)WherePhrase
WherePhrase(const WherePhrase &l) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o, WherePhrase *r) (defined in WherePhrase)WherePhrase
WherePhrase(WherePhrase *l, PhraseData::Condition o, QVariant r) (defined in WherePhrase)WherePhrase
~WherePhrase() (defined in WherePhrase)WherePhrase
- - - - diff --git a/doc/html/class_where_phrase.html b/doc/html/class_where_phrase.html deleted file mode 100644 index 8600024..0000000 --- a/doc/html/class_where_phrase.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - -Nut: WherePhrase Class Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
WherePhrase Class Reference
-
-
-
-Inheritance diagram for WherePhrase:
-
-
- - -FieldPhrase - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Public Member Functions

WherePhrase (const char *className, const char *s)
WherePhrase (const WherePhrase &l)
WherePhrase (WherePhrase *l)
WherePhrase (WherePhrase *l, PhraseData::Condition o)
WherePhrase (WherePhrase *l, PhraseData::Condition o, WherePhrase *r)
WherePhrase (WherePhrase *l, PhraseData::Condition o, QVariant r)
-WherePhrase operator== (const WherePhrase &other)
-WherePhrase operator!= (const WherePhrase &other)
-WherePhrase operator< (const WherePhrase &other)
-WherePhrase operator> (const WherePhrase &other)
-WherePhrase operator<= (const WherePhrase &other)
-WherePhrase operator>= (const WherePhrase &other)
-WherePhrase operator= (const WherePhrase &other)
-WherePhrase operator+ (const WherePhrase &other)
-WherePhrase operator- (const WherePhrase &other)
-WherePhrase operator* (const WherePhrase &other)
-WherePhrase operator/ (const WherePhrase &other)
-WherePhrase operator&& (const WherePhrase &other)
-WherePhrase operator|| (const WherePhrase &other)
-WherePhrase operator& (const WherePhrase &other)
-WherePhrase operator== (const QVariant &other)
-WherePhrase operator!= (const QVariant &other)
-WherePhrase operator< (const QVariant &other)
-WherePhrase operator> (const QVariant &other)
-WherePhrase operator<= (const QVariant &other)
-WherePhrase operator>= (const QVariant &other)
-PhraseDatadata () const
- - - -

-Protected Attributes

-PhraseData_data
-QSharedPointer< PhraseData_dataPointer
-
The documentation for this class was generated from the following files: -
- - - - diff --git a/doc/html/class_where_phrase.png b/doc/html/class_where_phrase.png deleted file mode 100644 index ce299410db8ca4c5b2761fa3e2f891ff0ce6f6a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmV;%0XhDOP)vTJkN^MxkN^Mxkifve1&Q1r00008bW%=J0RR90|NsC0)yh;d00041Nklh(ar6hm>Ct+2+X_MPrp|SID&i(+Tl#+{(0Kh>({$cWKIdy&3 z(et~Ex5?+v`{Z2MtHPS1YSkGn)IZbte3X)(SKIct)|z2fNIf%!pW)iIM>xNq$Pd358NeB<*(ZnIJMS8kN9+Oq)wpHz^83;>o~ z$tk7eApls`1^_N{BX64*+Ks$}ozQ;dKRFvg2GFh`2N?h?1v$t7U@6E!1^`R{pDZG> zs!c>>RS=SNP>_FtobqR1+nu_cAr&LZ8}($8?4-zgCCMk5qxKU2NpAC}yn1UQ+lC Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _data" ,fontname="Helvetica"]; - Node2 [label="PhraseData",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_phrase_data.html"]; - Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" right\nleft" ,fontname="Helvetica"]; -} diff --git a/doc/html/class_where_phrase__coll__graph.md5 b/doc/html/class_where_phrase__coll__graph.md5 deleted file mode 100644 index b71752f..0000000 --- a/doc/html/class_where_phrase__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -d0d928bba89abe7480bf303b70fd3f5f \ No newline at end of file diff --git a/doc/html/class_where_phrase__inherit__graph.dot b/doc/html/class_where_phrase__inherit__graph.dot deleted file mode 100644 index 89d9809..0000000 --- a/doc/html/class_where_phrase__inherit__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "WherePhrase" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="WherePhrase",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="FieldPhrase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_field_phrase.html"]; -} diff --git a/doc/html/class_where_phrase__inherit__graph.md5 b/doc/html/class_where_phrase__inherit__graph.md5 deleted file mode 100644 index 738e125..0000000 --- a/doc/html/class_where_phrase__inherit__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -8f3496018ead8706b4f6c07c575a5d83 \ No newline at end of file diff --git a/doc/html/classes.html b/doc/html/classes.html deleted file mode 100644 index dff4f90..0000000 --- a/doc/html/classes.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - -Nut: Class Index - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Class Index
-
-
-
C | D | F | M | P | Q | R | S | T | W
- - - - - - - - - - - - -
  C  
-
FieldPhrase   
  Q  
-
SqlServerGenerator   
  M  
-
  T  
-
ChangeLogTable   Query   
  D  
-
MySqlGenerator   
  R  
-
Table   
  P  
-
TableModel   
Database   RelationModel   TableSet   
DatabaseModel   PhraseData   
  S  
-
  W  
-
  F  
-
PostgreSqlGenerator   
SqliteGenerator   WherePhrase   
FieldModel   
-
C | D | F | M | P | Q | R | S | T | W
-
- - - - diff --git a/doc/html/closed.png b/doc/html/closed.png deleted file mode 100644 index 98cc2c909da37a6df914fbf67780eebd99c597f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{V-kvUwAr*{o@8{^CZMh(5KoB^r_<4^zF@3)Cp&&t3hdujKf f*?bjBoY!V+E))@{xMcbjXe@)LtDnm{r-UW|*e5JT diff --git a/doc/html/database_8h_source.html b/doc/html/database_8h_source.html deleted file mode 100644 index 22aa65d..0000000 --- a/doc/html/database_8h_source.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - -Nut: src/database.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
database.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef DATABASE_H
-
22 #define DATABASE_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include <QtCore/QList>
-
26 #include <QtSql/QSqlDatabase>
-
27 
-
28 #include "defines.h"
-
29 #include "tableset.h"
-
30 
-
31 QT_BEGIN_NAMESPACE
-
32 
-
33 class DatabaseModel;
-
34 class DatabasePrivate;
-
35 class TableSetBase;
-
36 class SqlGeneratorBase;
-
37 class NUT_EXPORT Database : public QObject
-
38 {
-
39  Q_OBJECT
-
40 
-
41  DatabasePrivate *d_ptr;
-
42  Q_DECLARE_PRIVATE(Database)
-
43 
-
44 public:
-
45  Database(QObject *parent = 0);
-
46 
-
47  bool open();
-
48  void close();
-
49 
-
50  QSqlQuery exec(QString sql);
-
51 
-
52  void add(TableSetBase *);
-
53  void saveChanges();
-
54  void cleanUp();
-
55 
-
56  QString databaseName() const;
-
57  QString hostName() const;
-
58  int port() const;
-
59  QString userName() const;
-
60  QString password() const;
-
61  QString connectionName() const;
-
62  QString driver() const;
-
63 
-
64  DatabaseModel model() const;
-
65  QString tableName(QString className);
-
66 
-
67  SqlGeneratorBase *sqlGenertor() const;
-
68 
-
69 protected:
-
70  virtual void databaseUpdated(int oldMajor, int oldMinor, int newMajor, int newMinor);
-
71 
-
72 public slots:
-
73  void setDatabaseName(QString databaseName);
-
74  void setHostName(QString hostName);
-
75  void setPort(int port);
-
76  void setUserName(QString userName);
-
77  void setPassword(QString password);
-
78  void setConnectionName(QString connectionName);
-
79  void setDriver(QString driver);
-
80 
-
81 private:
-
82  QSet<TableSetBase*> tableSets;
-
83 };
-
84 
-
85 QT_END_NAMESPACE
-
86 
-
87 #endif // DATABASE_H
-
- - - - diff --git a/doc/html/database__p_8h_source.html b/doc/html/database__p_8h_source.html deleted file mode 100644 index 35e082a..0000000 --- a/doc/html/database__p_8h_source.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - -Nut: src/database_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
database_p.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef DATABASE_P_H
-
22 #define DATABASE_P_H
-
23 
-
24 #include "database.h"
-
25 #include "databasemodel.h"
-
26 #include "changelogtable.h"
-
27 
-
28 #include <QDebug>
-
29 
-
30 QT_BEGIN_NAMESPACE
-
31 
- -
33 {
-
34  Database *q_ptr;
-
35  Q_DECLARE_PUBLIC(Database)
-
36 
-
37 public:
-
38  DatabasePrivate(Database *parent);
-
39 
-
40 
-
41  bool open();
-
42 
-
43  bool updateDatabase();
-
44  void createChangeLogs();
-
45  bool storeScheemaInDB();
-
46  DatabaseModel getLastScheema();
-
47  QVariantMap getCurrectScheema();
-
48 
-
49  QSqlDatabase db;
-
50 
-
51  QString hostName;
-
52  QString databaseName;
-
53  int port;
-
54  QString userName;
-
55  QString password;
-
56  QString connectionName;
-
57  QString driver;
-
58 
-
59  QHash<QString, QString> tables;
-
60 
-
61  SqlGeneratorBase *sqlGenertor;
-
62  DatabaseModel currentModel;
-
63 
-
64  TableSet<ChangeLogTable> *changeLogs;
-
65 };
-
66 
-
67 QT_END_NAMESPACE
-
68 
-
69 #endif // DATABASE_P_H
-
- - - - diff --git a/doc/html/databasemodel_8h_source.html b/doc/html/databasemodel_8h_source.html deleted file mode 100644 index 55e4619..0000000 --- a/doc/html/databasemodel_8h_source.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - -Nut: src/databasemodel.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
databasemodel.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef DATABASEMODEL_H
-
22 #define DATABASEMODEL_H
-
23 
-
24 #include <QtCore/QList>
-
25 
-
26 QT_BEGIN_NAMESPACE
-
27 
-
28 class TableModel;
-
29 struct RelationModel;
-
30 class QJsonObject;
-
31 class DatabaseModel : public QList<TableModel*>
-
32 {
-
33  int _versionMajor, _versionMinor;
-
34 public:
-
35  DatabaseModel();
-
36 
-
37  TableModel *model(QString tableName) const;
-
38  TableModel *modelByClass(QString className) const;
-
39 
-
40  RelationModel *relationByClassNames(QString masterClassName, QString childClassName);
-
41  RelationModel *relationByTableNames(QString masterTableName, QString childTableName);
-
42 
-
43  bool operator ==(const DatabaseModel &other) const;
-
44 
-
45  static DatabaseModel fromJson(QJsonObject &json);
-
46  QJsonObject toJson() const;
-
47 
-
48  int versionMajor() const;
-
49  void setVersionMajor(int versionMajor);
-
50 
-
51  int versionMinor() const;
-
52  void setVersionMinor(int versionMinor);
-
53 };
-
54 
-
55 QT_END_NAMESPACE
-
56 
-
57 #endif // DATABASEMODEL_H
-
- - - - diff --git a/doc/html/defines_8h_source.html b/doc/html/defines_8h_source.html deleted file mode 100644 index 556e254..0000000 --- a/doc/html/defines_8h_source.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - -Nut: src/defines.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
defines.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef SYNTAX_DEFINES_H
-
22 #define SYNTAX_DEFINES_H
-
23 
-
24 #include "qglobal.h"
-
25 #include "defines_p.h"
-
26 
-
27 #define QT_NAMESPACE Nut
-
28 
-
29 #ifdef NUT_COMPILE_STATIC
-
30 # define NUT_EXPORT
-
31 #else
-
32 # define NUT_EXPORT Q_DECL_EXPORT
-
33 #endif
-
34 
-
35 // Database
-
36 #define NUT_DB_VERSION(major, minor) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), QT_STRINGIFY(#major "." #minor))
-
37 
-
38 #define NUT_DECLARE_TABLE(type, name) \
-
39  Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \
-
40  Q_PROPERTY(type* name READ name) \
-
41  Q_PROPERTY(TableSet<type> name##s READ name##s) \
-
42  type* m_##name; \
-
43  TableSet<type> *m_##name##s; \
-
44 public: \
-
45  static const type _##name; \
-
46  type* name() const{ return m_##name; } \
-
47  TableSet<type> *name##s() const { return m_##name##s; }
-
48 
-
49 //Table
-
50 #define NUT_DECLARE_FIELD(type, name, read, write) \
-
51  Q_PROPERTY(type name READ read WRITE write) \
-
52  Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name " " __nut_FIELD), #name) \
-
53  type m_##name; \
-
54 public: \
-
55  static FieldPhrase name##Field(){ \
-
56  static FieldPhrase f = FieldPhrase(staticMetaObject.className(), #name); \
-
57  return f; \
-
58  } \
-
59  type read() const{ \
-
60  return m_##name; \
-
61  } \
-
62  void write(type name){ \
-
63  m_##name = name; \
-
64  propertyChanged(#name); \
-
65  }
-
66 
-
67 #define NUT_FOREGION_KEY(type, keytype, name, read, write) \
-
68  Q_PROPERTY(type* name READ read WRITE write) \
-
69  NUT_DECLARE_FIELD(keytype, name##Id, read##Id, write##Id) \
-
70  Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name "Id " __nut_FOREGION_KEY), #type) \
-
71  type *m_##name; \
-
72 public: \
-
73  type *read() const { return m_##name ; } \
-
74  void write(type *name){ \
-
75  m_##name = name; \
-
76  }
-
77 
-
78 #define NUT_DECLARE_CHILD_TABLE(type, n) \
-
79  private: \
-
80  TableSet<type> *m_##n; \
-
81  public: \
-
82  static type *n##Table(){ \
-
83  static type *f = new type(); \
-
84  return f; \
-
85  } \
-
86  TableSet<type> *n(){ \
-
87  return m_##n; \
-
88  }
-
89 
-
90 
-
91 #define NUT_INDEX(name, field, order)
-
92 #define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x)
-
93 #define NUT_AUTO_INCREMENT(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_AUTO_INCREMENT), #x)
-
94 #define NUT_PRIMARY_AUTO_INCREMENT(x) NUT_PRIMARY_KEY(x) \
-
95  NUT_AUTO_INCREMENT(x)
-
96 #define NUT_UNIQUE(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_UNIQUE), #x)
-
97 #define NUT_LEN(x, n) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_LEN), #n)
-
98 #define NUT_DEFAULT_VALUE(x, n) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_DEFAULT_VALUE), #n)
-
99 #define NUT_NOT_NULL(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_NOT_NULL), "1")
-
100 
-
101 #ifndef NUT_NO_KEYWORDS
-
102 # define FROM(x) /*QScopedPointer<QueryBase*>*/(x->createQuery())
-
103 # define WHERE(x) ->setWhere(x)
-
104 # define JOIN(x) ->join(#x)
-
105 # define ORDERBY(x) ->orderBy(#x, "ASC");
-
106 # define ORDERBY_DESC(x) ->orderBy(#x, "DESC");
-
107 
-
108 # define SELECT() ->toList()
-
109 # define COUNT() ->count()
-
110 # define DELETE() ->remove()
-
111 # define FIRST() ->first()
-
112 #endif // NUT_NO_KEYWORDS
-
113 
-
114 
-
115 
-
116 #endif // SYNTAX_DEFINES_H
-
- - - - diff --git a/doc/html/defines__p_8h_source.html b/doc/html/defines__p_8h_source.html deleted file mode 100644 index 7de61c5..0000000 --- a/doc/html/defines__p_8h_source.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - -Nut: src/defines_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
defines_p.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef DEFINES_P_H
-
22 #define DEFINES_P_H
-
23 
-
24 #define __NAME "name"
-
25 #define __TYPE "type"
-
26 #define __FIELDS "fields"
-
27 #define __nut_FIELD "field"
-
28 
-
29 #define __nut_DB_VERSION "database_version"
-
30 #define __nut_NAME_PERFIX "nut_db_key::"
-
31 #define __nut_PRIMARY_KEY "primary_key"
-
32 #define __nut_AUTO_INCREMENT "auto_increment"
-
33 #define __nut_UNIQUE "unique"
-
34 #define __nut_TABLE "table"
-
35 #define __nut_TABLE_NAME "table_name"
-
36 
-
37 #define __nut_LEN "len"
-
38 #define __nut_DEFAULT_VALUE "def"
-
39 #define __nut_NOT_NULL "notnull"
-
40 
-
41 #define __nut_FOREGION_KEY "foregion_key"
-
42 #define __nut_NEW "new"
-
43 #define __nut_REMOVE "remove"
-
44 #define __nut_CHANGE "change"
-
45 
-
46 #endif // DEFINES_P_H
-
- - - - diff --git a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html deleted file mode 100644 index 1bef402..0000000 --- a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - -Nut: src/ Directory Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
src Directory Reference
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-Files

file  changelogtable.cpp
file  changelogtable.h [code]
file  database.cpp
file  database.h [code]
file  databasemodel.cpp
file  databasemodel.h [code]
file  defines.h [code]
file  mysqlgenerator.cpp
file  mysqlgenerator.h [code]
file  postgresqlgenerator.cpp
file  postgresqlgenerator.h [code]
file  query.cpp
file  query.h [code]
file  querybase.cpp
file  sqlgeneratorbase.cpp
file  sqlitegenerator.cpp
file  sqlitegenerator.h [code]
file  sqlservergenerator.cpp
file  sqlservergenerator.h [code]
file  table.cpp
file  table.h [code]
file  tablemodel.cpp
file  tablemodel.h [code]
file  tableset.cpp
file  tableset.h [code]
file  tablesetbase.cpp
file  wherephrase.cpp
file  wherephrase.h [code]
-
- - - - diff --git a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.dot b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.dot deleted file mode 100644 index 771c667..0000000 --- a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.dot +++ /dev/null @@ -1,6 +0,0 @@ -digraph "src/" { - compound=true - node [ fontsize="10", fontname="Helvetica"]; - edge [ labelfontsize="10", labelfontname="Helvetica"]; - dir_68267d1309a1af8e8297ef4c3efbcdba [shape=box, label="src", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"]; -} diff --git a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 deleted file mode 100644 index 232647c..0000000 --- a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 +++ /dev/null @@ -1 +0,0 @@ -d20f30a36274e113bcc267fb4ea2e5c7 \ No newline at end of file diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css deleted file mode 100644 index 0c559a0..0000000 --- a/doc/html/doxygen.css +++ /dev/null @@ -1,1163 +0,0 @@ -/* The standard CSS for doxygen */ - -body, table, div, p, dl { - font: 400 14px/19px Roboto,sans-serif; -} - -/* @group Heading Levels */ - -h1 { - font-size: 150%; -} - -.title { - font-size: 150%; - font-weight: bold; - margin: 10px 2px; -} - -h2 { - border-bottom: 1px solid #879ECB; - color: #354C7B; - font-size: 150%; - font-weight: normal; - margin-top: 1.75em; - padding-top: 8px; - padding-bottom: 4px; - width: 100%; -} - -h3 { - font-size: 100%; -} - -h1, h2, h3, h4, h5, h6 { - -webkit-transition: text-shadow 0.5s linear; - -moz-transition: text-shadow 0.5s linear; - -ms-transition: text-shadow 0.5s linear; - -o-transition: text-shadow 0.5s linear; - transition: text-shadow 0.5s linear; - margin-right: 15px; -} - -h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { - text-shadow: 0 0 15px cyan; -} - -dt { - font-weight: bold; -} - -div.multicol { - -moz-column-gap: 1em; - -webkit-column-gap: 1em; - -moz-column-count: 3; - -webkit-column-count: 3; -} - -p.startli, p.startdd, p.starttd { - margin-top: 2px; -} - -p.endli { - margin-bottom: 0px; -} - -p.enddd { - margin-bottom: 4px; -} - -p.endtd { - margin-bottom: 2px; -} - -/* @end */ - -caption { - font-weight: bold; -} - -span.legend { - font-size: 70%; - text-align: center; -} - -h3.version { - font-size: 90%; - text-align: center; -} - -div.qindex, div.navtab{ - background-color: #EBEFF6; - border: 1px solid #A3B4D7; - text-align: center; -} - -div.qindex, div.navpath { - width: 100%; - line-height: 140%; -} - -div.navtab { - margin-right: 15px; -} - -/* @group Link Styling */ - -a { - color: #3D578C; - font-weight: normal; - text-decoration: none; -} - -.contents a:visited { - color: #4665A2; -} - -a:hover { - text-decoration: underline; -} - -a.qindex { - font-weight: bold; -} - -a.qindexHL { - font-weight: bold; - background-color: #9CAFD4; - color: #ffffff; - border: 1px double #869DCA; -} - -.contents a.qindexHL:visited { - color: #ffffff; -} - -a.el { - font-weight: bold; -} - -a.elRef { -} - -a.code, a.code:visited { - color: #4665A2; -} - -a.codeRef, a.codeRef:visited { - color: #4665A2; -} - -/* @end */ - -dl.el { - margin-left: -1cm; -} - -pre.fragment { - border: 1px solid #C4CFE5; - background-color: #FBFCFD; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; - font-family: monospace, fixed; - font-size: 105%; -} - -div.fragment { - padding: 4px; - margin: 4px; - background-color: #FBFCFD; - border: 1px solid #C4CFE5; -} - -div.line { - font-family: monospace, fixed; - font-size: 13px; - min-height: 13px; - line-height: 1.0; - text-wrap: unrestricted; - white-space: -moz-pre-wrap; /* Moz */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ - text-indent: -53px; - padding-left: 53px; - padding-bottom: 0px; - margin: 0px; - -webkit-transition-property: background-color, box-shadow; - -webkit-transition-duration: 0.5s; - -moz-transition-property: background-color, box-shadow; - -moz-transition-duration: 0.5s; - -ms-transition-property: background-color, box-shadow; - -ms-transition-duration: 0.5s; - -o-transition-property: background-color, box-shadow; - -o-transition-duration: 0.5s; - transition-property: background-color, box-shadow; - transition-duration: 0.5s; -} - -div.line.glow { - background-color: cyan; - box-shadow: 0 0 10px cyan; -} - - -span.lineno { - padding-right: 4px; - text-align: right; - border-right: 2px solid #0F0; - background-color: #E8E8E8; - white-space: pre; -} -span.lineno a { - background-color: #D8D8D8; -} - -span.lineno a:hover { - background-color: #C8C8C8; -} - -div.ah { - background-color: black; - font-weight: bold; - color: #ffffff; - margin-bottom: 3px; - margin-top: 3px; - padding: 0.2em; - border: solid thin #333; - border-radius: 0.5em; - -webkit-border-radius: .5em; - -moz-border-radius: .5em; - box-shadow: 2px 2px 3px #999; - -webkit-box-shadow: 2px 2px 3px #999; - -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; - background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); - background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); -} - -div.groupHeader { - margin-left: 16px; - margin-top: 12px; - font-weight: bold; -} - -div.groupText { - margin-left: 16px; - font-style: italic; -} - -body { - background-color: white; - color: black; - margin: 0; -} - -div.contents { - margin-top: 10px; - margin-left: 12px; - margin-right: 8px; -} - -td.indexkey { - background-color: #EBEFF6; - font-weight: bold; - border: 1px solid #C4CFE5; - margin: 2px 0px 2px 0; - padding: 2px 10px; - white-space: nowrap; - vertical-align: top; -} - -td.indexvalue { - background-color: #EBEFF6; - border: 1px solid #C4CFE5; - padding: 2px 10px; - margin: 2px 0px; -} - -tr.memlist { - background-color: #EEF1F7; -} - -p.formulaDsp { - text-align: center; -} - -img.formulaDsp { - -} - -img.formulaInl { - vertical-align: middle; -} - -div.center { - text-align: center; - margin-top: 0px; - margin-bottom: 0px; - padding: 0px; -} - -div.center img { - border: 0px; -} - -address.footer { - text-align: right; - padding-right: 12px; -} - -img.footer { - border: 0px; - vertical-align: middle; -} - -/* @group Code Colorization */ - -span.keyword { - color: #008000 -} - -span.keywordtype { - color: #604020 -} - -span.keywordflow { - color: #e08000 -} - -span.comment { - color: #800000 -} - -span.preprocessor { - color: #806020 -} - -span.stringliteral { - color: #002080 -} - -span.charliteral { - color: #008080 -} - -span.vhdldigit { - color: #ff00ff -} - -span.vhdlchar { - color: #000000 -} - -span.vhdlkeyword { - color: #700070 -} - -span.vhdllogic { - color: #ff0000 -} - -blockquote { - background-color: #F7F8FB; - border-left: 2px solid #9CAFD4; - margin: 0 24px 0 4px; - padding: 0 12px 0 16px; -} - -/* @end */ - -/* -.search { - color: #003399; - font-weight: bold; -} - -form.search { - margin-bottom: 0px; - margin-top: 0px; -} - -input.search { - font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; -} -*/ - -td.tiny { - font-size: 75%; -} - -.dirtab { - padding: 4px; - border-collapse: collapse; - border: 1px solid #A3B4D7; -} - -th.dirtab { - background: #EBEFF6; - font-weight: bold; -} - -hr { - height: 0px; - border: none; - border-top: 1px solid #4A6AAA; -} - -hr.footer { - height: 1px; -} - -/* @group Member Descriptions */ - -table.memberdecls { - border-spacing: 0px; - padding: 0px; -} - -.memberdecls td, .fieldtable tr { - -webkit-transition-property: background-color, box-shadow; - -webkit-transition-duration: 0.5s; - -moz-transition-property: background-color, box-shadow; - -moz-transition-duration: 0.5s; - -ms-transition-property: background-color, box-shadow; - -ms-transition-duration: 0.5s; - -o-transition-property: background-color, box-shadow; - -o-transition-duration: 0.5s; - transition-property: background-color, box-shadow; - transition-duration: 0.5s; -} - -.memberdecls td.glow, .fieldtable tr.glow { - background-color: cyan; - box-shadow: 0 0 15px cyan; -} - -.mdescLeft, .mdescRight, -.memItemLeft, .memItemRight, -.memTemplItemLeft, .memTemplItemRight, .memTemplParams { - background-color: #F9FAFC; - border: none; - margin: 4px; - padding: 1px 0 0 8px; -} - -.mdescLeft, .mdescRight { - padding: 0px 8px 4px 8px; - color: #555; -} - -.memItemLeft, .memItemRight, .memTemplParams { - border-bottom: 1px solid #DEE4F0; -} - -.memItemLeft, .memTemplItemLeft { - white-space: nowrap; -} - -.memItemRight { - width: 100%; -} - -.memTemplParams { - color: #4665A2; - white-space: nowrap; -} - -/* @end */ - -/* @group Member Details */ - -/* Styles for detailed member documentation */ - -.memtemplate { - font-size: 80%; - color: #4665A2; - font-weight: normal; - margin-left: 9px; -} - -.memnav { - background-color: #EBEFF6; - border: 1px solid #A3B4D7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} - -.mempage { - width: 100%; -} - -.memitem { - padding: 0; - margin-bottom: 10px; - margin-right: 5px; - -webkit-transition: box-shadow 0.5s linear; - -moz-transition: box-shadow 0.5s linear; - -ms-transition: box-shadow 0.5s linear; - -o-transition: box-shadow 0.5s linear; - transition: box-shadow 0.5s linear; - display: table !important; - width: 100%; -} - -.memitem.glow { - box-shadow: 0 0 15px cyan; -} - -.memname { - font-weight: bold; - margin-left: 6px; -} - -.memname td { - vertical-align: bottom; -} - -.memproto, dl.reflist dt { - border-top: 1px solid #A8B8D9; - border-left: 1px solid #A8B8D9; - border-right: 1px solid #A8B8D9; - padding: 6px 0px 6px 0px; - color: #253555; - font-weight: bold; - text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - background-image:url('nav_f.png'); - background-repeat:repeat-x; - background-color: #E2E8F2; - /* opera specific markup */ - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - border-top-right-radius: 4px; - border-top-left-radius: 4px; - /* firefox specific markup */ - -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; - -moz-border-radius-topright: 4px; - -moz-border-radius-topleft: 4px; - /* webkit specific markup */ - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - -webkit-border-top-right-radius: 4px; - -webkit-border-top-left-radius: 4px; - -} - -.memdoc, dl.reflist dd { - border-bottom: 1px solid #A8B8D9; - border-left: 1px solid #A8B8D9; - border-right: 1px solid #A8B8D9; - padding: 6px 10px 2px 10px; - background-color: #FBFCFD; - border-top-width: 0; - background-image:url('nav_g.png'); - background-repeat:repeat-x; - background-color: #FFFFFF; - /* opera specific markup */ - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - /* firefox specific markup */ - -moz-border-radius-bottomleft: 4px; - -moz-border-radius-bottomright: 4px; - -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; - /* webkit specific markup */ - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -} - -dl.reflist dt { - padding: 5px; -} - -dl.reflist dd { - margin: 0px 0px 10px 0px; - padding: 5px; -} - -.paramkey { - text-align: right; -} - -.paramtype { - white-space: nowrap; -} - -.paramname { - color: #602020; - white-space: nowrap; -} -.paramname em { - font-style: normal; -} -.paramname code { - line-height: 14px; -} - -.params, .retval, .exception, .tparams { - margin-left: 0px; - padding-left: 0px; -} - -.params .paramname, .retval .paramname { - font-weight: bold; - vertical-align: top; -} - -.params .paramtype { - font-style: italic; - vertical-align: top; -} - -.params .paramdir { - font-family: "courier new",courier,monospace; - vertical-align: top; -} - -table.mlabels { - border-spacing: 0px; -} - -td.mlabels-left { - width: 100%; - padding: 0px; -} - -td.mlabels-right { - vertical-align: bottom; - padding: 0px; - white-space: nowrap; -} - -span.mlabels { - margin-left: 8px; -} - -span.mlabel { - background-color: #728DC1; - border-top:1px solid #5373B4; - border-left:1px solid #5373B4; - border-right:1px solid #C4CFE5; - border-bottom:1px solid #C4CFE5; - text-shadow: none; - color: white; - margin-right: 4px; - padding: 2px 3px; - border-radius: 3px; - font-size: 7pt; - white-space: nowrap; -} - - - -/* @end */ - -/* these are for tree view when not used as main index */ - -div.directory { - margin: 10px 0px; - border-top: 1px solid #A8B8D9; - border-bottom: 1px solid #A8B8D9; - width: 100%; -} - -.directory table { - border-collapse:collapse; -} - -.directory td { - margin: 0px; - padding: 0px; - vertical-align: top; -} - -.directory td.entry { - white-space: nowrap; - padding-right: 6px; -} - -.directory td.entry a { - outline:none; -} - -.directory td.entry a img { - border: none; -} - -.directory td.desc { - width: 100%; - padding-left: 6px; - padding-right: 6px; - padding-top: 3px; - border-left: 1px solid rgba(0,0,0,0.05); -} - -.directory tr.even { - padding-left: 6px; - background-color: #F7F8FB; -} - -.directory img { - vertical-align: -30%; -} - -.directory .levels { - white-space: nowrap; - width: 100%; - text-align: right; - font-size: 9pt; -} - -.directory .levels span { - cursor: pointer; - padding-left: 2px; - padding-right: 2px; - color: #3D578C; -} - -div.dynheader { - margin-top: 8px; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -address { - font-style: normal; - color: #2A3D61; -} - -table.doxtable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.doxtable td, table.doxtable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -table.doxtable th { - background-color: #374F7F; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -table.fieldtable { - width: 100%; - margin-bottom: 10px; - border: 1px solid #A8B8D9; - border-spacing: 0px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; - -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); - box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); -} - -.fieldtable td, .fieldtable th { - padding: 3px 7px 2px; -} - -.fieldtable td.fieldtype, .fieldtable td.fieldname { - white-space: nowrap; - border-right: 1px solid #A8B8D9; - border-bottom: 1px solid #A8B8D9; - vertical-align: top; -} - -.fieldtable td.fielddoc { - border-bottom: 1px solid #A8B8D9; - width: 100%; -} - -.fieldtable tr:last-child td { - border-bottom: none; -} - -.fieldtable th { - background-image:url('nav_f.png'); - background-repeat:repeat-x; - background-color: #E2E8F2; - font-size: 90%; - color: #253555; - padding-bottom: 4px; - padding-top: 5px; - text-align:left; - -moz-border-radius-topleft: 4px; - -moz-border-radius-topright: 4px; - -webkit-border-top-left-radius: 4px; - -webkit-border-top-right-radius: 4px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; - border-bottom: 1px solid #A8B8D9; -} - - -.tabsearch { - top: 0px; - left: 10px; - height: 36px; - background-image: url('tab_b.png'); - z-index: 101; - overflow: hidden; - font-size: 13px; -} - -.navpath ul -{ - font-size: 11px; - background-image:url('tab_b.png'); - background-repeat:repeat-x; - height:30px; - line-height:30px; - color:#8AA0CC; - border:solid 1px #C2CDE4; - overflow:hidden; - margin:0px; - padding:0px; -} - -.navpath li -{ - list-style-type:none; - float:left; - padding-left:10px; - padding-right:15px; - background-image:url('bc_s.png'); - background-repeat:no-repeat; - background-position:right; - color:#364D7C; -} - -.navpath li.navelem a -{ - height:32px; - display:block; - text-decoration: none; - outline: none; - font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; -} - -.navpath li.navelem a:hover -{ - color:#6884BD; -} - -.navpath li.footer -{ - list-style-type:none; - float:right; - padding-left:10px; - padding-right:15px; - background-image:none; - background-repeat:no-repeat; - background-position:right; - color:#364D7C; - font-size: 8pt; -} - - -div.summary -{ - float: right; - font-size: 8pt; - padding-right: 5px; - width: 50%; - text-align: right; -} - -div.summary a -{ - white-space: nowrap; -} - -div.ingroups -{ - font-size: 8pt; - width: 50%; - text-align: left; -} - -div.ingroups a -{ - white-space: nowrap; -} - -div.header -{ - background-image:url('nav_h.png'); - background-repeat:repeat-x; - background-color: #F9FAFC; - margin: 0px; - border-bottom: 1px solid #C4CFE5; -} - -div.headertitle -{ - padding: 5px 5px 5px 10px; -} - -dl -{ - padding: 0 0 0 10px; -} - -/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ -dl.section -{ - margin-left: 0px; - padding-left: 0px; -} - -dl.note -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #D0C000; -} - -dl.warning, dl.attention -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #FF0000; -} - -dl.pre, dl.post, dl.invariant -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #00D000; -} - -dl.deprecated -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #505050; -} - -dl.todo -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #00C0E0; -} - -dl.test -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #3030E0; -} - -dl.bug -{ - margin-left:-7px; - padding-left: 3px; - border-left:4px solid; - border-color: #C08050; -} - -dl.section dd { - margin-bottom: 6px; -} - - -#projectlogo -{ - text-align: center; - vertical-align: bottom; - border-collapse: separate; -} - -#projectlogo img -{ - border: 0px none; -} - -#projectname -{ - font: 300% Tahoma, Arial,sans-serif; - margin: 0px; - padding: 2px 0px; -} - -#projectbrief -{ - font: 120% Tahoma, Arial,sans-serif; - margin: 0px; - padding: 0px; -} - -#projectnumber -{ - font: 50% Tahoma, Arial,sans-serif; - margin: 0px; - padding: 0px; -} - -#titlearea -{ - padding: 0px; - margin: 0px; - width: 100%; - border-bottom: 1px solid #5373B4; -} - -.image -{ - text-align: center; -} - -.dotgraph -{ - text-align: center; -} - -.mscgraph -{ - text-align: center; -} - -.caption -{ - font-weight: bold; -} - -div.zoom -{ - border: 1px solid #90A5CE; -} - -dl.citelist { - margin-bottom:50px; -} - -dl.citelist dt { - color:#334975; - float:left; - font-weight:bold; - margin-right:10px; - padding:5px; -} - -dl.citelist dd { - margin:2px 0; - padding:5px 0; -} - -div.toc { - padding: 14px 25px; - background-color: #F4F6FA; - border: 1px solid #D8DFEE; - border-radius: 7px 7px 7px 7px; - float: right; - height: auto; - margin: 0 20px 10px 10px; - width: 200px; -} - -div.toc li { - background: url("bdwn.png") no-repeat scroll 0 5px transparent; - font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; - margin-top: 5px; - padding-left: 10px; - padding-top: 2px; -} - -div.toc h3 { - font: bold 12px/1.2 Arial,FreeSans,sans-serif; - color: #4665A2; - border-bottom: 0 none; - margin: 0; -} - -div.toc ul { - list-style: none outside none; - border: medium none; - padding: 0px; -} - -div.toc li.level1 { - margin-left: 0px; -} - -div.toc li.level2 { - margin-left: 15px; -} - -div.toc li.level3 { - margin-left: 30px; -} - -div.toc li.level4 { - margin-left: 45px; -} - -.inherit_header { - font-weight: bold; - color: gray; - cursor: pointer; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.inherit_header td { - padding: 6px 0px 2px 5px; -} - -.inherit { - display: none; -} - -tr.heading h2 { - margin-top: 12px; - margin-bottom: 4px; -} - -@media print -{ - #top { display: none; } - #side-nav { display: none; } - #nav-path { display: none; } - body { overflow:visible; } - h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } - .summary { display: none; } - .memitem { page-break-inside: avoid; } - #doc-content - { - margin-left:0 !important; - height:auto !important; - width:auto !important; - overflow:inherit; - display:inline; - } -} - diff --git a/doc/html/doxygen.png b/doc/html/doxygen.png deleted file mode 100644 index 3ff17d807fd8aa003bed8bb2a69e8f0909592fd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3779 zcmV;!4m|ORP)tMIv#Q0*~7*`IBSO7_x;@a8#Zk6_PeKR_s92J&)(m+);m9Iz3blw)z#Gi zP!9lj4$%+*>Hz@HCmM9L9|8c+0u=!H$O3?R0Kgx|#WP<6fKfC8fM-CQZT|_r@`>VO zX^Hgb|9cJqpdJA5$MCEK`F_2@2Y@s>^+;pF`~jdI0Pvr|vl4`=C)EH@1IFe7pdJ8F zH(qGi004~QnF)Ggga~8v08kGAs2hKTATxr7pwfNk|4#_AaT>w8P6TV+R2kbS$v==} zAjf`s0g#V8lB+b3)5oEI*q+{Yt$MZDruD2^;$+(_%Qn+%v0X-bJO=;@kiJ^ygLBnC z?1OVv_%aex1M@jKU|Z~$eI?PoF4Vj>fDzyo zAiLfpXY*a^Sj-S5D0S3@#V$sRW)g)_1e#$%8xdM>Jm7?!h zu0P2X=xoN>^!4DoPRgph2(2va07yfpXF+WH7EOg1GY%Zn z7~1A<(z7Q$ktEXhW_?GMpHp9l_UL18F3KOsxu81pqoBiNbFSGsof-W z6~eloMoz=4?OOnl2J268x5rOY`dCk0us(uS#Ud4yqOr@?=Q57a}tit|BhY>}~frH1sP`ScHS_d)oqH^lYy zZ%VP`#10MlE~P?cE(%(#(AUSv_T{+;t@$U}El}(1ig`vZo`Rm;+5&(AYzJ^Ae=h2X z@Re%vHwZU>|f0NI&%$*4eJweC5OROQrpPMA@*w|o z()A==l}(@bv^&>H1Ob3C=<^|hob?0+xJ?QQ3-ueQC}zy&JQNib!OqSO@-=>XzxlSF zAZ^U*1l6EEmg3r};_HY>&Jo_{dOPEFTWPmt=U&F#+0(O59^UIlHbNX+eF8UzyDR*T z(=5X$VF3!gm@RooS-&iiUYGG^`hMR(07zr_xP`d!^BH?uD>Phl8Rdifx3Af^Zr`Ku ztL+~HkVeL#bJ)7;`=>;{KNRvjmc}1}c58Sr#Treq=4{xo!ATy|c>iRSp4`dzMMVd@ zL8?uwXDY}Wqgh4mH`|$BTXpUIu6A1-cSq%hJw;@^Zr8TP=GMh*p(m(tN7@!^D~sl$ zz^tf4II4|};+irE$Fnm4NTc5%p{PRA`%}Zk`CE5?#h3|xcyQsS#iONZ z6H(@^i9td!$z~bZiJLTax$o>r(p}3o@< zyD7%(>ZYvy=6$U3e!F{Z`uSaYy`xQyl?b{}eg|G3&fz*`QH@mDUn)1%#5u`0m$%D} z?;tZ0u(mWeMV0QtzjgN!lT*pNRj;6510Wwx?Yi_=tYw|J#7@(Xe7ifDzXuK;JB;QO z#bg~K$cgm$@{QiL_3yr}y&~wuv=P=#O&Tj=Sr)aCUlYmZMcw?)T?c%0rUe1cS+o!qs_ zQ6Gp)-{)V!;=q}llyK3|^WeLKyjf%y;xHku;9(vM!j|~<7w1c*Mk-;P{T&yG) z@C-8E?QPynNQ<8f01D`2qexcVEIOU?y}MG)TAE6&VT5`rK8s(4PE;uQ92LTXUQ<>^ ztyQ@=@kRdh@ebUG^Z6NWWIL;_IGJ2ST>$t!$m$qvtj0Qmw8moN6GUV^!QKNK zHBXCtUH8)RY9++gH_TUV4^=-j$t}dD3qsN7GclJ^Zc&(j6&a_!$jCf}%c5ey`pm~1)@{yI3 zTdWyB+*X{JFw#z;PwRr5evb2!ueWF;v`B0HoUu4-(~aL=z;OXUUEtG`_$)Oxw6FKg zEzY`CyKaSBK3xt#8gA|r_|Kehn_HYVBMpEwbn9-fI*!u*eTA1ef8Mkl1=!jV4oYwWYM}i`A>_F4nhmlCIC6WLa zY%;4&@AlnaG11ejl61Jev21|r*m+?Kru3;1tFDl}#!OzUp6c>go4{C|^erwpG*&h6bspUPJag}oOkN2912Y3I?(eRc@U9>z#HPBHC?nps7H5!zP``90!Q1n80jo+B3TWXp!8Pe zwuKuLLI6l3Gv@+QH*Y}2wPLPQ1^EZhT#+Ed8q8Wo z1pTmIBxv14-{l&QVKxAyQF#8Q@NeJwWdKk>?cpiJLkJr+aZ!Me+Cfp!?FWSRf^j2k z73BRR{WSKaMkJ>1Nbx5dan5hg^_}O{Tj6u%iV%#QGz0Q@j{R^Ik)Z*+(YvY2ziBG)?AmJa|JV%4UT$k`hcOg5r9R?5>?o~JzK zJCrj&{i#hG>N7!B4kNX(%igb%kDj0fOQThC-8mtfap82PNRXr1D>lbgg)dYTQ(kbx z`Ee5kXG~Bh+BHQBf|kJEy6(ga%WfhvdQNDuOfQoe377l#ht&DrMGeIsI5C<&ai zWG$|hop2@@q5YDa)_-A?B02W;#fH!%k`daQLEItaJJ8Yf1L%8x;kg?)k)00P-lH+w z)5$QNV6r2$YtnV(4o=0^3{kmaXn*Dm0F*fU(@o)yVVjk|ln8ea6BMy%vZAhW9|wvA z8RoDkVoMEz1d>|5(k0Nw>22ZT){V<3$^C-cN+|~hKt2)){+l-?3m@-$c?-dlzQ)q- zZ)j%n^gerV{|+t}9m1_&&Ly!9$rtG4XX|WQ8`xYzGC~U@nYh~g(z9)bdAl#xH)xd5a=@|qql z|FzEil{P5(@gy!4ek05i$>`E^G~{;pnf6ftpLh$h#W?^#4UkPfa;;?bsIe&kz!+40 zI|6`F2n020)-r`pFaZ38F!S-lJM-o&inOw|66=GMeP@xQU5ghQH{~5Uh~TMTd;I9` z>YhVB`e^EVj*S7JF39ZgNf}A-0DwOcTT63ydN$I3b?yBQtUI*_fae~kPvzoD$zjX3 zoqBe#>12im4WzZ=f^4+u=!lA|#r%1`WB0-6*3BL#at`47#ebPpR|D1b)3BjT34nYY z%Ds%d?5$|{LgOIaRO{{oC&RK`O91$fqwM0(C_TALcozu*fWHb%%q&p-q{_8*2Zsi^ zh1ZCnr^UYa;4vQEtHk{~zi>wwMC5o{S=$P0X681y`SXwFH?Ewn{x-MOZynmc)JT5v zuHLwh;tLfxRrr%|k370}GofLl7thg>ACWWY&msqaVu&ry+`7+Ss>NL^%T1|z{IGMA zW-SKl=V-^{(f!Kf^#3(|T2W47d(%JVCI4JgRrT1pNz>+ietmFToNv^`gzC@&O-)+i zPQ~RwK8%C_vf%;%e>NyTp~dM5;!C|N0Q^6|CEb7Bw=Vz~$1#FA;Z*?mKSC)Hl-20s t8QyHj(g6VK0RYbl8UjE)0O0w=e*@m04r>stuEhWV002ovPDHLkV1hl;dM*F} diff --git a/doc/html/dynsections.js b/doc/html/dynsections.js deleted file mode 100644 index 116542f..0000000 --- a/doc/html/dynsections.js +++ /dev/null @@ -1,78 +0,0 @@ -function toggleVisibility(linkObj) -{ - var base = $(linkObj).attr('id'); - var summary = $('#'+base+'-summary'); - var content = $('#'+base+'-content'); - var trigger = $('#'+base+'-trigger'); - var src=$(trigger).attr('src'); - if (content.is(':visible')===true) { - content.hide(); - summary.show(); - $(linkObj).addClass('closed').removeClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); - } else { - content.show(); - summary.hide(); - $(linkObj).removeClass('closed').addClass('opened'); - $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); - } - return false; -} - -function updateStripes() -{ - $('table.directory tr'). - removeClass('even').filter(':visible:even').addClass('even'); -} -function toggleLevel(level) -{ - $('table.directory tr').each(function(){ - var l = this.id.split('_').length-1; - var i = $('#img'+this.id.substring(3)); - var a = $('#arr'+this.id.substring(3)); - if (l - - - - -Nut: File List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
File List
-
-
-
Here is a list of all documented files with brief descriptions:
-
[detail level 12]
- - - - - - - - - - - - - - -
\-src
 o*changelogtable.h
 o*database.h
 o*databasemodel.h
 o*defines.h
 o*mysqlgenerator.h
 o*postgresqlgenerator.h
 o*query.h
 o*sqlitegenerator.h
 o*sqlservergenerator.h
 o*table.h
 o*tablemodel.h
 o*tableset.h
 \*wherephrase.h
-
-
- - - - diff --git a/doc/html/ftv2blank.png b/doc/html/ftv2blank.png deleted file mode 100644 index 63c605bb4c3d941c921a4b6cfa74951e946bcb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%QnH>djv*C{Z|`mdau^P8_z}#X h?B8GEpdi4(BFDx$je&7RrDQEg&ePS;Wt~$(69Dh@6T1Ka diff --git a/doc/html/ftv2cl.png b/doc/html/ftv2cl.png deleted file mode 100644 index 132f6577bf7f085344904602815a260d29f55d9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 453 zcmV;$0XqJPP)VBF;ev;toEj8_OB0EQg5eYilIj#JZG_m^33l3^k4mtzx!TVD?g)Y$ zrvwRDSqT!wLIM$dWCIa$vtxE|mzbTzu-y&$FvF6WA2a{Wr1g}`WdPT-0JzEZ0IxAv z-Z+ejZc&H;I5-pb_SUB}04j0^V)3t{`z<7asDl2Tw3w3sP%)0^8$bhEg)IOTBcRXv zFfq~3&gvJ$F-U7mpBW8z1GY~HK&7h4^YI~Orv~wLnC0PP_dAkv;nzX{9Q|8Gv=2ca z@v)c9T;D#h`TZ2X&&$ff2wedmot995de~-s3I)yauahg;7qn*?1n?F$e+PwP37}~; z1NKUk7reVK^7A;$QRW7qAx40HHUZ<|k3U%nz(Ec`#i+q9K!dgcROAlCS?`L= v>#=f?wF5ZND!1uAfQsk;KN^4&*8~0npJiJ%2dj9(00000NkvXXu0mjfWVFf_ diff --git a/doc/html/ftv2doc.png b/doc/html/ftv2doc.png deleted file mode 100644 index 17edabff95f7b8da13c9516a04efe05493c29501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 746 zcmV7=@pnbNXRFEm&G8P!&WHG=d)>K?YZ1bzou)2{$)) zumDct!>4SyxL;zgaG>wy`^Hv*+}0kUfCrz~BCOViSb$_*&;{TGGn2^x9K*!Sf0=lV zpP=7O;GA0*Jm*tTYj$IoXvimpnV4S1Z5f$p*f$Db2iq2zrVGQUz~yq`ahn7ck(|CE z7Gz;%OP~J6)tEZWDzjhL9h2hdfoU2)Nd%T<5Kt;Y0XLt&<@6pQx!nw*5`@bq#?l*?3z{Hlzoc=Pr>oB5(9i6~_&-}A(4{Q$>c>%rV&E|a(r&;?i5cQB=} zYSDU5nXG)NS4HEs0it2AHe2>shCyr7`6@4*6{r@8fXRbTA?=IFVWAQJL&H5H{)DpM#{W(GL+Idzf^)uRV@oB8u$ z8v{MfJbTiiRg4bza<41NAzrl{=3fl_D+$t+^!xlQ8S}{UtY`e z;;&9UhyZqQRN%2pot{*Ei0*4~hSF_3AH2@fKU!$NSflS>{@tZpDT4`M2WRTTVH+D? z)GFlEGGHe?koB}i|1w45!BF}N_q&^HJ&-tyR{(afC6H7|aml|tBBbv}55C5DNP8p3 z)~jLEO4Z&2hZmP^i-e%(@d!(E|KRafiU8Q5u(wU((j8un3OR*Hvj+t diff --git a/doc/html/ftv2folderclosed.png b/doc/html/ftv2folderclosed.png deleted file mode 100644 index bb8ab35edce8e97554e360005ee9fc5bffb36e66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 616 zcmV-u0+;=XP)a9#ETzayK)T~Jw&MMH>OIr#&;dC}is*2Mqdf&akCc=O@`qC+4i z5Iu3w#1M@KqXCz8TIZd1wli&kkl2HVcAiZ8PUn5z_kG@-y;?yK06=cA0U%H0PH+kU zl6dp}OR(|r8-RG+YLu`zbI}5TlOU6ToR41{9=uz^?dGTNL;wIMf|V3`d1Wj3y!#6` zBLZ?xpKR~^2x}?~zA(_NUu3IaDB$tKma*XUdOZN~c=dLt_h_k!dbxm_*ibDM zlFX`g{k$X}yIe%$N)cn1LNu=q9_CS)*>A zsX_mM4L@`(cSNQKMFc$RtYbx{79#j-J7hk*>*+ZZhM4Hw?I?rsXCi#mRWJ=-0LGV5a-WR0Qgt<|Nqf)C-@80`5gIz45^_20000IqP)X=#(TiCT&PiIIVc55T}TU}EUh*{q$|`3@{d>{Tc9Bo>e= zfmF3!f>fbI9#GoEHh0f`i5)wkLpva0ztf%HpZneK?w-7AK@b4Itw{y|Zd3k!fH?q2 zlhckHd_V2M_X7+)U&_Xcfvtw60l;--DgZmLSw-Y?S>)zIqMyJ1#FwLU*%bl38ok+! zh78H87n`ZTS;uhzAR$M`zZ`bVhq=+%u9^$5jDplgxd44}9;IRqUH1YHH|@6oFe%z( zo4)_>E$F&^P-f(#)>(TrnbE>Pefs9~@iN=|)Rz|V`sGfHNrJ)0gJb8xx+SBmRf@1l zvuzt=vGfI)<-F9!o&3l?>9~0QbUDT(wFdnQPv%xdD)m*g%!20>Bc9iYmGAp<9YAa( z0QgYgTWqf1qN++Gqp z8@AYPTB3E|6s=WLG?xw0tm|U!o=&zd+H0oRYE;Dbx+Na9s^STqX|Gnq%H8s(nGDGJ j8vwW|`Ts`)fSK|Kx=IK@RG@g200000NkvXXu0mjfauFEA diff --git a/doc/html/ftv2lastnode.png b/doc/html/ftv2lastnode.png deleted file mode 100644 index 63c605bb4c3d941c921a4b6cfa74951e946bcb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%QnH>djv*C{Z|`mdau^P8_z}#X h?B8GEpdi4(BFDx$je&7RrDQEg&ePS;Wt~$(69Dh@6T1Ka diff --git a/doc/html/ftv2link.png b/doc/html/ftv2link.png deleted file mode 100644 index 17edabff95f7b8da13c9516a04efe05493c29501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 746 zcmV7=@pnbNXRFEm&G8P!&WHG=d)>K?YZ1bzou)2{$)) zumDct!>4SyxL;zgaG>wy`^Hv*+}0kUfCrz~BCOViSb$_*&;{TGGn2^x9K*!Sf0=lV zpP=7O;GA0*Jm*tTYj$IoXvimpnV4S1Z5f$p*f$Db2iq2zrVGQUz~yq`ahn7ck(|CE z7Gz;%OP~J6)tEZWDzjhL9h2hdfoU2)Nd%T<5Kt;Y0XLt&<@6pQx!nw*5`@bq#?l*?3z{Hlzoc=Pr>oB5(9i6~_&-}A(4{Q$>c>%rV&E|a(r&;?i5cQB=} zYSDU5nXG)NS4HEs0it2AHe2>shCyr7`6@4*6{r@8fXRbTA?=IFVWAQJL&H5H{)DpM#{W(GL+Idzf^)uRV@oB8u$ z8v{MfJbTiiRg4bza<41NAzrl{=3fl_D+$t+^!xlQ8S}{UtY`e z;;&9UhyZqQRN%2pot{*Ei0*4~hSF_3AH2@fKU!$NSflS>{@tZpDT4`M2WRTTVH+D? z)GFlEGGHe?koB}i|1w45!BF}N_q&^HJ&-tyR{(afC6H7|aml|tBBbv}55C5DNP8p3 z)~jLEO4Z&2hZmP^i-e%(@d!(E|KRafiU8Q5u(wU((j8un3OR*Hvj+t diff --git a/doc/html/ftv2mlastnode.png b/doc/html/ftv2mlastnode.png deleted file mode 100644 index 0b63f6d38c4b9ec907b820192ebe9724ed6eca22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmVkw!R34#Lv2LOS^S2tZA31X++9RY}n zChwn@Z)Wz*WWHH{)HDtJnq&A2hk$b-y(>?@z0iHr41EKCGp#T5?07*qoM6N<$f(V3Pvj6}9 diff --git a/doc/html/ftv2mnode.png b/doc/html/ftv2mnode.png deleted file mode 100644 index 0b63f6d38c4b9ec907b820192ebe9724ed6eca22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 246 zcmVkw!R34#Lv2LOS^S2tZA31X++9RY}n zChwn@Z)Wz*WWHH{)HDtJnq&A2hk$b-y(>?@z0iHr41EKCGp#T5?07*qoM6N<$f(V3Pvj6}9 diff --git a/doc/html/ftv2mo.png b/doc/html/ftv2mo.png deleted file mode 100644 index 4bfb80f76e65815989a9350ad79d8ce45380e2b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 403 zcmV;E0c`$>P)${!fXv7NWJ%@%u4(KapRY>T6_x;E zxE7kt!}Tiw8@d9Sd`rTGum>z#Q14vIm`wm1#-byD1muMi02@YNO5LRF0o!Y{`a!Ya z{^&p0Su|s705&2QxmqdexG+-zNKL3f@8gTQSJrKByfo+oNJ^-{|Mn||Q5SDwjQVsS zr1}7o5-QMs>gYIMD>GRw@$lT`z4r-_m{5U#cR{urD_)TOeY)(UD|qZ^&y`IVijqk~ xs(9-kWFr7E^!lgi8GsFK5kOY_{Xbgf0^etEU%fLevs?fG002ovPDHLkV1nB&vX1}& diff --git a/doc/html/ftv2node.png b/doc/html/ftv2node.png deleted file mode 100644 index 63c605bb4c3d941c921a4b6cfa74951e946bcb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%QnH>djv*C{Z|`mdau^P8_z}#X h?B8GEpdi4(BFDx$je&7RrDQEg&ePS;Wt~$(69Dh@6T1Ka diff --git a/doc/html/ftv2ns.png b/doc/html/ftv2ns.png deleted file mode 100644 index 72e3d71c2892d6f00e259facebc88b45f6db2e35..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 388 zcmV-~0ek+5P)f+++#cT|!CkD&4pnIkeMEUEM*>`*9>+Juji$!h-mW%M^8s9957{3nvbrz^&=u<~TAUrFROkmt%^F~Ez+-c53Lv%iH3d38!Rv?K zrb&MYAhp;Gf<}wS;9ZZq2@;!uYG;=Z>~GKE^{HD4keu}lnyqhc>kWX^tQn|warJ~h zT+rtMkdz6aHoN%z(o|&wpu@@OpJnF_z{PA)6(FHw02iHslz^(N{4*+K9)QJHR87wT iTyp>aXaF{u2lxRou|^4tux6eB0000^P)R?RzRoKvklcaQ%HF6%rK2&ZgO(-ihJ_C zzrKgp4jgO( fd_(yg|3PpEQb#9`a?Pz_00000NkvXXu0mjftR`5K diff --git a/doc/html/ftv2pnode.png b/doc/html/ftv2pnode.png deleted file mode 100644 index c6ee22f937a07d1dbfc27c669d11f8ed13e2f152..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 229 zcmV^P)R?RzRoKvklcaQ%HF6%rK2&ZgO(-ihJ_C zzrKgp4jgO( fd_(yg|3PpEQb#9`a?Pz_00000NkvXXu0mjftR`5K diff --git a/doc/html/ftv2splitbar.png b/doc/html/ftv2splitbar.png deleted file mode 100644 index fe895f2c58179b471a22d8320b39a4bd7312ec8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmeAS@N?(olHy`uVBq!ia0vp^Yzz!63>-{AmhX=Jf(#6djGiuzAr*{o?=JLmPLyc> z_*`QK&+BH@jWrYJ7>r6%keRM@)Qyv8R=enp0jiI>aWlGyB58O zFVR20d+y`K7vDw(hJF3;>dD*3-?v=<8M)@x|EEGLnJsniYK!2U1 Y!`|5biEc?d1`HDhPgg&ebxsLQ02F6;9RL6T diff --git a/doc/html/ftv2vertline.png b/doc/html/ftv2vertline.png deleted file mode 100644 index 63c605bb4c3d941c921a4b6cfa74951e946bcb48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%QnH>djv*C{Z|`mdau^P8_z}#X h?B8GEpdi4(BFDx$je&7RrDQEg&ePS;Wt~$(69Dh@6T1Ka diff --git a/doc/html/functions.html b/doc/html/functions.html deleted file mode 100644 index 4072e27..0000000 --- a/doc/html/functions.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - -Nut: Class Members - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
Here is a list of all documented class members with links to the class documentation for each member:
-
- - - - diff --git a/doc/html/functions_func.html b/doc/html/functions_func.html deleted file mode 100644 index 5823612..0000000 --- a/doc/html/functions_func.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - -Nut: Class Members - Functions - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
- - - - diff --git a/doc/html/graph_legend.dot b/doc/html/graph_legend.dot deleted file mode 100644 index 789df56..0000000 --- a/doc/html/graph_legend.dot +++ /dev/null @@ -1,22 +0,0 @@ -digraph "Graph Legend" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",fillcolor="grey75",style="filled" fontcolor="black"]; - Node10 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPublicBase.html"]; - Node11 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="red",URL="$classTruncated.html"]; - Node13 -> Node9 [dir="back",color="darkgreen",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classProtectedBase.html"]; - Node14 -> Node9 [dir="back",color="firebrick4",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPrivateBase.html"]; - Node15 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="grey75"]; - Node16 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; - Node17 -> Node16 [dir="back",color="orange",fontsize="10",style="dashed",label="< int >",fontname="Helvetica"]; - Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; - Node18 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="Helvetica"]; - Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classUsed.html"]; -} diff --git a/doc/html/graph_legend.html b/doc/html/graph_legend.html deleted file mode 100644 index 07f9403..0000000 --- a/doc/html/graph_legend.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - -Nut: Graph Legend - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
- - - - -
- -
- -
-
-
Graph Legend
-
-
-

This page explains how to interpret the graphs that are generated by doxygen.

-

Consider the following example:

-
/*! Invisible class because of truncation */
-
class Invisible { };
-
-
/*! Truncated class, inheritance relation is hidden */
-
class Truncated : public Invisible { };
-
-
/* Class not documented with doxygen comments */
-
class Undocumented { };
-
-
/*! Class that is inherited using public inheritance */
-
class PublicBase : public Truncated { };
-
-
/*! A template class */
-
template<class T> class Templ { };
-
-
/*! Class that is inherited using protected inheritance */
-
class ProtectedBase { };
-
-
/*! Class that is inherited using private inheritance */
-
class PrivateBase { };
-
-
/*! Class that is used by the Inherited class */
-
class Used { };
-
-
/*! Super class that inherits a number of other classes */
-
class Inherited : public PublicBase,
-
protected ProtectedBase,
-
private PrivateBase,
-
public Undocumented,
-
public Templ<int>
-
{
-
private:
-
Used *m_usedClass;
-
};
-

This will result in the following graph:

-
- -
-

The boxes in the above graph have the following meaning:

-
    -
  • -A filled gray box represents the struct or class for which the graph is generated.
  • -
  • -A box with a black border denotes a documented struct or class.
  • -
  • -A box with a grey border denotes an undocumented struct or class.
  • -
  • -A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • -
-

The arrows have the following meaning:

-
    -
  • -A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • -
  • -A dark green arrow is used for protected inheritance.
  • -
  • -A dark red arrow is used for private inheritance.
  • -
  • -A purple dashed arrow is used if a class is contained or used by another class. The arrow is labeled with the variable(s) through which the pointed class or struct is accessible.
  • -
  • -A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labeled with the template parameters of the instance.
  • -
-
- - - - diff --git a/doc/html/graph_legend.md5 b/doc/html/graph_legend.md5 deleted file mode 100644 index a06ed05..0000000 --- a/doc/html/graph_legend.md5 +++ /dev/null @@ -1 +0,0 @@ -387ff8eb65306fa251338d3c9bd7bfff \ No newline at end of file diff --git a/doc/html/hierarchy.html b/doc/html/hierarchy.html deleted file mode 100644 index 081bccf..0000000 --- a/doc/html/hierarchy.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - -Nut: Class Hierarchy - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
Class Hierarchy
-
-
-
This inheritance list is sorted roughly, but not completely, alphabetically:
-
- - - - diff --git a/doc/html/index.html b/doc/html/index.html deleted file mode 100644 index 73a1134..0000000 --- a/doc/html/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - -Nut: Main Page - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - -
-
-
-
Nut Documentation
-
-
-
- - - - diff --git a/doc/html/inherit_graph_0.dot b/doc/html/inherit_graph_0.dot deleted file mode 100644 index 5e9c6db..0000000 --- a/doc/html/inherit_graph_0.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="Database",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database.html",tooltip="Database class."]; -} diff --git a/doc/html/inherit_graph_0.md5 b/doc/html/inherit_graph_0.md5 deleted file mode 100644 index 80ead58..0000000 --- a/doc/html/inherit_graph_0.md5 +++ /dev/null @@ -1 +0,0 @@ -5ca3f49b5b32e85c0cf481bda271619d \ No newline at end of file diff --git a/doc/html/inherit_graph_1.dot b/doc/html/inherit_graph_1.dot deleted file mode 100644 index 42d7b40..0000000 --- a/doc/html/inherit_graph_1.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="DatabaseModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database_model.html"]; -} diff --git a/doc/html/inherit_graph_1.md5 b/doc/html/inherit_graph_1.md5 deleted file mode 100644 index a8648b3..0000000 --- a/doc/html/inherit_graph_1.md5 +++ /dev/null @@ -1 +0,0 @@ -5ce739371874f79b4785274545c71802 \ No newline at end of file diff --git a/doc/html/inherit_graph_10.dot b/doc/html/inherit_graph_10.dot deleted file mode 100644 index 8d1ab5d..0000000 --- a/doc/html/inherit_graph_10.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="TableModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_model.html"]; -} diff --git a/doc/html/inherit_graph_10.md5 b/doc/html/inherit_graph_10.md5 deleted file mode 100644 index 2938aed..0000000 --- a/doc/html/inherit_graph_10.md5 +++ /dev/null @@ -1 +0,0 @@ -f0709f891cea52872b983686df433105 \ No newline at end of file diff --git a/doc/html/inherit_graph_11.dot b/doc/html/inherit_graph_11.dot deleted file mode 100644 index 9da6f00..0000000 --- a/doc/html/inherit_graph_11.dot +++ /dev/null @@ -1,9 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="TableSetBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set_base.html"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="TableSet\< T \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_set.html"]; -} diff --git a/doc/html/inherit_graph_11.md5 b/doc/html/inherit_graph_11.md5 deleted file mode 100644 index 1a760c9..0000000 --- a/doc/html/inherit_graph_11.md5 +++ /dev/null @@ -1 +0,0 @@ -c9b8d540c0064524d169feefd072881c \ No newline at end of file diff --git a/doc/html/inherit_graph_12.dot b/doc/html/inherit_graph_12.dot deleted file mode 100644 index 1eb190c..0000000 --- a/doc/html/inherit_graph_12.dot +++ /dev/null @@ -1,9 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="WherePhrase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_where_phrase.html"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="FieldPhrase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_field_phrase.html"]; -} diff --git a/doc/html/inherit_graph_12.md5 b/doc/html/inherit_graph_12.md5 deleted file mode 100644 index 90bbdcf..0000000 --- a/doc/html/inherit_graph_12.md5 +++ /dev/null @@ -1 +0,0 @@ -36302c611c26de05ff36821856fa0842 \ No newline at end of file diff --git a/doc/html/inherit_graph_2.dot b/doc/html/inherit_graph_2.dot deleted file mode 100644 index e4c758e..0000000 --- a/doc/html/inherit_graph_2.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="DatabasePrivate",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_database_private.html"]; -} diff --git a/doc/html/inherit_graph_2.md5 b/doc/html/inherit_graph_2.md5 deleted file mode 100644 index e7be255..0000000 --- a/doc/html/inherit_graph_2.md5 +++ /dev/null @@ -1 +0,0 @@ -4072b3e6cfca64cd2c20fe3ea6df2925 \ No newline at end of file diff --git a/doc/html/inherit_graph_3.dot b/doc/html/inherit_graph_3.dot deleted file mode 100644 index e546bd3..0000000 --- a/doc/html/inherit_graph_3.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="FieldModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$struct_field_model.html"]; -} diff --git a/doc/html/inherit_graph_3.md5 b/doc/html/inherit_graph_3.md5 deleted file mode 100644 index 7e0b4de..0000000 --- a/doc/html/inherit_graph_3.md5 +++ /dev/null @@ -1 +0,0 @@ -8bef0e923a16f064eeb6c736da96e974 \ No newline at end of file diff --git a/doc/html/inherit_graph_4.dot b/doc/html/inherit_graph_4.dot deleted file mode 100644 index 0f932b0..0000000 --- a/doc/html/inherit_graph_4.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="PhraseData",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_phrase_data.html"]; -} diff --git a/doc/html/inherit_graph_4.md5 b/doc/html/inherit_graph_4.md5 deleted file mode 100644 index a5cfac6..0000000 --- a/doc/html/inherit_graph_4.md5 +++ /dev/null @@ -1 +0,0 @@ -11e55387f0b8b3f101ddeb0af2bd6bca \ No newline at end of file diff --git a/doc/html/inherit_graph_5.dot b/doc/html/inherit_graph_5.dot deleted file mode 100644 index 26b5f04..0000000 --- a/doc/html/inherit_graph_5.dot +++ /dev/null @@ -1,9 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="QueryBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query_base.html"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="Query\< T \>",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query.html",tooltip="This class hold a query."]; -} diff --git a/doc/html/inherit_graph_5.md5 b/doc/html/inherit_graph_5.md5 deleted file mode 100644 index c688ede..0000000 --- a/doc/html/inherit_graph_5.md5 +++ /dev/null @@ -1 +0,0 @@ -9c42ae8bd0a48510e10dc126303a02e3 \ No newline at end of file diff --git a/doc/html/inherit_graph_6.dot b/doc/html/inherit_graph_6.dot deleted file mode 100644 index 39b6fdd..0000000 --- a/doc/html/inherit_graph_6.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="QueryPrivate",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_query_private.html"]; -} diff --git a/doc/html/inherit_graph_6.md5 b/doc/html/inherit_graph_6.md5 deleted file mode 100644 index 6f771fb..0000000 --- a/doc/html/inherit_graph_6.md5 +++ /dev/null @@ -1 +0,0 @@ -5b0e8035c748a5832740488fd743ff49 \ No newline at end of file diff --git a/doc/html/inherit_graph_7.dot b/doc/html/inherit_graph_7.dot deleted file mode 100644 index c70a476..0000000 --- a/doc/html/inherit_graph_7.dot +++ /dev/null @@ -1,7 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="RelationModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$struct_relation_model.html"]; -} diff --git a/doc/html/inherit_graph_7.md5 b/doc/html/inherit_graph_7.md5 deleted file mode 100644 index 0572f78..0000000 --- a/doc/html/inherit_graph_7.md5 +++ /dev/null @@ -1 +0,0 @@ -60b6713ba2fd61d340d231c07a0cf4a9 \ No newline at end of file diff --git a/doc/html/inherit_graph_8.dot b/doc/html/inherit_graph_8.dot deleted file mode 100644 index 3aaade2..0000000 --- a/doc/html/inherit_graph_8.dot +++ /dev/null @@ -1,15 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="SqlGeneratorBase",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_generator_base.html"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="MySqlGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_my_sql_generator.html"]; - Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="PostgreSqlGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_postgre_sql_generator.html"]; - Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="SqliteGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sqlite_generator.html"]; - Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="SqlServerGenerator",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_sql_server_generator.html"]; -} diff --git a/doc/html/inherit_graph_8.md5 b/doc/html/inherit_graph_8.md5 deleted file mode 100644 index 89f2275..0000000 --- a/doc/html/inherit_graph_8.md5 +++ /dev/null @@ -1 +0,0 @@ -b3aa1854fa4197c62ac7beefd04ba94f \ No newline at end of file diff --git a/doc/html/inherit_graph_9.dot b/doc/html/inherit_graph_9.dot deleted file mode 100644 index 3120542..0000000 --- a/doc/html/inherit_graph_9.dot +++ /dev/null @@ -1,9 +0,0 @@ -digraph "Graphical Class Hierarchy" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - rankdir="LR"; - Node1 [label="Table",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table.html"]; - Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ChangeLogTable",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_change_log_table.html"]; -} diff --git a/doc/html/inherit_graph_9.md5 b/doc/html/inherit_graph_9.md5 deleted file mode 100644 index 9fb062a..0000000 --- a/doc/html/inherit_graph_9.md5 +++ /dev/null @@ -1 +0,0 @@ -5b7ee67cc8096dfce5b8e87fc4c7e58c \ No newline at end of file diff --git a/doc/html/inherits.html b/doc/html/inherits.html deleted file mode 100644 index bbb4e51..0000000 --- a/doc/html/inherits.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - -Nut: Class Hierarchy - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
- - - - -
- -
- -
-
-
Class Hierarchy
-
-
- - - - - - - - - - - - - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
-
- - - - diff --git a/doc/html/jquery.js b/doc/html/jquery.js deleted file mode 100644 index 63939e7..0000000 --- a/doc/html/jquery.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! jQuery v1.7.1 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; -f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")), -f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() -{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c) -{if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); diff --git a/doc/html/mysqlgenerator_8h_source.html b/doc/html/mysqlgenerator_8h_source.html deleted file mode 100644 index 38ebdd1..0000000 --- a/doc/html/mysqlgenerator_8h_source.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - -Nut: src/mysqlgenerator.h Source File - - - - - - -
-
-
- - - - - -
-
Nut -  0.1 -
-
- - - - - - - -
-
-
mysqlgenerator.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef MYSQLGENERATOR_H
-
22 #define MYSQLGENERATOR_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include "sqlgeneratorbase_p.h"
-
26 
-
27 QT_BEGIN_NAMESPACE
-
28 
-
29 class MySqlGenerator : public SqlGeneratorBase
-
30 {
-
31 public:
-
32  MySqlGenerator(Database *parent = 0);
-
33 
-
34  QString fieldType(FieldModel *field);
-
35 
-
36 };
-
37 
-
38 QT_END_NAMESPACE
-
39 
-
40 #endif // MYSQLGENERATOR_H
-
- - - - diff --git a/doc/html/nav_f.png b/doc/html/nav_f.png deleted file mode 100644 index 72a58a529ed3a9ed6aa0c51a79cf207e026deee2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^j6iI`!2~2XGqLUlQVE_ejv*C{Z|{2ZH7M}7UYxc) zn!W8uqtnIQ>_z8U diff --git a/doc/html/nav_g.png b/doc/html/nav_g.png deleted file mode 100644 index 2093a237a94f6c83e19ec6e5fd42f7ddabdafa81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrB!3HFm1ilyoDK$?Q$B+ufw|5PB85lU25BhtE tr?otc=hd~V+ws&_A@j8Fiv!KF$B+ufw|5=67#uj90@pIL wZ=Q8~_Ju`#59=RjDrmm`tMD@M=!-l18IR?&vFVdQ&MBb@0HFXL1|%O$WD@{VPM$7~Ar*{o?;hlAFyLXmaDC0y znK1_#cQqJWPES%4Uujug^TE?jMft$}Eq^WaR~)%f)vSNs&gek&x%A9X9sM - - - - -Nut: src/postgresqlgenerator.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
postgresqlgenerator.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef POSTGRESQLGENERATOR_H
-
22 #define POSTGRESQLGENERATOR_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include "sqlgeneratorbase_p.h"
-
26 
-
27 QT_BEGIN_NAMESPACE
-
28 
-
29 class PostgreSqlGenerator : public SqlGeneratorBase
-
30 {
-
31 public:
- -
33 
-
34  QString fieldType(FieldModel *field);
-
35 
-
36  QString diff(FieldModel *oldField, FieldModel *newField);
-
37 };
-
38 
-
39 QT_END_NAMESPACE
-
40 
-
41 #endif // POSTGRESQLGENERATOR_H
-
- - - - diff --git a/doc/html/query_8h_source.html b/doc/html/query_8h_source.html deleted file mode 100644 index 9f69fb1..0000000 --- a/doc/html/query_8h_source.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - -Nut: src/query.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
query.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef QUERY_H
-
22 #define QUERY_H
-
23 
-
24 #include <QtCore/QVariant>
-
25 #include <QtCore/QDebug>
-
26 #include <QtCore/QScopedPointer>
-
27 #include <QtCore/QRegularExpression>
-
28 
-
29 #include "query_p.h"
-
30 #include "database.h"
-
31 #include "databasemodel.h"
-
32 #include "tablesetbase_p.h"
-
33 #include "sqlgeneratorbase_p.h"
-
34 #include "querybase_p.h"
-
35 #include "wherephrase.h"
-
36 
-
37 QT_BEGIN_NAMESPACE
-
38 
-
39 template<class T>
-
40 class NUT_EXPORT Query : public QueryBase
-
41 {
-
42  QueryPrivate *d_ptr;
-
43  Q_DECLARE_PRIVATE(Query)
-
44 
-
45 public:
-
46  Query(Database *database, TableSetBase *tableSet);
-
47  ~Query();
-
48 
-
49  QList<T *> toList(int count = -1);
-
50  int remove();
-
51  T *first();
-
52 
-
53  int count();
-
54 
-
55  QVariant max(FieldPhrase &f);
-
56  QVariant min(FieldPhrase &f);
-
57  QVariant average(FieldPhrase &f){
-
58  //TODO: ...
-
59  return QVariant();
-
60  }
-
61 
-
62  Query<T> *join(const QString &tableName);
-
63  Query<T> *setWhere(WherePhrase where);
-
64 
-
65  Query<T> *join(Table *c){
-
66  join(c->metaObject()->className());
-
67  return this;
-
68  }
-
69 
-
70 // Query<T> *setWhere(const QString &where);
-
71  Query<T> *orderBy(QString fieldName, QString type);
-
72  Query<T> *orderBy(WherePhrase phrase);
-
73 };
-
74 
-
75 template<class T>
-
76 Q_OUTOFLINE_TEMPLATE Query<T>::Query(Database *database, TableSetBase *tableSet) : QueryBase(database),
-
77  d_ptr(new QueryPrivate(this))
-
78 {
-
79  Q_D(Query);
-
80 
-
81  d->database = database;
-
82  d->tableSet = tableSet;
-
83  d->tableName = d->database->tableName(T::staticMetaObject.className());
-
84 }
-
85 
-
86 template<class T>
-
87 Q_OUTOFLINE_TEMPLATE Query<T>::~Query()
-
88 {
-
89  qDebug() << "Query::~Query()";
-
90  Q_D(Query);
-
91  delete d;
-
92 }
-
93 
-
94 template<class T>
-
95 Q_OUTOFLINE_TEMPLATE QList<T *> Query<T>::toList(int count)
-
96 {
-
97  Q_D(Query);
-
98  QList<T*> result;
-
99  d->select = "*";
-
100 
-
101 // QSqlQuery q = d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, d->orders, d->tableName, d->joinClassName));
-
102  QSqlQuery q = d->database->exec(d->database->sqlGenertor()->selectCommand(
-
103  SqlGeneratorBase::SelectALl,
-
104  "",
-
105  d->wheres,
-
106  d->orderPhrases,
-
107  d->tableName,
-
108  d->joinClassName));
-
109 
-
110  QString pk =d->database->model().model(d->tableName)->primaryKey();
-
111  QVariant lastPkValue = QVariant();
-
112  int childTypeId = 0;
-
113  T *lastRow = 0;
-
114  TableSetBase *childTableSet;
-
115  QStringList masterFields = d->database->model().model(d->tableName)->fieldsNames();
-
116  QStringList childFields;
-
117  if(!d->joinClassName.isNull())
-
118  if(d->database->model().modelByClass(d->joinClassName)){
-
119  childFields = d->database->model().modelByClass(d->joinClassName)->fieldsNames();
-
120  QString joinTableName = d->database->tableName(d->joinClassName);
-
121  childTypeId = d->database->model().model(joinTableName)->typeId();
-
122  }
-
123 
-
124  while (q.next()) {
-
125  if(lastPkValue != q.value(pk)){
-
126  T *t = new T();
-
127 
-
128  foreach (QString field, masterFields)
-
129  t->setProperty(field.toLatin1().data(), q.value(field));
-
130 
-
131  t->setTableSet(d->tableSet);
-
132  t->setStatus(Table::FeatchedFromDB);
-
133  t->setParent(this);
-
134 
-
135  result.append(t);
-
136  lastRow = t;
-
137 
-
138  if(childTypeId){
-
139  QSet<TableSetBase*> tableSets = t->tableSets;
-
140  foreach (TableSetBase *ts, tableSets)
-
141  if(ts->childClassName() == d->joinClassName)
-
142  childTableSet = ts;
-
143  }
-
144  }
-
145 
-
146  if(childTypeId){
-
147  const QMetaObject *childMetaObject = QMetaType::metaObjectForType(childTypeId);
-
148  Table *childTable = qobject_cast<Table*>(childMetaObject->newInstance());
-
149 
-
150  foreach (QString field, childFields)
-
151  childTable->setProperty(field.toLatin1().data(), q.value(field));
-
152 
-
153  childTable->setParent(this);
-
154  childTable->setParentTable(lastRow);
-
155  childTable->setStatus(Table::FeatchedFromDB);
-
156  childTable->setTableSet(childTableSet);
-
157  childTableSet->add(childTable);
-
158  }
-
159  lastPkValue = q.value(pk);
-
160 
-
161  if(!--count)
-
162  break;
-
163  }
-
164 
-
165  deleteLater();
-
166  return result;
-
167 }
-
168 
-
169 template<class T>
-
170 Q_OUTOFLINE_TEMPLATE T *Query<T>::first()
-
171 {
-
172  QList<T *> list = toList(1);
-
173 
-
174  if(list.count())
-
175  return list.first();
-
176  else
-
177  return 0;
-
178 }
-
179 
-
180 template<class T>
-
181 Q_OUTOFLINE_TEMPLATE int Query<T>::count()
-
182 {
-
183  Q_D(Query);
-
184 
-
185  d->select = "COUNT(*)";
-
186  QSqlQuery q = d->database->exec(d->database->sqlGenertor()->selectCommand("COUNT(*)", d->wheres, d->orders, d->tableName, d->joinClassName));
-
187 
-
188  if(q.next())
-
189  return q.value(0).toInt();
-
190  return 0;
-
191 }
-
192 
-
193 template<class T>
-
194 Q_OUTOFLINE_TEMPLATE QVariant Query<T>::max(FieldPhrase &f){
-
195  Q_D(Query);
-
196 
-
197  QSqlQuery q = d->database->exec(d->database->sqlGenertor()->selectCommand("MAX(" + f.data()->text + ")", d->wheres, d->orders, d->tableName, d->joinClassName));
-
198 
-
199  if(q.next())
-
200  return q.value(0).toInt();
-
201  return 0;
-
202 }
-
203 
-
204 template<class T>
-
205 Q_OUTOFLINE_TEMPLATE QVariant Query<T>::min(FieldPhrase &f){
-
206  Q_D(Query);
-
207 
-
208  QSqlQuery q = d->database->exec(d->database->sqlGenertor()->selectCommand("MIN(" + f.data()->text + ")", d->wheres, d->orders, d->tableName, d->joinClassName));
-
209 
-
210  if(q.next())
-
211  return q.value(0).toInt();
-
212  return 0;
-
213 }
-
214 
-
215 template<class T>
-
216 Q_OUTOFLINE_TEMPLATE int Query<T>::remove()
-
217 {
-
218  Q_D(Query);
-
219 
-
220  QString sql = d->database->sqlGenertor()->deleteCommand(d->wheres, d->tableName);
-
221 // d->_database->sqlGenertor()->deleteRecords(_tableName, queryText());
-
222 // sql = compileCommand(sql);
-
223  QSqlQuery q = d->database->exec(sql);
-
224  return q.numRowsAffected();
-
225 }
-
226 
-
227 template<class T>
-
228 Q_OUTOFLINE_TEMPLATE Query<T> *Query<T>::join(const QString &tableName)
-
229 {
-
230  Q_D(Query);
-
231  d->joinClassName = tableName;
-
232  return this;
-
233 }
-
234 
-
235 template<class T>
-
236 Q_OUTOFLINE_TEMPLATE Query<T> *Query<T>::setWhere(WherePhrase where)
-
237 {
-
238  Q_D(Query);
-
239  d->wheres.append(where);
-
240  return this;
-
241 }
-
242 
-
243 template<class T>
-
244 Q_OUTOFLINE_TEMPLATE Query<T> *Query<T>::orderBy(QString fieldName, QString type)
-
245 {
-
246  Q_D(Query);
-
247  d->orders.insert(fieldName, type);
-
248  return this;
-
249 }
-
250 
-
251 template<class T>
-
252 Q_OUTOFLINE_TEMPLATE Query<T> *Query<T>::orderBy(WherePhrase phrase)
-
253 {
-
254  Q_D(Query);
-
255  d->orderPhrases.append(phrase);
-
256  return this;
-
257 }
-
258 
-
259 QT_END_NAMESPACE
-
260 
-
261 #endif // QUERY_H
-
- - - - diff --git a/doc/html/query__p_8h_source.html b/doc/html/query__p_8h_source.html deleted file mode 100644 index 7ef6e3f..0000000 --- a/doc/html/query__p_8h_source.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - -Nut: src/query_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
query_p.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef QUERY_P_H
-
22 #define QUERY_P_H
-
23 
-
24 #include "wherephrase.h"
-
25 
-
26 #include <QList>
-
27 #include <QString>
-
28 
-
29 class Database;
-
30 class TableSetBase;
-
31 //template<class T>
-
32 class QueryBase;
- -
34  QueryBase *q_ptr;
-
35  Q_DECLARE_PUBLIC(QueryBase)
-
36 
-
37 public:
-
38  QueryPrivate(QueryBase *parent);
-
39  QString tableName;
-
40  QString select;
-
41  Database *database;
-
42  TableSetBase *tableSet;
-
43  QString joinClassName;
-
44  QList<WherePhrase> wheres;
-
45  QHash<QString, QString> orders;
-
46  QList<WherePhrase> orderPhrases;
-
47 };
-
48 
-
49 #endif // QUERY_P_H
-
- - - - diff --git a/doc/html/querybase__p_8h_source.html b/doc/html/querybase__p_8h_source.html deleted file mode 100644 index 9e92b6f..0000000 --- a/doc/html/querybase__p_8h_source.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - -Nut: src/querybase_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
querybase_p.h
-
-
-
1 #ifndef QUERYBASE_H
-
2 #define QUERYBASE_H
-
3 
-
4 #include <QtCore/QObject>
-
5 #include <QtCore/qglobal.h>
-
6 
-
7 class QueryBase : public QObject
-
8 {
-
9  Q_OBJECT
-
10 public:
-
11  explicit QueryBase(QObject *parent = 0);
-
12 
-
13 signals:
-
14 
-
15 public slots:
-
16 };
-
17 
-
18 #endif // QUERYBASE_H
-
- - - - diff --git a/doc/html/search/all_63.html b/doc/html/search/all_63.html deleted file mode 100644 index 56b5ad1..0000000 --- a/doc/html/search/all_63.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_63.js b/doc/html/search/all_63.js deleted file mode 100644 index 3a2e4e3..0000000 --- a/doc/html/search/all_63.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['changelogtable',['ChangeLogTable',['../class_change_log_table.html',1,'']]], - ['connectionname',['connectionName',['../class_database.html#a69c42807ea444ab5f38573ad661db11d',1,'Database']]] -]; diff --git a/doc/html/search/all_64.html b/doc/html/search/all_64.html deleted file mode 100644 index b53ff08..0000000 --- a/doc/html/search/all_64.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_64.js b/doc/html/search/all_64.js deleted file mode 100644 index 5314b90..0000000 --- a/doc/html/search/all_64.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['database',['Database',['../class_database.html',1,'']]], - ['databasemodel',['DatabaseModel',['../class_database_model.html',1,'']]] -]; diff --git a/doc/html/search/all_66.html b/doc/html/search/all_66.html deleted file mode 100644 index 3d1f8b3..0000000 --- a/doc/html/search/all_66.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_66.js b/doc/html/search/all_66.js deleted file mode 100644 index 8b88ca4..0000000 --- a/doc/html/search/all_66.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['fieldmodel',['FieldModel',['../struct_field_model.html',1,'']]], - ['fieldphrase',['FieldPhrase',['../class_field_phrase.html',1,'']]] -]; diff --git a/doc/html/search/all_6d.html b/doc/html/search/all_6d.html deleted file mode 100644 index 2e27d4d..0000000 --- a/doc/html/search/all_6d.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_6d.js b/doc/html/search/all_6d.js deleted file mode 100644 index 0f030d4..0000000 --- a/doc/html/search/all_6d.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['model',['model',['../class_database.html#a30bc122da3fe8232ba22ce437d5b2986',1,'Database']]], - ['mysqlgenerator',['MySqlGenerator',['../class_my_sql_generator.html',1,'']]] -]; diff --git a/doc/html/search/all_6f.html b/doc/html/search/all_6f.html deleted file mode 100644 index 61827e8..0000000 --- a/doc/html/search/all_6f.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_6f.js b/doc/html/search/all_6f.js deleted file mode 100644 index d9b9b26..0000000 --- a/doc/html/search/all_6f.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['orderby',['orderBy',['../class_query.html#aa06b66cc9bbe9f3901215c943b94bb89',1,'Query']]] -]; diff --git a/doc/html/search/all_70.html b/doc/html/search/all_70.html deleted file mode 100644 index 0340151..0000000 --- a/doc/html/search/all_70.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_70.js b/doc/html/search/all_70.js deleted file mode 100644 index af97fc8..0000000 --- a/doc/html/search/all_70.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['phrasedata',['PhraseData',['../class_phrase_data.html',1,'']]], - ['postgresqlgenerator',['PostgreSqlGenerator',['../class_postgre_sql_generator.html',1,'']]] -]; diff --git a/doc/html/search/all_71.html b/doc/html/search/all_71.html deleted file mode 100644 index b4dc1e6..0000000 --- a/doc/html/search/all_71.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_71.js b/doc/html/search/all_71.js deleted file mode 100644 index 3b168a7..0000000 --- a/doc/html/search/all_71.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['query',['Query',['../class_query.html',1,'']]] -]; diff --git a/doc/html/search/all_72.html b/doc/html/search/all_72.html deleted file mode 100644 index 0ab18d6..0000000 --- a/doc/html/search/all_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_72.js b/doc/html/search/all_72.js deleted file mode 100644 index 8756a80..0000000 --- a/doc/html/search/all_72.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['relationmodel',['RelationModel',['../struct_relation_model.html',1,'']]] -]; diff --git a/doc/html/search/all_73.html b/doc/html/search/all_73.html deleted file mode 100644 index 1ec8f17..0000000 --- a/doc/html/search/all_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_73.js b/doc/html/search/all_73.js deleted file mode 100644 index 81b145e..0000000 --- a/doc/html/search/all_73.js +++ /dev/null @@ -1,6 +0,0 @@ -var searchData= -[ - ['setwhere',['setWhere',['../class_query.html#ab4be37c2a469cbd549b7df9e5f415599',1,'Query']]], - ['sqlitegenerator',['SqliteGenerator',['../class_sqlite_generator.html',1,'']]], - ['sqlservergenerator',['SqlServerGenerator',['../class_sql_server_generator.html',1,'']]] -]; diff --git a/doc/html/search/all_74.html b/doc/html/search/all_74.html deleted file mode 100644 index fdc6589..0000000 --- a/doc/html/search/all_74.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_74.js b/doc/html/search/all_74.js deleted file mode 100644 index ddc78a8..0000000 --- a/doc/html/search/all_74.js +++ /dev/null @@ -1,7 +0,0 @@ -var searchData= -[ - ['table',['Table',['../class_table.html',1,'']]], - ['tablemodel',['TableModel',['../class_table_model.html',1,'']]], - ['tableset',['TableSet',['../class_table_set.html',1,'']]], - ['tolist',['toList',['../class_query.html#a6c939f50425b98cc3e0d3df9e155d302',1,'Query']]] -]; diff --git a/doc/html/search/all_77.html b/doc/html/search/all_77.html deleted file mode 100644 index 73323d3..0000000 --- a/doc/html/search/all_77.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/all_77.js b/doc/html/search/all_77.js deleted file mode 100644 index f25b912..0000000 --- a/doc/html/search/all_77.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['wherephrase',['WherePhrase',['../class_where_phrase.html',1,'']]] -]; diff --git a/doc/html/search/classes_63.html b/doc/html/search/classes_63.html deleted file mode 100644 index 72c66b9..0000000 --- a/doc/html/search/classes_63.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_63.js b/doc/html/search/classes_63.js deleted file mode 100644 index 8644043..0000000 --- a/doc/html/search/classes_63.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['changelogtable',['ChangeLogTable',['../class_change_log_table.html',1,'']]] -]; diff --git a/doc/html/search/classes_64.html b/doc/html/search/classes_64.html deleted file mode 100644 index 5902708..0000000 --- a/doc/html/search/classes_64.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_64.js b/doc/html/search/classes_64.js deleted file mode 100644 index 5314b90..0000000 --- a/doc/html/search/classes_64.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['database',['Database',['../class_database.html',1,'']]], - ['databasemodel',['DatabaseModel',['../class_database_model.html',1,'']]] -]; diff --git a/doc/html/search/classes_66.html b/doc/html/search/classes_66.html deleted file mode 100644 index 941988c..0000000 --- a/doc/html/search/classes_66.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_66.js b/doc/html/search/classes_66.js deleted file mode 100644 index 8b88ca4..0000000 --- a/doc/html/search/classes_66.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['fieldmodel',['FieldModel',['../struct_field_model.html',1,'']]], - ['fieldphrase',['FieldPhrase',['../class_field_phrase.html',1,'']]] -]; diff --git a/doc/html/search/classes_6d.html b/doc/html/search/classes_6d.html deleted file mode 100644 index abe6f0d..0000000 --- a/doc/html/search/classes_6d.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_6d.js b/doc/html/search/classes_6d.js deleted file mode 100644 index b1ad27d..0000000 --- a/doc/html/search/classes_6d.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['mysqlgenerator',['MySqlGenerator',['../class_my_sql_generator.html',1,'']]] -]; diff --git a/doc/html/search/classes_70.html b/doc/html/search/classes_70.html deleted file mode 100644 index e4b5208..0000000 --- a/doc/html/search/classes_70.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_70.js b/doc/html/search/classes_70.js deleted file mode 100644 index af97fc8..0000000 --- a/doc/html/search/classes_70.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['phrasedata',['PhraseData',['../class_phrase_data.html',1,'']]], - ['postgresqlgenerator',['PostgreSqlGenerator',['../class_postgre_sql_generator.html',1,'']]] -]; diff --git a/doc/html/search/classes_71.html b/doc/html/search/classes_71.html deleted file mode 100644 index 80a4fbb..0000000 --- a/doc/html/search/classes_71.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_71.js b/doc/html/search/classes_71.js deleted file mode 100644 index 3b168a7..0000000 --- a/doc/html/search/classes_71.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['query',['Query',['../class_query.html',1,'']]] -]; diff --git a/doc/html/search/classes_72.html b/doc/html/search/classes_72.html deleted file mode 100644 index 0d0ddb4..0000000 --- a/doc/html/search/classes_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_72.js b/doc/html/search/classes_72.js deleted file mode 100644 index 8756a80..0000000 --- a/doc/html/search/classes_72.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['relationmodel',['RelationModel',['../struct_relation_model.html',1,'']]] -]; diff --git a/doc/html/search/classes_73.html b/doc/html/search/classes_73.html deleted file mode 100644 index a1bf0b9..0000000 --- a/doc/html/search/classes_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_73.js b/doc/html/search/classes_73.js deleted file mode 100644 index b1ccdc2..0000000 --- a/doc/html/search/classes_73.js +++ /dev/null @@ -1,5 +0,0 @@ -var searchData= -[ - ['sqlitegenerator',['SqliteGenerator',['../class_sqlite_generator.html',1,'']]], - ['sqlservergenerator',['SqlServerGenerator',['../class_sql_server_generator.html',1,'']]] -]; diff --git a/doc/html/search/classes_74.html b/doc/html/search/classes_74.html deleted file mode 100644 index f7f27ce..0000000 --- a/doc/html/search/classes_74.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_74.js b/doc/html/search/classes_74.js deleted file mode 100644 index 88dd00f..0000000 --- a/doc/html/search/classes_74.js +++ /dev/null @@ -1,6 +0,0 @@ -var searchData= -[ - ['table',['Table',['../class_table.html',1,'']]], - ['tablemodel',['TableModel',['../class_table_model.html',1,'']]], - ['tableset',['TableSet',['../class_table_set.html',1,'']]] -]; diff --git a/doc/html/search/classes_77.html b/doc/html/search/classes_77.html deleted file mode 100644 index e3967e9..0000000 --- a/doc/html/search/classes_77.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/classes_77.js b/doc/html/search/classes_77.js deleted file mode 100644 index f25b912..0000000 --- a/doc/html/search/classes_77.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['wherephrase',['WherePhrase',['../class_where_phrase.html',1,'']]] -]; diff --git a/doc/html/search/close.png b/doc/html/search/close.png deleted file mode 100644 index 9342d3dfeea7b7c4ee610987e717804b5a42ceb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 273 zcmV+s0q*{ZP)4(RlMby96)VwnbG{ zbe&}^BDn7x>$<{ck4zAK-=nT;=hHG)kmplIF${xqm8db3oX6wT3bvp`TE@m0cg;b) zBuSL}5?N7O(iZLdAlz@)b)Rd~DnSsSX&P5qC`XwuFwcAYLC+d2>+1(8on;wpt8QIC X2MT$R4iQDd00000NkvXXu0mjfia~GN diff --git a/doc/html/search/functions_63.html b/doc/html/search/functions_63.html deleted file mode 100644 index 9ebe11d..0000000 --- a/doc/html/search/functions_63.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_63.js b/doc/html/search/functions_63.js deleted file mode 100644 index de7fec2..0000000 --- a/doc/html/search/functions_63.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['connectionname',['connectionName',['../class_database.html#a69c42807ea444ab5f38573ad661db11d',1,'Database']]] -]; diff --git a/doc/html/search/functions_6d.html b/doc/html/search/functions_6d.html deleted file mode 100644 index d01ac53..0000000 --- a/doc/html/search/functions_6d.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_6d.js b/doc/html/search/functions_6d.js deleted file mode 100644 index 7d1f677..0000000 --- a/doc/html/search/functions_6d.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['model',['model',['../class_database.html#a30bc122da3fe8232ba22ce437d5b2986',1,'Database']]] -]; diff --git a/doc/html/search/functions_6f.html b/doc/html/search/functions_6f.html deleted file mode 100644 index 222f0f8..0000000 --- a/doc/html/search/functions_6f.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_6f.js b/doc/html/search/functions_6f.js deleted file mode 100644 index d9b9b26..0000000 --- a/doc/html/search/functions_6f.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['orderby',['orderBy',['../class_query.html#aa06b66cc9bbe9f3901215c943b94bb89',1,'Query']]] -]; diff --git a/doc/html/search/functions_71.html b/doc/html/search/functions_71.html deleted file mode 100644 index af909d4..0000000 --- a/doc/html/search/functions_71.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_71.js b/doc/html/search/functions_71.js deleted file mode 100644 index 651a68d..0000000 --- a/doc/html/search/functions_71.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['queryprivate',['QueryPrivate',['../class_query_private.html#a3e9a8f34c861028721594834c0437321',1,'QueryPrivate']]] -]; diff --git a/doc/html/search/functions_73.html b/doc/html/search/functions_73.html deleted file mode 100644 index 774d577..0000000 --- a/doc/html/search/functions_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_73.js b/doc/html/search/functions_73.js deleted file mode 100644 index 7f90321..0000000 --- a/doc/html/search/functions_73.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['setwhere',['setWhere',['../class_query.html#ab4be37c2a469cbd549b7df9e5f415599',1,'Query']]] -]; diff --git a/doc/html/search/functions_74.html b/doc/html/search/functions_74.html deleted file mode 100644 index e3c96c3..0000000 --- a/doc/html/search/functions_74.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
-
Loading...
-
- -
Searching...
-
No Matches
- -
- - diff --git a/doc/html/search/functions_74.js b/doc/html/search/functions_74.js deleted file mode 100644 index 8449f51..0000000 --- a/doc/html/search/functions_74.js +++ /dev/null @@ -1,4 +0,0 @@ -var searchData= -[ - ['tolist',['toList',['../class_query.html#a6c939f50425b98cc3e0d3df9e155d302',1,'Query']]] -]; diff --git a/doc/html/search/mag_sel.png b/doc/html/search/mag_sel.png deleted file mode 100644 index 81f6040a2092402b4d98f9ffa8855d12a0d4ca17..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 563 zcmV-30?hr1P)zxx&tqG15pu7)IiiXFflOc2k;dXd>%13GZAy? zRz!q0=|E6a6vV)&ZBS~G9oe0kbqyw1*gvY`{Pop2oKq#FlzgXt@Xh-7fxh>}`Fxg> z$%N%{$!4=5nM{(;=c!aG1Ofr^Do{u%Ih{^&Fc@H2)+a-?TBXrw5DW&z%Nb6mQ!L9O zl}b@6mB?f=tX3;#vl)}ggh(Vpyh(IK z(Mb0D{l{U$FsRjP;!{($+bsaaVi8T#1c0V#qEIOCYa9@UVLV`f__E81L;?WEaRA;Y zUH;rZ;vb;mk7JX|$=i3O~&If0O@oZfLg8gfIjW=dcBsz;gI=!{-r4# z4%6v$&~;q^j7Fo67yJ(NJWuX+I~I!tj^nW3?}^9bq|<3^+vapS5sgM^x7!cs(+mMT z&y%j};&~po+YO)3hoUH4E*E;e9>?R6SS&`X)p`njycAVcg{rEb41T{~Hk(bl-7eSb zmFxA2uIqo#@R?lKm50ND`~6Nfn|-b1|L6O98vt3Tx@gKz#isxO002ovPDHLkV1kyW B_l^Jn diff --git a/doc/html/search/nomatches.html b/doc/html/search/nomatches.html deleted file mode 100644 index b1ded27..0000000 --- a/doc/html/search/nomatches.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -
-
No Matches
-
- - diff --git a/doc/html/search/search.css b/doc/html/search/search.css deleted file mode 100644 index d18c1da..0000000 --- a/doc/html/search/search.css +++ /dev/null @@ -1,238 +0,0 @@ -/*---------------- Search Box */ - -#FSearchBox { - float: left; -} - -#MSearchBox { - white-space : nowrap; - position: absolute; - float: none; - display: inline; - margin-top: 8px; - right: 0px; - width: 170px; - z-index: 102; - background-color: white; -} - -#MSearchBox .left -{ - display:block; - position:absolute; - left:10px; - width:20px; - height:19px; - background:url('search_l.png') no-repeat; - background-position:right; -} - -#MSearchSelect { - display:block; - position:absolute; - width:20px; - height:19px; -} - -.left #MSearchSelect { - left:4px; -} - -.right #MSearchSelect { - right:5px; -} - -#MSearchField { - display:block; - position:absolute; - height:19px; - background:url('search_m.png') repeat-x; - border:none; - width:116px; - margin-left:20px; - padding-left:4px; - color: #909090; - outline: none; - font: 9pt Arial, Verdana, sans-serif; -} - -#FSearchBox #MSearchField { - margin-left:15px; -} - -#MSearchBox .right { - display:block; - position:absolute; - right:10px; - top:0px; - width:20px; - height:19px; - background:url('search_r.png') no-repeat; - background-position:left; -} - -#MSearchClose { - display: none; - position: absolute; - top: 4px; - background : none; - border: none; - margin: 0px 4px 0px 0px; - padding: 0px 0px; - outline: none; -} - -.left #MSearchClose { - left: 6px; -} - -.right #MSearchClose { - right: 2px; -} - -.MSearchBoxActive #MSearchField { - color: #000000; -} - -/*---------------- Search filter selection */ - -#MSearchSelectWindow { - display: none; - position: absolute; - left: 0; top: 0; - border: 1px solid #90A5CE; - background-color: #F9FAFC; - z-index: 1; - padding-top: 4px; - padding-bottom: 4px; - -moz-border-radius: 4px; - -webkit-border-top-left-radius: 4px; - -webkit-border-top-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -} - -.SelectItem { - font: 8pt Arial, Verdana, sans-serif; - padding-left: 2px; - padding-right: 12px; - border: 0px; -} - -span.SelectionMark { - margin-right: 4px; - font-family: monospace; - outline-style: none; - text-decoration: none; -} - -a.SelectItem { - display: block; - outline-style: none; - color: #000000; - text-decoration: none; - padding-left: 6px; - padding-right: 12px; -} - -a.SelectItem:focus, -a.SelectItem:active { - color: #000000; - outline-style: none; - text-decoration: none; -} - -a.SelectItem:hover { - color: #FFFFFF; - background-color: #3D578C; - outline-style: none; - text-decoration: none; - cursor: pointer; - display: block; -} - -/*---------------- Search results window */ - -iframe#MSearchResults { - width: 60ex; - height: 15em; -} - -#MSearchResultsWindow { - display: none; - position: absolute; - left: 0; top: 0; - border: 1px solid #000; - background-color: #EEF1F7; -} - -/* ----------------------------------- */ - - -#SRIndex { - clear:both; - padding-bottom: 15px; -} - -.SREntry { - font-size: 10pt; - padding-left: 1ex; -} - -.SRPage .SREntry { - font-size: 8pt; - padding: 1px 5px; -} - -body.SRPage { - margin: 5px 2px; -} - -.SRChildren { - padding-left: 3ex; padding-bottom: .5em -} - -.SRPage .SRChildren { - display: none; -} - -.SRSymbol { - font-weight: bold; - color: #425E97; - font-family: Arial, Verdana, sans-serif; - text-decoration: none; - outline: none; -} - -a.SRScope { - display: block; - color: #425E97; - font-family: Arial, Verdana, sans-serif; - text-decoration: none; - outline: none; -} - -a.SRSymbol:focus, a.SRSymbol:active, -a.SRScope:focus, a.SRScope:active { - text-decoration: underline; -} - -span.SRScope { - padding-left: 4px; -} - -.SRPage .SRStatus { - padding: 2px 5px; - font-size: 8pt; - font-style: italic; -} - -.SRResult { - display: none; -} - -DIV.searchresults { - margin-left: 10px; - margin-right: 10px; -} diff --git a/doc/html/search/search.js b/doc/html/search/search.js deleted file mode 100644 index 38f13fc..0000000 --- a/doc/html/search/search.js +++ /dev/null @@ -1,799 +0,0 @@ -// Search script generated by doxygen -// Copyright (C) 2009 by Dimitri van Heesch. - -// The code in this file is loosly based on main.js, part of Natural Docs, -// which is Copyright (C) 2003-2008 Greg Valure -// Natural Docs is licensed under the GPL. - -var indexSectionsWithContent = -{ - 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101000000101111110010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001101000000100111110010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000101000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" -}; - -var indexSectionNames = -{ - 0: "all", - 1: "classes", - 2: "functions" -}; - -function convertToId(search) -{ - var result = ''; - for (i=0;i do a search - { - this.Search(); - } - } - - this.OnSearchSelectKey = function(evt) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==40 && this.searchIndex0) // Up - { - this.searchIndex--; - this.OnSelectItem(this.searchIndex); - } - else if (e.keyCode==13 || e.keyCode==27) - { - this.OnSelectItem(this.searchIndex); - this.CloseSelectionWindow(); - this.DOMSearchField().focus(); - } - return false; - } - - // --------- Actions - - // Closes the results window. - this.CloseResultsWindow = function() - { - this.DOMPopupSearchResultsWindow().style.display = 'none'; - this.DOMSearchClose().style.display = 'none'; - this.Activate(false); - } - - this.CloseSelectionWindow = function() - { - this.DOMSearchSelectWindow().style.display = 'none'; - } - - // Performs a search. - this.Search = function() - { - this.keyTimeout = 0; - - // strip leading whitespace - var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); - - var code = searchValue.toLowerCase().charCodeAt(0); - var hexCode; - if (code<16) - { - hexCode="0"+code.toString(16); - } - else - { - hexCode=code.toString(16); - } - - var resultsPage; - var resultsPageWithSearch; - var hasResultsPage; - - if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') - { - resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; - resultsPageWithSearch = resultsPage+'?'+escape(searchValue); - hasResultsPage = true; - } - else // nothing available for this search term - { - resultsPage = this.resultsPath + '/nomatches.html'; - resultsPageWithSearch = resultsPage; - hasResultsPage = false; - } - - window.frames.MSearchResults.location = resultsPageWithSearch; - var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); - - if (domPopupSearchResultsWindow.style.display!='block') - { - var domSearchBox = this.DOMSearchBox(); - this.DOMSearchClose().style.display = 'inline'; - if (this.insideFrame) - { - var domPopupSearchResults = this.DOMPopupSearchResults(); - domPopupSearchResultsWindow.style.position = 'relative'; - domPopupSearchResultsWindow.style.display = 'block'; - var width = document.body.clientWidth - 8; // the -8 is for IE :-( - domPopupSearchResultsWindow.style.width = width + 'px'; - domPopupSearchResults.style.width = width + 'px'; - } - else - { - var domPopupSearchResults = this.DOMPopupSearchResults(); - var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; - var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; - domPopupSearchResultsWindow.style.display = 'block'; - left -= domPopupSearchResults.offsetWidth; - domPopupSearchResultsWindow.style.top = top + 'px'; - domPopupSearchResultsWindow.style.left = left + 'px'; - } - } - - this.lastSearchValue = searchValue; - this.lastResultsPage = resultsPage; - } - - // -------- Activation Functions - - // Activates or deactivates the search panel, resetting things to - // their default values if necessary. - this.Activate = function(isActive) - { - if (isActive || // open it - this.DOMPopupSearchResultsWindow().style.display == 'block' - ) - { - this.DOMSearchBox().className = 'MSearchBoxActive'; - - var searchField = this.DOMSearchField(); - - if (searchField.value == this.searchLabel) // clear "Search" term upon entry - { - searchField.value = ''; - this.searchActive = true; - } - } - else if (!isActive) // directly remove the panel - { - this.DOMSearchBox().className = 'MSearchBoxInactive'; - this.DOMSearchField().value = this.searchLabel; - this.searchActive = false; - this.lastSearchValue = '' - this.lastResultsPage = ''; - } - } -} - -// ----------------------------------------------------------------------- - -// The class that handles everything on the search results page. -function SearchResults(name) -{ - // The number of matches from the last run of . - this.lastMatchCount = 0; - this.lastKey = 0; - this.repeatOn = false; - - // Toggles the visibility of the passed element ID. - this.FindChildElement = function(id) - { - var parentElement = document.getElementById(id); - var element = parentElement.firstChild; - - while (element && element!=parentElement) - { - if (element.nodeName == 'DIV' && element.className == 'SRChildren') - { - return element; - } - - if (element.nodeName == 'DIV' && element.hasChildNodes()) - { - element = element.firstChild; - } - else if (element.nextSibling) - { - element = element.nextSibling; - } - else - { - do - { - element = element.parentNode; - } - while (element && element!=parentElement && !element.nextSibling); - - if (element && element!=parentElement) - { - element = element.nextSibling; - } - } - } - } - - this.Toggle = function(id) - { - var element = this.FindChildElement(id); - if (element) - { - if (element.style.display == 'block') - { - element.style.display = 'none'; - } - else - { - element.style.display = 'block'; - } - } - } - - // Searches for the passed string. If there is no parameter, - // it takes it from the URL query. - // - // Always returns true, since other documents may try to call it - // and that may or may not be possible. - this.Search = function(search) - { - if (!search) // get search word from URL - { - search = window.location.search; - search = search.substring(1); // Remove the leading '?' - search = unescape(search); - } - - search = search.replace(/^ +/, ""); // strip leading spaces - search = search.replace(/ +$/, ""); // strip trailing spaces - search = search.toLowerCase(); - search = convertToId(search); - - var resultRows = document.getElementsByTagName("div"); - var matches = 0; - - var i = 0; - while (i < resultRows.length) - { - var row = resultRows.item(i); - if (row.className == "SRResult") - { - var rowMatchName = row.id.toLowerCase(); - rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' - - if (search.length<=rowMatchName.length && - rowMatchName.substr(0, search.length)==search) - { - row.style.display = 'block'; - matches++; - } - else - { - row.style.display = 'none'; - } - } - i++; - } - document.getElementById("Searching").style.display='none'; - if (matches == 0) // no results - { - document.getElementById("NoMatches").style.display='block'; - } - else // at least one result - { - document.getElementById("NoMatches").style.display='none'; - } - this.lastMatchCount = matches; - return true; - } - - // return the first item with index index or higher that is visible - this.NavNext = function(index) - { - var focusItem; - while (1) - { - var focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') - { - break; - } - else if (!focusItem) // last element - { - break; - } - focusItem=null; - index++; - } - return focusItem; - } - - this.NavPrev = function(index) - { - var focusItem; - while (1) - { - var focusName = 'Item'+index; - focusItem = document.getElementById(focusName); - if (focusItem && focusItem.parentNode.parentNode.style.display=='block') - { - break; - } - else if (!focusItem) // last element - { - break; - } - focusItem=null; - index--; - } - return focusItem; - } - - this.ProcessKeys = function(e) - { - if (e.type == "keydown") - { - this.repeatOn = false; - this.lastKey = e.keyCode; - } - else if (e.type == "keypress") - { - if (!this.repeatOn) - { - if (this.lastKey) this.repeatOn = true; - return false; // ignore first keypress after keydown - } - } - else if (e.type == "keyup") - { - this.lastKey = 0; - this.repeatOn = false; - } - return this.lastKey!=0; - } - - this.Nav = function(evt,itemIndex) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) // Up - { - var newIndex = itemIndex-1; - var focusItem = this.NavPrev(newIndex); - if (focusItem) - { - var child = this.FindChildElement(focusItem.parentNode.parentNode.id); - if (child && child.style.display == 'block') // children visible - { - var n=0; - var tmpElem; - while (1) // search for last child - { - tmpElem = document.getElementById('Item'+newIndex+'_c'+n); - if (tmpElem) - { - focusItem = tmpElem; - } - else // found it! - { - break; - } - n++; - } - } - } - if (focusItem) - { - focusItem.focus(); - } - else // return focus to search field - { - parent.document.getElementById("MSearchField").focus(); - } - } - else if (this.lastKey==40) // Down - { - var newIndex = itemIndex+1; - var focusItem; - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem && elem.style.display == 'block') // children visible - { - focusItem = document.getElementById('Item'+itemIndex+'_c0'); - } - if (!focusItem) focusItem = this.NavNext(newIndex); - if (focusItem) focusItem.focus(); - } - else if (this.lastKey==39) // Right - { - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'block'; - } - else if (this.lastKey==37) // Left - { - var item = document.getElementById('Item'+itemIndex); - var elem = this.FindChildElement(item.parentNode.parentNode.id); - if (elem) elem.style.display = 'none'; - } - else if (this.lastKey==27) // Escape - { - parent.searchBox.CloseResultsWindow(); - parent.document.getElementById("MSearchField").focus(); - } - else if (this.lastKey==13) // Enter - { - return true; - } - return false; - } - - this.NavChild = function(evt,itemIndex,childIndex) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==13) return true; - if (!this.ProcessKeys(e)) return false; - - if (this.lastKey==38) // Up - { - if (childIndex>0) - { - var newIndex = childIndex-1; - document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); - } - else // already at first child, jump to parent - { - document.getElementById('Item'+itemIndex).focus(); - } - } - else if (this.lastKey==40) // Down - { - var newIndex = childIndex+1; - var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); - if (!elem) // last child, jump to parent next parent - { - elem = this.NavNext(itemIndex+1); - } - if (elem) - { - elem.focus(); - } - } - else if (this.lastKey==27) // Escape - { - parent.searchBox.CloseResultsWindow(); - parent.document.getElementById("MSearchField").focus(); - } - else if (this.lastKey==13) // Enter - { - return true; - } - return false; - } -} - -function setKeyActions(elem,action) -{ - elem.setAttribute('onkeydown',action); - elem.setAttribute('onkeypress',action); - elem.setAttribute('onkeyup',action); -} - -function setClassAttr(elem,attr) -{ - elem.setAttribute('class',attr); - elem.setAttribute('className',attr); -} - -function createResults() -{ - var results = document.getElementById("SRResults"); - for (var e=0; ek7RCwB~R6VQOP#AvB$vH7i{6H{96zot$7cZT<7246EF5Np6N}+$IbiG6W zg#87A+NFaX+=_^xM1#gCtshC=E{%9^uQX_%?YwXvo{#q&MnpJ8uh(O?ZRc&~_1%^SsPxG@rfElJg-?U zm!Cz-IOn(qJP3kDp-^~qt+FGbl=5jNli^Wj_xIBG{Rc0en{!oFvyoNC7{V~T8}b>| z=jL2WIReZzX(YN(_9fV;BBD$VXQIxNasAL8ATvEu822WQ%mvv4FO#qs` BFGc_W diff --git a/doc/html/search/search_r.png b/doc/html/search/search_r.png deleted file mode 100644 index 97ee8b439687084201b79c6f776a41f495c6392a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 612 zcmV-q0-ODbP)PbXFRCwB?)W514K@j&X?z2*SxFI6-@HT2E2K=9X9%Pb zEK*!TBw&g(DMC;|A)uGlRkOS9vd-?zNs%bR4d$w+ox_iFnE8fvIvv7^5<(>Te12Li z7C)9srCzmK{ZcNM{YIl9j{DePFgOWiS%xG@5CnnnJa4nvY<^glbz7^|-ZY!dUkAwd z{gaTC@_>b5h~;ug#R0wRL0>o5!hxm*s0VW?8dr}O#zXTRTnrQm_Z7z1Mrnx>&p zD4qifUjzLvbVVWi?l?rUzwt^sdb~d!f_LEhsRVIXZtQ=qSxuxqm zEX#tf>$?M_Y1-LSDT)HqG?`%-%ZpY!#{N!rcNIiL;G7F0`l?)mNGTD9;f9F5Up3Kg zw}a<-JylhG&;=!>B+fZaCX+?C+kHYrP%c?X2!Zu_olK|GcS4A70HEy;vn)I0>0kLH z`jc(WIaaHc7!HS@f*^R^Znx8W=_jIl2oWJoQ*h1^$FX!>*PqR1J8k|fw}w_y}TpE>7m8DqDO<3z`OzXt$ccSejbEZCg@0000 - - - - -Nut: src/sqlgeneratorbase_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
sqlgeneratorbase_p.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef SQLGENERATORBASE_H
-
22 #define SQLGENERATORBASE_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include <QtCore/QObject>
-
26 #include <QtCore/QStringList>
-
27 #include "wherephrase.h"
-
28 
-
29 QT_BEGIN_NAMESPACE
-
30 
-
31 class Table;
-
32 struct FieldModel;
-
33 class DatabaseModel;
-
34 class TableModel;
-
35 class Database;
-
36 //struct PhraseData;
-
37 //class WherePhrase;
-
38 class SqlGeneratorBase : public QObject
-
39 {
-
40 // Q_OBJECT
-
41 
-
42  Database *_database;
-
43 public:
-
44  enum CommandType{
-
45  Select,
-
46  Insert,
-
47  Update,
-
48  Delete
-
49  };
-
50  enum AgregateType{
-
51  SelectALl,
-
52  Count,
-
53  Min,
-
54  Max,
-
55  Average
-
56  };
-
57 
-
58  SqlGeneratorBase(Database *parent);
-
59  virtual ~SqlGeneratorBase();
-
60 
-
61  virtual QString masterDatabaseName(QString databaseName);
-
62 
-
63  virtual QString fieldType(FieldModel *field) = 0;
-
64  virtual QString fieldDeclare(FieldModel *field);
-
65 
-
66  virtual QStringList diff(DatabaseModel lastModel, DatabaseModel newModel);
-
67  virtual QString diff(FieldModel *oldField, FieldModel *newField);
-
68  virtual QString diff(TableModel *oldTable, TableModel *newTable);
-
69 
-
70  virtual QString saveRecord(Table *t, QString tableName);
-
71  virtual QString insertRecord(Table *t, QString tableName);
-
72  virtual QString updateRecord(Table *t, QString tableName);
-
73  virtual QString deleteRecord(Table *t, QString tableName);
-
74 
-
75 
-
76  virtual QString deleteRecords(QString tableName, QString where);
-
77 
-
78  virtual QString selectCommand(AgregateType t, QString agregateArg,
-
79  QList<WherePhrase> &wheres, QList<WherePhrase> &orders,
-
80  QString tableName, QString joinClassName);
-
81 
-
82  virtual QString selectCommand(QList<WherePhrase> &wheres, QHash<QString, QString> &orders,
-
83  QString tableName, QString joinClassName);
-
84  virtual QString selectCommand(QString selectPhrase,
-
85  QList<WherePhrase> &wheres, QHash<QString, QString> &orders,
-
86  QString tableName, QString joinClassName);
-
87 
-
88  virtual QString deleteCommand(QList<WherePhrase> &wheres, QString tableName);
-
89 
-
90  virtual QString escapeValue(const QVariant &v) const;
-
91  virtual QString phrase(const PhraseData *d) const;
-
92  virtual QString operatorString(const PhraseData::Condition &cond) const;
-
93 
-
94 private:
-
95  QString agregateText(const AgregateType &t, const QString &arg = QString::null) const;
-
96  QString fromTableText(const QString &tableName, QString &joinClassName, QString &orderBy) const;
-
97  QString createWhere(QList<WherePhrase> &wheres);
-
98  QString phraseOrder(const PhraseData *d) const;
-
99 };
-
100 
-
101 QT_END_NAMESPACE
-
102 
-
103 #endif // SQLGENERATORBASE_H
-
- - - - diff --git a/doc/html/sqlitegenerator_8h_source.html b/doc/html/sqlitegenerator_8h_source.html deleted file mode 100644 index bab9f7e..0000000 --- a/doc/html/sqlitegenerator_8h_source.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - -Nut: src/sqlitegenerator.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
sqlitegenerator.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef SQLITEGENERATOR_H
-
22 #define SQLITEGENERATOR_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include "sqlgeneratorbase_p.h"
-
26 
-
27 class SqliteGenerator : public SqlGeneratorBase
-
28 {
-
29 public:
-
30  SqliteGenerator(Database *parent = 0);
-
31 
-
32  QString fieldType(FieldModel *field);
-
33 };
-
34 
-
35 #endif // SQLITEGENERATOR_H
-
- - - - diff --git a/doc/html/sqlservergenerator_8h_source.html b/doc/html/sqlservergenerator_8h_source.html deleted file mode 100644 index 5c2bd1e..0000000 --- a/doc/html/sqlservergenerator_8h_source.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - -Nut: src/sqlservergenerator.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
sqlservergenerator.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef SQLSERVERGENERATOR_H
-
22 #define SQLSERVERGENERATOR_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include "sqlgeneratorbase_p.h"
-
26 
-
27 QT_BEGIN_NAMESPACE
-
28 
-
29 class SqlServerGenerator : public SqlGeneratorBase
-
30 {
-
31 public:
-
32  SqlServerGenerator(Database *parent = 0);
-
33 
-
34  QString masterDatabaseName(QString databaseName);
-
35 
-
36  QString fieldType(FieldModel *field);
-
37  QString diff(FieldModel *oldField, FieldModel *newField);
-
38 
-
39  QString escapeValue(const QVariant &v) const;
-
40 };
-
41 
-
42 QT_END_NAMESPACE
-
43 
-
44 #endif // SQLSERVERGENERATOR_H
-
- - - - diff --git a/doc/html/struct_field_model-members.html b/doc/html/struct_field_model-members.html deleted file mode 100644 index 75ef313..0000000 --- a/doc/html/struct_field_model-members.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
FieldModel Member List
-
-
- -

This is the complete list of members for FieldModel, including all inherited members.

- - - - - - - - - - - - -
defaultValue (defined in FieldModel)FieldModel
FieldModel() (defined in FieldModel)FieldModel
isAutoIncrement (defined in FieldModel)FieldModel
isPrimaryKey (defined in FieldModel)FieldModel
isUnique (defined in FieldModel)FieldModel
length (defined in FieldModel)FieldModel
name (defined in FieldModel)FieldModel
notNull (defined in FieldModel)FieldModel
operator!=(const FieldModel &f) const (defined in FieldModel)FieldModel
operator==(const FieldModel &f) const (defined in FieldModel)FieldModel
type (defined in FieldModel)FieldModel
- - - - diff --git a/doc/html/struct_field_model.html b/doc/html/struct_field_model.html deleted file mode 100644 index c278ac5..0000000 --- a/doc/html/struct_field_model.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - -Nut: FieldModel Struct Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
FieldModel Struct Reference
-
-
- - - - -

-Public Member Functions

-bool operator== (const FieldModel &f) const
-bool operator!= (const FieldModel &f) const
- - - - - - - - - -

-Public Attributes

-QString name
-QVariant::Type type
-int length
-QString defaultValue
-bool notNull
-bool isPrimaryKey
-bool isAutoIncrement
-bool isUnique
-
The documentation for this struct was generated from the following file: -
- - - - diff --git a/doc/html/struct_relation_model-members.html b/doc/html/struct_relation_model-members.html deleted file mode 100644 index 8141fa7..0000000 --- a/doc/html/struct_relation_model-members.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - -Nut: Member List - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
-
-
RelationModel Member List
-
-
- -

This is the complete list of members for RelationModel, including all inherited members.

- - - - - -
className (defined in RelationModel)RelationModel
foregionColumn (defined in RelationModel)RelationModel
localColumn (defined in RelationModel)RelationModel
table (defined in RelationModel)RelationModel
- - - - diff --git a/doc/html/struct_relation_model.html b/doc/html/struct_relation_model.html deleted file mode 100644 index c7521ea..0000000 --- a/doc/html/struct_relation_model.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - -Nut: RelationModel Struct Reference - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - -
-
- -
-
RelationModel Struct Reference
-
-
- - - - - - -

-Public Attributes

-QString className
-QString localColumn
-TableModeltable
-QString foregionColumn
-
The documentation for this struct was generated from the following file: -
- - - - diff --git a/doc/html/struct_relation_model__coll__graph.dot b/doc/html/struct_relation_model__coll__graph.dot deleted file mode 100644 index 1dc97af..0000000 --- a/doc/html/struct_relation_model__coll__graph.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph "RelationModel" -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="RelationModel",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" table" ,fontname="Helvetica"]; - Node2 [label="TableModel",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$class_table_model.html"]; -} diff --git a/doc/html/struct_relation_model__coll__graph.md5 b/doc/html/struct_relation_model__coll__graph.md5 deleted file mode 100644 index 3c01a46..0000000 --- a/doc/html/struct_relation_model__coll__graph.md5 +++ /dev/null @@ -1 +0,0 @@ -1d1016c6a2521ac7f33ccacd3e9a5373 \ No newline at end of file diff --git a/doc/html/sync_off.png b/doc/html/sync_off.png deleted file mode 100644 index 3b443fc62892114406e3d399421b2a881b897acc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 853 zcmV-b1FHOqP)oT|#XixUYy%lpuf3i8{fX!o zUyDD0jOrAiT^tq>fLSOOABs-#u{dV^F$b{L9&!2=9&RmV;;8s^x&UqB$PCj4FdKbh zoB1WTskPUPu05XzFbA}=KZ-GP1fPpAfSs>6AHb12UlR%-i&uOlTpFNS7{jm@mkU1V zh`nrXr~+^lsV-s1dkZOaI|kYyVj3WBpPCY{n~yd%u%e+d=f%`N0FItMPtdgBb@py; zq@v6NVArhyTC7)ULw-Jy8y42S1~4n(3LkrW8mW(F-4oXUP3E`e#g**YyqI7h-J2zK zK{m9##m4ri!7N>CqQqCcnI3hqo1I;Yh&QLNY4T`*ptiQGozK>FF$!$+84Z`xwmeMh zJ0WT+OH$WYFALEaGj2_l+#DC3t7_S`vHpSivNeFbP6+r50cO8iu)`7i%Z4BTPh@_m3Tk!nAm^)5Bqnr%Ov|Baunj#&RPtRuK& z4RGz|D5HNrW83-#ydk}tVKJrNmyYt-sTxLGlJY5nc&Re zU4SgHNPx8~Yxwr$bsju?4q&%T1874xxzq+_%?h8_ofw~(bld=o3iC)LUNR*BY%c0y zWd_jX{Y8`l%z+ol1$@Qa?Cy!(0CVIEeYpKZ`(9{z>3$CIe;pJDQk$m3p}$>xBm4lb zKo{4S)`wdU9Ba9jJbVJ0C=SOefZe%d$8=2r={nu<_^a3~>c#t_U6dye5)JrR(_a^E f@}b6j1K9lwFJq@>o)+Ry00000NkvXXu0mjfWa5j* diff --git a/doc/html/sync_on.png b/doc/html/sync_on.png deleted file mode 100644 index e08320fb64e6fa33b573005ed6d8fe294e19db76..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 845 zcmV-T1G4;yP)Y;xxyHF2B5Wzm| zOOGupOTn@c(JmBOl)e;XMNnZuiTJP>rM8<|Q`7I_))aP?*T)ow&n59{}X4$3Goat zgjs?*aasfbrokzG5cT4K=uG`E14xZl@z)F={P0Y^?$4t z>v!teRnNZym<6h{7sLyF1V0HsfEl+l6TrZpsfr1}luH~F7L}ktXu|*uVX^RG$L0`K zWs3j|0tIvVe(N%_?2{(iCPFGf#B6Hjy6o&}D$A%W%jfO8_W%ZO#-mh}EM$LMn7joJ z05dHr!5Y92g+31l<%i1(=L1a1pXX+OYnalY>31V4K}BjyRe3)9n#;-cCVRD_IG1fT zOKGeNY8q;TL@K{dj@D^scf&VCs*-Jb>8b>|`b*osv52-!A?BpbYtTQBns5EAU**$m zSnVSm(teh>tQi*S*A>#ySc=n;`BHz`DuG4&g4Kf8lLhca+zvZ7t7RflD6-i-mcK=M z!=^P$*u2)bkY5asG4gsss!Hn%u~>}kIW`vMs%lJLH+u*9<4PaV_c6U`KqWXQH%+Nu zTv41O(^ZVi@qhjQdG!fbZw&y+2o!iYymO^?ud3{P*HdoX83YV*Uu_HB=?U&W9%AU# z80}k1SS-CXTU7dcQlsm<^oYLxVSseqY6NO}dc`Nj?8vrhNuCdm@^{a3AQ_>6myOj+ z`1RsLUXF|dm|3k7s2jD(B{rzE>WI2scH8i1;=O5Cc9xB3^aJk%fQjqsu+kH#0=_5a z0nCE8@dbQa-|YIuUVvG0L_IwHMEhOj$Mj4Uq05 X8=0q~qBNan00000NkvXXu0mjfptF>5 diff --git a/doc/html/tab_a.png b/doc/html/tab_a.png deleted file mode 100644 index 3b725c41c5a527a3a3e40097077d0e206a681247..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^j6kfy!2~3aiye;!QlXwMjv*C{Z|8b*H5dputLHD# z=<0|*y7z(Vor?d;H&?EG&cXR}?!j-Lm&u1OOI7AIF5&c)RFE;&p0MYK>*Kl@eiymD r@|NpwKX@^z+;{u_Z~trSBfrMKa%3`zocFjEXaR$#tDnm{r-UW|TZ1%4 diff --git a/doc/html/tab_b.png b/doc/html/tab_b.png deleted file mode 100644 index 258c141616477d2eae6c7d1f2a7dd6eafa0f5346..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^j6kfy!2~3aiye;!QhA;(jv*C{Z|??j9WoGTdH7&X z(9($HUV)9C=AM^Vq>I&jx_WcYlgH_iGmK}P|K46&z4%J_^i#oadkiPsQP|_0)sg8u zq0N2G-{;T0v}+Wu-7Pl%*`s}Pc0x&$@!UI2iHp3Ku)0eZZeaW!csA;8NWHCt)=THR S?LI)889ZJ6T-G@yGywqOSws&2 diff --git a/doc/html/tab_h.png b/doc/html/tab_h.png deleted file mode 100644 index 4ca910284bc1e87d45eeacd2147566dbf1b59664..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^j6kfy!2~3aiye;!Qth5Djv*C{Z||PwZE|36y~t_) z>QKa_i$6Fy9UWbMa%4%k|7qY6jcQ1}(Xp8OwZ+ca)5Du9_T76E>aDj`wZ$O!=ZI-;YrdjIl`U`uzuDWSP?o#Dmo{%SgM#oan kX~E1%D-|#H#QbHoIja2U-MgvsK&LQxy85}Sb4q9e0Efg%P5=M^ diff --git a/doc/html/table_8h_source.html b/doc/html/table_8h_source.html deleted file mode 100644 index 3173331..0000000 --- a/doc/html/table_8h_source.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - -Nut: src/table.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
table.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef TABLE_H
-
22 #define TABLE_H
-
23 
-
24 #include <QtCore/QObject>
-
25 #include <QtCore/qglobal.h>
-
26 #include <QtCore/QSet>
-
27 
-
28 #include "tablemodel.h"
-
29 #include "defines.h"
-
30 #include "wherephrase.h"
-
31 
-
32 QT_BEGIN_NAMESPACE
-
33 
-
34 class Database;
-
35 class TableSetBase;
-
36 class NUT_EXPORT Table : public QObject
-
37 {
-
38  Q_OBJECT
-
39 
-
40 public:
-
41  explicit Table(QObject *tableSet = 0);
-
42 
-
43  enum Status{
-
44  NewCreated,
-
45  FeatchedFromDB,
-
46  Added,
-
47  Modified,
-
48  Deleted
-
49  };
-
50 
-
51  void add(TableSetBase *);
-
52  void save(Database *db);
-
53 
-
54  QString primaryKey() const;
-
55  bool isPrimaryKeyAutoIncrement() const;
-
56  QVariant primaryValue() const;
-
57  Status status() const;
-
58  void setStatus(const Status &status);
-
59 
-
60  TableSetBase *tableSet() const;
-
61  void setTableSet(TableSetBase *tableSet);
-
62 
-
63  QSet<QString> changedProperties() const;
-
64 
-
65  bool setParentTable(Table *master);
-
66 signals:
-
67 
-
68 public slots:
-
69 
-
70 protected:
-
71  void propertyChanged(QString propName);
-
72 
-
73 private:
-
74  Status _status;
-
75  QSet<QString> _changedProperties;
-
76  TableSetBase *_tableSet;
-
77 
-
78  QSet<TableSetBase*> tableSets;
-
79 
-
80  template<class T>
-
81  friend class Query;
-
82 };
-
83 
-
84 QT_END_NAMESPACE
-
85 
-
86 #endif // TABLE_H
-
- - - - diff --git a/doc/html/tablemodel_8h_source.html b/doc/html/tablemodel_8h_source.html deleted file mode 100644 index a8b6660..0000000 --- a/doc/html/tablemodel_8h_source.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - -Nut: src/tablemodel.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
tablemodel.h
-
-
-
1 ï»¿/**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef TABLESCHEEMA_H
-
22 #define TABLESCHEEMA_H
-
23 
-
24 #include <QtCore/QVariant>
-
25 #include <QDebug>
-
26 class QJsonObject;
-
27 class TableModel;
-
28 
-
29 struct FieldModel{
-
30  FieldModel() : name(QString::null), length(0), defaultValue(QString::null),
-
31  notNull(false), isPrimaryKey(false), isAutoIncrement(false), isUnique(false)
-
32  {
-
33 
-
34  }
-
35 
-
36  QString name;
-
37  QVariant::Type type;
-
38  int length;
-
39  QString defaultValue;
-
40  bool notNull;
-
41  bool isPrimaryKey;
-
42  bool isAutoIncrement;
-
43  bool isUnique;
-
44 
-
45  bool operator ==(const FieldModel &f) const{
-
46 
-
47  bool b = name == f.name
-
48  && type == f.type
-
49  && length == f.length
-
50  && defaultValue == f.defaultValue
-
51  && notNull == f.notNull;
-
52 
-
53  return b;
-
54  }
-
55 
-
56  bool operator !=(const FieldModel &f) const{
-
57  return !(*this == f);
-
58  }
-
59 };
-
60 
- -
62  QString className;
-
63  QString localColumn;
-
64  TableModel *table;
-
65  QString foregionColumn;
-
66 };
- -
68 {
-
69 public:
-
70 
-
71  TableModel(int typeId, QString tableName);
-
72  TableModel(QJsonObject json, QString tableName);
-
73 
-
74  QJsonObject toJson() const;
-
75 
-
76 // static TableScheema *registerTable(int typeId, QString tableName);
-
77 // static void createForegionKeys();
-
78  static TableModel* model(QString className);
-
79 
-
80  FieldModel *field(QString name) const;
-
81  RelationModel *foregionKey(QString otherTable) const;
-
82 
-
83  QString toString() const;
-
84 
-
85  QString primaryKey() const;
-
86 
-
87  QString name() const;
-
88  void setName(const QString &name);
-
89 
-
90  QString className() const;
-
91  void setClassName(const QString &className);
-
92 
-
93  int typeId() const;
-
94  void setTypeId(const int &typeId);
-
95  QList<FieldModel *> fields() const;
-
96  QList<RelationModel *> foregionKeys() const;
-
97  QStringList fieldsNames() const;
-
98 
-
99  static TableModel *findByTypeId(int typeId);
-
100  static TableModel *findByName(QString name);
-
101  static TableModel *findByClassName(QString className);
-
102 
-
103  bool operator ==(const TableModel &t) const;
-
104  bool operator !=(const TableModel &t) const;
-
105 
-
106 private:
-
107  QString _name;
-
108  QString _className;
-
109  int _typeId;
-
110  QList<FieldModel*> _fields;
-
111  QList<RelationModel*> _foregionKeys;
-
112  static QSet<TableModel*>_allModels;
-
113 };
-
114 
-
115 #endif // TABLESCHEEMA_H
-
- - - - diff --git a/doc/html/tableset_8h_source.html b/doc/html/tableset_8h_source.html deleted file mode 100644 index f5ba5c9..0000000 --- a/doc/html/tableset_8h_source.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - -Nut: src/tableset.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
tableset.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef TABLESET_H
-
22 #define TABLESET_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 #include <QtCore/QVariant>
-
26 #include <QtCore/QMetaMethod>
-
27 #include <QtSql/QSqlQuery>
-
28 
-
29 #include "tablesetbase_p.h"
-
30 #include "database.h"
-
31 #include "table.h"
-
32 
-
33 QT_BEGIN_NAMESPACE
-
34 
-
35 template<class T>
-
36 class Query;
-
37 
-
38 template<class T>
-
39 class NUT_EXPORT TableSet : public TableSetBase
-
40 {
-
41 public:
-
42  TableSet(Database *parent);
-
43  TableSet(Table *parent);
-
44 
-
45  void append(T *t);
-
46  void append(QList<T*> t);
-
47  void remove(T *t);
-
48  void remove(QList<T*> t);
-
49 
-
50  inline T type() const {}
-
51 
-
52  int length() const;
-
53  T *at(int i) const;
-
54  const T &operator[](int i) const;
-
55  Query<T> *createQuery();
-
56 };
-
57 
-
58 template<class T>
-
59 Q_OUTOFLINE_TEMPLATE TableSet<T>::TableSet(Database *parent) : TableSetBase(parent)
-
60 {
-
61  _childClassName = T::staticMetaObject.className();
-
62 }
-
63 
-
64 template<class T>
-
65 Q_OUTOFLINE_TEMPLATE TableSet<T>::TableSet(Table *parent) : TableSetBase(parent)
-
66 {
-
67  _childClassName = T::staticMetaObject.className();
-
68 }
-
69 
-
70 template<class T>
-
71 Q_OUTOFLINE_TEMPLATE Query<T> *TableSet<T>::createQuery()
-
72 {
-
73  Query<T> *q = new Query<T>(_database, this);
-
74 
-
75  return q;
-
76 }
-
77 
-
78 template<class T>
-
79 Q_OUTOFLINE_TEMPLATE int TableSet<T>::length() const
-
80 {
-
81  return _tables.count();
-
82 }
-
83 
-
84 template<class T>
-
85 Q_OUTOFLINE_TEMPLATE T *TableSet<T>::at(int i) const
-
86 {
-
87  return (T*)_tablesList.at(i);
-
88 }
-
89 
-
90 template<class T>
-
91 Q_OUTOFLINE_TEMPLATE const T &TableSet<T>::operator[](int i) const
-
92 {
-
93  return _tablesList[i];
-
94 }
-
95 
-
96 template<class T>
-
97 Q_OUTOFLINE_TEMPLATE void TableSet<T>::append(T *t)
-
98 {
-
99  _tables.insert(t);
-
100  _tablesList.append(t);
-
101 // rows.append(t);
-
102  t->setTableSet(this);
-
103  if(t->status() != Table::FeatchedFromDB)
-
104  t->setStatus(Table::Added);
-
105 }
-
106 
-
107 template<class T>
-
108 Q_OUTOFLINE_TEMPLATE void TableSet<T>::append(QList<T *> t)
-
109 {
-
110  foreach (T* i, t)
-
111  append(i);
-
112 }
-
113 
-
114 template<class T>
-
115 Q_OUTOFLINE_TEMPLATE void TableSet<T>::remove(T *t)
-
116 {
-
117  _tables.remove(t);
-
118  t->setStatus(Table::Deleted);
-
119 }
-
120 
-
121 template<class T>
-
122 Q_OUTOFLINE_TEMPLATE void TableSet<T>::remove(QList<T *> t)
-
123 {
-
124  foreach (T* i, t)
-
125  remove(i);
-
126 }
-
127 
-
128 QT_END_NAMESPACE
-
129 
-
130 #endif // TABLESET_H
-
- - - - diff --git a/doc/html/tablesetbase__p_8h_source.html b/doc/html/tablesetbase__p_8h_source.html deleted file mode 100644 index cdd5930..0000000 --- a/doc/html/tablesetbase__p_8h_source.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - -Nut: src/tablesetbase_p.h Source File - - - - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - - - - - -
- -
- - -
-
-
-
tablesetbase_p.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef TABLESETBASE_H
-
22 #define TABLESETBASE_H
-
23 
-
24 #include <QtCore/QObject>
-
25 #include <QtCore/qglobal.h>
-
26 #include <QtCore/QSet>
-
27 
-
28 #include "defines.h"
-
29 
-
30 class Table;
-
31 class Database;
-
32 class TableSetBase : public QObject
-
33 {
-
34 
-
35 public:
-
36  TableSetBase(Database *parent);
-
37  TableSetBase(Table *parent);
-
38 
-
39  virtual void save(Database *db);
-
40  void clearChilds();
-
41  void add(Table* t);
-
42  QString childClassName() const;
-
43 
-
44  Database *database() const;
-
45  void setDatabase(Database *database);
-
46 
-
47 protected:
-
48  QSet<Table*> _tables;
-
49  QList<Table*> _tablesList;
-
50  QString _tableName;
-
51  Database *_database;
-
52  Table *_table;
-
53  QString _childClassName;
-
54 };
-
55 
-
56 #endif // TABLESETBASE_H
-
- - - - diff --git a/doc/html/tabs.css b/doc/html/tabs.css deleted file mode 100644 index 9cf578f..0000000 --- a/doc/html/tabs.css +++ /dev/null @@ -1,60 +0,0 @@ -.tabs, .tabs2, .tabs3 { - background-image: url('tab_b.png'); - width: 100%; - z-index: 101; - font-size: 13px; - font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; -} - -.tabs2 { - font-size: 10px; -} -.tabs3 { - font-size: 9px; -} - -.tablist { - margin: 0; - padding: 0; - display: table; -} - -.tablist li { - float: left; - display: table-cell; - background-image: url('tab_b.png'); - line-height: 36px; - list-style: none; -} - -.tablist a { - display: block; - padding: 0 20px; - font-weight: bold; - background-image:url('tab_s.png'); - background-repeat:no-repeat; - background-position:right; - color: #283A5D; - text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - text-decoration: none; - outline: none; -} - -.tabs3 .tablist a { - padding: 0 10px; -} - -.tablist a:hover { - background-image: url('tab_h.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); - text-decoration: none; -} - -.tablist li.current a { - background-image: url('tab_a.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); -} diff --git a/doc/html/wherephrase_8h_source.html b/doc/html/wherephrase_8h_source.html deleted file mode 100644 index 06db3c3..0000000 --- a/doc/html/wherephrase_8h_source.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - -Nut: src/wherephrase.h Source File - - - - - - -
-
- - - - - - -
-
Nut -  0.1 -
-
-
- - - - - -
-
-
-
wherephrase.h
-
-
-
1 /**************************************************************************
-
2 **
-
3 ** This file is part of Nut project.
-
4 ** https://github.com/HamedMasafi/Nut
-
5 **
-
6 ** Nut is free software: you can redistribute it and/or modify
-
7 ** it under the terms of the GNU Lesser General Public License as published by
-
8 ** the Free Software Foundation, either version 3 of the License, or
-
9 ** (at your option) any later version.
-
10 **
-
11 ** Nut is distributed in the hope that it will be useful,
-
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
-
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-
14 ** GNU Lesser General Public License for more details.
-
15 **
-
16 ** You should have received a copy of the GNU Lesser General Public License
-
17 ** along with Nut. If not, see <http://www.gnu.org/licenses/>.
-
18 **
-
19 **************************************************************************/
-
20 
-
21 #ifndef PHRASE_H
-
22 #define PHRASE_H
-
23 
-
24 #include <QtCore/qglobal.h>
-
25 
-
26 #include <QVariant>
-
27 #include <QDate>
-
28 #include <QDateTime>
-
29 #include <QTime>
-
30 #include <QSharedPointer>
-
31 
-
32 QT_BEGIN_NAMESPACE
-
33 
-
34 class SqlGeneratorBase;
-
35 class PhraseData{
-
36 public:
-
37  enum Condition
-
38  {
-
39  NotAssign = 0,
-
40  Equal,
-
41  Less,
-
42  LessEqual,
-
43  Null,
-
44  In,
-
45  Like,
-
46 
-
47  Not = 10,
-
48  NotEqual,
-
49  GreaterEqual,
-
50  Greater,
-
51  NotNull,
-
52  NotIn,
-
53  NotLike,
-
54 
-
55  And = 20,
-
56  Or,
-
57 
-
58 
-
59  Append,
-
60  Set,
-
61 
-
62  Add,
-
63  Minus,
-
64  Multiple,
-
65  Divide
-
66  };
-
67 
-
68  enum Type{
-
69  Field,
-
70  WithVariant,
-
71  WithOther,
-
72  WithoutOperand
-
73  };
-
74  Type type;
-
75 
-
76  Condition operatorCond;
-
77 
-
78  QString text;
-
79  const PhraseData *left;
-
80  const PhraseData *right;
-
81  QVariant operand;
-
82 
-
83  PhraseData(const char *className, const char* s);
-
84  PhraseData(PhraseData *l, Condition o);
-
85  PhraseData(PhraseData *l, Condition o, const PhraseData *r);
-
86  PhraseData(PhraseData *l, Condition o, QVariant r);
-
87 
-
88  ~PhraseData();
-
89 };
-
90 
- -
92 protected:
-
93  PhraseData *_data;
-
94  QSharedPointer<PhraseData> _dataPointer;
-
95 
-
96 public:
-
97  WherePhrase(const char *className, const char* s);
-
98 
-
99  WherePhrase(const WherePhrase &l);
- -
101  WherePhrase(WherePhrase *l, PhraseData::Condition o);
-
102  WherePhrase(WherePhrase *l, PhraseData::Condition o, WherePhrase *r);
-
103  WherePhrase(WherePhrase *l, PhraseData::Condition o, QVariant r);
-
104 
-
105  ~WherePhrase();
-
106 
-
107  WherePhrase operator ==(const WherePhrase &other);
-
108  WherePhrase operator !=(const WherePhrase &other);
-
109  WherePhrase operator <(const WherePhrase &other);
-
110  WherePhrase operator >(const WherePhrase &other);
-
111  WherePhrase operator <=(const WherePhrase &other);
-
112  WherePhrase operator >=(const WherePhrase &other);
-
113 
-
114  WherePhrase operator =(const WherePhrase &other);
-
115 
-
116  WherePhrase operator +(const WherePhrase &other);
-
117  WherePhrase operator -(const WherePhrase &other);
-
118  WherePhrase operator *(const WherePhrase &other);
-
119  WherePhrase operator /(const WherePhrase &other);
-
120 
-
121  WherePhrase operator &&(const WherePhrase &other);
-
122  WherePhrase operator ||(const WherePhrase &other);
-
123 
-
124  WherePhrase operator &(const WherePhrase &other);
-
125 
-
126 
-
127  WherePhrase operator ==(const QVariant &other);
-
128  WherePhrase operator !=(const QVariant &other);
-
129  WherePhrase operator <(const QVariant &other);
-
130  WherePhrase operator >(const QVariant &other);
-
131  WherePhrase operator <=(const QVariant &other);
-
132  WherePhrase operator >=(const QVariant &other);
-
133 
-
134 
-
135  PhraseData *data() const;
-
136 };
-
137 
-
138 class FieldPhrase: public WherePhrase{
-
139 public:
-
140  FieldPhrase(const char *className, const char* s);
-
141 
-
142  WherePhrase operator =(const QVariant &other);
-
143  WherePhrase operator !();
-
144 
-
145  WherePhrase isNull();
-
146  WherePhrase in(QVariantList list);
-
147  WherePhrase in(QStringList list);
-
148  WherePhrase like(QString pattern);
-
149 };
-
150 
-
151 
-
152 //TODO: make FieldPhrase template class
-
153 //template <typename T>
-
154 //class FieldPhrase: public WherePhrase{
-
155 
-
156 //};
-
157 
-
158 QT_END_NAMESPACE
-
159 
-
160 #endif // PHRASE_H
-
- - - - diff --git a/src/database.cpp b/src/database.cpp index 6551903..6135f42 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -179,7 +179,7 @@ bool DatabasePrivate::getCurrectScheema() tables.clear(); // TODO: change logs must not be in model - int changeLogTypeId = qRegisterMetaType(); + int changeLogTypeId = qRegisterMetaType(); currentModel.append( new TableModel(changeLogTypeId, __CHANGE_LOG_TABLE_NAME)); tables.insert(ChangeLogTable::staticMetaObject.className(), @@ -237,8 +237,6 @@ bool DatabasePrivate::getCurrectScheema() DatabaseModel DatabasePrivate::getLastScheema() { - Q_Q(Database); - ChangeLogTable *u = changeLogs->query() ->orderBy(!ChangeLogTable::idField()) ->first(); @@ -326,7 +324,6 @@ Database::Database(const Database &other) : QObject(other.parent()), d_ptr(new DatabasePrivate(this)) { DatabasePrivate::lastId++; - Q_D(Database); setDriver(other.driver()); setHostName(other.hostName()); @@ -481,6 +478,12 @@ void Database::databaseUpdated(QString oldVersion, QString newVersion) } +/** + * @brief Database::open + * Opens the database connection using the current connection values. + * Returns true on success; otherwise returns false. + * @return bool + */ bool Database::open() { return open(true); diff --git a/src/tableset.h b/src/tableset.h index 2a9c6be..b5e069f 100644 --- a/src/tableset.h +++ b/src/tableset.h @@ -27,8 +27,6 @@ #include #include -#include - #include "tablesetbase_p.h" //#include "database.h" #include "table.h" @@ -62,15 +60,13 @@ public: template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Database *parent) : TableSetBase(parent) { -// auto t = new QMetaType(qRegisterMetaType()); -// _childClassName = t->metaObject()->className(); + _childClassName = T::staticMetaObject.className(); } template Q_OUTOFLINE_TEMPLATE TableSet::TableSet(Table *parent) : TableSetBase(parent) { -// auto t = new QMetaType(qRegisterMetaType()); -// _childClassName = t->metaObject()->className(); + _childClassName = T::staticMetaObject.className(); } template diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 908e796..d12ba0f 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -41,8 +41,8 @@ void MainTest::initTestCase() void MainTest::dataScheema() { - auto json = db.model().toJson(); - auto model = DatabaseModel::fromJson(json); +// auto json = db.model().toJson(); +// auto model = DatabaseModel::fromJson(json); // qDebug() << model.toJson(); // qDebug() << db.model().toJson(); @@ -98,7 +98,7 @@ void MainTest::selectPosts() auto q = db.posts()->query() // q->join(Post::commentsTable()); // q->join(Post::commentsTable()); -// ->join() + ->join() ->orderBy(!Post::saveDateField() & Post::bodyField()) ->setWhere(Post::idField() == postId); From 3780da25c2f9a1a3d15fea889b14f8c595f9fe3b Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 17:56:49 +0330 Subject: [PATCH 23/47] removed std::remove_pointer from query.h --- src/query.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/query.h b/src/query.h index 3ec0dc1..deac129 100644 --- a/src/query.h +++ b/src/query.h @@ -107,7 +107,7 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->tableName = // TableModel::findByClassName(T::staticMetaObject.className())->name(); d->database->model() - .tableByClassName(std::remove_pointer::type::staticMetaObject.className()) + .tableByClassName(T::staticMetaObject.className()) ->name(); } @@ -163,7 +163,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) while (q.next()) { if (lastPkValue != q.value(pk)) { - T *t = new T();//new std::remove_pointer::type(); + T *t = new T(); foreach (QString field, masterFields) t->setProperty(field.toLatin1().data(), q.value(field)); // for (int i = 0; i < t->metaObject()->propertyCount(); From ef5f238fed9ee35c10b64f3d3243f2c898683952 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 18:08:32 +0330 Subject: [PATCH 24/47] disabled email notification in travis ci --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 528bb2a..46f1620 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,6 @@ before_install: script: - qmake nut.pro - make + + notifications: + email: false From e45860eb599dd717574f8dd015553a3b77304cff Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 9 Jan 2018 21:02:28 +0330 Subject: [PATCH 25/47] wip:join --- src/generators/sqlgeneratorbase.cpp | 43 +++++++++++++++++++++++++++++ src/generators/sqlgeneratorbase_p.h | 4 +++ src/query.h | 9 ++++-- src/query_p.h | 1 + test/basic/maintest.cpp | 1 + test/common/post.h | 2 +- 6 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 4c90641..4d80067 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -33,6 +33,18 @@ NUT_BEGIN_NAMESPACE +/* + * Index: + * ALTER TABLE `travelLog` ADD INDEX(`driverId`); + * + * Foreign key: + * ALTER TABLE `travelLog` + * ADD CONSTRAINT `travelLog_ibfk_1` + * FOREIGN KEY (`driverId`) + * REFERENCES `account` (`id`) + * ON DELETE CASCADE + * ON UPDATE CASCADE; + */ SqlGeneratorBase::SqlGeneratorBase(Database *parent) : QObject((QObject *)parent) { @@ -50,6 +62,11 @@ QString SqlGeneratorBase::masterDatabaseName(QString databaseName) return ""; } +QString SqlGeneratorBase::createTable(TableModel *table) +{ + +} + QString SqlGeneratorBase::saveRecord(Table *t, QString tableName) { Q_ASSERT(!tableName.isEmpty() && !tableName.isNull()); @@ -161,6 +178,32 @@ QString SqlGeneratorBase::diff(TableModel *oldTable, TableModel *newTable) return sql; } +QString SqlGeneratorBase::join(const QStringList &list) +{ + if (!list.count()) + return ""; + + if (list.count() == 1) + return list.first(); + + DatabaseModel model = _database->model(); + QStringList clone = list; + QString mainTable = clone.takeFirst(); + QString ret = mainTable; + + do { + QString t = model.tableByClassName(clone.first())->name(); + RelationModel *rel = model.relationByTableNames(mainTable, t); + + if (rel) { + clone.takeFirst(); + ret.append(", " + _database->tableName(clone.takeFirst())); + } + } while (clone.count()); + + return ret; +} + QString SqlGeneratorBase::insertRecord(Table *t, QString tableName) { QString sql = ""; diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index a2bc6fe..2000d64 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -59,6 +59,8 @@ public: virtual QString masterDatabaseName(QString databaseName); + virtual QString createTable(TableModel *table); + virtual QString fieldType(FieldModel *field) = 0; virtual QString fieldDeclare(FieldModel *field); @@ -66,6 +68,8 @@ public: virtual QString diff(FieldModel *oldField, FieldModel *newField); virtual QString diff(TableModel *oldTable, TableModel *newTable); + virtual QString join(const QStringList &list); + virtual QString saveRecord(Table *t, QString tableName); virtual QString insertRecord(Table *t, QString tableName); virtual QString updateRecord(Table *t, QString tableName); diff --git a/src/query.h b/src/query.h index deac129..4d14886 100644 --- a/src/query.h +++ b/src/query.h @@ -53,7 +53,7 @@ public: //ddl Query *setWhere(WherePhrase where); - Query *join(const QString &tableName); + Query *join(const QString &className); Query *join(Table *c); template @@ -125,6 +125,8 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) QList result; d->select = "*"; + d->joins.prepend(d->tableName); + qDebug() << "JOINS="<< d->database->sqlGenertor()->join(d->joins); // QSqlQuery q = // d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, // d->orders, d->tableName, d->joinClassName)); @@ -316,10 +318,11 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::average(FieldPhrase &f) } template -Q_OUTOFLINE_TEMPLATE Query *Query::join(const QString &tableName) +Q_OUTOFLINE_TEMPLATE Query *Query::join(const QString &className) { Q_D(Query); - d->joinClassName = tableName; + d->joinClassName = className; + d->joins.append(className); return this; } diff --git a/src/query_p.h b/src/query_p.h index 8046c3c..250a0f6 100644 --- a/src/query_p.h +++ b/src/query_p.h @@ -46,6 +46,7 @@ public: Database *database; TableSetBase *tableSet; QString joinClassName; + QStringList joins; QList wheres; QList orderPhrases; QHash orders; diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index d12ba0f..900ef67 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -98,6 +98,7 @@ void MainTest::selectPosts() auto q = db.posts()->query() // q->join(Post::commentsTable()); // q->join(Post::commentsTable()); + ->join() ->join() ->orderBy(!Post::saveDateField() & Post::bodyField()) ->setWhere(Post::idField() == postId); diff --git a/test/common/post.h b/test/common/post.h index fbca48f..5b25e23 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -29,7 +29,7 @@ class Post : public Table NUT_DECLARE_CHILD_TABLE(Comment, comments) public: - explicit Post(QObject *tableSet = 0); + Q_INVOKABLE Post(QObject *tableSet = 0); signals: From 597134dc23559cd603175a5084abec5368e38dd2 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Wed, 10 Jan 2018 01:38:19 +0330 Subject: [PATCH 26/47] base join detector and code generator in sql generator base --- src/database.cpp | 4 +-- src/defines.h | 3 +++ src/generators/sqlgeneratorbase.cpp | 40 +++++++++++++++++++++++++---- src/query.h | 3 ++- src/querybase.cpp | 9 +++++++ src/querybase_p.h | 5 +++- src/tablemodel.cpp | 1 + src/tablemodel.h | 2 +- src/tablesetbase_p.h | 7 ++++- test/basic/maintest.cpp | 5 ++-- test/common/post.cpp | 2 +- 11 files changed, 66 insertions(+), 15 deletions(-) diff --git a/src/database.cpp b/src/database.cpp index 6135f42..f9824d9 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -227,8 +227,8 @@ bool DatabasePrivate::getCurrectScheema() } } - foreach (TableModel *sch, currentModel) - foreach (RelationModel *fk, sch->foregionKeys()) + foreach (TableModel *table, currentModel) + foreach (RelationModel *fk, table->foregionKeys()) fk->table = currentModel.tableByClassName(fk->className); allTableMaps.insert(q->metaObject()->className(), currentModel); diff --git a/src/defines.h b/src/defines.h index a03b05d..f5c965a 100644 --- a/src/defines.h +++ b/src/defines.h @@ -32,6 +32,9 @@ # define NUT_EXPORT Q_DECL_EXPORT #endif +#define NUT_INFO(type, name, value) \ + Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name "\n" #type), #value) + // Database //TODO: remove minor version #define NUT_DB_VERSION(version) \ diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 4d80067..9619336 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -44,6 +44,11 @@ NUT_BEGIN_NAMESPACE * REFERENCES `account` (`id`) * ON DELETE CASCADE * ON UPDATE CASCADE; + * + * SELECT + * FROM dbo.GiftTypes + * INNER JOIN dbo.GiftCards ON dbo.GiftTypes.GiftTypeID = dbo.GiftCards.GiftTypeID + * INNER JOIN dbo.Entities ON dbo.GiftCards.GiftCardID = dbo.Entities.GiftCardID */ SqlGeneratorBase::SqlGeneratorBase(Database *parent) : QObject((QObject *)parent) @@ -180,6 +185,12 @@ QString SqlGeneratorBase::diff(TableModel *oldTable, TableModel *newTable) QString SqlGeneratorBase::join(const QStringList &list) { + //TODO: make this ungly code better and bugless :-) + /* + * Known issues: + * Support onle near joins, far supports with medium table finding not support yet + */ + if (!list.count()) return ""; @@ -192,12 +203,31 @@ QString SqlGeneratorBase::join(const QStringList &list) QString ret = mainTable; do { - QString t = model.tableByClassName(clone.first())->name(); - RelationModel *rel = model.relationByTableNames(mainTable, t); - + QString table = model.tableByClassName(clone.first())->name(); + clone.takeFirst(); + RelationModel *rel = model.relationByTableNames(mainTable, table); if (rel) { - clone.takeFirst(); - ret.append(", " + _database->tableName(clone.takeFirst())); + //mainTable is master of table + ret.append(QString(" INNER JOIN %1 ON %4.%2 = %1.%3") + .arg(table) + .arg(rel->table->primaryKey()) + .arg(rel->localColumn) + .arg(mainTable)); + + } else{ + rel = model.relationByTableNames(table, mainTable); + if (rel) { + // table is master of mainTable + ret.append(QString(" INNER JOIN %1 ON %4.%2 = %1.%3") + .arg(table) + .arg(rel->localColumn) + .arg(rel->table->primaryKey()) + .arg(mainTable)); + + } else { + qInfo("Relation for %s and %s not exists", + qPrintable(table), qPrintable(mainTable)); + } } } while (clone.count()); diff --git a/src/query.h b/src/query.h index 4d14886..8f4ad76 100644 --- a/src/query.h +++ b/src/query.h @@ -209,7 +209,8 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) childTable->setStatus(Table::FeatchedFromDB); childTable->setTableSet(childTableSet); childTable->clear(); - childTableSet->add(childTable); + addTableToSet(childTableSet, childTable); +// childTableSet->add(childTable); } lastPkValue = q.value(pk); diff --git a/src/querybase.cpp b/src/querybase.cpp index 56f93d0..5a9526d 100644 --- a/src/querybase.cpp +++ b/src/querybase.cpp @@ -1,5 +1,9 @@ #include "querybase_p.h" +#include "table.h" +#include "tablesetbase_p.h" + + NUT_BEGIN_NAMESPACE QueryBase::QueryBase(QObject *parent) : QObject(parent) @@ -7,4 +11,9 @@ QueryBase::QueryBase(QObject *parent) : QObject(parent) } +void QueryBase::addTableToSet(TableSetBase *set, Table *table) +{ + set->add(table); +} + NUT_END_NAMESPACE diff --git a/src/querybase_p.h b/src/querybase_p.h index c5f370d..4d53ce3 100644 --- a/src/querybase_p.h +++ b/src/querybase_p.h @@ -28,13 +28,16 @@ NUT_BEGIN_NAMESPACE //TODO: remove this class +class Table; +class TableSetBase; class QueryBase : public QObject { Q_OBJECT public: explicit QueryBase(QObject *parent = 0); -signals: +protected: + void addTableToSet(TableSetBase *set, Table *table); public slots: }; diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 7e3758a..5696ff6 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -211,6 +211,7 @@ TableModel::TableModel(int typeId, QString tableName) fk->foregionColumn = value; fk->className = value; _foregionKeys.append(fk); + qDebug() << "REL="<query() // q->join(Post::commentsTable()); // q->join(Post::commentsTable()); - ->join() +// ->join() ->join() ->orderBy(!Post::saveDateField() & Post::bodyField()) ->setWhere(Post::idField() == postId); @@ -158,8 +158,7 @@ void MainTest::testDate() void MainTest::join() { auto q = db.comments()->query() -// ->join(Comment::author()) -// ->join(Comment::post()) + ->join() ->join() ->setWhere(Comment::saveDateField() < QDateTime::currentDateTime().addDays(-1)) ->orderBy(Comment::saveDateField()); diff --git a/test/common/post.cpp b/test/common/post.cpp index 62155fb..bf980f6 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -3,7 +3,7 @@ #include "tableset.h" Post::Post(QObject *parent) : Table(parent), - m_comments(new TableSet(this)), m_id(0), m_title("") + m_id(0), m_title(""), m_comments(new TableSet(this)) { } From 073f3b8d2e7587e53be0f2bbbc5bcad2b3b7159d Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Wed, 10 Jan 2018 02:05:55 +0330 Subject: [PATCH 27/47] travis ci file fixed --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46f1620..528bb2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,3 @@ before_install: script: - qmake nut.pro - make - - notifications: - email: false From a22065799495823d3ed745c294268472c1d3c125 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Wed, 10 Jan 2018 02:35:49 +0330 Subject: [PATCH 28/47] fix travis build break --- src/generators/sqlgeneratorbase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 9619336..1c630e2 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -19,6 +19,7 @@ **************************************************************************/ #include +#include #include #include #include From 8af466e4807a6cc5c5783b1a7c228ff2b45fda63 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Wed, 10 Jan 2018 19:48:49 +0330 Subject: [PATCH 29/47] join in select command --- src/defines.h | 15 +-------------- src/generators/mysqlgenerator.cpp | 11 +++++++++++ src/generators/mysqlgenerator.h | 1 + src/generators/sqlgeneratorbase.cpp | 19 +++++++++++++------ src/generators/sqlgeneratorbase_p.h | 5 ++--- src/generators/sqlitegenerator.cpp | 7 +++---- src/generators/sqlservergenerator.cpp | 5 ++--- src/generators/sqlservergenerator.h | 3 +-- src/query.h | 19 +++++++++++++------ test/common/user.h | 2 +- 10 files changed, 48 insertions(+), 39 deletions(-) diff --git a/src/defines.h b/src/defines.h index f5c965a..21a4bad 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,7 +33,7 @@ #endif #define NUT_INFO(type, name, value) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name "\n" #type), #value) + Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #value) // Database //TODO: remove minor version @@ -107,17 +107,4 @@ public: \ #define NUT_NOT_NULL(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_NOT_NULL), "1") #define NUT_INDEX(name, field, order) -#ifndef NUT_NO_KEYWORDS -# define FROM(x) (x->query()) -# define WHERE(x) ->setWhere(x) -# define JOIN(x) ->join() -# define ORDERBY(x) ->orderBy(#x); -# define ORDERBY_DESC(x) ->orderBy(!#x); - -# define SELECT() ->toList() -# define COUNT() ->count() -# define DELETE() ->remove() -# define FIRST() ->first() -#endif // NUT_NO_KEYWORDS - #endif // SYNTAX_DEFINES_H diff --git a/src/generators/mysqlgenerator.cpp b/src/generators/mysqlgenerator.cpp index e1ecb12..1436360 100644 --- a/src/generators/mysqlgenerator.cpp +++ b/src/generators/mysqlgenerator.cpp @@ -134,4 +134,15 @@ QString MySqlGenerator::phrase(const PhraseData *d) const return SqlGeneratorBase::phrase(d); } +QString MySqlGenerator::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, int skip, int take) +{ + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); + + if (take != -1 && skip != -1) + command.append(QString(" LIMIT %1 OFFSET %2") + .arg(skip) + .arg(take)); + return command; +} + NUT_END_NAMESPACE diff --git a/src/generators/mysqlgenerator.h b/src/generators/mysqlgenerator.h index 8243ada..335ebab 100644 --- a/src/generators/mysqlgenerator.h +++ b/src/generators/mysqlgenerator.h @@ -35,6 +35,7 @@ public: QString escapeValue(const QVariant &v) const; QVariant readValue(const QVariant::Type &type, const QVariant &dbValue); QString phrase(const PhraseData *d) const; + QString selectCommand(AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 1c630e2..d30538f 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -180,11 +180,12 @@ QString SqlGeneratorBase::diff(TableModel *oldTable, TableModel *newTable) sql = QString("CREATE TABLE %1 \n(%2)").arg(newTable->name()).arg( columnSql.join(",\n")); + qDebug() << sql; } return sql; } -QString SqlGeneratorBase::join(const QStringList &list) +QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) { //TODO: make this ungly code better and bugless :-) /* @@ -215,6 +216,9 @@ QString SqlGeneratorBase::join(const QStringList &list) .arg(rel->localColumn) .arg(mainTable)); + if (order != Q_NULLPTR) + order->append(table + "." + rel->localColumn); + } else{ rel = model.relationByTableNames(table, mainTable); if (rel) { @@ -225,6 +229,9 @@ QString SqlGeneratorBase::join(const QStringList &list) .arg(rel->table->primaryKey()) .arg(mainTable)); + if (order != Q_NULLPTR) + order->append(table + "." + rel->table->primaryKey()); + } else { qInfo("Relation for %s and %s not exists", qPrintable(table), qPrintable(mainTable)); @@ -373,16 +380,16 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, QList &wheres, QList &orders, - QString tableName, - QString joinClassName, int skip, int take) + QStringList joins, int skip, int take) { Q_UNUSED(take); Q_UNUSED(skip); + QStringList joinedOrders; QString select = agregateText(t, agregateArg); + QString from = join(joins, &joinedOrders); QString where = createWhere(wheres); - QString order = ""; - QString from = fromTableText(tableName, joinClassName, order); + QString order = joinedOrders.join(", "); foreach (WherePhrase p, orders) { if (order != "") @@ -404,7 +411,7 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, replaceTableNames(sql); - return sql; + return sql + " "; } QString SqlGeneratorBase::createWhere(QList &wheres) diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 2000d64..5803654 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -68,7 +68,7 @@ public: virtual QString diff(FieldModel *oldField, FieldModel *newField); virtual QString diff(TableModel *oldTable, TableModel *newTable); - virtual QString join(const QStringList &list); + virtual QString join(const QStringList &list, QStringList *order = Q_NULLPTR); virtual QString saveRecord(Table *t, QString tableName); virtual QString insertRecord(Table *t, QString tableName); @@ -82,8 +82,7 @@ public: QString agregateArg, QList &wheres, QList &orders, - QString tableName, - QString joinClassName, + QStringList joins, int skip = -1, int take = -1); virtual QString deleteCommand(QList &wheres, QString tableName); diff --git a/src/generators/sqlitegenerator.cpp b/src/generators/sqlitegenerator.cpp index 5219a61..a315831 100644 --- a/src/generators/sqlitegenerator.cpp +++ b/src/generators/sqlitegenerator.cpp @@ -54,10 +54,9 @@ QString SqliteGenerator::fieldType(FieldModel *field) dbType = "real"; break; case QVariant::Int: -// if(field->isPrimaryKey) -// dbType = "INTEGER PRIMARY KEY"; -// else - dbType = "integer"; + dbType = "integer"; +// if (field->isAutoIncrement) +// dbType.append(" PRIMARY KEY AUTOINCREMENT"); break; case QVariant::String: if(field->length) diff --git a/src/generators/sqlservergenerator.cpp b/src/generators/sqlservergenerator.cpp index a051d6d..5cddc97 100644 --- a/src/generators/sqlservergenerator.cpp +++ b/src/generators/sqlservergenerator.cpp @@ -135,10 +135,9 @@ QString SqlServerGenerator::escapeValue(const QVariant &v) const QString SqlServerGenerator::selectCommand( SqlGeneratorBase::AgregateType t, QString agregateArg, - QList &wheres, QList &orders, QString tableName, - QString joinClassName, int skip, int take) + QList &wheres, QList &orders, QStringList joins, int skip, int take) { - QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, tableName, joinClassName, skip, take); + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); if (take != -1 && skip != -1) command.append(QString("OFFSET %1 ROWS FETCH NEXT %2 ROWS ONLY") diff --git a/src/generators/sqlservergenerator.h b/src/generators/sqlservergenerator.h index 0966b27..f006dca 100644 --- a/src/generators/sqlservergenerator.h +++ b/src/generators/sqlservergenerator.h @@ -40,8 +40,7 @@ public: QString selectCommand(AgregateType t, QString agregateArg, QList &wheres, - QList &orders, QString tableName, - QString joinClassName, int skip, int take); + QList &orders, QStringList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/query.h b/src/query.h index 8f4ad76..4b6fa8a 100644 --- a/src/query.h +++ b/src/query.h @@ -126,13 +126,14 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) d->select = "*"; d->joins.prepend(d->tableName); + qDebug() << "JOINS="<< d->database->sqlGenertor()->join(d->joins); // QSqlQuery q = // d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, // d->orders, d->tableName, d->joinClassName)); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, - d->tableName, d->joinClassName, d->skip, d->take); + d->joins, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); // QString pk = TableModel::findByName(d->tableName)->primaryKey(); @@ -229,9 +230,11 @@ Q_OUTOFLINE_TEMPLATE QList Query::select(const FieldPhrase f) { Q_D(Query); QList ret; + + d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SignleField, f.data()->text, d->wheres, - d->orderPhrases, d->tableName, d->joinClassName, d->skip, d->take); + d->orderPhrases, d->joins, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); @@ -263,9 +266,10 @@ Q_OUTOFLINE_TEMPLATE int Query::count() { Q_D(Query); + d->joins.prepend(d->tableName); d->select = "COUNT(*)"; d->sql = d->database->sqlGenertor()->selectCommand(SqlGeneratorBase::Count, - QStringLiteral("*"), d->wheres, d->orderPhrases, d->tableName, d->joinClassName); + QStringLiteral("*"), d->wheres, d->orderPhrases, d->joins); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -278,9 +282,10 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::max(FieldPhrase &f) { Q_D(Query); + d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::Max, f.data()->text, d->wheres, d->orderPhrases, - d->tableName, d->joinClassName); + d->joins); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -293,9 +298,10 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::min(FieldPhrase &f) { Q_D(Query); + d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::Min, f.data()->text, d->wheres, d->orderPhrases, - d->tableName, d->joinClassName); + d->joins); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -308,9 +314,10 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::average(FieldPhrase &f) { Q_D(Query); + d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::Average, f.data()->text, d->wheres, d->orderPhrases, - d->tableName, d->joinClassName); + d->joins); QSqlQuery q = d->database->exec(d->sql); if (q.next()) diff --git a/test/common/user.h b/test/common/user.h index d2350f2..dd3330c 100644 --- a/test/common/user.h +++ b/test/common/user.h @@ -17,7 +17,7 @@ class User : public Nut::Table Q_OBJECT NUT_PRIMARY_AUTO_INCREMENT(id) - NUT_DECLARE_FIELD(QUuid, id, id, setId) + NUT_DECLARE_FIELD(int, id, id, setId) NUT_NOT_NULL(username) NUT_LEN(username, 50) From 1713a237eb5c3cc9ef0175f7cdce30afeec6b9e4 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 11 Jan 2018 10:43:01 +0330 Subject: [PATCH 30/47] uuid detect --- src/generators/sqlgeneratorbase.cpp | 45 ++++++++++++++++++----------- src/generators/sqlgeneratorbase_p.h | 12 +++++--- src/query.h | 8 +++-- test/basic/maintest.cpp | 12 +++++++- test/basic/maintest.h | 3 ++ 5 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index d30538f..06029a2 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "sqlgeneratorbase_p.h" @@ -381,6 +382,17 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QList &wheres, QList &orders, QStringList joins, int skip, int take) +{ + return selectCommand(t, agregateArg, wheres, orders, joins, skip, take); +} + +QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, + QString agregateArg, + QList &wheres, + QList &orders, + QStringList joins, + int skip, int take, + QStringList *order) { Q_UNUSED(take); Q_UNUSED(skip); @@ -389,12 +401,14 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString select = agregateText(t, agregateArg); QString from = join(joins, &joinedOrders); QString where = createWhere(wheres); - QString order = joinedOrders.join(", "); + QString orderText = joinedOrders.join(", "); + if (order != Q_NULLPTR) + order = joinedOrders; foreach (WherePhrase p, orders) { - if (order != "") - order.append(", "); - order.append(phraseOrder(p.data())); + if (orderText != "") + orderText.append(", "); + orderText.append(phraseOrder(p.data())); } QString sql = "SELECT " + select + " FROM " + from; @@ -402,8 +416,8 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, if (where != "") sql.append(" WHERE " + where); - if (order != "") - sql.append(" ORDER BY " + order); + if (orderText != "") + sql.append(" ORDER BY " + orderText); for (int i = 0; i < _database->model().count(); i++) sql = sql.replace(_database->model().at(i)->className() + ".", @@ -479,14 +493,6 @@ QString SqlGeneratorBase::updateCommand(WherePhrase &phrase, return sql; } -QString SqlGeneratorBase::joinTables(QStringList tables) -{ - Q_UNUSED(tables); - //TODO: implement me -// _database->model().relationByClassNames() - return ""; -} - QString SqlGeneratorBase::escapeValue(const QVariant &v) const { switch (v.type()) { @@ -502,18 +508,22 @@ QString SqlGeneratorBase::escapeValue(const QVariant &v) const return v.toString(); break; + case QVariant::Uuid: + return v.toUuid().toString(); + break; + case QVariant::Char: case QVariant::String: return "'" + v.toString() + "'"; case QVariant::DateTime: - return "'" + v.toDateTime().toString() + "'"; + return "'" + v.toDateTime().toString(Qt::ISODate) + "'"; case QVariant::Date: - return "'" + v.toDate().toString() + "'"; + return "'" + v.toDate().toString(Qt::ISODate) + "'"; case QVariant::Time: - return "'" + v.toTime().toString() + "'"; + return "'" + v.toTime().toString(Qt::ISODate) + "'"; case QVariant::StringList: case QVariant::List: @@ -534,6 +544,7 @@ QString SqlGeneratorBase::escapeValue(const QVariant &v) const return ""; default: + Q_UNREACHABLE(); return ""; } } diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 5803654..5668116 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -71,11 +71,10 @@ public: virtual QString join(const QStringList &list, QStringList *order = Q_NULLPTR); virtual QString saveRecord(Table *t, QString tableName); + virtual QString insertRecord(Table *t, QString tableName); virtual QString updateRecord(Table *t, QString tableName); virtual QString deleteRecord(Table *t, QString tableName); - - virtual QString deleteRecords(QString tableName, QString where); virtual QString selectCommand(AgregateType t, @@ -84,13 +83,18 @@ public: QList &orders, QStringList joins, int skip = -1, int take = -1); + virtual QString selectCommand(AgregateType t, + QString agregateArg, + QList &wheres, + QList &orders, + QStringList joins, + int skip = -1, int take = -1, + QStringList *order = Q_NULLPTR); virtual QString deleteCommand(QList &wheres, QString tableName); virtual QString updateCommand(WherePhrase &phrase, QList &wheres, QString tableName); - virtual QString joinTables(QStringList tables); - virtual QString escapeValue(const QVariant &v) const; virtual QVariant readValue(const QVariant::Type &type, const QVariant &dbValue); virtual QString phrase(const PhraseData *d) const; diff --git a/src/query.h b/src/query.h index 4b6fa8a..51150e1 100644 --- a/src/query.h +++ b/src/query.h @@ -131,12 +131,16 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) // QSqlQuery q = // d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, // d->orders, d->tableName, d->joinClassName)); + QStringList orders; d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, - d->joins, d->skip, d->take); + d->joins, d->skip, d->take, &orders); QSqlQuery q = d->database->exec(d->sql); - // QString pk = TableModel::findByName(d->tableName)->primaryKey(); + while (q.next()) { + + } + QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); QVariant lastPkValue = QVariant(); int childTypeId = 0; diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 338440c..9183869 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -46,7 +46,16 @@ void MainTest::dataScheema() // qDebug() << model.toJson(); // qDebug() << db.model().toJson(); -// QTEST_ASSERT(model == db.model()); + // QTEST_ASSERT(model == db.model()); +} + +void MainTest::createUser() +{ + user = new User; + user->setUsername("admin"); + user->setPassword("123456"); + db.users()->append(user); + db.saveChanges(); } void MainTest::createPost() @@ -84,6 +93,7 @@ void MainTest::createPost2() Comment *comment = new Comment; comment->setMessage("comment #" + QString::number(i)); comment->setSaveDate(QDateTime::currentDateTime()); + comment->setAuthor(user); comment->setPostId(newPost->id()); db.comments()->append(comment); } diff --git a/test/basic/maintest.h b/test/basic/maintest.h index b00d259..06e3ee1 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -6,12 +6,14 @@ #include "weblogdatabase.h" class Post; +class User; class MainTest : public QObject { Q_OBJECT WeblogDatabase db; int postId; Post *post; + User *User; public: explicit MainTest(QObject *parent = 0); @@ -22,6 +24,7 @@ private slots: void initTestCase(); void dataScheema(); + void createUser(); void createPost(); void createPost2(); void selectPosts(); From dc71ce1270568456a071b25e1e2e9e9c51feeb66 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 11 Jan 2018 13:06:48 +0330 Subject: [PATCH 31/47] NUT_INFO --- src/defines.h | 22 +++--- src/generators/sqlgeneratorbase.cpp | 14 +--- src/generators/sqlgeneratorbase_p.h | 7 -- src/query.h | 83 ++++++++++++++++----- src/query_p.h | 1 + src/table.cpp | 2 + src/tablemodel.cpp | 112 ++++++++++++++++------------ src/tablemodel.h | 1 + test/basic/maintest.h | 2 +- 9 files changed, 145 insertions(+), 99 deletions(-) diff --git a/src/defines.h b/src/defines.h index 21a4bad..60b9d1c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,15 +33,15 @@ #endif #define NUT_INFO(type, name, value) \ - Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #value) + Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #type "\n" #name "\n" #value) // Database //TODO: remove minor version #define NUT_DB_VERSION(version) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version) + NUT_INFO(__nut_DB_VERSION, version, 0) #define NUT_DECLARE_TABLE(type, name) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ + NUT_INFO(__nut_TABLE, type, name) \ Q_PROPERTY(type* name READ name) \ Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##s READ name##s) \ type* m_##name; \ @@ -54,7 +54,7 @@ public: \ //Table #define NUT_DECLARE_FIELD(type, name, read, write) \ Q_PROPERTY(type name READ read WRITE write) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name " " __nut_FIELD), #name) \ + NUT_INFO(__nut_FIELD, name, 0) \ type m_##name; \ public: \ static NUT_WRAP_NAMESPACE(FieldPhrase) name ## Field(){ \ @@ -72,7 +72,7 @@ public: \ #define NUT_FOREGION_KEY(type, keytype, name, read, write) \ Q_PROPERTY(type* name READ read WRITE write) \ NUT_DECLARE_FIELD(keytype, name##Id, read##Id, write##Id) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name "Id " __nut_FOREGION_KEY), #type) \ + NUT_INFO(__nut_FOREGION_KEY, name, type) \ type *m_##name; \ public: \ type *read() const { return m_##name ; } \ @@ -97,14 +97,14 @@ public: \ } -#define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) -#define NUT_AUTO_INCREMENT(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_AUTO_INCREMENT), #x) +#define NUT_PRIMARY_KEY(x) NUT_INFO(__nut_PRIMARY_KEY, x, 0) +#define NUT_AUTO_INCREMENT(x) NUT_INFO(__nut_AUTO_INCREMENT, x, 0) #define NUT_PRIMARY_AUTO_INCREMENT(x) NUT_PRIMARY_KEY(x) \ NUT_AUTO_INCREMENT(x) -#define NUT_UNIQUE(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_UNIQUE), #x) -#define NUT_LEN(field, len) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #field " " __nut_LEN), #len) -#define NUT_DEFAULT_VALUE(x, n) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_DEFAULT_VALUE), #n) -#define NUT_NOT_NULL(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_NOT_NULL), "1") +#define NUT_UNIQUE(x) NUT_INFO(__nut_UNIQUE, x, 0) +#define NUT_LEN(field, len) NUT_INFO(__nut_LEN, field, len) +#define NUT_DEFAULT_VALUE(x, n) NUT_INFO(__nut_DEFAULT_VALUE, x, n) +#define NUT_NOT_NULL(x) NUT_INFO(__nut_NOT_NULL, x, 1) #define NUT_INDEX(name, field, order) #endif // SYNTAX_DEFINES_H diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 06029a2..c99c162 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -377,22 +377,12 @@ QString SqlGeneratorBase::deleteRecords(QString tableName, QString where) return sql; } -QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, - QString agregateArg, - QList &wheres, - QList &orders, - QStringList joins, int skip, int take) -{ - return selectCommand(t, agregateArg, wheres, orders, joins, skip, take); -} - QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, - int skip, int take, - QStringList *order) + int skip, int take) { Q_UNUSED(take); Q_UNUSED(skip); @@ -402,8 +392,6 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString from = join(joins, &joinedOrders); QString where = createWhere(wheres); QString orderText = joinedOrders.join(", "); - if (order != Q_NULLPTR) - order = joinedOrders; foreach (WherePhrase p, orders) { if (orderText != "") diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 5668116..d729899 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -83,13 +83,6 @@ public: QList &orders, QStringList joins, int skip = -1, int take = -1); - virtual QString selectCommand(AgregateType t, - QString agregateArg, - QList &wheres, - QList &orders, - QStringList joins, - int skip = -1, int take = -1, - QStringList *order = Q_NULLPTR); virtual QString deleteCommand(QList &wheres, QString tableName); diff --git a/src/query.h b/src/query.h index 51150e1..325696c 100644 --- a/src/query.h +++ b/src/query.h @@ -104,6 +104,7 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->database = database; d->tableSet = tableSet; + d->className = T::staticMetaObject.className(); d->tableName = // TableModel::findByClassName(T::staticMetaObject.className())->name(); d->database->model() @@ -125,22 +126,76 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) QList result; d->select = "*"; - d->joins.prepend(d->tableName); + d->joins.prepend(d->className); + + qDebug() << "JOINS="<< d->joins; - qDebug() << "JOINS="<< d->database->sqlGenertor()->join(d->joins); - // QSqlQuery q = - // d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, - // d->orders, d->tableName, d->joinClassName)); - QStringList orders; d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, - d->joins, d->skip, d->take, &orders); + d->joins, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); - while (q.next()) { - + struct LevelData{ + QString key; + QString className; + QVariant keyValue; + int typeId; + TableSetBase *tableSet; + Table *lastRow; + }; + QVector levels; + foreach (QString className, d->joins) { + LevelData data; + data.className = className; + TableModel *m = d->database->model().tableByClassName(className); + if (!m) + qFatal("Model '%s' not found!!!", qPrintable(className)); + data.key = m->primaryKey(); + data.typeId = m->typeId(); + data.keyValue = QVariant(); + data.tableSet = 0; + levels.append(data); } + QList returnList; + while (q.next()) { + for (int i = 0; i < levels.count(); i++) { + LevelData &data = levels[i]; + if (!data.tableSet || data.keyValue != q.value(data.key)) { + + //create table row + Table *childTable; + if (data.className == d->className) { + childTable = new T(); + returnList.append(dynamic_cast(childTable)); + } else { + const QMetaObject *childMetaObject + = QMetaType::metaObjectForType(data.typeId); + childTable = qobject_cast(childMetaObject->newInstance()); + } + + QStringList childFields + = d->database->model().tableByClassName(data.className)->fieldsNames(); + foreach (QString field, childFields) + childTable->setProperty(field.toLatin1().data(), q.value(field)); + + //set last created row + data.lastRow = childTable; + if (i < levels.count() - 1) { + QSet tableSets = childTable->tableSets; + foreach (TableSetBase *ts, tableSets) + if (ts->childClassName() == levels[i + 1].className) + data.tableSet = ts; + } + if (i) + childTable->setTableSet(levels[i - 1].tableSet); + } + } + } + if (m_autoDelete) + deleteLater(); + return returnList; +/* QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); QVariant lastPkValue = QVariant(); int childTypeId = 0; @@ -173,15 +228,6 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) T *t = new T(); foreach (QString field, masterFields) t->setProperty(field.toLatin1().data(), q.value(field)); - // for (int i = 0; i < t->metaObject()->propertyCount(); - // i++) { - // const QMetaProperty p = - // t->metaObject()->property(i); - - // p.write(t, - // d->database->sqlGenertor()->readValue(p.type(), - // q.value(p.name()))); - // } t->setTableSet(d->tableSet); t->setStatus(Table::FeatchedFromDB); @@ -226,6 +272,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) if (m_autoDelete) deleteLater(); return result; + */ } template diff --git a/src/query_p.h b/src/query_p.h index 250a0f6..a768ef3 100644 --- a/src/query_p.h +++ b/src/query_p.h @@ -41,6 +41,7 @@ public: ~QueryPrivate(); QString sql; + QString className; QString tableName; QString select; Database *database; diff --git a/src/table.cpp b/src/table.cpp index 47af793..c310e64 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -22,6 +22,7 @@ #include #include "table.h" #include "database.h" +#include "databasemodel.h" #include "generators/sqlgeneratorbase_p.h" NUT_BEGIN_NAMESPACE @@ -130,6 +131,7 @@ int Table::save(Database *db) { QSqlQuery q = db->exec(db->sqlGenertor()->saveRecord(this, db->tableName(metaObject()->className()))); + if(status() == Added && isPrimaryKeyAutoIncrement()) setProperty(primaryKey().toLatin1().data(), q.lastInsertId()); diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 5696ff6..bcded9c 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -144,6 +144,23 @@ bool TableModel::operator !=(const TableModel &t) const return !(*this == t); } +bool TableModel::checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value) +{ + if (!QString(classInfo.name()).startsWith(__nut_NAME_PERFIX)) { + return false; + } else { + QStringList parts = QString(classInfo.value()).split("\n"); + if (parts.count() != 3) + return false; + + type = parts[0]; + name = parts[1]; + value = parts[2]; + qDebug() << Q_FUNC_INFO << parts; + return true; + } +} + TableModel::TableModel(int typeId, QString tableName) { //TODO: check that @@ -163,20 +180,19 @@ TableModel::TableModel(int typeId, QString tableName) // get fields names for(int j = 0; j < tableMetaObject->classInfoCount(); j++){ - QString name = tableMetaObject->classInfo(j).name(); - name = name.replace("\"", ""); + QString type; + QString name; + QString value; - name = name.remove(__nut_NAME_PERFIX); + if (!checkClassInfo(tableMetaObject->classInfo(j), + type, name, value)) { + continue; + } - if(name.contains(" ")){ - QStringList parts = name.split(" "); - QString propName = parts.at(1); - - if(propName == __nut_FIELD){ - FieldModel *f = new FieldModel; - f->name = parts.at(0); - _fields.append(f); - } + if(type == __nut_FIELD){ + FieldModel *f = new FieldModel; + f->name = name; + _fields.append(f); } } // Browse all fields @@ -195,48 +211,46 @@ TableModel::TableModel(int typeId, QString tableName) // Browse class infos for(int j = 0; j < tableMetaObject->classInfoCount(); j++){ - QString name = tableMetaObject->classInfo(j).name(); - QString value = tableMetaObject->classInfo(j).value(); + QString type; + QString name; + QString value; - name = name.replace("\"", "").remove(__nut_NAME_PERFIX); - value = value.replace("\"", ""); + if (!checkClassInfo(tableMetaObject->classInfo(j), + type, name, value)) { + continue; + } - if(name.contains(" ")){ - QStringList parts = name.split(" "); - QString propName = parts.at(1); + if(type == __nut_FOREGION_KEY){ + RelationModel *fk = new RelationModel; + fk->localColumn = name; + fk->foregionColumn = value; + fk->className = value; + _foregionKeys.append(fk); + } - if(propName == __nut_FOREGION_KEY){ - RelationModel *fk = new RelationModel; - fk->localColumn = parts.at(0); - fk->foregionColumn = value; - fk->className = value; - _foregionKeys.append(fk); - qDebug() << "REL="<length = value.toInt(); - else if(propName == __nut_NOT_NULL) - f->notNull = true; - else if(propName == __nut_DEFAULT_VALUE) - f->defaultValue = value; - else if(propName == __nut_PRIMARY_KEY) - f->isPrimaryKey = true; - else if(propName == __nut_AUTO_INCREMENT) - f->isAutoIncrement = true; - else if(propName == __nut_UNIQUE) - f->isUnique = true; + if(type == __nut_FIELD){ } + + + FieldModel *f = field(name); + if(!f) + continue; + + if(type == __nut_LEN) + f->length = value.toInt(); + else if(type == __nut_NOT_NULL) + f->notNull = true; + else if(type == __nut_DEFAULT_VALUE) + f->defaultValue = value; + else if(type == __nut_PRIMARY_KEY) + f->isPrimaryKey = true; + else if(type == __nut_AUTO_INCREMENT) + f->isAutoIncrement = true; + else if(type == __nut_UNIQUE) + f->isUnique = true; + + } if(!findByTypeId(typeId) && !tableName.isNull()) diff --git a/src/tablemodel.h b/src/tablemodel.h index 2d58d2c..fd0d704 100644 --- a/src/tablemodel.h +++ b/src/tablemodel.h @@ -117,6 +117,7 @@ private: QList _fields; QList _foregionKeys; static QSet_allModels; + bool checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value); }; NUT_END_NAMESPACE diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 06e3ee1..1ba679a 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -13,7 +13,7 @@ class MainTest : public QObject WeblogDatabase db; int postId; Post *post; - User *User; + User *user; public: explicit MainTest(QObject *parent = 0); From 04496c541dcd514246cecf4a7eb1fde4ed79049f Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 11 Jan 2018 13:06:48 +0330 Subject: [PATCH 32/47] NUT_INFO --- src/defines.h | 22 +++--- src/generators/sqlgeneratorbase.cpp | 14 +--- src/generators/sqlgeneratorbase_p.h | 7 -- src/query.h | 83 ++++++++++++++++----- src/query_p.h | 1 + src/table.cpp | 2 + src/tablemodel.cpp | 112 ++++++++++++++++------------ src/tablemodel.h | 1 + test/basic/maintest.h | 2 +- 9 files changed, 145 insertions(+), 99 deletions(-) diff --git a/src/defines.h b/src/defines.h index 21a4bad..60b9d1c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,15 +33,15 @@ #endif #define NUT_INFO(type, name, value) \ - Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #value) + Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #type "\n" #name "\n" #value) // Database //TODO: remove minor version #define NUT_DB_VERSION(version) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_DB_VERSION), #version) + NUT_INFO(__nut_DB_VERSION, version, 0) #define NUT_DECLARE_TABLE(type, name) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX __nut_TABLE " " #type), #name) \ + NUT_INFO(__nut_TABLE, type, name) \ Q_PROPERTY(type* name READ name) \ Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##s READ name##s) \ type* m_##name; \ @@ -54,7 +54,7 @@ public: \ //Table #define NUT_DECLARE_FIELD(type, name, read, write) \ Q_PROPERTY(type name READ read WRITE write) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name " " __nut_FIELD), #name) \ + NUT_INFO(__nut_FIELD, name, 0) \ type m_##name; \ public: \ static NUT_WRAP_NAMESPACE(FieldPhrase) name ## Field(){ \ @@ -72,7 +72,7 @@ public: \ #define NUT_FOREGION_KEY(type, keytype, name, read, write) \ Q_PROPERTY(type* name READ read WRITE write) \ NUT_DECLARE_FIELD(keytype, name##Id, read##Id, write##Id) \ - Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #name "Id " __nut_FOREGION_KEY), #type) \ + NUT_INFO(__nut_FOREGION_KEY, name, type) \ type *m_##name; \ public: \ type *read() const { return m_##name ; } \ @@ -97,14 +97,14 @@ public: \ } -#define NUT_PRIMARY_KEY(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_PRIMARY_KEY), #x) -#define NUT_AUTO_INCREMENT(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_AUTO_INCREMENT), #x) +#define NUT_PRIMARY_KEY(x) NUT_INFO(__nut_PRIMARY_KEY, x, 0) +#define NUT_AUTO_INCREMENT(x) NUT_INFO(__nut_AUTO_INCREMENT, x, 0) #define NUT_PRIMARY_AUTO_INCREMENT(x) NUT_PRIMARY_KEY(x) \ NUT_AUTO_INCREMENT(x) -#define NUT_UNIQUE(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_UNIQUE), #x) -#define NUT_LEN(field, len) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #field " " __nut_LEN), #len) -#define NUT_DEFAULT_VALUE(x, n) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_DEFAULT_VALUE), #n) -#define NUT_NOT_NULL(x) Q_CLASSINFO(QT_STRINGIFY(__nut_NAME_PERFIX #x " " __nut_NOT_NULL), "1") +#define NUT_UNIQUE(x) NUT_INFO(__nut_UNIQUE, x, 0) +#define NUT_LEN(field, len) NUT_INFO(__nut_LEN, field, len) +#define NUT_DEFAULT_VALUE(x, n) NUT_INFO(__nut_DEFAULT_VALUE, x, n) +#define NUT_NOT_NULL(x) NUT_INFO(__nut_NOT_NULL, x, 1) #define NUT_INDEX(name, field, order) #endif // SYNTAX_DEFINES_H diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 06029a2..c99c162 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -377,22 +377,12 @@ QString SqlGeneratorBase::deleteRecords(QString tableName, QString where) return sql; } -QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, - QString agregateArg, - QList &wheres, - QList &orders, - QStringList joins, int skip, int take) -{ - return selectCommand(t, agregateArg, wheres, orders, joins, skip, take); -} - QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, - int skip, int take, - QStringList *order) + int skip, int take) { Q_UNUSED(take); Q_UNUSED(skip); @@ -402,8 +392,6 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString from = join(joins, &joinedOrders); QString where = createWhere(wheres); QString orderText = joinedOrders.join(", "); - if (order != Q_NULLPTR) - order = joinedOrders; foreach (WherePhrase p, orders) { if (orderText != "") diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 5668116..d729899 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -83,13 +83,6 @@ public: QList &orders, QStringList joins, int skip = -1, int take = -1); - virtual QString selectCommand(AgregateType t, - QString agregateArg, - QList &wheres, - QList &orders, - QStringList joins, - int skip = -1, int take = -1, - QStringList *order = Q_NULLPTR); virtual QString deleteCommand(QList &wheres, QString tableName); diff --git a/src/query.h b/src/query.h index 51150e1..325696c 100644 --- a/src/query.h +++ b/src/query.h @@ -104,6 +104,7 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->database = database; d->tableSet = tableSet; + d->className = T::staticMetaObject.className(); d->tableName = // TableModel::findByClassName(T::staticMetaObject.className())->name(); d->database->model() @@ -125,22 +126,76 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) QList result; d->select = "*"; - d->joins.prepend(d->tableName); + d->joins.prepend(d->className); + + qDebug() << "JOINS="<< d->joins; - qDebug() << "JOINS="<< d->database->sqlGenertor()->join(d->joins); - // QSqlQuery q = - // d->database->exec(d->database->sqlGenertor()->selectCommand(d->wheres, - // d->orders, d->tableName, d->joinClassName)); - QStringList orders; d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, - d->joins, d->skip, d->take, &orders); + d->joins, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); - while (q.next()) { - + struct LevelData{ + QString key; + QString className; + QVariant keyValue; + int typeId; + TableSetBase *tableSet; + Table *lastRow; + }; + QVector levels; + foreach (QString className, d->joins) { + LevelData data; + data.className = className; + TableModel *m = d->database->model().tableByClassName(className); + if (!m) + qFatal("Model '%s' not found!!!", qPrintable(className)); + data.key = m->primaryKey(); + data.typeId = m->typeId(); + data.keyValue = QVariant(); + data.tableSet = 0; + levels.append(data); } + QList returnList; + while (q.next()) { + for (int i = 0; i < levels.count(); i++) { + LevelData &data = levels[i]; + if (!data.tableSet || data.keyValue != q.value(data.key)) { + + //create table row + Table *childTable; + if (data.className == d->className) { + childTable = new T(); + returnList.append(dynamic_cast(childTable)); + } else { + const QMetaObject *childMetaObject + = QMetaType::metaObjectForType(data.typeId); + childTable = qobject_cast
(childMetaObject->newInstance()); + } + + QStringList childFields + = d->database->model().tableByClassName(data.className)->fieldsNames(); + foreach (QString field, childFields) + childTable->setProperty(field.toLatin1().data(), q.value(field)); + + //set last created row + data.lastRow = childTable; + if (i < levels.count() - 1) { + QSet tableSets = childTable->tableSets; + foreach (TableSetBase *ts, tableSets) + if (ts->childClassName() == levels[i + 1].className) + data.tableSet = ts; + } + if (i) + childTable->setTableSet(levels[i - 1].tableSet); + } + } + } + if (m_autoDelete) + deleteLater(); + return returnList; +/* QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); QVariant lastPkValue = QVariant(); int childTypeId = 0; @@ -173,15 +228,6 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) T *t = new T(); foreach (QString field, masterFields) t->setProperty(field.toLatin1().data(), q.value(field)); - // for (int i = 0; i < t->metaObject()->propertyCount(); - // i++) { - // const QMetaProperty p = - // t->metaObject()->property(i); - - // p.write(t, - // d->database->sqlGenertor()->readValue(p.type(), - // q.value(p.name()))); - // } t->setTableSet(d->tableSet); t->setStatus(Table::FeatchedFromDB); @@ -226,6 +272,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) if (m_autoDelete) deleteLater(); return result; + */ } template diff --git a/src/query_p.h b/src/query_p.h index 250a0f6..a768ef3 100644 --- a/src/query_p.h +++ b/src/query_p.h @@ -41,6 +41,7 @@ public: ~QueryPrivate(); QString sql; + QString className; QString tableName; QString select; Database *database; diff --git a/src/table.cpp b/src/table.cpp index 47af793..c310e64 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -22,6 +22,7 @@ #include #include "table.h" #include "database.h" +#include "databasemodel.h" #include "generators/sqlgeneratorbase_p.h" NUT_BEGIN_NAMESPACE @@ -130,6 +131,7 @@ int Table::save(Database *db) { QSqlQuery q = db->exec(db->sqlGenertor()->saveRecord(this, db->tableName(metaObject()->className()))); + if(status() == Added && isPrimaryKeyAutoIncrement()) setProperty(primaryKey().toLatin1().data(), q.lastInsertId()); diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 5696ff6..bcded9c 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -144,6 +144,23 @@ bool TableModel::operator !=(const TableModel &t) const return !(*this == t); } +bool TableModel::checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value) +{ + if (!QString(classInfo.name()).startsWith(__nut_NAME_PERFIX)) { + return false; + } else { + QStringList parts = QString(classInfo.value()).split("\n"); + if (parts.count() != 3) + return false; + + type = parts[0]; + name = parts[1]; + value = parts[2]; + qDebug() << Q_FUNC_INFO << parts; + return true; + } +} + TableModel::TableModel(int typeId, QString tableName) { //TODO: check that @@ -163,20 +180,19 @@ TableModel::TableModel(int typeId, QString tableName) // get fields names for(int j = 0; j < tableMetaObject->classInfoCount(); j++){ - QString name = tableMetaObject->classInfo(j).name(); - name = name.replace("\"", ""); + QString type; + QString name; + QString value; - name = name.remove(__nut_NAME_PERFIX); + if (!checkClassInfo(tableMetaObject->classInfo(j), + type, name, value)) { + continue; + } - if(name.contains(" ")){ - QStringList parts = name.split(" "); - QString propName = parts.at(1); - - if(propName == __nut_FIELD){ - FieldModel *f = new FieldModel; - f->name = parts.at(0); - _fields.append(f); - } + if(type == __nut_FIELD){ + FieldModel *f = new FieldModel; + f->name = name; + _fields.append(f); } } // Browse all fields @@ -195,48 +211,46 @@ TableModel::TableModel(int typeId, QString tableName) // Browse class infos for(int j = 0; j < tableMetaObject->classInfoCount(); j++){ - QString name = tableMetaObject->classInfo(j).name(); - QString value = tableMetaObject->classInfo(j).value(); + QString type; + QString name; + QString value; - name = name.replace("\"", "").remove(__nut_NAME_PERFIX); - value = value.replace("\"", ""); + if (!checkClassInfo(tableMetaObject->classInfo(j), + type, name, value)) { + continue; + } - if(name.contains(" ")){ - QStringList parts = name.split(" "); - QString propName = parts.at(1); + if(type == __nut_FOREGION_KEY){ + RelationModel *fk = new RelationModel; + fk->localColumn = name; + fk->foregionColumn = value; + fk->className = value; + _foregionKeys.append(fk); + } - if(propName == __nut_FOREGION_KEY){ - RelationModel *fk = new RelationModel; - fk->localColumn = parts.at(0); - fk->foregionColumn = value; - fk->className = value; - _foregionKeys.append(fk); - qDebug() << "REL="<length = value.toInt(); - else if(propName == __nut_NOT_NULL) - f->notNull = true; - else if(propName == __nut_DEFAULT_VALUE) - f->defaultValue = value; - else if(propName == __nut_PRIMARY_KEY) - f->isPrimaryKey = true; - else if(propName == __nut_AUTO_INCREMENT) - f->isAutoIncrement = true; - else if(propName == __nut_UNIQUE) - f->isUnique = true; + if(type == __nut_FIELD){ } + + + FieldModel *f = field(name); + if(!f) + continue; + + if(type == __nut_LEN) + f->length = value.toInt(); + else if(type == __nut_NOT_NULL) + f->notNull = true; + else if(type == __nut_DEFAULT_VALUE) + f->defaultValue = value; + else if(type == __nut_PRIMARY_KEY) + f->isPrimaryKey = true; + else if(type == __nut_AUTO_INCREMENT) + f->isAutoIncrement = true; + else if(type == __nut_UNIQUE) + f->isUnique = true; + + } if(!findByTypeId(typeId) && !tableName.isNull()) diff --git a/src/tablemodel.h b/src/tablemodel.h index 2d58d2c..fd0d704 100644 --- a/src/tablemodel.h +++ b/src/tablemodel.h @@ -117,6 +117,7 @@ private: QList _fields; QList _foregionKeys; static QSet_allModels; + bool checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value); }; NUT_END_NAMESPACE diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 06e3ee1..1ba679a 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -13,7 +13,7 @@ class MainTest : public QObject WeblogDatabase db; int postId; Post *post; - User *User; + User *user; public: explicit MainTest(QObject *parent = 0); From c5e9d5ec2b066be8ef0f9a38c4cb5af2e1d6e040 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 11 Jan 2018 13:38:45 +0330 Subject: [PATCH 33/47] new macro --- src/database.cpp | 38 +++++++++++++++++++++++++++++--------- src/database_p.h | 2 ++ src/databasemodel.cpp | 2 +- src/defines.h | 3 +-- src/table.cpp | 5 ++++- src/tablemodel.cpp | 4 +++- src/tablemodel.h | 3 ++- 7 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/database.cpp b/src/database.cpp index f9824d9..993f188 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -188,16 +188,20 @@ bool DatabasePrivate::getCurrectScheema() changeLogs = new TableSet(q); for (int i = 0; i < q->metaObject()->classInfoCount(); i++) { - QMetaClassInfo ci = q->metaObject()->classInfo(i); - QString ciName = QString(ci.name()) - .replace(__nut_NAME_PERFIX, "") - .replace("\"", ""); + QString type; + QString name; + QString value; - if (ciName.startsWith(__nut_TABLE)) - tables.insert(ciName.split(" ").at(1), ci.value()); + if (!checkClassInfo(q->metaObject()->classInfo(i), + type, name, value)) { + continue; + } - if (ciName == __nut_DB_VERSION) { - currentModel.setVersion(QString(ci.value())); + if (type == __nut_TABLE) + tables.insert(name, type); + + if (type == __nut_DB_VERSION) + currentModel.setVersion(name); /* TODO: remove QStringList version @@ -213,7 +217,6 @@ bool DatabasePrivate::getCurrectScheema() if (!ok) qFatal("NUT_DB_VERSION macro accept version in format 'x' or " "'x[.y]' only, and x,y must be integer values\n");*/ - } } for (int i = 1; i < q->metaObject()->propertyCount(); i++) { @@ -235,6 +238,23 @@ bool DatabasePrivate::getCurrectScheema() return true; } +bool DatabasePrivate::checkClassInfo(const QMetaClassInfo &classInfo, QString &type, QString &name, QString &value) +{ + if (!QString(classInfo.name()).startsWith(__nut_NAME_PERFIX)) { + return false; + } else { + QStringList parts = QString(classInfo.value()).split("\n"); + if (parts.count() != 3) + return false; + + type = parts[0]; + name = parts[1]; + value = parts[2]; + qDebug() << Q_FUNC_INFO << parts; + return true; + } +} + DatabaseModel DatabasePrivate::getLastScheema() { ChangeLogTable *u = changeLogs->query() diff --git a/src/database_p.h b/src/database_p.h index 4a64be7..8265273 100644 --- a/src/database_p.h +++ b/src/database_p.h @@ -45,6 +45,8 @@ public: DatabaseModel getLastScheema(); bool getCurrectScheema(); + bool checkClassInfo(const QMetaClassInfo &classInfo, + QString &type, QString &name, QString &value); QSqlDatabase db; QString hostName; diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 3b203a4..a4f99bf 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -79,7 +79,7 @@ TableModel *DatabaseModel::tableByClassName(QString className) const // qWarning("Table with class name '%s' not found in model", // qUtf8Printable(className)); -// Q_UNREACHABLE(); + Q_UNREACHABLE(); return 0; } diff --git a/src/defines.h b/src/defines.h index 60b9d1c..b55e827 100644 --- a/src/defines.h +++ b/src/defines.h @@ -33,10 +33,9 @@ #endif #define NUT_INFO(type, name, value) \ - Q_CLASSINFO(__nut_NAME_PERFIX #type #name #value, #type "\n" #name "\n" #value) + Q_CLASSINFO(__nut_NAME_PERFIX type #name #value, type "\n" #name "\n" #value) // Database -//TODO: remove minor version #define NUT_DB_VERSION(version) \ NUT_INFO(__nut_DB_VERSION, version, 0) diff --git a/src/table.cpp b/src/table.cpp index c310e64..3f729dd 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -68,7 +68,10 @@ QString Table::primaryKey() const bool Table::isPrimaryKeyAutoIncrement() const { - return TableModel::findByClassName(metaObject()->className())->field(primaryKey())->isAutoIncrement; + auto m = TableModel::findByClassName(metaObject()->className()); + auto pk = m->primaryKey(); + auto f = m->field(pk); + return f->isAutoIncrement; } diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index bcded9c..4bd7cc4 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -144,7 +144,8 @@ bool TableModel::operator !=(const TableModel &t) const return !(*this == t); } -bool TableModel::checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value) +bool TableModel::checkClassInfo(const QMetaClassInfo &classInfo, + QString &type, QString &name, QString &value) { if (!QString(classInfo.name()).startsWith(__nut_NAME_PERFIX)) { return false; @@ -189,6 +190,7 @@ TableModel::TableModel(int typeId, QString tableName) continue; } + qDebug() << "**********" << type << __nut_FIELD << (type == __nut_FIELD); if(type == __nut_FIELD){ FieldModel *f = new FieldModel; f->name = name; diff --git a/src/tablemodel.h b/src/tablemodel.h index fd0d704..04d05be 100644 --- a/src/tablemodel.h +++ b/src/tablemodel.h @@ -117,7 +117,8 @@ private: QList _fields; QList _foregionKeys; static QSet_allModels; - bool checkClassInfo(const QMetaClassInfo &classInfo, QString type, QString name, QString value); + bool checkClassInfo(const QMetaClassInfo &classInfo, + QString &type, QString &name, QString &value); }; NUT_END_NAMESPACE From b3fac0763cea54cf2286b4a51aecdfd915b80999 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Thu, 11 Jan 2018 19:44:29 +0330 Subject: [PATCH 34/47] join progress / pass to home --- src/database.cpp | 3 +- src/databasemodel.cpp | 5 +-- src/defines.h | 2 +- src/generators/mysqlgenerator.cpp | 4 +- src/generators/sqlgeneratorbase.cpp | 56 ++++++++++++++++++++------ src/generators/sqlgeneratorbase_p.h | 2 + src/generators/sqlitegenerator.cpp | 15 +++++++ src/generators/sqlitegenerator.h | 5 +++ src/query.h | 62 ++++++++++++++++++++--------- src/table.cpp | 1 - src/tablemodel.cpp | 2 - test/basic/maintest.cpp | 28 ++++++++----- test/basic/maintest.h | 3 +- 13 files changed, 135 insertions(+), 53 deletions(-) diff --git a/src/database.cpp b/src/database.cpp index 993f188..202787a 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -198,7 +198,7 @@ bool DatabasePrivate::getCurrectScheema() } if (type == __nut_TABLE) - tables.insert(name, type); + tables.insert(name, value); if (type == __nut_DB_VERSION) currentModel.setVersion(name); @@ -250,7 +250,6 @@ bool DatabasePrivate::checkClassInfo(const QMetaClassInfo &classInfo, QString &t type = parts[0]; name = parts[1]; value = parts[2]; - qDebug() << Q_FUNC_INFO << parts; return true; } } diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index a4f99bf..92987ea 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -70,16 +70,15 @@ TableModel *DatabaseModel::tableByName(QString tableName) const TableModel *DatabaseModel::tableByClassName(QString className) const { + QStringList l; for(int i = 0; i < size(); i++){ TableModel *s = at(i); + l.append(s->className()); if(s->className() == className) return s; } -// qWarning("Table with class name '%s' not found in model", -// qUtf8Printable(className)); - Q_UNREACHABLE(); return 0; } diff --git a/src/defines.h b/src/defines.h index b55e827..0a8f443 100644 --- a/src/defines.h +++ b/src/defines.h @@ -71,7 +71,7 @@ public: \ #define NUT_FOREGION_KEY(type, keytype, name, read, write) \ Q_PROPERTY(type* name READ read WRITE write) \ NUT_DECLARE_FIELD(keytype, name##Id, read##Id, write##Id) \ - NUT_INFO(__nut_FOREGION_KEY, name, type) \ + NUT_INFO(__nut_FOREGION_KEY, name##Id, type) \ type *m_##name; \ public: \ type *read() const { return m_##name ; } \ diff --git a/src/generators/mysqlgenerator.cpp b/src/generators/mysqlgenerator.cpp index 1436360..2a9b753 100644 --- a/src/generators/mysqlgenerator.cpp +++ b/src/generators/mysqlgenerator.cpp @@ -140,8 +140,8 @@ QString MySqlGenerator::selectCommand(SqlGeneratorBase::AgregateType t, QString if (take != -1 && skip != -1) command.append(QString(" LIMIT %1 OFFSET %2") - .arg(skip) - .arg(take)); + .arg(take) + .arg(skip)); return command; } diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index c99c162..a1a174b 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -71,7 +71,8 @@ QString SqlGeneratorBase::masterDatabaseName(QString databaseName) QString SqlGeneratorBase::createTable(TableModel *table) { - + Q_UNUSED(table); + return ""; } QString SqlGeneratorBase::saveRecord(Table *t, QString tableName) @@ -95,6 +96,21 @@ QString SqlGeneratorBase::saveRecord(Table *t, QString tableName) return ""; } +QString SqlGeneratorBase::recordsPhrase(QString className) +{ + TableModel *table = _database->model().tableByClassName(className); + if (!table) + return ""; + + QString ret = ""; + foreach (FieldModel *f, table->fields()) { + if (!ret.isEmpty()) + ret.append(", "); + ret.append(QString("%1.%2 AS %1_%2").arg(table->name()).arg(f->name)); + } + return ret; +} + QString SqlGeneratorBase::fieldDeclare(FieldModel *field) { return field->name + " " + fieldType(field) + (field->notNull ? " NOT NULL" : ""); @@ -181,13 +197,13 @@ QString SqlGeneratorBase::diff(TableModel *oldTable, TableModel *newTable) sql = QString("CREATE TABLE %1 \n(%2)").arg(newTable->name()).arg( columnSql.join(",\n")); - qDebug() << sql; } return sql; } QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) { + //TODO: reorder list first! //TODO: make this ungly code better and bugless :-) /* * Known issues: @@ -198,46 +214,50 @@ QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) return ""; if (list.count() == 1) - return list.first(); + return "[" + list.first() + "]"; DatabaseModel model = _database->model(); QStringList clone = list; QString mainTable = clone.takeFirst(); - QString ret = mainTable; + QString ret = "[" + mainTable + "]"; do { - QString table = model.tableByClassName(clone.first())->name(); - clone.takeFirst(); - RelationModel *rel = model.relationByTableNames(mainTable, table); + if (!clone.count()) + break; + + QString table = clone.first();// model.tableByClassName(clone.first())->name(); + RelationModel *rel = model.relationByClassNames(mainTable, clone.first()); if (rel) { //mainTable is master of table - ret.append(QString(" INNER JOIN %1 ON %4.%2 = %1.%3") + ret.append(QString(" INNER JOIN [%1] ON %4.%2 = %1.%3") .arg(table) .arg(rel->table->primaryKey()) .arg(rel->localColumn) .arg(mainTable)); if (order != Q_NULLPTR) - order->append(table + "." + rel->localColumn); + order->append(mainTable + "." + rel->table->primaryKey()); } else{ - rel = model.relationByTableNames(table, mainTable); + rel = model.relationByClassNames(clone.first(), mainTable); if (rel) { // table is master of mainTable - ret.append(QString(" INNER JOIN %1 ON %4.%2 = %1.%3") + ret.append(QString(" INNER JOIN [%1] ON %4.%2 = %1.%3") .arg(table) .arg(rel->localColumn) .arg(rel->table->primaryKey()) .arg(mainTable)); if (order != Q_NULLPTR) - order->append(table + "." + rel->table->primaryKey()); + order->append(mainTable + "." + rel->localColumn); } else { qInfo("Relation for %s and %s not exists", qPrintable(table), qPrintable(mainTable)); } } + + clone.takeFirst(); } while (clone.count()); return ret; @@ -389,6 +409,15 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QStringList joinedOrders; QString select = agregateText(t, agregateArg); + + if (select == "*") { + select = ""; + foreach (QString c, joins) { + if (!select.isEmpty()) + select.append(", "); + select.append(recordsPhrase(c)); + } + } QString from = join(joins, &joinedOrders); QString where = createWhere(wheres); QString orderText = joinedOrders.join(", "); @@ -433,7 +462,8 @@ QString SqlGeneratorBase::createWhere(QList &wheres) void SqlGeneratorBase::replaceTableNames(QString &command) { foreach (TableModel *m, TableModel::allModels()) - command = command.replace("[" + m->className() + "].", "`" + m->name() + "`."); + command = command + .replace("[" + m->className() + "]", "`" + m->name() + "`"); } void SqlGeneratorBase::removeTableNames(QString &command) diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index d729899..9643abe 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -72,6 +72,8 @@ public: virtual QString saveRecord(Table *t, QString tableName); + virtual QString recordsPhrase(QString className); + virtual QString insertRecord(Table *t, QString tableName); virtual QString updateRecord(Table *t, QString tableName); virtual QString deleteRecord(Table *t, QString tableName); diff --git a/src/generators/sqlitegenerator.cpp b/src/generators/sqlitegenerator.cpp index a315831..18ae5d9 100644 --- a/src/generators/sqlitegenerator.cpp +++ b/src/generators/sqlitegenerator.cpp @@ -71,4 +71,19 @@ QString SqliteGenerator::fieldType(FieldModel *field) return dbType; } +QString SqliteGenerator::selectCommand(SqlGeneratorBase::AgregateType t, + QString agregateArg, + QList &wheres, + QList &orders, + QStringList joins, int skip, int take) +{ + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); + + if (take != -1 && skip != -1) + command.append(QString(" LIMIT %1 OFFSET %2") + .arg(take) + .arg(skip)); + return command; +} + NUT_END_NAMESPACE diff --git a/src/generators/sqlitegenerator.h b/src/generators/sqlitegenerator.h index d607e0e..613ef95 100644 --- a/src/generators/sqlitegenerator.h +++ b/src/generators/sqlitegenerator.h @@ -32,6 +32,11 @@ public: SqliteGenerator(Database *parent = 0); QString fieldType(FieldModel *field); + + QString selectCommand(AgregateType t, QString agregateArg, + QList &wheres, + QList &orders, + QStringList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/query.h b/src/query.h index 325696c..03740b8 100644 --- a/src/query.h +++ b/src/query.h @@ -122,73 +122,99 @@ Q_OUTOFLINE_TEMPLATE Query::~Query() template Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) { + Q_UNUSED(count); Q_D(Query); QList result; d->select = "*"; d->joins.prepend(d->className); - qDebug() << "JOINS="<< d->joins; d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, d->joins, d->skip, d->take); + qDebug() << d->sql; QSqlQuery q = d->database->exec(d->sql); struct LevelData{ QString key; QString className; + QString tableName; QVariant keyValue; int typeId; TableSetBase *tableSet; Table *lastRow; }; QVector levels; + QList returnList; foreach (QString className, d->joins) { LevelData data; data.className = className; TableModel *m = d->database->model().tableByClassName(className); - if (!m) - qFatal("Model '%s' not found!!!", qPrintable(className)); - data.key = m->primaryKey(); + if (!m) { + qWarning("Model '%s' not found!!!", qPrintable(className)); + return returnList; + } + data.key = m->name() + "_" + m->primaryKey(); data.typeId = m->typeId(); data.keyValue = QVariant(); data.tableSet = 0; + data.tableName = m->name(); levels.append(data); } - QList returnList; while (q.next()) { for (int i = 0; i < levels.count(); i++) { LevelData &data = levels[i]; - if (!data.tableSet || data.keyValue != q.value(data.key)) { + if (/*!data.tableSet ||*/ data.keyValue != q.value(data.key)) { + data.keyValue = q.value(data.key); //create table row - Table *childTable; + Table *table; if (data.className == d->className) { - childTable = new T(); - returnList.append(dynamic_cast(childTable)); + table = new T(); + table->setTableSet(d->tableSet); + returnList.append(dynamic_cast(table)); } else { const QMetaObject *childMetaObject = QMetaType::metaObjectForType(data.typeId); - childTable = qobject_cast
(childMetaObject->newInstance()); + table = qobject_cast
(childMetaObject->newInstance()); } QStringList childFields = d->database->model().tableByClassName(data.className)->fieldsNames(); foreach (QString field, childFields) - childTable->setProperty(field.toLatin1().data(), q.value(field)); + table->setProperty(field.toLatin1().data(), + q.value(data.tableName + "_" + field)); + + table->setStatus(Table::FeatchedFromDB); + table->setParent(this); + table->clear(); //set last created row - data.lastRow = childTable; + data.lastRow = table; if (i < levels.count() - 1) { - QSet tableSets = childTable->tableSets; - foreach (TableSetBase *ts, tableSets) - if (ts->childClassName() == levels[i + 1].className) - data.tableSet = ts; +// if (data.className == d->className) { +// data.tableSet = d->tableSet; +// } else + { + QSet tableSets = table->tableSets; + foreach (TableSetBase *ts, tableSets) + if (ts->childClassName() == levels[i + 1].className) + data.tableSet = ts; + + if (!data.tableSet) + qWarning() << "Dataset not found for" << data.className; + } + } + if (i) { +// if (!table->tableSet()) + table->setTableSet(levels[i - 1].tableSet); + table->setParentTable(levels[i - 1].lastRow); + } else { +// table->setTableSet(d->tableSet); +// data.tableSet = d->tableSet; } - if (i) - childTable->setTableSet(levels[i - 1].tableSet); } } } diff --git a/src/table.cpp b/src/table.cpp index 3f729dd..49f6139 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -134,7 +134,6 @@ int Table::save(Database *db) { QSqlQuery q = db->exec(db->sqlGenertor()->saveRecord(this, db->tableName(metaObject()->className()))); - if(status() == Added && isPrimaryKeyAutoIncrement()) setProperty(primaryKey().toLatin1().data(), q.lastInsertId()); diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 4bd7cc4..511aa25 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -157,7 +157,6 @@ bool TableModel::checkClassInfo(const QMetaClassInfo &classInfo, type = parts[0]; name = parts[1]; value = parts[2]; - qDebug() << Q_FUNC_INFO << parts; return true; } } @@ -190,7 +189,6 @@ TableModel::TableModel(int typeId, QString tableName) continue; } - qDebug() << "**********" << type << __nut_FIELD << (type == __nut_FIELD); if(type == __nut_FIELD){ FieldModel *f = new FieldModel; f->name = name; diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 9183869..1f12625 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -14,6 +14,8 @@ #include "post.h" #include "comment.h" +#define PRINT(x) +//qDebug() << #x "=" << x; MainTest::MainTest(QObject *parent) : QObject(parent) { } @@ -70,6 +72,7 @@ void MainTest::createPost() Comment *comment = new Comment; comment->setMessage("comment #" + QString::number(i)); comment->setSaveDate(QDateTime::currentDateTime()); + comment->setAuthorId(user->id()); newPost->comments()->append(comment); } db.saveChanges(); @@ -106,18 +109,16 @@ void MainTest::createPost2() void MainTest::selectPosts() { auto q = db.posts()->query() -// q->join(Post::commentsTable()); -// q->join(Post::commentsTable()); -// ->join() ->join() ->orderBy(!Post::saveDateField() & Post::bodyField()) ->setWhere(Post::idField() == postId); auto posts = q->toList(); - qDebug() << "SQL="<sqlCommand(); post = posts.at(0); post->setBody(""); + PRINT(posts.length()); + PRINT(posts.at(0)->comments()->length()); QTEST_ASSERT(posts.length() == 1); QTEST_ASSERT(posts.at(0)->comments()->length() == 3); QTEST_ASSERT(posts.at(0)->title() == "post title"); @@ -128,12 +129,18 @@ void MainTest::selectPosts() db.cleanUp(); } +void MainTest::selectFirst() +{ + auto posts = db.posts()->query() + ->first(); + QTEST_ASSERT(posts != Q_NULLPTR); +} + void MainTest::selectPostsWithoutTitle() { auto q = db.posts()->query(); q->setWhere(Post::titleField().isNull()); auto count = q->count(); - qDebug() << q->sqlCommand(); QTEST_ASSERT(count == 0); } @@ -169,12 +176,13 @@ void MainTest::join() { auto q = db.comments()->query() ->join() - ->join() - ->setWhere(Comment::saveDateField() < QDateTime::currentDateTime().addDays(-1)) - ->orderBy(Comment::saveDateField()); + ->join(); - q->toList(); + Comment *comment = q->first(); + +// Comment *comment = q->toList().first(); qDebug() << q->sqlCommand(); + QTEST_ASSERT(comment->author()->username() == "admin"); } @@ -208,6 +216,7 @@ void MainTest::modifyPost() ->setWhere(Post::idField() == postId); post = q->first(); + PRINT(post->title()); QTEST_ASSERT(post->title() == "new name"); } @@ -215,7 +224,6 @@ void MainTest::emptyDatabase() { auto commentsCount = db.comments()->query()->remove(); auto postsCount = db.posts()->query()->remove(); - QTEST_ASSERT(postsCount == 3); QTEST_ASSERT(commentsCount == 6); } diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 1ba679a..23d0d63 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -28,10 +28,11 @@ private slots: void createPost(); void createPost2(); void selectPosts(); + void selectFirst(); + void join(); void selectPostsWithoutTitle(); void selectPostIds(); void testDate(); - void join(); void selectWithInvalidRelation(); void select10NewstPosts(); void modifyPost(); From 3acc4a45837c6810cd6b2ce43d32c5f982cbb714 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Fri, 12 Jan 2018 14:10:06 +0330 Subject: [PATCH 35/47] hw --- src/databasemodel.cpp | 8 +-- src/generators/sqlgeneratorbase.cpp | 2 +- src/query.h | 82 +++++++++++++++++++++++------ test/basic/maintest.cpp | 7 ++- 4 files changed, 74 insertions(+), 25 deletions(-) diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 92987ea..3ed8282 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -18,12 +18,14 @@ ** **************************************************************************/ -#include "databasemodel.h" -#include "tablemodel.h" - #include #include +#include + +#include "tablemodel.h" +#include "databasemodel.h" + NUT_BEGIN_NAMESPACE QMap DatabaseModel::_models; diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index a1a174b..14ea252 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -106,7 +106,7 @@ QString SqlGeneratorBase::recordsPhrase(QString className) foreach (FieldModel *f, table->fields()) { if (!ret.isEmpty()) ret.append(", "); - ret.append(QString("%1.%2 AS %1_%2").arg(table->name()).arg(f->name)); + ret.append(QString("%1.%2 AS [%1_%2]").arg(table->name()).arg(f->name)); } return ret; } diff --git a/src/query.h b/src/query.h index 03740b8..da676a2 100644 --- a/src/query.h +++ b/src/query.h @@ -36,6 +36,8 @@ #include "wherephrase.h" #include "tablemodel.h" +#include + NUT_BEGIN_NAMESPACE template @@ -73,6 +75,15 @@ public: //data selecting T *first(); QList toList(int count = -1); + template + QList toList(std::function func) { + QList l = toList(); + QList ret; + foreach (T *t, l) + ret.append(func(t)); + return ret; + } + template QList select(const FieldPhrase f); int count(); @@ -122,27 +133,34 @@ Q_OUTOFLINE_TEMPLATE Query::~Query() template Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) { + /* + * TODO: make this as good as possible, this is heart of Nut + * Known issues: + * Is complex: O(n*j) n=db rows count, j=joins count + */ + Q_UNUSED(count); Q_D(Query); - QList result; + d->select = "*"; - d->joins.prepend(d->className); - - d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, d->joins, d->skip, d->take); - qDebug() << d->sql; + QSqlQuery q = d->database->exec(d->sql); struct LevelData{ - QString key; + QString key; // key field name QString className; QString tableName; + TableModel *model; + QSet rows; // found rows related to this join level + TableSetBase *tableSet; + int parentId; + QVariant keyValue; int typeId; - TableSetBase *tableSet; Table *lastRow; }; QVector levels; @@ -155,6 +173,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) qWarning("Model '%s' not found!!!", qPrintable(className)); return returnList; } + data.model = m; data.key = m->name() + "_" + m->primaryKey(); data.typeId = m->typeId(); data.keyValue = QVariant(); @@ -190,22 +209,39 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) table->setStatus(Table::FeatchedFromDB); table->setParent(this); table->clear(); + data.rows.insert(table); //set last created row data.lastRow = table; - if (i < levels.count() - 1) { + foreach (RelationModel *rel, data.model->foregionKeys()) { + for (int j = 0; j < levels.count(); ++j) { + if (rel->className == levels[j].className && i != j) { + if (levels[j].tableSet) { + data.tableSet = levels[j].tableSet; + table->setTableSet(levels[j].tableSet); + table->setParentTable(levels[j].lastRow); + } else { + qWarning() << "Dataset not found for" << data.className; + } + } + } + } + /*if (i < levels.count() - 1) { + // if (data.className == d->className) { // data.tableSet = d->tableSet; // } else - { - QSet tableSets = table->tableSets; - foreach (TableSetBase *ts, tableSets) - if (ts->childClassName() == levels[i + 1].className) - data.tableSet = ts; +// { +// QSet tableSets = table->tableSets; +// foreach (TableSetBase *ts, tableSets) { +// qDebug() << "checking" << ts->childClassName() << levels[i + 1].className; +// if (ts->childClassName() == levels[i + 1].className) +// data.tableSet = ts; +// } - if (!data.tableSet) - qWarning() << "Dataset not found for" << data.className; - } +// if (!data.tableSet) +// qWarning() << "Dataset not found for" << data.className; +// } } if (i) { // if (!table->tableSet()) @@ -214,12 +250,24 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) } else { // table->setTableSet(d->tableSet); // data.tableSet = d->tableSet; - } + }*/ } } } + + for (int i = 0; i < levels.count(); i++) { + LevelData &data = levels[i]; + qDebug() <<"RESULT" << data.className << data.rows.count(); + QSet::iterator it; + for (it = data.rows.begin(); it != data.rows.end(); ++it) { +// qDebug() << *i +// add *i to it's parent row + } + } + if (m_autoDelete) deleteLater(); + return returnList; /* QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 1f12625..91be639 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -14,8 +14,7 @@ #include "post.h" #include "comment.h" -#define PRINT(x) -//qDebug() << #x "=" << x; +#define PRINT(x) qDebug() << #x "=" << x; MainTest::MainTest(QObject *parent) : QObject(parent) { } @@ -175,8 +174,8 @@ void MainTest::testDate() void MainTest::join() { auto q = db.comments()->query() - ->join() - ->join(); + ->join() + ->join(); Comment *comment = q->first(); From c236342ea11ae4c894c6950699fccc25aa31dccd Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sat, 13 Jan 2018 19:29:55 +0330 Subject: [PATCH 36/47] pass to home --- src/database.cpp | 2 +- src/databasemodel.cpp | 13 +- src/databasemodel.h | 3 + src/generators/mysqlgenerator.cpp | 13 +- src/generators/mysqlgenerator.h | 2 +- src/generators/sqlgeneratorbase.cpp | 50 ++++- src/generators/sqlgeneratorbase_p.h | 8 +- src/generators/sqlitegenerator.cpp | 9 +- src/generators/sqlitegenerator.h | 3 +- src/generators/sqlservergenerator.cpp | 14 +- src/generators/sqlservergenerator.h | 4 +- src/query.h | 261 +++++++++++--------------- src/query_p.h | 3 +- src/table.cpp | 2 +- src/table.h | 1 + src/tablemodel.cpp | 5 +- src/tablemodel.h | 8 +- src/wherephrase.cpp | 1 + src/wherephrase.h | 9 + test/basic/maintest.cpp | 23 ++- test/basic/maintest.h | 2 +- 21 files changed, 244 insertions(+), 192 deletions(-) diff --git a/src/database.cpp b/src/database.cpp index 202787a..5d0e55c 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -232,7 +232,7 @@ bool DatabasePrivate::getCurrectScheema() foreach (TableModel *table, currentModel) foreach (RelationModel *fk, table->foregionKeys()) - fk->table = currentModel.tableByClassName(fk->className); + fk->masterTable = currentModel.tableByClassName(fk->masterClassName); allTableMaps.insert(q->metaObject()->className(), currentModel); return true; diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index 92987ea..ea49a1d 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -144,7 +144,7 @@ RelationModel *DatabaseModel::relationByClassNames(const QString &masterClassNam return 0; foreach (RelationModel *rel, childTable->foregionKeys()) - if(rel->className == masterClassName) + if(rel->masterClassName == masterClassName) return rel; return 0; @@ -158,7 +158,7 @@ RelationModel *DatabaseModel::relationByTableNames(const QString &masterTableNam return 0; foreach (RelationModel *rel, childTable->foregionKeys()) - if(rel->table->name() == masterTableName) + if(rel->masterTable->name() == masterTableName) return rel; return 0; @@ -203,6 +203,15 @@ bool DatabaseModel::remove(const QString &tableName) return false; } +void DatabaseModel::fixRelations() +{ + /*TODO: fixme + foreach (TableModel *table, currentModel) + foreach (RelationModel *fk, table->foregionKeys()) + fk->masterTable = currentModel.tableByClassName(fk->masterClassName); + */ +} + DatabaseModel *DatabaseModel::modelByName(const QString &name) { if (_models.contains(name)) diff --git a/src/databasemodel.h b/src/databasemodel.h index 6fc251d..c4e25b8 100644 --- a/src/databasemodel.h +++ b/src/databasemodel.h @@ -65,6 +65,9 @@ public: bool remove(const QString &tableName); + //TODO: may be private (called from DatabasePrivate::getCurrectScheema only) + void fixRelations(); + static DatabaseModel *modelByName(const QString &name); }; diff --git a/src/generators/mysqlgenerator.cpp b/src/generators/mysqlgenerator.cpp index 2a9b753..559e392 100644 --- a/src/generators/mysqlgenerator.cpp +++ b/src/generators/mysqlgenerator.cpp @@ -134,9 +134,18 @@ QString MySqlGenerator::phrase(const PhraseData *d) const return SqlGeneratorBase::phrase(d); } -QString MySqlGenerator::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, int skip, int take) +QString MySqlGenerator::selectCommand(SqlGeneratorBase::AgregateType t, + QString agregateArg, + QString tableName, + QList &wheres, + QList &orders, + QList joins, + int skip, int take) { - QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, + tableName, + wheres, orders, + joins, skip, take); if (take != -1 && skip != -1) command.append(QString(" LIMIT %1 OFFSET %2") diff --git a/src/generators/mysqlgenerator.h b/src/generators/mysqlgenerator.h index 335ebab..bf4ec6f 100644 --- a/src/generators/mysqlgenerator.h +++ b/src/generators/mysqlgenerator.h @@ -35,7 +35,7 @@ public: QString escapeValue(const QVariant &v) const; QVariant readValue(const QVariant::Type &type, const QVariant &dbValue); QString phrase(const PhraseData *d) const; - QString selectCommand(AgregateType t, QString agregateArg, QList &wheres, QList &orders, QStringList joins, int skip, int take); + QString selectCommand(AgregateType t, QString agregateArg, QString tableName, QList &wheres, QList &orders, QList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index a1a174b..8cb634b 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -106,7 +106,7 @@ QString SqlGeneratorBase::recordsPhrase(QString className) foreach (FieldModel *f, table->fields()) { if (!ret.isEmpty()) ret.append(", "); - ret.append(QString("%1.%2 AS %1_%2").arg(table->name()).arg(f->name)); + ret.append(QString("%1.%2 AS [%1.%2]").arg(table->name()).arg(f->name)); } return ret; } @@ -201,6 +201,36 @@ QString SqlGeneratorBase::diff(TableModel *oldTable, TableModel *newTable) return sql; } +QString SqlGeneratorBase::join(const QString &mainTable, + const QList list, + QStringList *order) +{ + QString ret = mainTable; + QList::const_iterator i; + for (i = list.begin(); i != list.end(); ++i) { + if ((*i)->masterTable->name() == mainTable) { + ret.append(QString(" INNER JOIN %1 ON %1.%2 = %3.%4") + .arg((*i)->slaveTable->name()) + .arg((*i)->localColumn) + .arg((*i)->masterTable->name()) + .arg((*i)->masterTable->primaryKey())); + + if (order != Q_NULLPTR) + order->append(mainTable + "." + (*i)->slaveTable->primaryKey()); + } else { + ret.append(QString(" INNER JOIN %1 ON %1.%2 = %3.%4") + .arg((*i)->masterTable->name()) + .arg((*i)->masterTable->primaryKey()) + .arg(mainTable) + .arg((*i)->localColumn)); + + if (order != Q_NULLPTR) + order->append(mainTable + "." + (*i)->masterTable->primaryKey()); + } + } + return ret; +} + QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) { //TODO: reorder list first! @@ -231,12 +261,12 @@ QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) //mainTable is master of table ret.append(QString(" INNER JOIN [%1] ON %4.%2 = %1.%3") .arg(table) - .arg(rel->table->primaryKey()) + .arg(rel->masterTable->primaryKey()) .arg(rel->localColumn) .arg(mainTable)); if (order != Q_NULLPTR) - order->append(mainTable + "." + rel->table->primaryKey()); + order->append(mainTable + "." + rel->masterTable->primaryKey()); } else{ rel = model.relationByClassNames(clone.first(), mainTable); @@ -245,7 +275,7 @@ QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) ret.append(QString(" INNER JOIN [%1] ON %4.%2 = %1.%3") .arg(table) .arg(rel->localColumn) - .arg(rel->table->primaryKey()) + .arg(rel->masterTable->primaryKey()) .arg(mainTable)); if (order != Q_NULLPTR) @@ -399,9 +429,10 @@ QString SqlGeneratorBase::deleteRecords(QString tableName, QString where) QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, + QString tableName, QList &wheres, QList &orders, - QStringList joins, + QList joins, int skip, int take) { Q_UNUSED(take); @@ -410,15 +441,16 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, QStringList joinedOrders; QString select = agregateText(t, agregateArg); - if (select == "*") { + //TODO: temporatory disabled + if (t == SelectAll) { select = ""; - foreach (QString c, joins) { + foreach (RelationModel *c, joins) { if (!select.isEmpty()) select.append(", "); - select.append(recordsPhrase(c)); + select.append(recordsPhrase(c->slaveTable->className())); } } - QString from = join(joins, &joinedOrders); + QString from = join(tableName, joins, &joinedOrders); QString where = createWhere(wheres); QString orderText = joinedOrders.join(", "); diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 9643abe..82256b1 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -33,6 +33,7 @@ struct FieldModel; class DatabaseModel; class TableModel; class Database; +class RelationModel; class SqlGeneratorBase : public QObject { // Q_OBJECT @@ -68,6 +69,9 @@ public: virtual QString diff(FieldModel *oldField, FieldModel *newField); virtual QString diff(TableModel *oldTable, TableModel *newTable); + virtual QString join(const QString &mainTable, + const QList list, + QStringList *order = Q_NULLPTR); virtual QString join(const QStringList &list, QStringList *order = Q_NULLPTR); virtual QString saveRecord(Table *t, QString tableName); @@ -80,10 +84,10 @@ public: virtual QString deleteRecords(QString tableName, QString where); virtual QString selectCommand(AgregateType t, - QString agregateArg, + QString agregateArg, QString tableName, QList &wheres, QList &orders, - QStringList joins, + QList joins, int skip = -1, int take = -1); virtual QString deleteCommand(QList &wheres, QString tableName); diff --git a/src/generators/sqlitegenerator.cpp b/src/generators/sqlitegenerator.cpp index 18ae5d9..bddd186 100644 --- a/src/generators/sqlitegenerator.cpp +++ b/src/generators/sqlitegenerator.cpp @@ -73,11 +73,16 @@ QString SqliteGenerator::fieldType(FieldModel *field) QString SqliteGenerator::selectCommand(SqlGeneratorBase::AgregateType t, QString agregateArg, + QString tableName, QList &wheres, QList &orders, - QStringList joins, int skip, int take) + QList joins, + int skip, int take) { - QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, + tableName, + wheres, orders, + joins, skip, take); if (take != -1 && skip != -1) command.append(QString(" LIMIT %1 OFFSET %2") diff --git a/src/generators/sqlitegenerator.h b/src/generators/sqlitegenerator.h index 613ef95..eeefffa 100644 --- a/src/generators/sqlitegenerator.h +++ b/src/generators/sqlitegenerator.h @@ -34,9 +34,10 @@ public: QString fieldType(FieldModel *field); QString selectCommand(AgregateType t, QString agregateArg, + QString tableName, QList &wheres, QList &orders, - QStringList joins, int skip, int take); + QList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/generators/sqlservergenerator.cpp b/src/generators/sqlservergenerator.cpp index 5cddc97..d1c5b3c 100644 --- a/src/generators/sqlservergenerator.cpp +++ b/src/generators/sqlservergenerator.cpp @@ -133,11 +133,17 @@ QString SqlServerGenerator::escapeValue(const QVariant &v) const return SqlGeneratorBase::escapeValue(v); } -QString SqlServerGenerator::selectCommand( - SqlGeneratorBase::AgregateType t, QString agregateArg, - QList &wheres, QList &orders, QStringList joins, int skip, int take) +QString SqlServerGenerator::selectCommand(SqlGeneratorBase::AgregateType t, + QString agregateArg, + QString tableName, + QList &wheres, + QList &orders, + QList joins, int skip, int take) { - QString command = SqlGeneratorBase::selectCommand(t, agregateArg, wheres, orders, joins, skip, take); + QString command = SqlGeneratorBase::selectCommand(t, agregateArg, + tableName, + wheres, orders, + joins, skip, take); if (take != -1 && skip != -1) command.append(QString("OFFSET %1 ROWS FETCH NEXT %2 ROWS ONLY") diff --git a/src/generators/sqlservergenerator.h b/src/generators/sqlservergenerator.h index f006dca..9368050 100644 --- a/src/generators/sqlservergenerator.h +++ b/src/generators/sqlservergenerator.h @@ -39,8 +39,10 @@ public: QString escapeValue(const QVariant &v) const; QString selectCommand(AgregateType t, QString agregateArg, + QString tableName, QList &wheres, - QList &orders, QStringList joins, int skip, int take); + QList &orders, + QList joins, int skip, int take); }; NUT_END_NAMESPACE diff --git a/src/query.h b/src/query.h index 03740b8..b2d3270 100644 --- a/src/query.h +++ b/src/query.h @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "query_p.h" #include "database.h" @@ -39,7 +41,7 @@ NUT_BEGIN_NAMESPACE template -class NUT_EXPORT Query : public QueryBase + class NUT_EXPORT Query : public QueryBase { QueryPrivate *d_ptr; Q_DECLARE_PRIVATE(Query) @@ -63,7 +65,8 @@ public: return this; } -// Query *orderBy(QString fieldName, QString type); + + // Query *orderBy(QString fieldName, QString type); Query *skip(int n); Query *take(int n); Query *orderBy(WherePhrase phrase); @@ -106,8 +109,8 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->tableSet = tableSet; d->className = T::staticMetaObject.className(); d->tableName - = // TableModel::findByClassName(T::staticMetaObject.className())->name(); - d->database->model() + = // TableModel::findByClassName(T::staticMetaObject.className())->name(); + d->database->model() .tableByClassName(T::staticMetaObject.className()) ->name(); } @@ -129,25 +132,61 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) d->joins.prepend(d->className); - d->sql = d->database->sqlGenertor()->selectCommand( - SqlGeneratorBase::SelectAll, "", d->wheres, d->orderPhrases, - d->joins, d->skip, d->take); - qDebug() << d->sql; + SqlGeneratorBase::SelectAll, "", + d->tableName, + d->wheres, d->orderPhrases, d->relations, + d->skip, d->take); + // qDebug() << "JOINS=" << d->database->sqlGenertor()->join(d->relations); + qDebug() << "SQL=" << d->sql; QSqlQuery q = d->database->exec(d->sql); +qDebug() <<"==========================" <relations) { + childTables.append(rel->slaveTable->name()); + masterTables.append(rel->masterTable->name()); + } +qDebug() << childTables; +qDebug() << masterTables; struct LevelData{ + QVariant keyValue; + TableSetBase *tableSet; + RelationModel *relation; + QList masters; + QList slaves; + QString key; QString className; QString tableName; - QVariant keyValue; int typeId; - TableSetBase *tableSet; Table *lastRow; }; QVector levels; QList returnList; - foreach (QString className, d->joins) { + QList::iterator i; + for (int i = 0; i < d->relations.count(); ++i) { + LevelData data; + data.relation = d->relations[i]; + data.key = data.relation->slaveTable->name() + "." + data.relation->localColumn; + data.tableSet = 0; + for (int j = 0; j < i; ++j) { + if (d->relations[i]->masterTable->name() == d->relations[j]->slaveTable->name()) { + data.masters.append(j); + levels[i].slaves.append(i); + } + } + data.typeId = d->relations[i]->slaveTable->typeId(); + levels.append(data); + } +qDebug()<<"count="<joins.count() - 1; i >= 0; i--) { + QString className = d->joins[i]; + // foreach (QString className, d->joins) { LevelData data; data.className = className; TableModel *m = d->database->model().tableByClassName(className); @@ -155,65 +194,51 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) qWarning("Model '%s' not found!!!", qPrintable(className)); return returnList; } - data.key = m->name() + "_" + m->primaryKey(); + data.key = m->name() + "." + m->primaryKey(); data.typeId = m->typeId(); data.keyValue = QVariant(); data.tableSet = 0; data.tableName = m->name(); levels.append(data); - } + }*/ while (q.next()) { - for (int i = 0; i < levels.count(); i++) { - LevelData &data = levels[i]; - if (/*!data.tableSet ||*/ data.keyValue != q.value(data.key)) { - data.keyValue = q.value(data.key); + qDebug() << "HAS"; + int p = levels.count(); + while (p) { + for (int i = 0; i < levels.count(); i++) { + LevelData &data = levels[i]; + qDebug()<<"key="<className) { - table = new T(); - table->setTableSet(d->tableSet); - returnList.append(dynamic_cast(table)); - } else { - const QMetaObject *childMetaObject - = QMetaType::metaObjectForType(data.typeId); - table = qobject_cast
(childMetaObject->newInstance()); - } - - QStringList childFields - = d->database->model().tableByClassName(data.className)->fieldsNames(); - foreach (QString field, childFields) - table->setProperty(field.toLatin1().data(), - q.value(data.tableName + "_" + field)); - - table->setStatus(Table::FeatchedFromDB); - table->setParent(this); - table->clear(); - - //set last created row - data.lastRow = table; - if (i < levels.count() - 1) { -// if (data.className == d->className) { -// data.tableSet = d->tableSet; -// } else - { - QSet tableSets = table->tableSets; - foreach (TableSetBase *ts, tableSets) - if (ts->childClassName() == levels[i + 1].className) - data.tableSet = ts; - - if (!data.tableSet) - qWarning() << "Dataset not found for" << data.className; + //create table row + Table *table; + if (data.className == d->className) { + table = new T(); + table->setTableSet(d->tableSet); + returnList.append(dynamic_cast(table)); + } else { + const QMetaObject *childMetaObject + = QMetaType::metaObjectForType(data.typeId); + table = qobject_cast
(childMetaObject->newInstance()); } - } - if (i) { -// if (!table->tableSet()) - table->setTableSet(levels[i - 1].tableSet); - table->setParentTable(levels[i - 1].lastRow); - } else { -// table->setTableSet(d->tableSet); -// data.tableSet = d->tableSet; + + QStringList childFields + = d->database->model().tableByClassName(data.className)->fieldsNames(); + foreach (QString field, childFields) + table->setProperty(field.toLatin1().data(), + q.value(data.tableName + "." + field)); + + table->setStatus(Table::FeatchedFromDB); + table->setParent(this); + table->clear(); + + //set last created row + data.lastRow = table; + + qDebug() << "*" << data.masters << data.slaves; } } } @@ -221,84 +246,6 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) if (m_autoDelete) deleteLater(); return returnList; -/* - QString pk = d->database->model().tableByName(d->tableName)->primaryKey(); - QVariant lastPkValue = QVariant(); - int childTypeId = 0; - T *lastRow = 0; - TableSetBase *childTableSet = Q_NULLPTR; - - // FIXME: getting table error - // QStringList masterFields = - // TableModel::findByName(d->tableName)->fieldsNames(); - QStringList masterFields - = d->database->model().tableByName(d->tableName)->fieldsNames(); - QStringList childFields; - if (!d->joinClassName.isNull()) { - TableModel *joinTableModel - = TableModel::findByClassName(d->joinClassName); - if (joinTableModel) { - // childFields = - // d->database->model().modelByClass(d->joinClassName)->fieldsNames(); - childFields - = TableModel::findByClassName(d->joinClassName)->fieldsNames(); - QString joinTableName = d->database->tableName(d->joinClassName); - childTypeId = d->database->model().tableByName(joinTableName)->typeId(); - // childTypeId = - // TableModel::findByName(joinTableName)->typeId(); - } - } - - while (q.next()) { - if (lastPkValue != q.value(pk)) { - T *t = new T(); - foreach (QString field, masterFields) - t->setProperty(field.toLatin1().data(), q.value(field)); - - t->setTableSet(d->tableSet); - t->setStatus(Table::FeatchedFromDB); - t->setParent(this); - t->clear(); - - result.append(t); - lastRow = t; - - if (childTypeId) { - QSet tableSets = t->tableSets; - foreach (TableSetBase *ts, tableSets) - if (ts->childClassName() == d->joinClassName) - childTableSet = ts; - } - } - - if (childTypeId) { - const QMetaObject *childMetaObject - = QMetaType::metaObjectForType(childTypeId); - Table *childTable - = qobject_cast
(childMetaObject->newInstance()); - - foreach (QString field, childFields) - childTable->setProperty(field.toLatin1().data(), - q.value(field)); - // TODO: set database for table - childTable->setParent(this); - childTable->setParentTable(lastRow); - childTable->setStatus(Table::FeatchedFromDB); - childTable->setTableSet(childTableSet); - childTable->clear(); - addTableToSet(childTableSet, childTable); -// childTableSet->add(childTable); - } - lastPkValue = q.value(pk); - - if (!--count) - break; - } - - if (m_autoDelete) - deleteLater(); - return result; - */ } template @@ -310,8 +257,9 @@ Q_OUTOFLINE_TEMPLATE QList Query::select(const FieldPhrase f) d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( - SqlGeneratorBase::SignleField, f.data()->text, d->wheres, - d->orderPhrases, d->joins, d->skip, d->take); + SqlGeneratorBase::SignleField, f.data()->text, + d->tableName, d->wheres, + d->orderPhrases, d->relations, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); @@ -346,7 +294,11 @@ Q_OUTOFLINE_TEMPLATE int Query::count() d->joins.prepend(d->tableName); d->select = "COUNT(*)"; d->sql = d->database->sqlGenertor()->selectCommand(SqlGeneratorBase::Count, - QStringLiteral("*"), d->wheres, d->orderPhrases, d->joins); + QStringLiteral("*"), + d->tableName, + d->wheres, + d->orderPhrases, + d->relations); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -361,8 +313,9 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::max(FieldPhrase &f) d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( - SqlGeneratorBase::Max, f.data()->text, d->wheres, d->orderPhrases, - d->joins); + SqlGeneratorBase::Max, f.data()->text, d->tableName, + d->wheres, d->orderPhrases, + d->relations); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -377,8 +330,9 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::min(FieldPhrase &f) d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( - SqlGeneratorBase::Min, f.data()->text, d->wheres, d->orderPhrases, - d->joins); + SqlGeneratorBase::Min, f.data()->text, d->tableName, + d->wheres, d->orderPhrases, + d->relations); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -393,8 +347,9 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::average(FieldPhrase &f) d->joins.prepend(d->tableName); d->sql = d->database->sqlGenertor()->selectCommand( - SqlGeneratorBase::Average, f.data()->text, d->wheres, d->orderPhrases, - d->joins); + SqlGeneratorBase::Average, f.data()->text, d->tableName, + d->wheres, d->orderPhrases, + d->relations); QSqlQuery q = d->database->exec(d->sql); if (q.next()) @@ -406,6 +361,16 @@ template Q_OUTOFLINE_TEMPLATE Query *Query::join(const QString &className) { Q_D(Query); + + RelationModel *rel = d->database->model().relationByClassNames(d->className, className); + if (!rel) + rel = d->database->model().relationByClassNames(className, d->className); + + if (!rel) + qFatal("No relation beyween %s and %s", + qPrintable(d->className), qPrintable(className)); + + d->relations.append(rel); d->joinClassName = className; d->joins.append(className); return this; diff --git a/src/query_p.h b/src/query_p.h index a768ef3..54ff7c6 100644 --- a/src/query_p.h +++ b/src/query_p.h @@ -30,8 +30,8 @@ NUT_BEGIN_NAMESPACE class Database; class TableSetBase; -//template class QueryBase; +class RelationModel; class QueryPrivate{ QueryBase *q_ptr; Q_DECLARE_PUBLIC(QueryBase) @@ -48,6 +48,7 @@ public: TableSetBase *tableSet; QString joinClassName; QStringList joins; + QList relations; QList wheres; QList orderPhrases; QHash orders; diff --git a/src/table.cpp b/src/table.cpp index 49f6139..dec4bc0 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -109,7 +109,7 @@ bool Table::setParentTable(Table *master) TableModel *myModel = TableModel::findByClassName(metaObject()->className()); foreach (RelationModel *r, myModel->foregionKeys()) - if(r->className == masterClassName) + if(r->masterClassName == masterClassName) { setProperty(QString(r->localColumn).toLatin1().data(), master->primaryValue()); _changedProperties.insert(r->localColumn); diff --git a/src/table.h b/src/table.h index da9f8cb..cf80eba 100644 --- a/src/table.h +++ b/src/table.h @@ -72,6 +72,7 @@ protected: private: Status _status; QSet _changedProperties; + //TODO: is this removable? TableSetBase *_tableSet; QSet tableSets; diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 511aa25..81bbcc1 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -222,9 +222,10 @@ TableModel::TableModel(int typeId, QString tableName) if(type == __nut_FOREGION_KEY){ RelationModel *fk = new RelationModel; + fk->slaveTable = this; fk->localColumn = name; fk->foregionColumn = value; - fk->className = value; + fk->masterClassName = value; _foregionKeys.append(fk); } @@ -370,7 +371,7 @@ QJsonObject TableModel::toJson() const RelationModel *TableModel::foregionKey(QString otherTable) const { foreach (RelationModel *fk, _foregionKeys) - if(fk->className == otherTable) + if(fk->masterClassName == otherTable) return fk; return 0; diff --git a/src/tablemodel.h b/src/tablemodel.h index 04d05be..5c010fe 100644 --- a/src/tablemodel.h +++ b/src/tablemodel.h @@ -65,10 +65,14 @@ struct FieldModel{ }; struct RelationModel{ - TableModel *table; - QString className; + //slave QString localColumn; + TableModel *slaveTable; + //master QString foregionColumn; + TableModel *masterTable; + + QString masterClassName; }; class TableModel { diff --git a/src/wherephrase.cpp b/src/wherephrase.cpp index 8d4a93d..af0514c 100644 --- a/src/wherephrase.cpp +++ b/src/wherephrase.cpp @@ -230,4 +230,5 @@ WherePhrase WherePhrase::operator>=(const QVariant &other) return WherePhrase(this, PhraseData::GreaterEqual, other); } + NUT_END_NAMESPACE diff --git a/src/wherephrase.h b/src/wherephrase.h index 4529d0e..371a640 100644 --- a/src/wherephrase.h +++ b/src/wherephrase.h @@ -145,6 +145,8 @@ class FieldPhrase : public WherePhrase public: FieldPhrase(const char *className, const char *s); + WherePhrase operator=(const FieldPhrase &other); + WherePhrase operator=(const WherePhrase &other); WherePhrase operator=(const QVariant &other); WherePhrase operator+(const QVariant &other); @@ -179,6 +181,13 @@ operator=(const QVariant &other) return WherePhrase(this, PhraseData::Set, other); } +template +Q_OUTOFLINE_TEMPLATE WherePhrase +FieldPhrase::operator=(const FieldPhrase &other) +{ + return WherePhrase(this, PhraseData::Equal, &other); +} + template Q_OUTOFLINE_TEMPLATE WherePhrase FieldPhrase:: operator=(const WherePhrase &other) diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 1f12625..fe23495 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -14,8 +14,7 @@ #include "post.h" #include "comment.h" -#define PRINT(x) -//qDebug() << #x "=" << x; +#define PRINT(x) qDebug() << #x "=" << x; MainTest::MainTest(QObject *parent) : QObject(parent) { } @@ -109,7 +108,7 @@ void MainTest::createPost2() void MainTest::selectPosts() { auto q = db.posts()->query() - ->join() + ->join()//Comment::authorIdField() == Post::idField()) ->orderBy(!Post::saveDateField() & Post::bodyField()) ->setWhere(Post::idField() == postId); @@ -119,13 +118,13 @@ void MainTest::selectPosts() PRINT(posts.length()); PRINT(posts.at(0)->comments()->length()); - QTEST_ASSERT(posts.length() == 1); - QTEST_ASSERT(posts.at(0)->comments()->length() == 3); - QTEST_ASSERT(posts.at(0)->title() == "post title"); +// QTEST_ASSERT(posts.length() == 1); +// QTEST_ASSERT(posts.at(0)->comments()->length() == 3); +// QTEST_ASSERT(posts.at(0)->title() == "post title"); - QTEST_ASSERT(posts.at(0)->comments()->at(0)->message() == "comment #0"); - QTEST_ASSERT(posts.at(0)->comments()->at(1)->message() == "comment #1"); - QTEST_ASSERT(posts.at(0)->comments()->at(2)->message() == "comment #2"); +// QTEST_ASSERT(posts.at(0)->comments()->at(0)->message() == "comment #0"); +// QTEST_ASSERT(posts.at(0)->comments()->at(1)->message() == "comment #1"); +// QTEST_ASSERT(posts.at(0)->comments()->at(2)->message() == "comment #2"); db.cleanUp(); } @@ -178,11 +177,11 @@ void MainTest::join() ->join() ->join(); - Comment *comment = q->first(); - +// Comment *comment = q->first(); + q->toList(); // Comment *comment = q->toList().first(); qDebug() << q->sqlCommand(); - QTEST_ASSERT(comment->author()->username() == "admin"); +// QTEST_ASSERT(comment->author()->username() == "admin"); } diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 23d0d63..26c8a41 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -24,12 +24,12 @@ private slots: void initTestCase(); void dataScheema(); + void join(); void createUser(); void createPost(); void createPost2(); void selectPosts(); void selectFirst(); - void join(); void selectPostsWithoutTitle(); void selectPostIds(); void testDate(); From 02037ba2b28810cf248125e57bcd3f4b006d069c Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sun, 14 Jan 2018 00:13:51 +0330 Subject: [PATCH 37/47] wip: new method: feresh and fast but complicated! --- src/generators/sqlgeneratorbase.cpp | 28 ++++++++++++++---------- src/generators/sqlgeneratorbase_p.h | 2 +- src/query.h | 34 +++++++++++++++++++---------- test/basic/maintest.cpp | 6 +++-- test/basic/maintest.h | 2 +- 5 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 8cb634b..8158bbe 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -96,9 +96,8 @@ QString SqlGeneratorBase::saveRecord(Table *t, QString tableName) return ""; } -QString SqlGeneratorBase::recordsPhrase(QString className) +QString SqlGeneratorBase::recordsPhrase(TableModel *table) { - TableModel *table = _database->model().tableByClassName(className); if (!table) return ""; @@ -209,20 +208,20 @@ QString SqlGeneratorBase::join(const QString &mainTable, QList::const_iterator i; for (i = list.begin(); i != list.end(); ++i) { if ((*i)->masterTable->name() == mainTable) { - ret.append(QString(" INNER JOIN %1 ON %1.%2 = %3.%4") - .arg((*i)->slaveTable->name()) - .arg((*i)->localColumn) + ret.append(QString(" INNER JOIN %3 ON %1.%2 = %3.%4") .arg((*i)->masterTable->name()) - .arg((*i)->masterTable->primaryKey())); + .arg((*i)->masterTable->primaryKey()) + .arg((*i)->slaveTable->name()) + .arg((*i)->localColumn)); if (order != Q_NULLPTR) order->append(mainTable + "." + (*i)->slaveTable->primaryKey()); } else { - ret.append(QString(" INNER JOIN %1 ON %1.%2 = %3.%4") - .arg((*i)->masterTable->name()) - .arg((*i)->masterTable->primaryKey()) + ret.append(QString(" INNER JOIN %3 ON %1.%2 = %3.%4") .arg(mainTable) - .arg((*i)->localColumn)); + .arg((*i)->localColumn) + .arg((*i)->masterTable->name()) + .arg((*i)->masterTable->primaryKey())); if (order != Q_NULLPTR) order->append(mainTable + "." + (*i)->masterTable->primaryKey()); @@ -443,11 +442,16 @@ QString SqlGeneratorBase::selectCommand(SqlGeneratorBase::AgregateType t, //TODO: temporatory disabled if (t == SelectAll) { + QSet tables; + tables.insert(_database->model().tableByName(tableName)); + foreach (RelationModel *rel, joins) + tables << rel->masterTable << rel->slaveTable; + select = ""; - foreach (RelationModel *c, joins) { + foreach (TableModel *t, tables) { if (!select.isEmpty()) select.append(", "); - select.append(recordsPhrase(c->slaveTable->className())); + select.append(recordsPhrase(t)); } } QString from = join(tableName, joins, &joinedOrders); diff --git a/src/generators/sqlgeneratorbase_p.h b/src/generators/sqlgeneratorbase_p.h index 82256b1..011f6b1 100644 --- a/src/generators/sqlgeneratorbase_p.h +++ b/src/generators/sqlgeneratorbase_p.h @@ -76,7 +76,7 @@ public: virtual QString saveRecord(Table *t, QString tableName); - virtual QString recordsPhrase(QString className); + virtual QString recordsPhrase(TableModel *table); virtual QString insertRecord(Table *t, QString tableName); virtual QString updateRecord(Table *t, QString tableName); diff --git a/src/query.h b/src/query.h index b2d3270..a891d36 100644 --- a/src/query.h +++ b/src/query.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "query_p.h" @@ -129,22 +130,28 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) Q_D(Query); QList result; d->select = "*"; + QElapsedTimer t; + t.start(); - d->joins.prepend(d->className); d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", d->tableName, d->wheres, d->orderPhrases, d->relations, d->skip, d->take); - // qDebug() << "JOINS=" << d->database->sqlGenertor()->join(d->relations); - qDebug() << "SQL=" << d->sql; QSqlQuery q = d->database->exec(d->sql); -qDebug() <<"==========================" < relatedTables; + foreach (RelationModel *rel, d->relations) + relatedTables << rel->slaveTable->name() << rel->masterTable->name(); + QStringList childTables, masterTables; + QMap lastClassRow; + foreach (RelationModel *rel, d->relations) { childTables.append(rel->slaveTable->name()); masterTables.append(rel->masterTable->name()); @@ -171,7 +178,12 @@ qDebug() << masterTables; for (int i = 0; i < d->relations.count(); ++i) { LevelData data; data.relation = d->relations[i]; + qDebug() <<"relation" << data.relation->masterTable->name() << data.relation->slaveTable->name(); data.key = data.relation->slaveTable->name() + "." + data.relation->localColumn; + data.className = data.relation->slaveTable->className(); + data.typeId = d->relations[i]->slaveTable->typeId(); + data.tableName = data.relation->slaveTable->name(); + data.tableSet = 0; for (int j = 0; j < i; ++j) { if (d->relations[i]->masterTable->name() == d->relations[j]->slaveTable->name()) { @@ -179,7 +191,6 @@ qDebug() << masterTables; levels[i].slaves.append(i); } } - data.typeId = d->relations[i]->slaveTable->typeId(); levels.append(data); } qDebug()<<"count="<join(); // Comment *comment = q->first(); - q->toList(); + auto comments = q->toList(); // Comment *comment = q->toList().first(); qDebug() << q->sqlCommand(); -// QTEST_ASSERT(comment->author()->username() == "admin"); + QTEST_ASSERT(comments.length()); + QTEST_ASSERT(comments[0]->author()); + QTEST_ASSERT(comments[0]->author()->username() == "admin"); } diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 26c8a41..74bd47a 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -24,10 +24,10 @@ private slots: void initTestCase(); void dataScheema(); - void join(); void createUser(); void createPost(); void createPost2(); + void join(); void selectPosts(); void selectFirst(); void selectPostsWithoutTitle(); From 4b0e3e43715b59476c4e6299fd0e9d2fab3d13fa Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Sun, 14 Jan 2018 17:33:24 +0330 Subject: [PATCH 38/47] join test created --- src/databasemodel.cpp | 9 ++-- src/query.cpp | 2 +- src/query.h | 31 ++++++++------ src/query_p.h | 1 - test/basic/tst_basic.pro | 6 ++- test/common/post.cpp | 5 ++- test/common/post.h | 2 + test/common/score.cpp | 6 +++ test/common/score.h | 24 +++++++++++ test/common/user.cpp | 8 ++-- test/common/user.h | 2 + test/common/weblogdatabase.cpp | 4 +- test/common/weblogdatabase.h | 2 + test/join/jointest.cpp | 75 ++++++++++++++++++++++++++++++++++ test/join/jointest.h | 26 ++++++++++++ test/join/tst_join.pro | 26 ++++++++++++ 16 files changed, 204 insertions(+), 25 deletions(-) create mode 100644 test/common/score.cpp create mode 100644 test/common/score.h create mode 100644 test/join/jointest.cpp create mode 100644 test/join/jointest.h create mode 100644 test/join/tst_join.pro diff --git a/src/databasemodel.cpp b/src/databasemodel.cpp index ea49a1d..e5adc6d 100644 --- a/src/databasemodel.cpp +++ b/src/databasemodel.cpp @@ -30,17 +30,20 @@ QMap DatabaseModel::_models; #define NODE_VERSION "version" #define NODE_TABLES "tables" -DatabaseModel::DatabaseModel(const QString &name) : QList(), _databaseClassName(name), _version(QString::null) +DatabaseModel::DatabaseModel(const QString &name) : + QList(), _databaseClassName(name), _version(QString::null) { _models.insert(name, this); } -DatabaseModel::DatabaseModel(const DatabaseModel &other) : QList(other), _version(QString::null) +DatabaseModel::DatabaseModel(const DatabaseModel &other) : + QList(other), _version(QString::null) { } -DatabaseModel::DatabaseModel(const QJsonObject &json) : QList() +DatabaseModel::DatabaseModel(const QJsonObject &json) : + QList() { setVersion(json.value(NODE_VERSION).toString()); diff --git a/src/query.cpp b/src/query.cpp index 9fc86ca..eacf1ba 100644 --- a/src/query.cpp +++ b/src/query.cpp @@ -23,7 +23,7 @@ NUT_BEGIN_NAMESPACE QueryPrivate::QueryPrivate(QueryBase *parent) : q_ptr(parent), - joinClassName(QString::null), skip(-1), take(-1) + skip(-1), take(-1) { } diff --git a/src/query.h b/src/query.h index a891d36..86b4ff7 100644 --- a/src/query.h +++ b/src/query.h @@ -128,7 +128,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) { Q_UNUSED(count); Q_D(Query); - QList result; + QList returnList; d->select = "*"; QElapsedTimer t; t.start(); @@ -140,22 +140,29 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) d->wheres, d->orderPhrases, d->relations, d->skip, d->take); QSqlQuery q = d->database->exec(d->sql); - if (q.lastError().isValid()) + if (q.lastError().isValid()) { qDebug() << q.lastError().text(); - + return returnList; + } QSet relatedTables; foreach (RelationModel *rel, d->relations) relatedTables << rel->slaveTable->name() << rel->masterTable->name(); - QStringList childTables, masterTables; + QSet childTables, masterTables; QMap lastClassRow; foreach (RelationModel *rel, d->relations) { - childTables.append(rel->slaveTable->name()); - masterTables.append(rel->masterTable->name()); + childTables.insert(rel->slaveTable->name()); + masterTables.insert(rel->masterTable->name()); } + foreach (QString ch, childTables) { + if (masterTables.contains(ch)) + childTables.remove(ch); + } + + qDebug() << "TABLES:"; qDebug() << childTables; qDebug() << masterTables; @@ -173,7 +180,6 @@ qDebug() << masterTables; Table *lastRow; }; QVector levels; - QList returnList; QList::iterator i; for (int i = 0; i < d->relations.count(); ++i) { LevelData data; @@ -378,12 +384,13 @@ Q_OUTOFLINE_TEMPLATE Query *Query::join(const QString &className) if (!rel) rel = d->database->model().relationByClassNames(className, d->className); - if (!rel) - qFatal("No relation beyween %s and %s", - qPrintable(d->className), qPrintable(className)); + if (!rel) { + qInfo("No relation between %s and %s", + qPrintable(d->className), qPrintable(className)); + return this; + } d->relations.append(rel); - d->joinClassName = className; d->joins.append(className); return this; } @@ -440,7 +447,6 @@ template Q_OUTOFLINE_TEMPLATE Query *Query::include(TableSetBase *t) { Q_D(Query); - d->joinClassName = t->childClassName(); return this; } @@ -448,7 +454,6 @@ template Q_OUTOFLINE_TEMPLATE Query *Query::include(Table *t) { Q_D(Query); - d->joinClassName = t->metaObject()->className(); return this; } diff --git a/src/query_p.h b/src/query_p.h index 54ff7c6..4b48859 100644 --- a/src/query_p.h +++ b/src/query_p.h @@ -46,7 +46,6 @@ public: QString select; Database *database; TableSetBase *tableSet; - QString joinClassName; QStringList joins; QList relations; QList wheres; diff --git a/test/basic/tst_basic.pro b/test/basic/tst_basic.pro index 2a11746..a274bdc 100644 --- a/test/basic/tst_basic.pro +++ b/test/basic/tst_basic.pro @@ -13,7 +13,8 @@ SOURCES += \ ../common/comment.cpp \ ../common/post.cpp \ ../common/user.cpp \ - ../common/weblogdatabase.cpp + ../common/weblogdatabase.cpp \ + ../common/score.cpp HEADERS += \ maintest.h \ @@ -21,4 +22,5 @@ HEADERS += \ ../common/comment.h \ ../common/post.h \ ../common/user.h \ - ../common/weblogdatabase.h + ../common/weblogdatabase.h \ + ../common/score.h diff --git a/test/common/post.cpp b/test/common/post.cpp index bf980f6..46df0f6 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -1,9 +1,12 @@ #include "post.h" #include "comment.h" +#include "score.h" #include "tableset.h" Post::Post(QObject *parent) : Table(parent), - m_id(0), m_title(""), m_comments(new TableSet(this)) + m_id(0), m_title(""), + m_comments(new TableSet(this)), + m_scores(new TableSet(this)) { } diff --git a/test/common/post.h b/test/common/post.h index 5b25e23..b020804 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -11,6 +11,7 @@ using namespace NUT_NAMESPACE; #endif class Comment; +class Score; class Post : public Table { Q_OBJECT @@ -27,6 +28,7 @@ class Post : public Table NUT_DECLARE_FIELD(QString, body, body, setBody) NUT_DECLARE_CHILD_TABLE(Comment, comments) + NUT_DECLARE_CHILD_TABLE(Score, scores) public: Q_INVOKABLE Post(QObject *tableSet = 0); diff --git a/test/common/score.cpp b/test/common/score.cpp new file mode 100644 index 0000000..08466a2 --- /dev/null +++ b/test/common/score.cpp @@ -0,0 +1,6 @@ +#include "score.h" + +Score::Score(QObject *parent) : Nut::Table(parent) +{ + +} diff --git a/test/common/score.h b/test/common/score.h new file mode 100644 index 0000000..02ce240 --- /dev/null +++ b/test/common/score.h @@ -0,0 +1,24 @@ +#ifndef SCORE_H +#define SCORE_H + +#include "table.h" + +class User; +class Post; +class Score : public Nut::Table +{ + Q_OBJECT + + NUT_PRIMARY_AUTO_INCREMENT(id) + NUT_DECLARE_FIELD(int, id, id, setId) + + NUT_DECLARE_FIELD(int, score, score, setScore) + + NUT_FOREGION_KEY(Post, int, post, post, setPost) + NUT_FOREGION_KEY(User, int, user, user, setUser) + +public: + Q_INVOKABLE Score(QObject *parent = Q_NULLPTR); +}; + +#endif // SCORE_H diff --git a/test/common/user.cpp b/test/common/user.cpp index 90abc0c..b2ee974 100644 --- a/test/common/user.cpp +++ b/test/common/user.cpp @@ -1,9 +1,11 @@ +#include "comment.h" +#include "score.h" + #include "user.h" -#include "comment.h" - User::User(QObject *tableSet) : Table(tableSet), - m_comments(new TableSet(this)) + m_comments(new TableSet(this)), + m_scores(new TableSet(this)) { } diff --git a/test/common/user.h b/test/common/user.h index dd3330c..667efd6 100644 --- a/test/common/user.h +++ b/test/common/user.h @@ -12,6 +12,7 @@ using namespace NUT_NAMESPACE; #endif class Comment; +class Score; class User : public Nut::Table { Q_OBJECT @@ -28,6 +29,7 @@ class User : public Nut::Table NUT_DECLARE_FIELD(QString, password, password, setPassword) NUT_DECLARE_CHILD_TABLE(Comment, comments) + NUT_DECLARE_CHILD_TABLE(Score, scores) public: Q_INVOKABLE User(QObject *tableSet = 0); diff --git a/test/common/weblogdatabase.cpp b/test/common/weblogdatabase.cpp index 40cba75..cf459b9 100644 --- a/test/common/weblogdatabase.cpp +++ b/test/common/weblogdatabase.cpp @@ -4,11 +4,13 @@ #include "post.h" #include "comment.h" #include "user.h" +#include "score.h" #include "weblogdatabase.h" WeblogDatabase::WeblogDatabase() : Database(), m_posts(new TableSet(this)), m_comments(new TableSet(this)), - m_users(new TableSet(this)) + m_users(new TableSet(this)), + m_scores(new TableSet(this)) { } diff --git a/test/common/weblogdatabase.h b/test/common/weblogdatabase.h index b7ece47..af72442 100644 --- a/test/common/weblogdatabase.h +++ b/test/common/weblogdatabase.h @@ -10,6 +10,7 @@ using namespace NUT_NAMESPACE; class Post; class Comment; class User; +class Score; class WeblogDatabase : public Database { Q_OBJECT @@ -19,6 +20,7 @@ class WeblogDatabase : public Database NUT_DECLARE_TABLE(Post, post) NUT_DECLARE_TABLE(Comment, comment) NUT_DECLARE_TABLE(User, user) + NUT_DECLARE_TABLE(Score, score) public: WeblogDatabase(); diff --git a/test/join/jointest.cpp b/test/join/jointest.cpp new file mode 100644 index 0000000..7a189c2 --- /dev/null +++ b/test/join/jointest.cpp @@ -0,0 +1,75 @@ +#include +#include +#include + +#include "consts.h" + +#include "jointest.h" +#include "query.h" +#include "tableset.h" +#include "tablemodel.h" +#include "databasemodel.h" + +#include "user.h" +#include "post.h" +#include "comment.h" +#include "score.h" + +#define PRINT(x) qDebug() << #x "=" << x; +JoinTest::JoinTest(QObject *parent) : QObject(parent) +{ +} + +void JoinTest::initTestCase() +{ + qDebug() << "User type id:" << qRegisterMetaType(); + qDebug() << "Post type id:" << qRegisterMetaType(); + qDebug() << "Comment type id:" << qRegisterMetaType(); + qDebug() << "Score type id:" << qRegisterMetaType(); + qDebug() << "DB type id:" << qRegisterMetaType(); + + db.setDriver(DRIVER); + db.setHostName(HOST); + db.setDatabaseName("nut_tst_join.db"); + db.setUserName(USERNAME); + db.setPassword(PASSWORD); + + bool ok = db.open(); + +// db.comments()->query()->remove(); +// db.posts()->query()->remove(); + + QTEST_ASSERT(ok); +} + +void JoinTest::join() +{ + auto q = db.comments()->query() + ->join() + ->join(); + +// Comment *comment = q->first(); + auto comments = q->toList(); +// Comment *comment = q->toList().first(); + qDebug() << q->sqlCommand(); + QTEST_ASSERT(comments.length()); + QTEST_ASSERT(comments[0]->author()); + QTEST_ASSERT(comments[0]->author()->username() == "admin"); +} + +void JoinTest::join2() +{ + auto q = db.users()->query() + ->join() + ->join(); + +// Comment *comment = q->first(); + auto comments = q->toList(); +// Comment *comment = q->toList().first(); +// qDebug() << q->sqlCommand(); +// QTEST_ASSERT(comments.length()); +// QTEST_ASSERT(comments[0]->author()); +// QTEST_ASSERT(comments[0]->author()->username() == "admin"); +} + +QTEST_MAIN(JoinTest) diff --git a/test/join/jointest.h b/test/join/jointest.h new file mode 100644 index 0000000..34bac28 --- /dev/null +++ b/test/join/jointest.h @@ -0,0 +1,26 @@ +#ifndef JOINTEST_H +#define JOINTEST_H + +#include +#include + +#include "weblogdatabase.h" + +class JoinTest : public QObject +{ + Q_OBJECT + WeblogDatabase db; + +public: + explicit JoinTest(QObject *parent = 0); + +signals: + +private slots: + void initTestCase(); + + void join2(); + void join(); +}; + +#endif // JOINTEST_H diff --git a/test/join/tst_join.pro b/test/join/tst_join.pro new file mode 100644 index 0000000..78533c7 --- /dev/null +++ b/test/join/tst_join.pro @@ -0,0 +1,26 @@ +QT += qml quick testlib sql +QT -= gui + +TARGET = tst_nut +TEMPLATE = app + +CONFIG += warn_on qmltestcase c++11 +INCLUDEPATH += $$PWD/../../src $$PWD/../common +include(../../nut.pri) +IMPORTPATH += $$OUT_PWD/../src/imports +SOURCES += \ + jointest.cpp \ + ../common/comment.cpp \ + ../common/post.cpp \ + ../common/user.cpp \ + ../common/weblogdatabase.cpp \ + ../common/score.cpp + +HEADERS += \ + jointest.h \ + ../common/consts.h \ + ../common/comment.h \ + ../common/post.h \ + ../common/user.h \ + ../common/weblogdatabase.h \ + ../common/score.h From f0717cc05bd7b546c1eeb7a4bc8150233284c868 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 01:42:46 +0330 Subject: [PATCH 39/47] visit method for table result --- src/changelogtable.h | 2 +- src/generators/sqlgeneratorbase.cpp | 4 +- src/query.h | 208 +++++++++++++++------------- src/table.cpp | 22 ++- src/table.h | 12 +- src/tableset.h | 2 +- test/common/comment.cpp | 3 +- test/common/comment.h | 2 +- test/common/post.h | 2 +- test/common/user.h | 2 +- test/join/jointest.cpp | 14 +- test/join/jointest.h | 2 +- 12 files changed, 149 insertions(+), 126 deletions(-) diff --git a/src/changelogtable.h b/src/changelogtable.h index 23861f9..27c4f70 100644 --- a/src/changelogtable.h +++ b/src/changelogtable.h @@ -38,7 +38,7 @@ class ChangeLogTable : public Table NUT_DECLARE_FIELD(QString, version, version, setVersion) public: - ChangeLogTable(QObject *tableSet = Q_NULLPTR); + ChangeLogTable(QObject *parentTableSet = Q_NULLPTR); }; NUT_END_NAMESPACE diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index 8158bbe..c4b814a 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -215,7 +215,7 @@ QString SqlGeneratorBase::join(const QString &mainTable, .arg((*i)->localColumn)); if (order != Q_NULLPTR) - order->append(mainTable + "." + (*i)->slaveTable->primaryKey()); + order->append((*i)->slaveTable->name() + "." + (*i)->slaveTable->primaryKey()); } else { ret.append(QString(" INNER JOIN %3 ON %1.%2 = %3.%4") .arg(mainTable) @@ -224,7 +224,7 @@ QString SqlGeneratorBase::join(const QString &mainTable, .arg((*i)->masterTable->primaryKey())); if (order != Q_NULLPTR) - order->append(mainTable + "." + (*i)->masterTable->primaryKey()); + order->append((*i)->masterTable->name() + "." + (*i)->masterTable->primaryKey()); } } return ret; diff --git a/src/query.h b/src/query.h index 86b4ff7..87627d2 100644 --- a/src/query.h +++ b/src/query.h @@ -145,120 +145,130 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) return returnList; } - QSet relatedTables; + QSet relatedTables; + relatedTables << d->database->model().tableByName(d->tableName); foreach (RelationModel *rel, d->relations) - relatedTables << rel->slaveTable->name() << rel->masterTable->name(); + relatedTables << rel->slaveTable << rel->masterTable; - QSet childTables, masterTables; - QMap lastClassRow; - - foreach (RelationModel *rel, d->relations) { - childTables.insert(rel->slaveTable->name()); - masterTables.insert(rel->masterTable->name()); - } - foreach (QString ch, childTables) { - if (masterTables.contains(ch)) - childTables.remove(ch); - } - - qDebug() << "TABLES:"; -qDebug() << childTables; -qDebug() << masterTables; - struct LevelData{ - QVariant keyValue; - TableSetBase *tableSet; - RelationModel *relation; QList masters; QList slaves; - - QString key; - QString className; - QString tableName; - int typeId; + QString keyFiledname; + QVariant lastKeyValue; + TableModel *table; Table *lastRow; }; QVector levels; - QList::iterator i; - for (int i = 0; i < d->relations.count(); ++i) { + QSet importedTables; + auto add_table = [&](int i, TableModel* table) { + if (importedTables.contains(table->name())) + return; + importedTables.insert(table->name()); + LevelData data; - data.relation = d->relations[i]; - qDebug() <<"relation" << data.relation->masterTable->name() << data.relation->slaveTable->name(); - data.key = data.relation->slaveTable->name() + "." + data.relation->localColumn; - data.className = data.relation->slaveTable->className(); - data.typeId = d->relations[i]->slaveTable->typeId(); - data.tableName = data.relation->slaveTable->name(); + data.table = table; + data.keyFiledname = data.table->name() + "." + data.table->primaryKey(); + data.lastKeyValue = QVariant(); - data.tableSet = 0; - for (int j = 0; j < i; ++j) { - if (d->relations[i]->masterTable->name() == d->relations[j]->slaveTable->name()) { - data.masters.append(j); - levels[i].slaves.append(i); - } - } - levels.append(data); - } -qDebug()<<"count="< masters; + foreach (RelationModel *rel, d->relations) + if (rel->slaveTable->name() == table->name()) + masters.insert(rel->masterTable->name()); - /*for (int i = d->joins.count() - 1; i >= 0; i--) { - QString className = d->joins[i]; - // foreach (QString className, d->joins) { - LevelData data; - data.className = className; - TableModel *m = d->database->model().tableByClassName(className); - if (!m) { - qWarning("Model '%s' not found!!!", qPrintable(className)); - return returnList; - } - data.key = m->name() + "." + m->primaryKey(); - data.typeId = m->typeId(); - data.keyValue = QVariant(); - data.tableSet = 0; - data.tableName = m->name(); - levels.append(data); - }*/ - - while (q.next()) { - qDebug() << "HAS"; - int p = levels.count(); - while (p) { - for (int i = 0; i < levels.count(); i++) { - LevelData &data = levels[i]; - qDebug() << "level"<className) { - table = new T(); - table->setTableSet(d->tableSet); - returnList.append(dynamic_cast(table)); - } else { - const QMetaObject *childMetaObject - = QMetaType::metaObjectForType(data.typeId); - table = qobject_cast
(childMetaObject->newInstance()); - } - - QStringList childFields - = d->database->model().tableByClassName(data.className)->fieldsNames(); - foreach (QString field, childFields) - table->setProperty(field.toLatin1().data(), - q.value(data.tableName + "." + field)); - - table->setStatus(Table::FeatchedFromDB); - table->setParent(this); - table->clear(); - - qDebug() << "table created" << table; - //set last created row - data.lastRow = table; + for (int j = 0; j < levels.count(); ++j) { + LevelData &dt = levels[j]; + qDebug() <<"[check]"<name() << dt.table->name(); + foreach (QString m, masters) + if (dt.table->name() == m) { + data.masters.append(j); + dt.slaves.append(i); } - } } + qDebug() << data.table->name() <<"added"; + levels.append(data); + }; + for (int i = 0; i < d->relations.count(); ++i) { + RelationModel *rel = d->relations[i]; + add_table(i, rel->masterTable); + add_table(i, rel->slaveTable); } + + QVector checked; + checked.reserve(levels.count()); + for (int i = 0; i < levels.count(); ++i) + checked.append(false); + qDebug() << "Elapsed time:" << QString("%1ms").arg(t.elapsed() / 1000.); + while (q.next()) { + checked.fill(false); + + int p = levels.count(); + qDebug() << "p is"<className() == d->className) { + table = new T(); + table->setParentTableSet(d->tableSet); + returnList.append(dynamic_cast(table)); + } else { + const QMetaObject *childMetaObject + = QMetaType::metaObjectForType(data.table->typeId()); + table = qobject_cast
(childMetaObject->newInstance()); + + qDebug() << data.table->name() <<"created"; + } + + QStringList childFields = data.table->fieldsNames(); + foreach (QString field, childFields) + table->setProperty(field.toLatin1().data(), + q.value(data.table->name() + "." + field)); + + foreach (int master, data.masters) { + table->setParentTableSet(levels[master].lastRow->childTableSet(data.table->className())); + qDebug() << data.table->name() << "added to" << levels[master].table->name(); + } + + table->setStatus(Table::FeatchedFromDB); + table->setParent(this); + table->clear(); + + qDebug() << "table created" << table; + //set last created row + data.lastRow = table; + + + + lastP = p; + } //while + } // while if (m_autoDelete) deleteLater(); diff --git a/src/table.cpp b/src/table.cpp index dec4bc0..e23e31f 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -34,7 +34,7 @@ Table::Table(QObject *parent) : QObject(parent) void Table::add(TableSetBase *t) { - this->tableSets.insert(t); + this->childTableSets.insert(t); } @@ -119,15 +119,23 @@ bool Table::setParentTable(Table *master) return false; } -TableSetBase *Table::tableSet() const +TableSetBase *Table::parentTableSet() const { - return _tableSet; + return _parentTableSet; } -void Table::setTableSet(TableSetBase *parent) +void Table::setParentTableSet(TableSetBase *parent) { - _tableSet = parent; - _tableSet->add(this); + _parentTableSet = parent; + _parentTableSet->add(this); +} + +TableSetBase *Table::childTableSet(const QString &name) const +{ + foreach (TableSetBase *t, childTableSets) + if (t->childClassName() == name) + return t; + return Q_NULLPTR; } int Table::save(Database *db) @@ -137,7 +145,7 @@ int Table::save(Database *db) if(status() == Added && isPrimaryKeyAutoIncrement()) setProperty(primaryKey().toLatin1().data(), q.lastInsertId()); - foreach(TableSetBase *ts, tableSets) + foreach(TableSetBase *ts, childTableSets) ts->save(db); setStatus(FeatchedFromDB); diff --git a/src/table.h b/src/table.h index cf80eba..efa6f63 100644 --- a/src/table.h +++ b/src/table.h @@ -38,7 +38,7 @@ class NUT_EXPORT Table : public QObject Q_OBJECT public: - explicit Table(QObject *tableSet = 0); + explicit Table(QObject *parentTableSet = 0); enum Status{ NewCreated, @@ -56,8 +56,10 @@ public: Status status() const; void setStatus(const Status &status); - TableSetBase *tableSet() const; - void setTableSet(TableSetBase *tableSet); + TableSetBase *parentTableSet() const; + void setParentTableSet(TableSetBase *parentTableSet); + + TableSetBase *childTableSet(const QString &name) const; QSet changedProperties() const; @@ -73,9 +75,9 @@ private: Status _status; QSet _changedProperties; //TODO: is this removable? - TableSetBase *_tableSet; + TableSetBase *_parentTableSet; - QSet tableSets; + QSet childTableSets; void clear(); void add(TableSetBase *); diff --git a/src/tableset.h b/src/tableset.h index b5e069f..1cb4762 100644 --- a/src/tableset.h +++ b/src/tableset.h @@ -109,7 +109,7 @@ Q_OUTOFLINE_TEMPLATE void TableSet::append(T *t) _tables.insert(t); _tablesList.append(t); // rows.append(t); - t->setTableSet(this); + t->setParentTableSet(this); if(t->status() != Table::FeatchedFromDB) t->setStatus(Table::Added); } diff --git a/test/common/comment.cpp b/test/common/comment.cpp index 87ec017..d732145 100644 --- a/test/common/comment.cpp +++ b/test/common/comment.cpp @@ -1,6 +1,7 @@ #include "comment.h" -Comment::Comment(QObject *parent) : Table(parent) +Comment::Comment(QObject *parent) : Table(parent), + m_author(Q_NULLPTR), m_post(Q_NULLPTR) { } diff --git a/test/common/comment.h b/test/common/comment.h index b221083..0fd30cc 100644 --- a/test/common/comment.h +++ b/test/common/comment.h @@ -25,7 +25,7 @@ class Comment : public Table NUT_FOREGION_KEY(User, int, author, author, setAuthor) public: - Q_INVOKABLE explicit Comment(QObject *tableSet = 0); + Q_INVOKABLE explicit Comment(QObject *parentTableSet = 0); }; Q_DECLARE_METATYPE(Comment*) diff --git a/test/common/post.h b/test/common/post.h index b020804..c8e7994 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -31,7 +31,7 @@ class Post : public Table NUT_DECLARE_CHILD_TABLE(Score, scores) public: - Q_INVOKABLE Post(QObject *tableSet = 0); + Q_INVOKABLE Post(QObject *parentTableSet = 0); signals: diff --git a/test/common/user.h b/test/common/user.h index 667efd6..0b98721 100644 --- a/test/common/user.h +++ b/test/common/user.h @@ -32,7 +32,7 @@ class User : public Nut::Table NUT_DECLARE_CHILD_TABLE(Score, scores) public: - Q_INVOKABLE User(QObject *tableSet = 0); + Q_INVOKABLE User(QObject *parentTableSet = 0); }; Q_DECLARE_METATYPE(User*) diff --git a/test/join/jointest.cpp b/test/join/jointest.cpp index 7a189c2..05918cb 100644 --- a/test/join/jointest.cpp +++ b/test/join/jointest.cpp @@ -51,17 +51,19 @@ void JoinTest::join() // Comment *comment = q->first(); auto comments = q->toList(); // Comment *comment = q->toList().first(); - qDebug() << q->sqlCommand(); - QTEST_ASSERT(comments.length()); - QTEST_ASSERT(comments[0]->author()); - QTEST_ASSERT(comments[0]->author()->username() == "admin"); +// qDebug() << q->sqlCommand(); + PRINT(comments.length()); + +// QTEST_ASSERT(comments.length()); +// QTEST_ASSERT(comments[0]->author()); +// QTEST_ASSERT(comments[0]->author()->username() == "admin"); } void JoinTest::join2() { auto q = db.users()->query() - ->join() - ->join(); + ->join() + ->join(); // Comment *comment = q->first(); auto comments = q->toList(); diff --git a/test/join/jointest.h b/test/join/jointest.h index 34bac28..cddb1cb 100644 --- a/test/join/jointest.h +++ b/test/join/jointest.h @@ -19,8 +19,8 @@ signals: private slots: void initTestCase(); - void join2(); void join(); + void join2(); }; #endif // JOINTEST_H From 7e437fd8059d4b65ea1c330377c63a4c61094fdc Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:20:40 +0330 Subject: [PATCH 40/47] join OK --- src/defines.h | 2 +- src/query.h | 39 +++++++++++++++++++++++++++++++-------- src/tablemodel.cpp | 3 ++- src/tablemodel.h | 1 + test/basic/maintest.cpp | 26 +++++++++++--------------- 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/src/defines.h b/src/defines.h index 0a8f443..b55e827 100644 --- a/src/defines.h +++ b/src/defines.h @@ -71,7 +71,7 @@ public: \ #define NUT_FOREGION_KEY(type, keytype, name, read, write) \ Q_PROPERTY(type* name READ read WRITE write) \ NUT_DECLARE_FIELD(keytype, name##Id, read##Id, write##Id) \ - NUT_INFO(__nut_FOREGION_KEY, name##Id, type) \ + NUT_INFO(__nut_FOREGION_KEY, name, type) \ type *m_##name; \ public: \ type *read() const { return m_##name ; } \ diff --git a/src/query.h b/src/query.h index 87627d2..31456bf 100644 --- a/src/query.h +++ b/src/query.h @@ -154,6 +154,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) struct LevelData{ QList masters; QList slaves; + QList masterFields; QString keyFiledname; QVariant lastKeyValue; TableModel *table; @@ -171,19 +172,25 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) data.keyFiledname = data.table->name() + "." + data.table->primaryKey(); data.lastKeyValue = QVariant(); - QSet masters; + QHash masters; foreach (RelationModel *rel, d->relations) if (rel->slaveTable->name() == table->name()) - masters.insert(rel->masterTable->name()); + masters.insert(rel->masterTable->name(), rel->localProperty); for (int j = 0; j < levels.count(); ++j) { LevelData &dt = levels[j]; qDebug() <<"[check]"<name() << dt.table->name(); - foreach (QString m, masters) - if (dt.table->name() == m) { + + QHashIterator it(masters); + while (it.hasNext()) { + it.next(); + + if (dt.table->name() == it.key()) { data.masters.append(j); + data.masterFields.append(it.value()); dt.slaves.append(i); } + } } qDebug() << data.table->name() <<"added"; levels.append(data); @@ -194,6 +201,15 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) add_table(i, rel->slaveTable); } + if (!importedTables.count()) { + LevelData data; + data.table = d->database->model().tableByName(d->tableName); + data.keyFiledname = d->tableName + "." + data.table->primaryKey(); + data.lastKeyValue = QVariant(); + + levels.append(data); + } + QVector checked; checked.reserve(levels.count()); for (int i = 0; i < levels.count(); ++i) @@ -243,24 +259,31 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) = QMetaType::metaObjectForType(data.table->typeId()); table = qobject_cast
(childMetaObject->newInstance()); - qDebug() << data.table->name() <<"created"; } + qDebug() << "table created" << table; QStringList childFields = data.table->fieldsNames(); foreach (QString field, childFields) table->setProperty(field.toLatin1().data(), q.value(data.table->name() + "." + field)); - foreach (int master, data.masters) { + for (int i = 0; i < data.masters.count(); ++i) { + int master = data.masters[i]; + table->setProperty(data.masterFields[i].toLocal8Bit().data(), + QVariant::fromValue(levels[master].lastRow)); + table->setParentTableSet(levels[master].lastRow->childTableSet(data.table->className())); - qDebug() << data.table->name() << "added to" << levels[master].table->name(); + TableSetBase *ts = levels[master].lastRow->childTableSet(data.table->className()); + qDebug() << table << "added to" + << levels[master].lastRow + << ts->childClassName() + << data.masterFields[i]; } table->setStatus(Table::FeatchedFromDB); table->setParent(this); table->clear(); - qDebug() << "table created" << table; //set last created row data.lastRow = table; diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index 81bbcc1..ccb9690 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -223,7 +223,8 @@ TableModel::TableModel(int typeId, QString tableName) if(type == __nut_FOREGION_KEY){ RelationModel *fk = new RelationModel; fk->slaveTable = this; - fk->localColumn = name; + fk->localColumn = name + "Id"; + fk->localProperty = name; fk->foregionColumn = value; fk->masterClassName = value; _foregionKeys.append(fk); diff --git a/src/tablemodel.h b/src/tablemodel.h index 5c010fe..42615e5 100644 --- a/src/tablemodel.h +++ b/src/tablemodel.h @@ -67,6 +67,7 @@ struct FieldModel{ struct RelationModel{ //slave QString localColumn; + QString localProperty; TableModel *slaveTable; //master QString foregionColumn; diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 5bc004e..65536cf 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -118,20 +118,23 @@ void MainTest::selectPosts() PRINT(posts.length()); PRINT(posts.at(0)->comments()->length()); -// QTEST_ASSERT(posts.length() == 1); -// QTEST_ASSERT(posts.at(0)->comments()->length() == 3); -// QTEST_ASSERT(posts.at(0)->title() == "post title"); + QTEST_ASSERT(posts.length() == 1); + QTEST_ASSERT(posts.at(0)->comments()->length() == 3); + QTEST_ASSERT(posts.at(0)->title() == "post title"); -// QTEST_ASSERT(posts.at(0)->comments()->at(0)->message() == "comment #0"); -// QTEST_ASSERT(posts.at(0)->comments()->at(1)->message() == "comment #1"); -// QTEST_ASSERT(posts.at(0)->comments()->at(2)->message() == "comment #2"); + QTEST_ASSERT(posts.at(0)->comments()->at(0)->message() == "comment #0"); + QTEST_ASSERT(posts.at(0)->comments()->at(1)->message() == "comment #1"); + QTEST_ASSERT(posts.at(0)->comments()->at(2)->message() == "comment #2"); db.cleanUp(); } void MainTest::selectFirst() { - auto posts = db.posts()->query() - ->first(); + auto q = db.posts()->query(); + + auto posts = q->first(); + + qDebug() << q->sqlCommand(); QTEST_ASSERT(posts != Q_NULLPTR); } @@ -194,13 +197,6 @@ void MainTest::selectWithInvalidRelation() q->toList(); } -void MainTest::select10NewstPosts() -{ - auto q = db.posts()->query(); - q->orderBy(!Post::saveDateField()); - q->toList(10); -} - void MainTest::modifyPost() { auto q = db.posts()->query(); From e7bf523efd7f51ba9d9dd1209684aee4c0d6788c Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:48:49 +0330 Subject: [PATCH 41/47] polish && TOC-TOC --- src/query.h | 35 +++++++++++------------------------ test/basic/maintest.cpp | 18 +++++++++++------- test/basic/maintest.h | 1 - 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/query.h b/src/query.h index 31456bf..ce9ec0b 100644 --- a/src/query.h +++ b/src/query.h @@ -27,8 +27,7 @@ #include #include #include -#include -#include +#include #include "query_p.h" #include "database.h" @@ -66,7 +65,6 @@ public: return this; } - // Query *orderBy(QString fieldName, QString type); Query *skip(int n); Query *take(int n); @@ -109,8 +107,7 @@ Q_OUTOFLINE_TEMPLATE Query::Query(Database *database, TableSetBase *tableSet, d->database = database; d->tableSet = tableSet; d->className = T::staticMetaObject.className(); - d->tableName - = // TableModel::findByClassName(T::staticMetaObject.className())->name(); + d->tableName = d->database->model() .tableByClassName(T::staticMetaObject.className()) ->name(); @@ -130,9 +127,6 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) Q_D(Query); QList returnList; d->select = "*"; - QElapsedTimer t; - t.start(); - d->sql = d->database->sqlGenertor()->selectCommand( SqlGeneratorBase::SelectAll, "", @@ -179,7 +173,6 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) for (int j = 0; j < levels.count(); ++j) { LevelData &dt = levels[j]; - qDebug() <<"[check]"<name() << dt.table->name(); QHashIterator it(masters); while (it.hasNext()) { @@ -192,7 +185,7 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) } } } - qDebug() << data.table->name() <<"added"; + levels.append(data); }; for (int i = 0; i < d->relations.count(); ++i) { @@ -214,12 +207,11 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) checked.reserve(levels.count()); for (int i = 0; i < levels.count(); ++i) checked.append(false); - qDebug() << "Elapsed time:" << QString("%1ms").arg(t.elapsed() / 1000.); + while (q.next()) { checked.fill(false); int p = levels.count(); - qDebug() << "p is"< Query::toList(int count) table = qobject_cast
(childMetaObject->newInstance()); } - qDebug() << "table created" << table; QStringList childFields = data.table->fieldsNames(); foreach (QString field, childFields) @@ -272,12 +263,9 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) table->setProperty(data.masterFields[i].toLocal8Bit().data(), QVariant::fromValue(levels[master].lastRow)); - table->setParentTableSet(levels[master].lastRow->childTableSet(data.table->className())); - TableSetBase *ts = levels[master].lastRow->childTableSet(data.table->className()); - qDebug() << table << "added to" - << levels[master].lastRow - << ts->childClassName() - << data.masterFields[i]; + table->setParentTableSet( + levels[master].lastRow->childTableSet( + data.table->className())); } table->setStatus(Table::FeatchedFromDB); @@ -287,15 +275,12 @@ Q_OUTOFLINE_TEMPLATE QList Query::toList(int count) //set last created row data.lastRow = table; - - lastP = p; } //while } // while if (m_autoDelete) deleteLater(); - qDebug() << "Elapsed time:" << QString("%1ms").arg(t.elapsed() / 1000.); return returnList; } @@ -413,9 +398,11 @@ Q_OUTOFLINE_TEMPLATE Query *Query::join(const QString &className) { Q_D(Query); - RelationModel *rel = d->database->model().relationByClassNames(d->className, className); + RelationModel *rel = d->database->model() + .relationByClassNames(d->className, className); if (!rel) - rel = d->database->model().relationByClassNames(className, d->className); + rel = d->database->model() + .relationByClassNames(className, d->className); if (!rel) { qInfo("No relation between %s and %s", diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 65536cf..1fc16a1 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "consts.h" @@ -15,6 +16,11 @@ #include "comment.h" #define PRINT(x) qDebug() << #x "=" << x; +#define TIC() QElapsedTimer timer; timer.start() +#define TOC() qDebug() << QString("Elapsed time: %1ms for %2") \ + .arg(timer.elapsed() / 1000.) \ + .arg(__func__) + MainTest::MainTest(QObject *parent) : QObject(parent) { } @@ -130,11 +136,9 @@ void MainTest::selectPosts() void MainTest::selectFirst() { - auto q = db.posts()->query(); + auto posts = db.posts()->query() + ->first(); - auto posts = q->first(); - - qDebug() << q->sqlCommand(); QTEST_ASSERT(posts != Q_NULLPTR); } @@ -176,14 +180,14 @@ void MainTest::testDate() void MainTest::join() { + TIC(); auto q = db.comments()->query() ->join() ->join(); -// Comment *comment = q->first(); auto comments = q->toList(); -// Comment *comment = q->toList().first(); - qDebug() << q->sqlCommand(); + + TOC(); QTEST_ASSERT(comments.length()); QTEST_ASSERT(comments[0]->author()); QTEST_ASSERT(comments[0]->author()->username() == "admin"); diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 74bd47a..49b1956 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -34,7 +34,6 @@ private slots: void selectPostIds(); void testDate(); void selectWithInvalidRelation(); - void select10NewstPosts(); void modifyPost(); void emptyDatabase(); }; From 2a1b2766ab9071ec17da14e9f22b94f6864b9e65 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:50:26 +0330 Subject: [PATCH 42/47] comment travis ci broken line --- src/generators/sqlgeneratorbase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generators/sqlgeneratorbase.cpp b/src/generators/sqlgeneratorbase.cpp index c4b814a..3a7b88f 100644 --- a/src/generators/sqlgeneratorbase.cpp +++ b/src/generators/sqlgeneratorbase.cpp @@ -281,8 +281,8 @@ QString SqlGeneratorBase::join(const QStringList &list, QStringList *order) order->append(mainTable + "." + rel->localColumn); } else { - qInfo("Relation for %s and %s not exists", - qPrintable(table), qPrintable(mainTable)); +// qInfo("Relation for %s and %s not exists", +// qPrintable(table), qPrintable(mainTable)); } } From bcdb4d3a174862a3cd4dd249dbbda75fe0e6b32a Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:54:11 +0330 Subject: [PATCH 43/47] added branches build icon to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 98aaafc..2cb66f7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Nut +## Build result +| Brancc name | Icon | +| ------------- |:-------------:| +| master | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=master)](https://travis-ci.org/HamedMasafi/Nut) | +| dev | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) | + [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) ## Advanced, Powerful and easy to use ORM for Qt5 From caa951fe06cdf7d4e6799c6d1ef35f1bf413fd92 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:54:11 +0330 Subject: [PATCH 44/47] added branches build icon to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 98aaafc..2cb66f7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Nut +## Build result +| Brancc name | Icon | +| ------------- |:-------------:| +| master | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=master)](https://travis-ci.org/HamedMasafi/Nut) | +| dev | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) | + [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) ## Advanced, Powerful and easy to use ORM for Qt5 From 2a18e75d95a508f661102bfe1f51225eaab7ee0c Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 17:59:17 +0330 Subject: [PATCH 45/47] readme fix --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2cb66f7..d44fb0d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ | master | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=master)](https://travis-ci.org/HamedMasafi/Nut) | | dev | [![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) | -[![Build Status](https://travis-ci.org/HamedMasafi/Nut.svg?branch=dev)](https://travis-ci.org/HamedMasafi/Nut) ## Advanced, Powerful and easy to use ORM for Qt5 From f2a0ebab2d2ecdf4287242a41705a482303c5bc7 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Mon, 15 Jan 2018 23:34:42 +0330 Subject: [PATCH 46/47] minor changes and some TODO comments --- src/query.h | 12 ++++----- src/table.cpp | 55 ++++++++++++++++----------------------- src/table.h | 2 ++ src/tablemodel.cpp | 57 +++++++++++------------------------------ test/basic/maintest.cpp | 19 +++++++++++++- test/basic/maintest.h | 1 + test/common/post.cpp | 1 + 7 files changed, 65 insertions(+), 82 deletions(-) diff --git a/src/query.h b/src/query.h index ce9ec0b..1fb4796 100644 --- a/src/query.h +++ b/src/query.h @@ -78,9 +78,9 @@ public: template QList select(const FieldPhrase f); int count(); - QVariant max(FieldPhrase &f); - QVariant min(FieldPhrase &f); - QVariant average(FieldPhrase &f); + QVariant max(const FieldPhrase &f); + QVariant min(const FieldPhrase &f); + QVariant average(const FieldPhrase &f); //data mailpulation int update(WherePhrase phrase); @@ -343,7 +343,7 @@ Q_OUTOFLINE_TEMPLATE int Query::count() } template -Q_OUTOFLINE_TEMPLATE QVariant Query::max(FieldPhrase &f) +Q_OUTOFLINE_TEMPLATE QVariant Query::max(const FieldPhrase &f) { Q_D(Query); @@ -360,7 +360,7 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::max(FieldPhrase &f) } template -Q_OUTOFLINE_TEMPLATE QVariant Query::min(FieldPhrase &f) +Q_OUTOFLINE_TEMPLATE QVariant Query::min(const FieldPhrase &f) { Q_D(Query); @@ -377,7 +377,7 @@ Q_OUTOFLINE_TEMPLATE QVariant Query::min(FieldPhrase &f) } template -Q_OUTOFLINE_TEMPLATE QVariant Query::average(FieldPhrase &f) +Q_OUTOFLINE_TEMPLATE QVariant Query::average(const FieldPhrase &f) { Q_D(Query); diff --git a/src/table.cpp b/src/table.cpp index e23e31f..003e67e 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -27,6 +27,18 @@ NUT_BEGIN_NAMESPACE +/* + * FIXME: + * Qt can not access metaObject inside of constructor + * so, if we can't initalize myModel inside of ctor. in + * other side myModel inited in propertyChanged signal, so + * any method that uses myModel (like: primaryKey, ...) can't + * be accessed before any property set. So ugly, but there are + * no other way for now. + * + * This should be fixed to v1.2 + */ + Table::Table(QObject *parent) : QObject(parent) { setStatus(NewCreated); @@ -40,38 +52,12 @@ void Table::add(TableSetBase *t) QString Table::primaryKey() const { -// static QString ret = QString::null; - -// if(ret == QString::null){ -// for(int i = 0; i < metaObject()->classInfoCount(); i++){ -// QMetaClassInfo ci = metaObject()->classInfo(i); -// QString ciName = ci.name(); - -// if(ciName.startsWith(__nut_NAME_PERFIX)) -// ciName.remove(__nut_NAME_PERFIX); - -// if(ciName.contains(" ")){ -// QStringList parts = ciName.split(" "); -// QString propName = parts.at(1); -// if(propName == __nut_PRIMARY_KEY) -// ret = parts.at(0); -// } -// } - -// if(ret == QString::null) -// ret = ""; -// } - -// return ret; - return TableModel::findByClassName(metaObject()->className())->primaryKey(); + return myModel->primaryKey(); } bool Table::isPrimaryKeyAutoIncrement() const { - auto m = TableModel::findByClassName(metaObject()->className()); - auto pk = m->primaryKey(); - auto f = m->field(pk); - return f->isAutoIncrement; + return myModel->field(myModel->primaryKey())->isAutoIncrement; } @@ -82,14 +68,17 @@ QVariant Table::primaryValue() const void Table::propertyChanged(QString propName) { - if(propName == primaryKey()) + if (!myModel) + myModel = TableModel::findByClassName(metaObject()->className()); + + if (propName == primaryKey()) return; _changedProperties.insert(propName); - if(_status == FeatchedFromDB) + if (_status == FeatchedFromDB) _status = Modified; - if(_status == NewCreated) + if (_status == NewCreated) _status = Added; } @@ -106,12 +95,12 @@ QSet Table::changedProperties() const bool Table::setParentTable(Table *master) { QString masterClassName = master->metaObject()->className(); - TableModel *myModel = TableModel::findByClassName(metaObject()->className()); foreach (RelationModel *r, myModel->foregionKeys()) if(r->masterClassName == masterClassName) { - setProperty(QString(r->localColumn).toLatin1().data(), master->primaryValue()); + setProperty(QString(r->localColumn).toLatin1().data(), + master->primaryValue()); _changedProperties.insert(r->localColumn); return true; } diff --git a/src/table.h b/src/table.h index efa6f63..0262328 100644 --- a/src/table.h +++ b/src/table.h @@ -33,6 +33,7 @@ NUT_BEGIN_NAMESPACE class Database; class TableSetBase; +class TableModel; class NUT_EXPORT Table : public QObject { Q_OBJECT @@ -72,6 +73,7 @@ protected: void propertyChanged(QString propName); private: + TableModel *myModel; Status _status; QSet _changedProperties; //TODO: is this removable? diff --git a/src/tablemodel.cpp b/src/tablemodel.cpp index ccb9690..8c272a2 100644 --- a/src/tablemodel.cpp +++ b/src/tablemodel.cpp @@ -30,8 +30,11 @@ NUT_BEGIN_NAMESPACE +/* + * TODO: It may be good idea if we replace this QSet with two QHash! + * one for className search and another for typeId. + */ QSet TableModel::_allModels; -//QMap TableScheema::scheemas; QString TableModel::name() const { @@ -95,6 +98,9 @@ QSet TableModel::allModels() return _allModels; } +/* + * This is not used anywhere + */ TableModel *TableModel::findByTypeId(int typeId) { foreach (TableModel *model, _allModels) @@ -103,20 +109,18 @@ TableModel *TableModel::findByTypeId(int typeId) return 0; } -//TableModel *TableModel::findByName(QString name) -//{ -// foreach (TableModel *model, _allModels) -// if(model->name() == name) -// return model; -// return 0; -//} - +/** + * @brief TableModel::findByClassName + * Find a table model by class name + * @param className + * @return + */ TableModel *TableModel::findByClassName(QString className) { - foreach (TableModel *model, _allModels){ + foreach (TableModel *model, _allModels) if(model->className() == className) return model; - } + return 0; } @@ -338,37 +342,6 @@ QJsonObject TableModel::toJson() const return obj; } -//TableScheema *TableScheema::registerTable(int typeId, QString tableName) -//{ -// TableScheema *scheema = new TableScheema(typeId, tableName); -// scheemas.insert(typeId, scheema); -// return scheema; -//} - -//void TableScheema::createForegionKeys() -//{ -// foreach (TableScheema *sch, scheemas) { -// foreach (ForegionKey *fk, sch->_foregionKeys) { -// fk->table = scheema(fk->tableName); -// } -// } -//} - -//TableModel *TableModel::model(QString className) -//{ -// qFatal(""); -//#ifdef NUT_NAMESPACE -// if(className.startsWith(QT_STRINGIFY(NUT_NAMESPACE) "::")) -// className = className.replace(QT_STRINGIFY(NUT_NAMESPACE) "::", ""); -//#endif - -// foreach (TableModel *s, _allModels) -// if(s->_className == className){ -// return s; -// } -// return 0; -//} - RelationModel *TableModel::foregionKey(QString otherTable) const { foreach (RelationModel *fk, _foregionKeys) diff --git a/test/basic/maintest.cpp b/test/basic/maintest.cpp index 1fc16a1..cc77796 100644 --- a/test/basic/maintest.cpp +++ b/test/basic/maintest.cpp @@ -14,6 +14,7 @@ #include "user.h" #include "post.h" #include "comment.h" +#include "score.h" #define PRINT(x) qDebug() << #x "=" << x; #define TIC() QElapsedTimer timer; timer.start() @@ -29,6 +30,7 @@ void MainTest::initTestCase() { qDebug() << "User type id:" << qRegisterMetaType(); qDebug() << "Post type id:" << qRegisterMetaType(); + qDebug() << "Score type id:" << qRegisterMetaType(); qDebug() << "Comment type id:" << qRegisterMetaType(); qDebug() << "DB type id:" << qRegisterMetaType(); @@ -80,6 +82,12 @@ void MainTest::createPost() comment->setAuthorId(user->id()); newPost->comments()->append(comment); } + for (int i = 0; i < 10; ++i) { + Score *score = new Score; + score->setScore(i % 5); + newPost->scores()->append(score); + } + db.saveChanges(); postId = newPost->id(); @@ -99,7 +107,7 @@ void MainTest::createPost2() for(int i = 0 ; i < 3; i++){ Comment *comment = new Comment; - comment->setMessage("comment #" + QString::number(i)); + comment->setMessage("comment #" + QString::number(i + 2)); comment->setSaveDate(QDateTime::currentDateTime()); comment->setAuthor(user); comment->setPostId(newPost->id()); @@ -134,6 +142,15 @@ void MainTest::selectPosts() db.cleanUp(); } +void MainTest::selectScoreAverage() +{ + auto a = db.scores()->query() + ->join() + ->setWhere(Post::idField() == 1) + ->average(Score::scoreField()); + qDebug() << a; +} + void MainTest::selectFirst() { auto posts = db.posts()->query() diff --git a/test/basic/maintest.h b/test/basic/maintest.h index 49b1956..5a56759 100644 --- a/test/basic/maintest.h +++ b/test/basic/maintest.h @@ -29,6 +29,7 @@ private slots: void createPost2(); void join(); void selectPosts(); + void selectScoreAverage(); void selectFirst(); void selectPostsWithoutTitle(); void selectPostIds(); diff --git a/test/common/post.cpp b/test/common/post.cpp index 46df0f6..9aa932a 100644 --- a/test/common/post.cpp +++ b/test/common/post.cpp @@ -12,3 +12,4 @@ Post::Post(QObject *parent) : Table(parent), } NUT_IMPLEMENT_CHILD_TABLE(Post, Comment, comments) +NUT_IMPLEMENT_CHILD_TABLE(Post, Score, scores) From 56588b9eb17ec282e52dd3b2d532ad97dfc27b36 Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Tue, 13 Feb 2018 12:24:16 +0330 Subject: [PATCH 47/47] table --- src/database.cpp | 9 +++++++-- src/defines.h | 6 +++--- src/table.cpp | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/database.cpp b/src/database.cpp index 5d0e55c..9ffdf45 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -70,6 +70,13 @@ bool DatabasePrivate::open(bool update) db.setDatabaseName(databaseName); db.setUserName(userName); db.setPassword(password); + + if (driver.toLower().startsWith("qsqlite") + && !QFile::exists(databaseName)) { + //Force to execute update database + isDatabaseNew = true; + update = true; + } bool ok = db.open(); if (!ok) { @@ -336,7 +343,6 @@ Database::Database(QObject *parent) : QObject(parent), d_ptr(new DatabasePrivate(this)) { DatabasePrivate::lastId++; - qRegisterMetaType(); } Database::Database(const Database &other) @@ -350,7 +356,6 @@ Database::Database(const Database &other) setDatabaseName(other.databaseName()); setUserName(other.userName()); setPassword(other.password()); - qRegisterMetaType(); } Database::Database(const QSqlDatabase &other) diff --git a/src/defines.h b/src/defines.h index b55e827..b8f4f89 100644 --- a/src/defines.h +++ b/src/defines.h @@ -42,13 +42,13 @@ #define NUT_DECLARE_TABLE(type, name) \ NUT_INFO(__nut_TABLE, type, name) \ Q_PROPERTY(type* name READ name) \ - Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##s READ name##s) \ + Q_PROPERTY(NUT_WRAP_NAMESPACE(TableSet) name##Table READ name##Table) \ type* m_##name; \ - NUT_WRAP_NAMESPACE(TableSet) *m_##name##s; \ + NUT_WRAP_NAMESPACE(TableSet) *m_##name##Table; \ public: \ static const type _##name; \ type* name() const{ return m_##name; } \ - NUT_WRAP_NAMESPACE(TableSet) *name##s() const { return m_##name##s; } + NUT_WRAP_NAMESPACE(TableSet) *name##Table() const { return m_##name##Table; } //Table #define NUT_DECLARE_FIELD(type, name, read, write) \ diff --git a/src/table.cpp b/src/table.cpp index 003e67e..eeea6ec 100644 --- a/src/table.cpp +++ b/src/table.cpp @@ -39,7 +39,7 @@ NUT_BEGIN_NAMESPACE * This should be fixed to v1.2 */ -Table::Table(QObject *parent) : QObject(parent) +Table::Table(QObject *parent) : QObject(parent), myModel(0) { setStatus(NewCreated); } @@ -71,6 +71,9 @@ void Table::propertyChanged(QString propName) if (!myModel) myModel = TableModel::findByClassName(metaObject()->className()); + if (!myModel) + qFatal ("model for this class not found"); + if (propName == primaryKey()) return;