summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2011-02-18 02:16:04 (GMT)
committerMichael Goddard <michael.goddard@nokia.com>2011-02-18 04:05:38 (GMT)
commit346af37b7bc8d97ae4cc24b0a1cfe9cf4802057b (patch)
treedd32ff5a347ebbe1206ca59d1a953fe55b98290e /src
parentb0822a83a3719ed32f6bf7f78c2ff1ba46837355 (diff)
downloadQt-346af37b7bc8d97ae4cc24b0a1cfe9cf4802057b.zip
Qt-346af37b7bc8d97ae4cc24b0a1cfe9cf4802057b.tar.gz
Qt-346af37b7bc8d97ae4cc24b0a1cfe9cf4802057b.tar.bz2
Fix an issue with removing rows in a table model.
Tables with nulls in a row were not being deleted properly in some cases. Made sure the responsible function no longer has default parameters so this doesn't happen again. Change-Id: I479121172d5ac172ca49da78638b9353d7a67548 Task-number: QTBUG-16007, QTBUG-15979 Reviewed-by: Charles Yin
Diffstat (limited to 'src')
-rw-r--r--src/sql/models/qsqltablemodel.cpp4
-rw-r--r--src/sql/models/qsqltablemodel_p.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 4df1d63..bf7c0aa 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -657,7 +657,7 @@ bool QSqlTableModel::insertRowIntoTable(const QSqlRecord &values)
return false;
}
- return d->exec(stmt, prepStatement, rec);
+ return d->exec(stmt, prepStatement, rec, QSqlRecord() /* no where values */);
}
/*!
@@ -695,7 +695,7 @@ bool QSqlTableModel::deleteRowFromTable(int row)
}
stmt.append(QLatin1Char(' ')).append(where);
- return d->exec(stmt, prepStatement, whereValues);
+ return d->exec(stmt, prepStatement, QSqlRecord() /* no new values */, whereValues);
}
/*!
diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h
index d2b96e6..f4f3811 100644
--- a/src/sql/models/qsqltablemodel_p.h
+++ b/src/sql/models/qsqltablemodel_p.h
@@ -75,7 +75,7 @@ public:
QSqlRecord record(const QVector<QVariant> &values) const;
bool exec(const QString &stmt, bool prepStatement,
- const QSqlRecord &rec, const QSqlRecord &whereValues = QSqlRecord());
+ const QSqlRecord &rec, const QSqlRecord &whereValues);
virtual void revertCachedRow(int row);
void revertInsertedRow();
bool setRecord(int row, const QSqlRecord &record);