sqlitemodel: fix select statements with limit/offset using expressions

This commit is contained in:
Peinthor Rene
2014-09-04 19:46:11 +02:00
parent dc3ca09e12
commit 1f6fe11560

View File

@@ -363,7 +363,7 @@ void SqliteTableModel::fetchData(unsigned int from, unsigned to)
QString queryTemp = rtrimChar(m_sQuery, ';');
// If the query ends with a LIMIT statement take it as it is, if not append our own LIMIT part for lazy population
if(queryTemp.contains(QRegExp("LIMIT\\s+\\d+\\s*((,|\\b(OFFSET)\\b)\\s*\\d+\\s*)?$", Qt::CaseInsensitive)))
if(queryTemp.contains(QRegExp("LIMIT\\s+.+\\s*((,|\\b(OFFSET)\\b)\\s*.+\\s*)?$", Qt::CaseInsensitive)))
sLimitQuery = queryTemp;
else
sLimitQuery = QString("%1 LIMIT %2, %3;").arg(queryTemp).arg(from).arg(to-from);