Revision 8925defa
Von Christian Ehringfeld vor etwa 10 Jahren hinzugefügt
| src/entityhelper.cpp | ||
|---|---|---|
|
if(newInstance) {
|
||
|
for (int i = 0; i < metaObject->propertyCount(); ++i) {
|
||
|
auto property = metaObject->property(i);
|
||
|
QString name = property.name();
|
||
|
if(property.isValid() && name != QString("objectName") && name !=entity->getPrimaryKey()) {
|
||
|
if(property.isValid() && property.name() != entity->getPrimaryKey()) {
|
||
|
property.write(newInstance,property.read(entity));
|
||
|
}
|
||
|
}
|
||
| src/query.cpp | ||
|---|---|---|
|
*/
|
||
|
|
||
|
#include "query.h"
|
||
|
#include "entity.h"
|
||
|
using namespace CuteEntityManager;
|
||
|
Query::Query() {
|
||
|
}
|
||
| src/query.h | ||
|---|---|---|
|
namespace CuteEntityManager {
|
||
|
class Condition;
|
||
|
class OrderBy;
|
||
|
class Entity;
|
||
|
enum class Direction;
|
||
|
class Query {
|
||
|
public:
|
||
| src/querybuilder.cpp | ||
|---|---|---|
|
if (first) {
|
||
|
first = false;
|
||
|
} else {
|
||
|
s.append(", ");
|
||
|
s += ", ";
|
||
|
}
|
||
|
s.append(this->schema->quoteColumnName(i.key())).append(" " +
|
||
|
this->getColumnType(
|
||
|
i.value()));
|
||
|
s+= this->schema->quoteColumnName(i.key()) + " " + this->getColumnType(i.value());
|
||
|
++i;
|
||
|
}
|
||
|
s.append(");");
|
||
|
s += ");";
|
||
|
return s;
|
||
|
}
|
||
|
|
||
| ... | ... | |
|
const QStringList &columns) const {
|
||
|
QString r = "SELECT ";
|
||
|
if (columns.isEmpty()) {
|
||
|
r.append("*");
|
||
|
r += "*";
|
||
|
} else {
|
||
|
for (int var = 0; var < columns.size(); ++var) {
|
||
|
if (var != 0) {
|
||
|
r.append(" ");
|
||
|
r += " ";
|
||
|
}
|
||
|
r.append(this->schema->quoteColumnName(columns.at(var)));
|
||
|
r += this->schema->quoteColumnName(columns.at(var));
|
||
|
}
|
||
|
}
|
||
|
r.append(" FROM");
|
||
|
r += " " + this->fromKeyword();
|
||
|
for (int var = 0; var < tables.size(); ++var) {
|
||
|
r.append(" ");
|
||
|
r.append(this->schema->quoteTableName(tables.at(var)));
|
||
|
r += " ";
|
||
|
r += this->schema->quoteTableName(tables.at(var));
|
||
|
}
|
||
|
return r;
|
||
|
}
|
||
Auch abrufbar als: Unified diff
...