mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-08 04:49:58 -05:00
SqliteTableModel: Don't add LIMIT to query if it is a PRAGMA or EXPLAIN
Don't add a "LIMIT x,y" at the end of the query in fetchData() when it is a PRAGMA or EXPLAIN statement. This way correct SQL code is produced and it also fixes an endless loop when the statement didn't end in a semicolon.
This commit is contained in:
@@ -285,7 +285,11 @@ void SqliteTableModel::fetchData(unsigned int from, unsigned to)
|
|||||||
{
|
{
|
||||||
int currentsize = m_data.size();
|
int currentsize = m_data.size();
|
||||||
|
|
||||||
QString sLimitQuery = QString("%1 LIMIT %2, %3;").arg(m_sQuery).arg(from).arg(to-from);
|
QString sLimitQuery;
|
||||||
|
if(m_sQuery.startsWith("PRAGMA", Qt::CaseInsensitive) || m_sQuery.startsWith("EXPLAIN", Qt::CaseInsensitive))
|
||||||
|
sLimitQuery = m_sQuery;
|
||||||
|
else
|
||||||
|
sLimitQuery = QString("%1 LIMIT %2, %3;").arg(m_sQuery).arg(from).arg(to-from);
|
||||||
m_db->logSQL(sLimitQuery, kLogMsg_App);
|
m_db->logSQL(sLimitQuery, kLogMsg_App);
|
||||||
QByteArray utf8Query = sLimitQuery.toUtf8();
|
QByteArray utf8Query = sLimitQuery.toUtf8();
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
|
|||||||
Reference in New Issue
Block a user