Revision ac5cbdcf
Von Christian Ehringfeld vor fast 9 Jahren hinzugefügt
src/entitymanager.h | ||
---|---|---|
*/
|
||
public:
|
||
template<class T> qint8 count(QHash<QString, QString> condition =
|
||
QHash<QString, QString>()) {
|
||
QHash<QString, QVariant>()) {
|
||
Entity *e = EntityInstanceFactory::createInstance<T>();
|
||
qint8 rc = 0;
|
||
if (e) {
|
||
... | ... | |
(EntityInstanceFactory::createInstance<T>());
|
||
if (ptr) {
|
||
auto maps = this->findAll(ptr);
|
||
const char *className = ptr.data()->getClassname();
|
||
return this->convert(maps, className);
|
||
return this->convert(maps, ptr->getClassname());
|
||
}
|
||
return QList<QSharedPointer<Entity>>();
|
||
}
|
||
... | ... | |
}
|
||
|
||
template<class T> QSharedPointer<Entity> findEntityByAttributes(
|
||
const QHash<QString, QString>
|
||
const QHash<QString, QVariant>
|
||
&attributes) {
|
||
auto list = this->findAllEntitiesByAttributes<T>(attributes, 1, 0);
|
||
if (list.isEmpty()) {
|
||
... | ... | |
}
|
||
|
||
template<class T> QList<QSharedPointer<Entity>> findAllEntitiesByAttributes(
|
||
const QHash<QString, QString> &attributes =
|
||
const QHash<QString, QVariant> &attributes =
|
||
QHash<QString, QString>(), quint32 limit = 0, quint32 offset = 0) {
|
||
auto list = this->findAllEntitiesByAttributes<T>(attributes);
|
||
return list;
|
||
QSharedPointer<Entity> e = QSharedPointer<Entity>
|
||
(EntityInstanceFactory::createInstance<T>());
|
||
if (e) {
|
||
auto results = this->findAllByAttributes(attributes, e->getTablename());
|
||
auto list = this->convert(results, e->getClassname());
|
||
return list;
|
||
}
|
||
return QList<QSharedPointer<Entity>>();
|
||
}
|
||
|
||
template<class T> QList<QSharedPointer<Entity>> findEntitiesBySql(
|
Auch abrufbar als: Unified diff
stackoverflow fix in em