mirror of https://github.com/qt/qtbase.git
QSqlTableMode::selectRow(): lack of WHERE clause is an error
Since we only want one row, never ever run a SELECT without a WHERE clause. Change-Id: I40a78935f5573111faa3922eae97e6d5961be5f2 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
3c2733e45f
commit
7b95df2da0
|
@ -427,10 +427,18 @@ bool QSqlTableModel::selectRow(int row)
|
|||
static const QString wh = Sql::where() + Sql::sp();
|
||||
if (d->filter.startsWith(wh, Qt::CaseInsensitive))
|
||||
d->filter.remove(0, wh.length());
|
||||
const QString stmt = selectStatement();
|
||||
|
||||
QString stmt;
|
||||
|
||||
if (!d->filter.isEmpty())
|
||||
stmt = selectStatement();
|
||||
|
||||
d->sortColumn = table_sort_col;
|
||||
d->filter = table_filter;
|
||||
|
||||
if (stmt.isEmpty())
|
||||
return false;
|
||||
|
||||
{
|
||||
QSqlQuery q(d->db);
|
||||
q.setForwardOnly(true);
|
||||
|
|
Loading…
Reference in New Issue