QtSql: eradicate remaining Q_FOREACH loops
Change-Id: I86afe7104d506b840130517ae8066588fab2d745 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>bb10
parent
88e043a8bd
commit
6f7a5b0ecf
|
|
@ -661,9 +661,8 @@ void QSQLiteDriver::close()
|
|||
{
|
||||
Q_D(QSQLiteDriver);
|
||||
if (isOpen()) {
|
||||
foreach (QSQLiteResult *result, d->results) {
|
||||
for (QSQLiteResult *result : qAsConst(d->results))
|
||||
result->d_func()->finalize();
|
||||
}
|
||||
|
||||
if (sqlite3_close(d->access) != SQLITE_OK)
|
||||
setLastError(qMakeError(d->access, tr("Error closing database"),
|
||||
|
|
|
|||
|
|
@ -709,8 +709,8 @@ void QSqlResult::bindValue(const QString& placeholder, const QVariant& val,
|
|||
d->binds = NamedBinding;
|
||||
// if the index has already been set when doing emulated named
|
||||
// bindings - don't reset it
|
||||
QList<int> indexes = d->indexes.value(placeholder);
|
||||
foreach (int idx, indexes) {
|
||||
const QList<int> indexes = d->indexes.value(placeholder);
|
||||
for (int idx : indexes) {
|
||||
if (d->values.count() <= idx)
|
||||
d->values.resize(idx + 1);
|
||||
d->values[idx] = val;
|
||||
|
|
|
|||
|
|
@ -736,7 +736,8 @@ bool QSqlTableModel::submitAll()
|
|||
|
||||
bool success = true;
|
||||
|
||||
foreach (int row, d->cache.keys()) {
|
||||
const auto cachedKeys = d->cache.keys();
|
||||
for (int row : cachedKeys) {
|
||||
// be sure cache *still* contains the row since overridden selectRow() could have called select()
|
||||
QSqlTableModelPrivate::CacheMap::iterator it = d->cache.find(row);
|
||||
if (it == d->cache.end())
|
||||
|
|
|
|||
Loading…
Reference in New Issue