diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2009-09-15 03:12:32 (GMT) |
---|---|---|
committer | Sarah Smith <sarah.j.smith@nokia.com> | 2009-09-15 03:12:32 (GMT) |
commit | 227dd18f0e25ee522e5a4323e849590a314dd4cd (patch) | |
tree | c7712b9b55e4f05bccf77c92edc992c3068ddfb3 /src/sql | |
parent | 02cc6a825227daf6f35f7bc17377a4a622f16391 (diff) | |
parent | d94f6a35202d2d62671072b4ba78e75b07d630bd (diff) | |
download | Qt-227dd18f0e25ee522e5a4323e849590a314dd4cd.zip Qt-227dd18f0e25ee522e5a4323e849590a314dd4cd.tar.gz Qt-227dd18f0e25ee522e5a4323e849590a314dd4cd.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/drivers/ibase/qsql_ibase.cpp | 3 | ||||
-rw-r--r-- | src/sql/models/qsqltablemodel.cpp | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index b0ba8cd..bc425fc 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1296,6 +1296,9 @@ int QIBaseResult::numRowsAffected() case isc_info_sql_stmt_insert: cCountType = isc_info_req_insert_count; break; + default: + qWarning() << "numRowsAffected: Unknown statement type (" << d->queryType << ")"; + return -1; } char acBuffer[33]; diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index eeb250d..df94080 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -559,7 +559,7 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in if (row.op == QSqlTableModelPrivate::None) { row.op = QSqlTableModelPrivate::Update; row.rec = d->rec; - row.primaryValues = d->primaryValues(indexInQuery(index).row()); + row.primaryValues = d->primaryValues(indexInQuery(index).row()); } row.rec.setValue(index.column(), value); emit dataChanged(index, index); @@ -669,7 +669,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) Q_D(QSqlTableModel); emit beforeDelete(row); - QSqlRecord rec = d->primaryValues(row); + const QSqlRecord whereValues = d->strategy == OnManualSubmit ? d->cache[row].primaryValues : d->primaryValues(row); bool prepStatement = d->db.driver()->hasFeature(QSqlDriver::PreparedQueries); QString stmt = d->db.driver()->sqlStatement(QSqlDriver::DeleteStatement, d->tableName, @@ -677,7 +677,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) prepStatement); QString where = d->db.driver()->sqlStatement(QSqlDriver::WhereStatement, d->tableName, - rec, + whereValues, prepStatement); if (stmt.isEmpty() || where.isEmpty()) { @@ -687,7 +687,7 @@ bool QSqlTableModel::deleteRowFromTable(int row) } stmt.append(QLatin1Char(' ')).append(where); - return d->exec(stmt, prepStatement, rec); + return d->exec(stmt, prepStatement, whereValues); } /*! @@ -1099,6 +1099,7 @@ bool QSqlTableModel::removeRows(int row, int count, const QModelIndex &parent) revertRow(idx); else { d->cache[idx].op = QSqlTableModelPrivate::Delete; + d->cache[idx].primaryValues = d->primaryValues(indexInQuery(createIndex(idx, 0)).row()); emit headerDataChanged(Qt::Vertical, idx, idx); } } |