row clear in query
This commit is contained in:
parent
25815ec242
commit
37915378b1
|
|
@ -152,6 +152,7 @@ Q_OUTOFLINE_TEMPLATE QList<T *> Query<T>::toList(int count)
|
||||||
t->setTableSet(d->tableSet);
|
t->setTableSet(d->tableSet);
|
||||||
t->setStatus(Table::FeatchedFromDB);
|
t->setStatus(Table::FeatchedFromDB);
|
||||||
t->setParent(this);
|
t->setParent(this);
|
||||||
|
t->clear();
|
||||||
|
|
||||||
result.append(t);
|
result.append(t);
|
||||||
lastRow = t;
|
lastRow = t;
|
||||||
|
|
@ -175,6 +176,7 @@ Q_OUTOFLINE_TEMPLATE QList<T *> Query<T>::toList(int count)
|
||||||
childTable->setParentTable(lastRow);
|
childTable->setParentTable(lastRow);
|
||||||
childTable->setStatus(Table::FeatchedFromDB);
|
childTable->setStatus(Table::FeatchedFromDB);
|
||||||
childTable->setTableSet(childTableSet);
|
childTable->setTableSet(childTableSet);
|
||||||
|
childTable->clear();
|
||||||
childTableSet->add(childTable);
|
childTableSet->add(childTable);
|
||||||
}
|
}
|
||||||
lastPkValue = q.value(pk);
|
lastPkValue = q.value(pk);
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,11 @@ void Table::propertyChanged(QString propName)
|
||||||
_status = Added;
|
_status = Added;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Table::clear()
|
||||||
|
{
|
||||||
|
_changedProperties.clear();
|
||||||
|
}
|
||||||
|
|
||||||
QSet<QString> Table::changedProperties() const
|
QSet<QString> Table::changedProperties() const
|
||||||
{
|
{
|
||||||
return _changedProperties;
|
return _changedProperties;
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ private:
|
||||||
TableSetBase *_tableSet;
|
TableSetBase *_tableSet;
|
||||||
|
|
||||||
QSet<TableSetBase*> tableSets;
|
QSet<TableSetBase*> tableSets;
|
||||||
|
void clear();
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
friend class Query;
|
friend class Query;
|
||||||
|
|
|
||||||
|
|
@ -156,13 +156,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//TODO: make FieldPhrase template class
|
|
||||||
//template <typename T>
|
|
||||||
//class FieldPhrase: public WherePhrase{
|
|
||||||
|
|
||||||
//};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Q_OUTOFLINE_TEMPLATE FieldPhrase<T>::FieldPhrase(const char *className, const char *s) : WherePhrase(className, s)
|
Q_OUTOFLINE_TEMPLATE FieldPhrase<T>::FieldPhrase(const char *className, const char *s) : WherePhrase(className, s)
|
||||||
{
|
{
|
||||||
|
|
@ -213,6 +206,8 @@ Q_OUTOFLINE_TEMPLATE WherePhrase FieldPhrase<T>::like(QString pattern)
|
||||||
return WherePhrase(this, PhraseData::Like, pattern);
|
return WherePhrase(this, PhraseData::Like, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Custom types
|
||||||
template<>
|
template<>
|
||||||
class FieldPhrase<DbGeography>: public WherePhrase {
|
class FieldPhrase<DbGeography>: public WherePhrase {
|
||||||
public:
|
public:
|
||||||
|
|
@ -225,6 +220,25 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
class FieldPhrase<bool>: public WherePhrase{
|
||||||
|
public:
|
||||||
|
FieldPhrase(const char *className, const char* s) : WherePhrase(className, s){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
WherePhrase operator ==(const bool &other) {
|
||||||
|
return WherePhrase(this, PhraseData::Equal, other ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
WherePhrase operator =(const bool &other) {
|
||||||
|
return WherePhrase(this, PhraseData::Set, other ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
WherePhrase operator !() {
|
||||||
|
return WherePhrase(this, PhraseData::Equal, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
NUT_END_NAMESPACE
|
NUT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue