Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4efa3afe

Von Christian Ehringfeld vor mehr als 8 Jahren hinzugefügt

  • ID 4efa3afe6465870cf8732e1f840bffeac921460a
  • Vorgänger ea09b5be
  • Nachfolger 87739ae0

bugfix

Unterschiede anzeigen:

src/querybuilder.cpp
QVariant pk = attributes.value(primaryKey);
attributes.remove(primaryKey);
QSqlQuery q = this->database->getQuery("UPDATE " + this->schema->quoteTableName(
tableName) + " SET " + this->attributes(attributes) + " " + this->whereKeyword()
tableName) + " SET " + this->attributes(attributes,
false) + " " + this->whereKeyword()
+ " " +
this->schema->quoteColumnName(primaryKey) + " = " + this->placeHolder(
primaryKey) + ";");
......
if (m.size() == 0 || (ignoreID && m.contains(primaryKey) && m.size() == 1)) {
return "";
}
return (withKeyword ? " WHERE " : "") + this->attributes(m, conjunction,
return (withKeyword ? " WHERE " : "") + this->attributes(m, true, conjunction,
ignoreID, primaryKey);
}
QString QueryBuilder::attributes(const QHash<QString, QVariant> &m,
QString QueryBuilder::attributes(const QHash<QString, QVariant> &m, bool select,
const QString &conjunction,
bool ignoreID, const QString &primaryKey) const {
QString rc = "";
......
if (!rc.isEmpty()) {
rc += " " + conjunction + " ";
}
rc += this->schema->quoteColumnName(i.key()) + (i.value().isNull() ? " is null"
rc += this->schema->quoteColumnName(i.key()) + (i.value().isNull()
&& select ? " is null"
: "=" + this->placeHolder(i.key()));
}
}

Auch abrufbar als: Unified diff