remove -=gui from tests
This commit is contained in:
parent
5ac713dd23
commit
d906bd81fd
|
|
@ -3,7 +3,7 @@
|
||||||
# Nut
|
# Nut
|
||||||
|
|
||||||
## Build result
|
## Build result
|
||||||
| Brancc name | Icon |
|
| Branch | Status |
|
||||||
| ------------- |:-------------:|
|
| ------------- |:-------------:|
|
||||||
| master | [](https://travis-ci.org/HamedMasafi/Nut) |
|
| master | [](https://travis-ci.org/HamedMasafi/Nut) |
|
||||||
| dev | [](https://travis-ci.org/HamedMasafi/Nut) |
|
| dev | [](https://travis-ci.org/HamedMasafi/Nut) |
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@ inline bool nutClassInfoInt(const QMetaClassInfo &classInfo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NUT_FIELD_PERFIX
|
||||||
|
#define NUT_FIELD_POSTFIX Field
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
#define NUT_DB_VERSION(version) \
|
#define NUT_DB_VERSION(version) \
|
||||||
|
|
|
||||||
|
|
@ -724,14 +724,14 @@ QString SqlGeneratorBase::insertCommand(const QString &tableName, const Assignme
|
||||||
|
|
||||||
void SqlGeneratorBase::replaceTableNames(QString &command)
|
void SqlGeneratorBase::replaceTableNames(QString &command)
|
||||||
{
|
{
|
||||||
foreach (TableModel *m, TableModel::allModels())
|
foreach (TableModel *m, _database->model())
|
||||||
command = command
|
command = command
|
||||||
.replace("[" + m->className() + "]", m->name());
|
.replace("[" + m->className() + "]", m->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SqlGeneratorBase::removeTableNames(QString &command)
|
void SqlGeneratorBase::removeTableNames(QString &command)
|
||||||
{
|
{
|
||||||
foreach (TableModel *m, TableModel::allModels())
|
foreach (TableModel *m, _database->model())
|
||||||
command = command.replace("[" + m->className() + "].", "");
|
command = command.replace("[" + m->className() + "].", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "abstractfieldphrase.h"
|
#include "abstractfieldphrase.h"
|
||||||
|
|
||||||
NUT_BEGIN_NAMESPACE
|
NUT_BEGIN_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef ABSTRACTFIELDPHRASE_H
|
#ifndef ABSTRACTFIELDPHRASE_H
|
||||||
#define ABSTRACTFIELDPHRASE_H
|
#define ABSTRACTFIELDPHRASE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "abstractfieldphrase.h"
|
#include "abstractfieldphrase.h"
|
||||||
#include "assignmentphrase.h"
|
#include "assignmentphrase.h"
|
||||||
#include "phrasedata.h"
|
#include "phrasedata.h"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef ASSIGNMENTPHRASE_H
|
#ifndef ASSIGNMENTPHRASE_H
|
||||||
#define ASSIGNMENTPHRASE_H
|
#define ASSIGNMENTPHRASE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "assignmentphraselist.h"
|
#include "assignmentphraselist.h"
|
||||||
#include "phrasedata.h"
|
#include "phrasedata.h"
|
||||||
#include <phrase.h>
|
#include <phrase.h>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef ASSIGNMENTPHRASELIST_H
|
#ifndef ASSIGNMENTPHRASELIST_H
|
||||||
#define ASSIGNMENTPHRASELIST_H
|
#define ASSIGNMENTPHRASELIST_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "abstractfieldphrase.h"
|
#include "abstractfieldphrase.h"
|
||||||
#include "conditionalphrase.h"
|
#include "conditionalphrase.h"
|
||||||
#include "phrasedata.h"
|
#include "phrasedata.h"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef CONDITIONALPHRASE_H
|
#ifndef CONDITIONALPHRASE_H
|
||||||
#define CONDITIONALPHRASE_H
|
#define CONDITIONALPHRASE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,22 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "datephrase.h"
|
#include "datephrase.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef DATEPHRASE_H
|
#ifndef DATEPHRASE_H
|
||||||
#define DATEPHRASE_H
|
#define DATEPHRASE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,21 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "fieldphrase.h"
|
#include "fieldphrase.h"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef FIELDPHRASE_H
|
#ifndef FIELDPHRASE_H
|
||||||
#define FIELDPHRASE_H
|
#define FIELDPHRASE_H
|
||||||
|
|
||||||
|
|
@ -43,57 +63,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//#define SPECIALIZATION_NUMERIC(type) \
|
|
||||||
//template<> \
|
|
||||||
//class FieldPhrase<type> : public AbstractFieldPhrase \
|
|
||||||
//{ \
|
|
||||||
// public: \
|
|
||||||
// FieldPhrase(const char *className, const char *s) : \
|
|
||||||
// AbstractFieldPhrase(className, s) \
|
|
||||||
// {} \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, %, PhraseData::Mod) \
|
|
||||||
// \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, +, PhraseData::Add) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, -, PhraseData::Minus) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, *, PhraseData::Multiple) \
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, /, PhraseData::Divide) \
|
|
||||||
// AssignmentPhrase operator =(const QVariant &other) { \
|
|
||||||
// return AssignmentPhrase(this, other); \
|
|
||||||
// } \
|
|
||||||
// AssignmentPhrase operator =(const ConditionalPhrase &other) { \
|
|
||||||
// return AssignmentPhrase(new PhraseData(data, PhraseData::Equal, other.data)); \
|
|
||||||
// } \
|
|
||||||
// ConditionalPhrase between(const QVariant &min, const QVariant &max) \
|
|
||||||
// { \
|
|
||||||
// return ConditionalPhrase(this, PhraseData::Between, \
|
|
||||||
// QVariantList() << min << max); \
|
|
||||||
// } \
|
|
||||||
// ConditionalPhrase operator ++() \
|
|
||||||
// {return ConditionalPhrase(this, PhraseData::Add, 1);} \
|
|
||||||
// ConditionalPhrase operator --() \
|
|
||||||
// {return ConditionalPhrase(this, PhraseData::Minus, 1);} \
|
|
||||||
// ConditionalPhrase operator ++(int) \
|
|
||||||
// {return ConditionalPhrase(this, PhraseData::Add, 1);} \
|
|
||||||
// ConditionalPhrase operator --(int) \
|
|
||||||
// {return ConditionalPhrase(this, PhraseData::Minus, 1);} \
|
|
||||||
//};
|
|
||||||
|
|
||||||
//SPECIALIZATION_NUMERIC(qint8)
|
|
||||||
//SPECIALIZATION_NUMERIC(qint16)
|
|
||||||
//SPECIALIZATION_NUMERIC(qint32)
|
|
||||||
//SPECIALIZATION_NUMERIC(qint64)
|
|
||||||
|
|
||||||
//SPECIALIZATION_NUMERIC(quint8)
|
|
||||||
//SPECIALIZATION_NUMERIC(quint16)
|
|
||||||
//SPECIALIZATION_NUMERIC(quint32)
|
|
||||||
//SPECIALIZATION_NUMERIC(quint64)
|
|
||||||
|
|
||||||
//SPECIALIZATION_NUMERIC(qreal)
|
|
||||||
|
|
||||||
//Date and time
|
//Date and time
|
||||||
#define CONDITIONAL_VARIANT_METHOD(name, cond) \
|
#define CONDITIONAL_VARIANT_METHOD(name, cond) \
|
||||||
ConditionalPhrase name(int val) \
|
ConditionalPhrase name(int val) \
|
||||||
|
|
@ -127,83 +96,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//template<>
|
|
||||||
//class FieldPhrase<QDate> : public AbstractFieldPhrase
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
// FieldPhrase(const char *className, const char *s) :
|
|
||||||
// AbstractFieldPhrase(className, s)
|
|
||||||
// {}
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual)
|
|
||||||
// AssignmentPhrase operator =(const QDate &other) {
|
|
||||||
// return AssignmentPhrase(this, other);
|
|
||||||
// }
|
|
||||||
// ConditionalPhrase between(const QDate &min, const QDate &max)
|
|
||||||
// {
|
|
||||||
// return ConditionalPhrase(this, PhraseData::Between,
|
|
||||||
// QVariantList() << min << max);
|
|
||||||
// }
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addYears, PhraseData::AddYears)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addMonths, PhraseData::AddMonths)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addDays, PhraseData::AddDays)
|
|
||||||
//};
|
|
||||||
|
|
||||||
//template<>
|
|
||||||
//class FieldPhrase<QTime> : public AbstractFieldPhrase
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
// FieldPhrase(const char *className, const char *s) :
|
|
||||||
// AbstractFieldPhrase(className, s)
|
|
||||||
// {}
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual)
|
|
||||||
// AssignmentPhrase operator =(const QTime &other) {
|
|
||||||
// return AssignmentPhrase(this, other);
|
|
||||||
// }
|
|
||||||
// ConditionalPhrase between(const QTime &min, const QTime &max)
|
|
||||||
// {
|
|
||||||
// return ConditionalPhrase(this, PhraseData::Between,
|
|
||||||
// QVariantList() << min << max);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addHours, PhraseData::AddHours)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addMinutes, PhraseData::AddMinutes)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addSeconds, PhraseData::AddSeconds)
|
|
||||||
//};
|
|
||||||
|
|
||||||
//template<>
|
|
||||||
//class FieldPhrase<QDateTime> : public AbstractFieldPhrase
|
|
||||||
//{
|
|
||||||
//public:
|
|
||||||
// FieldPhrase(const char *className, const char *s) :
|
|
||||||
// AbstractFieldPhrase(className, s)
|
|
||||||
// {}
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <, PhraseData::Less)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, <=, PhraseData::LessEqual)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >, PhraseData::Greater)
|
|
||||||
// SPECIALIZATION_NUMERIC_MEMBER(type, >=, PhraseData::GreaterEqual)
|
|
||||||
// AssignmentPhrase operator =(const QDateTime &other) {
|
|
||||||
// return AssignmentPhrase(this, other);
|
|
||||||
// }
|
|
||||||
// ConditionalPhrase between(const QDateTime &min, const QDateTime &max)
|
|
||||||
// {
|
|
||||||
// return ConditionalPhrase(this, PhraseData::Between,
|
|
||||||
// QVariantList() << min << max);
|
|
||||||
// }
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addYears, PhraseData::AddYears)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addMonths, PhraseData::AddMonths)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addDays, PhraseData::AddDays)
|
|
||||||
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addHours, PhraseData::AddHours)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addMinutes, PhraseData::AddMinutes)
|
|
||||||
// CONDITIONAL_VARIANT_METHOD(addSeconds, PhraseData::AddSeconds)
|
|
||||||
//};
|
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // FIELDPHRASE_H
|
#endif // FIELDPHRASE_H
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "phrasedata.h"
|
#include "phrasedata.h"
|
||||||
|
|
||||||
NUT_BEGIN_NAMESPACE
|
NUT_BEGIN_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef PHRASEDATA_H
|
#ifndef PHRASEDATA_H
|
||||||
#define PHRASEDATA_H
|
#define PHRASEDATA_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "phrasedatalist.h"
|
#include "phrasedatalist.h"
|
||||||
|
|
||||||
NUT_BEGIN_NAMESPACE
|
NUT_BEGIN_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef PHRASEDATALIST_H
|
#ifndef PHRASEDATALIST_H
|
||||||
#define PHRASEDATALIST_H
|
#define PHRASEDATALIST_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include "abstractfieldphrase.h"
|
#include "abstractfieldphrase.h"
|
||||||
#include "phraselist.h"
|
#include "phraselist.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef PHRASELIST_H
|
#ifndef PHRASELIST_H
|
||||||
#define PHRASELIST_H
|
#define PHRASELIST_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += sql
|
QT += sql gui
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = nut
|
TARGET = nut
|
||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
|
|
@ -40,7 +39,8 @@ HEADERS += \
|
||||||
$$PWD/phrases/phrasedata.h \
|
$$PWD/phrases/phrasedata.h \
|
||||||
$$PWD/phrases/phrasedatalist.h \
|
$$PWD/phrases/phrasedatalist.h \
|
||||||
$$PWD/phrases/phraselist.h \
|
$$PWD/phrases/phraselist.h \
|
||||||
$$PWD/phrases/datephrase.h
|
$$PWD/phrases/datephrase.h \
|
||||||
|
$$PWD/table_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/generators/sqlgeneratorbase.cpp \
|
$$PWD/generators/sqlgeneratorbase.cpp \
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#include <QMetaMethod>
|
#include <QMetaMethod>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
#include "table_p.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "databasemodel.h"
|
#include "databasemodel.h"
|
||||||
#include "generators/sqlgeneratorbase_p.h"
|
#include "generators/sqlgeneratorbase_p.h"
|
||||||
|
|
@ -40,25 +41,28 @@ NUT_BEGIN_NAMESPACE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Table::Table(QObject *parent) : QObject(parent),
|
Table::Table(QObject *parent) : QObject(parent),
|
||||||
_status(NewCreated), _parentTableSet(nullptr)
|
d_ptr(new TablePrivate(this))
|
||||||
{
|
{
|
||||||
myModel = TableModel::findByClassName(metaObject()->className());
|
Q_D(Table);
|
||||||
|
d->model = TableModel::findByClassName(metaObject()->className());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::add(TableSetBase *t)
|
void Table::add(TableSetBase *t)
|
||||||
{
|
{
|
||||||
this->childTableSets.insert(t);
|
Q_D(Table);
|
||||||
|
d->childTableSets.insert(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Table::primaryKey() const
|
QString Table::primaryKey() const
|
||||||
{
|
{
|
||||||
return myModel->primaryKey();
|
Q_D(const Table);
|
||||||
|
return d->model->primaryKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Table::isPrimaryKeyAutoIncrement() const
|
bool Table::isPrimaryKeyAutoIncrement() const
|
||||||
{
|
{
|
||||||
FieldModel *pk = myModel->field(myModel->primaryKey());
|
Q_D(const Table);
|
||||||
|
FieldModel *pk = d->model->field(d->model->primaryKey());
|
||||||
if (!pk)
|
if (!pk)
|
||||||
return false;
|
return false;
|
||||||
return pk->isAutoIncrement;
|
return pk->isAutoIncrement;
|
||||||
|
|
@ -72,44 +76,49 @@ QVariant Table::primaryValue() const
|
||||||
|
|
||||||
void Table::propertyChanged(const QString &propName)
|
void Table::propertyChanged(const QString &propName)
|
||||||
{
|
{
|
||||||
if (!myModel)
|
Q_D(Table);
|
||||||
myModel = TableModel::findByClassName(metaObject()->className());
|
if (!d->model)
|
||||||
|
d->model = TableModel::findByClassName(metaObject()->className());
|
||||||
|
|
||||||
if (!myModel)
|
if (!d->model)
|
||||||
qFatal ("model for class '%s' not found", qPrintable(metaObject()->className()));
|
qFatal ("model for class '%s' not found", qPrintable(metaObject()->className()));
|
||||||
|
|
||||||
foreach (FieldModel *f, myModel->fields())
|
foreach (FieldModel *f, d->model->fields())
|
||||||
if(f->isPrimaryKey && propName == f->name && f->isAutoIncrement)
|
if(f->isPrimaryKey && propName == f->name && f->isAutoIncrement)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_changedProperties.insert(propName);
|
d->changedProperties.insert(propName);
|
||||||
if (_status == FeatchedFromDB)
|
if (d->status == FeatchedFromDB)
|
||||||
_status = Modified;
|
d->status = Modified;
|
||||||
|
|
||||||
if (_status == NewCreated)
|
if (d->status == NewCreated)
|
||||||
_status = Added;
|
d->status = Added;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::clear()
|
void Table::clear()
|
||||||
{
|
{
|
||||||
_changedProperties.clear();
|
Q_D(Table);
|
||||||
|
d->changedProperties.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> Table::changedProperties() const
|
QSet<QString> Table::changedProperties() const
|
||||||
{
|
{
|
||||||
return _changedProperties;
|
Q_D(const Table);
|
||||||
|
return d->changedProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Table::setParentTable(Table *master)
|
bool Table::setParentTable(Table *master)
|
||||||
{
|
{
|
||||||
|
Q_D(Table);
|
||||||
|
|
||||||
QString masterClassName = master->metaObject()->className();
|
QString masterClassName = master->metaObject()->className();
|
||||||
|
|
||||||
foreach (RelationModel *r, myModel->foregionKeys())
|
foreach (RelationModel *r, d->model->foregionKeys())
|
||||||
if(r->masterClassName == masterClassName)
|
if(r->masterClassName == masterClassName)
|
||||||
{
|
{
|
||||||
setProperty(QString(r->localColumn).toLatin1().data(),
|
setProperty(QString(r->localColumn).toLatin1().data(),
|
||||||
master->primaryValue());
|
master->primaryValue());
|
||||||
_changedProperties.insert(r->localColumn);
|
d->changedProperties.insert(r->localColumn);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,18 +127,21 @@ bool Table::setParentTable(Table *master)
|
||||||
|
|
||||||
TableSetBase *Table::parentTableSet() const
|
TableSetBase *Table::parentTableSet() const
|
||||||
{
|
{
|
||||||
return _parentTableSet;
|
Q_D(const Table);
|
||||||
|
return d->parentTableSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::setParentTableSet(TableSetBase *parent)
|
void Table::setParentTableSet(TableSetBase *parent)
|
||||||
{
|
{
|
||||||
_parentTableSet = parent;
|
Q_D(Table);
|
||||||
_parentTableSet->add(this);
|
d->parentTableSet = parent;
|
||||||
|
d->parentTableSet->add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableSetBase *Table::childTableSet(const QString &name) const
|
TableSetBase *Table::childTableSet(const QString &name) const
|
||||||
{
|
{
|
||||||
foreach (TableSetBase *t, childTableSets)
|
Q_D(const Table);
|
||||||
|
foreach (TableSetBase *t, d->childTableSets)
|
||||||
if (t->childClassName() == name)
|
if (t->childClassName() == name)
|
||||||
return t;
|
return t;
|
||||||
return Q_NULLPTR;
|
return Q_NULLPTR;
|
||||||
|
|
@ -137,12 +149,14 @@ TableSetBase *Table::childTableSet(const QString &name) const
|
||||||
|
|
||||||
int Table::save(Database *db)
|
int Table::save(Database *db)
|
||||||
{
|
{
|
||||||
|
Q_D(Table);
|
||||||
|
|
||||||
QSqlQuery q = db->exec(db->sqlGenertor()->saveRecord(this, db->tableName(metaObject()->className())));
|
QSqlQuery q = db->exec(db->sqlGenertor()->saveRecord(this, db->tableName(metaObject()->className())));
|
||||||
|
|
||||||
if(status() == Added && isPrimaryKeyAutoIncrement())
|
if(status() == Added && isPrimaryKeyAutoIncrement())
|
||||||
setProperty(primaryKey().toLatin1().data(), q.lastInsertId());
|
setProperty(primaryKey().toLatin1().data(), q.lastInsertId());
|
||||||
|
|
||||||
foreach(TableSetBase *ts, childTableSets)
|
foreach(TableSetBase *ts, d->childTableSets)
|
||||||
ts->save(db);
|
ts->save(db);
|
||||||
setStatus(FeatchedFromDB);
|
setStatus(FeatchedFromDB);
|
||||||
|
|
||||||
|
|
@ -151,12 +165,22 @@ int Table::save(Database *db)
|
||||||
|
|
||||||
Table::Status Table::status() const
|
Table::Status Table::status() const
|
||||||
{
|
{
|
||||||
return _status;
|
Q_D(const Table);
|
||||||
|
return static_cast<Status>(d->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Table::setStatus(const Status &status)
|
void Table::setStatus(const Status &status)
|
||||||
{
|
{
|
||||||
_status = status;
|
Q_D(Table);
|
||||||
|
d->status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TablePrivate::TablePrivate(Table *parent) : q_ptr(parent),
|
||||||
|
status(Table::NewCreated), parentTableSet(nullptr)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
|
||||||
13
src/table.h
13
src/table.h
|
|
@ -34,9 +34,12 @@ NUT_BEGIN_NAMESPACE
|
||||||
class Database;
|
class Database;
|
||||||
class TableSetBase;
|
class TableSetBase;
|
||||||
class TableModel;
|
class TableModel;
|
||||||
|
class TablePrivate;
|
||||||
class NUT_EXPORT Table : public QObject
|
class NUT_EXPORT Table : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
TablePrivate *d_ptr;
|
||||||
|
Q_DECLARE_PRIVATE(Table)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Table(QObject *parentTableSet = nullptr);
|
explicit Table(QObject *parentTableSet = nullptr);
|
||||||
|
|
@ -73,13 +76,13 @@ protected:
|
||||||
void propertyChanged(const QString &propName);
|
void propertyChanged(const QString &propName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TableModel *myModel;
|
// TableModel *myModel;
|
||||||
Status _status;
|
// Status _status;
|
||||||
QSet<QString> _changedProperties;
|
// QSet<QString> _changedProperties;
|
||||||
//TODO: is this removable?
|
//TODO: is this removable?
|
||||||
TableSetBase *_parentTableSet;
|
// TableSetBase *_parentTableSet;
|
||||||
|
|
||||||
QSet<TableSetBase*> childTableSets;
|
// QSet<TableSetBase*> childTableSets;
|
||||||
void clear();
|
void clear();
|
||||||
void add(TableSetBase *);
|
void add(TableSetBase *);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef TABLEPRIVATE_H
|
||||||
|
#define TABLEPRIVATE_H
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
|
#include <QtCore/QSet>
|
||||||
|
|
||||||
|
NUT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class TableModel;
|
||||||
|
class Table;
|
||||||
|
class TableSetBase;
|
||||||
|
class TablePrivate {
|
||||||
|
Table *q_ptr;
|
||||||
|
Q_DECLARE_PUBLIC(Table)
|
||||||
|
|
||||||
|
public:
|
||||||
|
TablePrivate(Table *parent);
|
||||||
|
|
||||||
|
|
||||||
|
TableModel *model;
|
||||||
|
int status;
|
||||||
|
QSet<QString> changedProperties;
|
||||||
|
TableSetBase *parentTableSet;
|
||||||
|
QSet<TableSetBase*> childTableSets;
|
||||||
|
};
|
||||||
|
|
||||||
|
NUT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // TABLEPRIVATE_H
|
||||||
|
|
@ -89,7 +89,7 @@ struct RelationModel{
|
||||||
};
|
};
|
||||||
bool operator ==(const RelationModel &l, const RelationModel &r);
|
bool operator ==(const RelationModel &l, const RelationModel &r);
|
||||||
bool operator !=(const RelationModel &l, const RelationModel &r);
|
bool operator !=(const RelationModel &l, const RelationModel &r);
|
||||||
class TableModel
|
class NUT_EXPORT TableModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TableModel(int typeId, const QString &tableName = QString());
|
explicit TableModel(int typeId, const QString &tableName = QString());
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ void BasicTest::cleanupTestCase()
|
||||||
user->deleteLater();
|
user->deleteLater();
|
||||||
|
|
||||||
//release models before exiting
|
//release models before exiting
|
||||||
qDeleteAll(TableModel::allModels());
|
// qDeleteAll(TableModel::allModels());
|
||||||
|
|
||||||
if (QFile::remove("nut_tst_basic"))
|
if (QFile::remove("nut_tst_basic"))
|
||||||
qDebug() << "database removed";
|
qDebug() << "database removed";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_nut
|
TARGET = tst_nut
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_benchmark
|
TARGET = tst_benchmark
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
QT += qml quick testlib sql
|
QT += qml quick testlib sql
|
||||||
|
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_nut
|
TARGET = tst_nut
|
||||||
CONFIG += warn_on qmltestcase c++11
|
CONFIG += warn_on qmltestcase c++11
|
||||||
INCLUDEPATH += $$PWD/../../src $$PWD/../common
|
INCLUDEPATH += $$PWD/../../src $$PWD/../common
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql gui
|
||||||
|
|
||||||
TARGET = tst_datatypes
|
TARGET = tst_datatypes
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
CONFIG += qt console warn_on depend_includepath testcase
|
CONFIG += qt console warn_on depend_includepath testcase
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += qml quick testlib sql
|
QT += qml quick testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_nut
|
TARGET = tst_nut
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ void MainTest::mix()
|
||||||
insert(id = 0);
|
insert(id = 0);
|
||||||
insert((id = 4) & (name = "john"));
|
insert((id = 4) & (name = "john"));
|
||||||
order_by(id);
|
order_by(id);
|
||||||
order_by(id | ~name);
|
order_by(id | !name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTest::select(const PhraseList &ph)
|
void MainTest::select(const PhraseList &ph)
|
||||||
|
|
@ -148,7 +148,7 @@ void MainTest::insert(const AssignmentPhraseList &p)
|
||||||
|
|
||||||
void MainTest::order_by(const PhraseList &ph)
|
void MainTest::order_by(const PhraseList &ph)
|
||||||
{
|
{
|
||||||
|
QTEST_ASSERT(ph.data.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(MainTest)
|
QTEST_MAIN(MainTest)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_phrases
|
TARGET = tst_phrases
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_uuid
|
TARGET = tst_uuid
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ void UuidTest::restore()
|
||||||
|
|
||||||
void UuidTest::cleanupTestCase()
|
void UuidTest::cleanupTestCase()
|
||||||
{
|
{
|
||||||
qDeleteAll(Nut::TableModel::allModels());
|
// qDeleteAll(Nut::TableModel::allModels());
|
||||||
// Nut::DatabaseModel::deleteAllModels();
|
// Nut::DatabaseModel::deleteAllModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
QT += testlib sql
|
QT += testlib sql
|
||||||
QT -= gui
|
|
||||||
|
|
||||||
TARGET = tst_upgrades
|
TARGET = tst_upgrades
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue