Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 67aa0d3f

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 67aa0d3fcf523cc64b04585e2151dc3e8a107b89
  • Vorgänger 9fccde32
  • Nachfolger 19cf5548

clean up

Unterschiede anzeigen:

src/database.h
void startTransaction();
bool commitTransaction();
bool rollbackTransaction();
static DatabaseType getDatabaseType(QString s);
static QSharedPointer<Schema> getSchema(DatabaseType db,
QSharedPointer<Database> database);
};
}
#endif // DATABASE_H
src/databasemigration.cpp
using namespace CuteEntityManager;
DatabaseMigration::DatabaseMigration() : Entity() {
}
DatabaseMigration::DatabaseMigration(QString version,
src/entityhelper.cpp
using namespace CuteEntityManager;
EntityHelper::EntityHelper() {
}
const QHash<QString, Relation> EntityHelper::getNonInheritedRelations(
const Entity *entity) {
auto relations = entity->getRelations();
......
return relations;
}
const QList<const QMetaObject *> EntityHelper::superClasses(
const Entity *entity, bool
stopAtSingleTableInheritance) {
......
auto list = EntityInstanceFactory::castQVariantList(var);
for (int i = 0; i < list.size(); ++i) {
auto e = list.at(i);
if(e->getId() == remove->getId()) {
if (e->getId() == remove->getId()) {
list.removeAt(i);
EntityHelper::setListProperty(entity, list, property);
break;
src/entityhelper.h
static void addEntityToListProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> add, const QMetaProperty &property);
static void removeEntityFromListProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> remove, const QMetaProperty &property);
QSharedPointer<Entity> remove, const QMetaProperty &property);
static void setListProperty(const QSharedPointer<Entity> &entity,
QList<QSharedPointer<Entity>> &list,
const QMetaProperty &property);
......
const QString property);
static QMetaProperty mappedProperty(const Relation &r,
const QSharedPointer<Entity> &foreignEntity);
static QHash<QString, QVariant> getEntityAttributes(const QHash<QString, QMetaProperty>
static QHash<QString, QVariant> getEntityAttributes(const
QHash<QString, QMetaProperty>
&props,
const QSharedPointer<Entity> &entity);
};
src/entityinstancefactory.cpp
QHash<QByteArray, EntityInstanceFactory::Constructor>();
EntityInstanceFactory::EntityInstanceFactory() {
}
Entity *EntityInstanceFactory::createInstance(const char *className) {
src/entityinstancefactory.h
//http://www.mimec.org/node/350
template<typename T>
static void registerClass() {
EntityInstanceFactory::instance.insert( T::staticMetaObject.className(), &constructorHelper<T> );
EntityInstanceFactory::instance.insert( T::staticMetaObject.className(),
&constructorHelper<T> );
QString lName = "QList<QSharedPointer<";
lName.append(T::staticMetaObject.className());
lName.append(">>");
src/entitymanager.h
QList<QHash<QString, QVariant> > selectBySql(const QString &sql);
qint8 count(Query &query);
public:
public:
EntityManager(QSqlDatabase database);
EntityManager(const QString &databaseType, QString databasename = "" ,
src/expression.h
class Expression {
public:
Expression();
explicit Expression(QString expression,QHash<QString, QVariant> params = QHash<QString, QVariant>(),
bool onlyColumn = false);
explicit Expression(QString expression,
QHash<QString, QVariant> params = QHash<QString, QVariant>(),
bool onlyColumn = false);
explicit Expression(QString expression, bool onlyColumn);
QString getExpression() const;
void setExpression(const QString &value);
......
QHash<QString, QVariant> getParams() const;
void setParams(const QHash<QString, QVariant> &value);
private:
private:
QString expression;
QHash<QString, QVariant> params;
bool onlyColumn;
src/join.cpp
#include "join.h"
using namespace CuteEntityManager;
Join::Join() {
}
Join::Join(QString foreignTable, QString expression, QString type) {
src/querybuilder.cpp
Expression QueryBuilder::like(QString column, QVariant value,
JokerPosition jp, QChar wildcard) {
return this->arbitraryOperator(this->likeKeyword(), column,
this->addWildcard(value, jp, wildcard));
this->addWildcard(value, jp, wildcard));
}
Expression QueryBuilder::like(QHash<QString, QVariant> conditions,
src/querybuilder.h
* @param conjunction its AND or OR
*/
Expression where(QHash<QString, QVariant> conditions,
QString conjunction = "AND");
QString conjunction = "AND");
Expression where(QString condition,
QHash<QString, QVariant> values = QHash<QString, QVariant>());
QHash<QString, QVariant> values = QHash<QString, QVariant>());
//void where(Query &query,QHash<QString, QList<QVariant>> conditions, QString concat="AND");
Expression between(QString column, QVariant firstValue,
QVariant secondValue);
QVariant secondValue);
Expression notBetween(QString column, QVariant firstValue,
QVariant secondValue);
QVariant secondValue);
Expression in(QString column, QList<QVariant> values);
Expression notIn(QString column, QList<QVariant> values);
Expression notOperator(QString column, QVariant value);
Expression orOperator(QHash<QString, QVariant> conditions,
bool like = false);
bool like = false);
Expression andOperator(QHash<QString, QVariant> conditions);
/**
* @brief arbitraryOperator
......
* @param value
*/
Expression arbitraryOperator(QString op, QString column,
QVariant value);
QVariant value);
Expression isNull(QString column);
Expression isNotNull(QString column);
......
* @param value
*/
Expression like(QString column, QVariant value,
JokerPosition jp = JokerPosition::BOTH, QChar wildcard = '%');
JokerPosition jp = JokerPosition::BOTH, QChar wildcard = '%');
/**
* @brief like
* @param condition
* @param concat
*/
Expression like(QHash<QString, QVariant> conditions,
QString conjunction = "AND",
JokerPosition jp = JokerPosition::BOTH, QChar wildcard = '%');
QString conjunction = "AND",
JokerPosition jp = JokerPosition::BOTH, QChar wildcard = '%');
QStringList quoteTableNames(const QStringList &tables);
QString getSeparator() const;
......
const QString &primaryKey = "id") const;
QList<QSqlQuery> createOrMerge(const QSharedPointer<Entity> &entity,
bool insert) const;
virtual QString limit(const quint64 &limit, const quint64 &offset, bool withSpace=true) const;
virtual QString limit(const quint64 &limit, const quint64 &offset,
bool withSpace = true) const;
QString generateIndexName(const QString &name, const QString &table,
const QString &refColumn, const QString &refTable, const bool fk) const;
QString generateColumnNameID(QString name) const;
......
virtual QString whereKeyword() const;
virtual QString countKeyword() const;
virtual Expression inFunction(QString column, QList<QVariant> values,
bool notOp = false);
bool notOp = false);
virtual QString between(QString colName, QString valName1, QString valName2,
bool notOp = false);
virtual QString likeKeyword() const;
......
virtual QString offsetKeyword() const;
QString appendNot(bool notOp);
virtual Expression appendCondition(QString ph1, QString ph2, QVariant val1,
QVariant val2, QString condition);
QVariant val2, QString condition);
QString entityClassname() const;
QString separator;
QSharedPointer<Schema> schema;
src/tableschema.cpp
using namespace CuteEntityManager;
TableSchema::TableSchema() {
}
TableSchema::~TableSchema() {
}
const QSharedPointer<QSqlField> TableSchema::getColumn(QString name) const {

Auch abrufbar als: Unified diff