From 829f617ab2d4f240950ce88e9ce97421a2939a74 Mon Sep 17 00:00:00 2001 From: Derick Hawcroft Date: Thu, 5 Nov 2009 10:17:16 +1000 Subject: Check success of query. For example a bogus use of setFilter() might cause a query to fail. Check for this. Reviewed-by: Bill King --- src/sql/models/qsqltablemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index a91dc9f..98f22c8 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -406,7 +406,7 @@ bool QSqlTableModel::select() QSqlQuery qu(query, d->db); setQuery(qu); - if (!qu.isActive()) { + if (!qu.isActive() || lastError().isValid()) { // something went wrong - revert to non-select state d->initRecordAndPrimaryIndex(); return false; -- cgit v0.12