Revision 6d46f506
Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt
src/entitymanager.cpp | ||
---|---|---|
return this->db->exec(query);
|
||
}
|
||
|
||
/**
|
||
* @brief EntityManager::checkTable
|
||
* Checks if a table has been already created, if not it will create it
|
||
* @param entity
|
||
* @return
|
||
*/
|
||
bool EntityManager::checkTable(const QSharedPointer<Entity> &entity) {
|
||
bool rc = true;
|
||
if (!this->schema->containsTable(entity->getTablename())
|
||
... | ... | |
return schema;
|
||
}
|
||
|
||
/**
|
||
* @brief EntityManager::refresh
|
||
* fetches an entity again from the database
|
||
* @param entity
|
||
*/
|
||
void EntityManager::refresh(QSharedPointer<Entity> &entity) {
|
||
entity = this->findById(entity->getProperty(
|
||
entity->getPrimaryKey()).toLongLong(),
|
src/entitymanager.h | ||
---|---|---|
QSharedPointer<Database> getDb() const;
|
||
void setDb(const QSharedPointer<Database> &value);
|
||
QSharedPointer<Schema> getSchema() const;
|
||
/**
|
||
* @brief EntityManager::refresh
|
||
* fetches an entity again from the database
|
||
* @param entity
|
||
*/
|
||
void refresh(QSharedPointer<Entity> &entity);
|
||
void setSchema(const QSharedPointer<Schema> &value);
|
||
QList<QHash<QString, QVariant> > selectByQuery(Query &query);
|
||
... | ... | |
Cache cache;
|
||
QString createConnection();
|
||
QList<QHash<QString, QVariant> > convertQueryResult(QSqlQuery &q);
|
||
/**
|
||
* @brief EntityManager::checkTable
|
||
* Checks if a table has been already created, if not it will create it
|
||
* @param entity
|
||
* @return
|
||
*/
|
||
bool checkTable(const QSharedPointer<Entity> &entity);
|
||
QSharedPointer<QueryInterpreter> queryInterpreter;
|
||
|
src/querybuilder.cpp | ||
---|---|---|
const QSharedPointer<Entity> &entity)
|
||
const {
|
||
auto relations = QHash<QString, QHash<QString, QString>>();
|
||
// QHash<QString, Relation> m = (entity->getInheritanceStrategy() ==
|
||
// InheritanceStrategy::PER_CLASS_TABLE ? entity->getRelations() :
|
||
// EntityHelper::getNonInheritedRelations(entity.data()));
|
||
QHash<QString, Relation> m = entity->getRelations();
|
||
auto props = EntityHelper::getMetaProperties(entity.data());
|
||
for (auto i = m.begin(); i != m.end(); ++i) {
|
||
... | ... | |
return type;
|
||
}
|
||
|
||
/**
|
||
* @brief QueryBuilder::find
|
||
* @param id
|
||
* @param tableName
|
||
* @return
|
||
*/
|
||
QSqlQuery QueryBuilder::find(const qint64 &id, const QString &tableName) const {
|
||
QString pk = "id";
|
||
QSqlQuery q = this->database->getQuery(this->selectBase(QStringList(
|
||
... | ... | |
entity) + this->limit(limit, offset) + ";");
|
||
}
|
||
|
||
/**
|
||
* @brief QueryBuilder::findByAttributes
|
||
* @param m
|
||
* @param tableName
|
||
* @param ignoreID
|
||
* @return
|
||
*/
|
||
QSqlQuery QueryBuilder::findByAttributes(const QHash<QString, QVariant> &m,
|
||
const QString &tableName,
|
||
const bool &ignoreID, const qint64 limit, const qint64 offset) const {
|
Auch abrufbar als: Unified diff
doxy gen stuff