Revision 5b49a450
Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt
example/main.cpp | ||
---|---|---|
auto ep = a.dynamicCast<CuteEntityManager::Entity>();
|
||
qDebug() << "Tabelle artikel erstellt:" << e->createTable(ep);
|
||
e->create(ep);
|
||
qDebug() << "TEST12345678990";
|
||
auto artikel = e->findById<Artikel *>(1);
|
||
qDebug() << "ArtikelID:" << artikel.data()->getId();
|
||
// QSharedPointer<CuteEntityManager::Entity> p = QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann", Person::MALE, "", "", "",
|
src/relation.h | ||
---|---|---|
enum RelationType {
|
||
ONE_TO_ONE, //e.g. specialization, heritage
|
||
ONE_TO_MANY, //@OneToMany(cascade=ALL, mappedBy="customer")
|
||
MANY_TO_ONE, //1-n Entity foreign key in same table
|
||
MANY_TO_ONE,
|
||
//1-n Entity foreign key in same table
|
||
MANY_TO_MANY,
|
||
};
|
||
|
src/schema.cpp | ||
---|---|---|
}
|
||
|
||
QString Schema::quoteSimpleTableName(QString name) {
|
||
return name.indexOf("`") ? name : "`" + name + "`";
|
||
return name.indexOf("`") != -1 ? name : "`" + name + "`";
|
||
}
|
||
|
||
QString Schema::quoteTableName(QString name) {
|
||
if (name.indexOf("(") || name.indexOf("{{")) {
|
||
if (name.indexOf("(") != -1 || name.indexOf("{{") != -1) {
|
||
return name;
|
||
}
|
||
if (name.indexOf(".") == -1) {
|
||
... | ... | |
}
|
||
|
||
QString Schema::quoteColumnName(QString name) {
|
||
if (name.indexOf("(") || name.indexOf("[[") || name.indexOf("{{")) {
|
||
if (name.indexOf("(") != -1 || name.indexOf("[[") != -1 || name.indexOf("{{") != -1) {
|
||
return name;
|
||
}
|
||
int pos = name.indexOf(".");
|
||
QString prefix = "";
|
||
if (pos) {
|
||
if (pos != -1 ) {
|
||
prefix = this->quoteTableName(name.mid(0, pos)) + ".";
|
||
name = name.mid(pos + 1);
|
||
}
|
||
... | ... | |
}
|
||
|
||
QString Schema::quoteSimpleColumnName(QString name) {
|
||
return name.indexOf("`") || name == "*" ? name : "`" + name + "`";
|
||
return name.indexOf("`") != -1 || name == "*" ? name : "`" + name + "`";
|
||
}
|
||
|
||
QHash<QString, QSharedPointer<TableSchema> > Schema::getTableSchemas(
|
Auch abrufbar als: Unified diff
fix