File: queryexecutorwrapdistinctresults.h

package info (click to toggle)
sqlitestudio 3.4.21%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,880 kB
  • sloc: ansic: 406,208; cpp: 123,872; yacc: 2,692; tcl: 497; sh: 462; xml: 426; makefile: 19
file content (33 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef QUERYEXECUTORWRAPDISTINCTRESULTS_H
#define QUERYEXECUTORWRAPDISTINCTRESULTS_H

#include "queryexecutorstep.h"

/**
 * @brief The QueryExecutorWrapDistinctResults class
 *
 * This step is necessary for DISTINCT and GROUP BY selects,
 * because result columns are always limited by substr() function,
 * which makes INT and TEXT types of data to be the same, which is false.
 * For those cases, we need to put DISTINCT/GROUP BY into subselect,
 * so it works on original result columns, then get the substr() from them.
 *
 * Processed query is stored in QueryExecutor::Context::processedQuery.
 */
class QueryExecutorWrapDistinctResults : public QueryExecutorStep
{
        Q_OBJECT
    public:
        bool exec();

    private:
        /**
         * @brief Wraps single SELECT statement.
         * @param select SELECT to wrap.
         *
         * Puts given \p select as subselect of a new SELECT.
         */
        void wrapSelect(SqliteSelect* select);
};

#endif // QUERYEXECUTORWRAPDISTINCTRESULTS_H