1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include "queryexecutorcountresults.h"
#include "parser/ast/sqlitequery.h"
#include "db/queryexecutor.h"
#include <math.h>
#include <QDebug>
bool QueryExecutorCountResults::exec()
{
SqliteSelectPtr select = getSelect();
if (!select || select->explain)
{
// No return rows, but we're good to go.
// Pragma and Explain statements use "rows affected" for number of rows.
return true;
}
QString countSql = "SELECT count(*) AS cnt FROM ("+select->detokenize()+");";
context->countingQuery = countSql;
// qDebug() << "count sql:" << countSql;
return true;
}
|