Changeset View
Changeset View
Standalone View
Standalone View
src/resultset.cpp
| Show All 22 Lines | |||||
| 23 | 23 | | |||
| 24 | // Qt | 24 | // Qt | ||
| 25 | #include <QSqlQuery> | 25 | #include <QSqlQuery> | ||
| 26 | #include <QSqlError> | 26 | #include <QSqlError> | ||
| 27 | #include <QCoreApplication> | 27 | #include <QCoreApplication> | ||
| 28 | 28 | | |||
| 29 | // Local | 29 | // Local | ||
| 30 | #include <common/database/Database.h> | 30 | #include <common/database/Database.h> | ||
| 31 | #include <common/specialvalues.h> | ||||
| 31 | #include <utils/debug_and_return.h> | 32 | #include <utils/debug_and_return.h> | ||
| 32 | #include <utils/qsqlquery_iterator.h> | 33 | #include <utils/qsqlquery_iterator.h> | ||
| 33 | #include "kactivities-stats-logsettings.h" | 34 | #include "kactivities-stats-logsettings.h" | ||
| 34 | 35 | | |||
| 35 | // Boost and STL | 36 | // Boost and STL | ||
| 36 | #include <boost/range/algorithm/transform.hpp> | 37 | #include <boost/range/algorithm/transform.hpp> | ||
| 37 | #include <iterator> | 38 | #include <iterator> | ||
| 38 | #include <functional> | 39 | #include <functional> | ||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | 117 | public: | |||
| 170 | { | 171 | { | ||
| 171 | if (urlFilter == QLatin1String("*")) return QStringLiteral("1"); | 172 | if (urlFilter == QLatin1String("*")) return QStringLiteral("1"); | ||
| 172 | 173 | | |||
| 173 | return QStringLiteral("resource LIKE '") + Common::starPatternToLike(urlFilter) + QStringLiteral("' ESCAPE '\\'"); | 174 | return QStringLiteral("resource LIKE '") + Common::starPatternToLike(urlFilter) + QStringLiteral("' ESCAPE '\\'"); | ||
| 174 | } | 175 | } | ||
| 175 | 176 | | |||
| 176 | QString mimetypeClause(const QString &mimetype) const | 177 | QString mimetypeClause(const QString &mimetype) const | ||
| 177 | { | 178 | { | ||
| 178 | if (mimetype == QLatin1String(":any") || mimetype == QLatin1String("*")) return QStringLiteral("1"); | 179 | if (mimetype == ANY_TYPE_TAG || mimetype == QLatin1String("*")) return QStringLiteral("1"); | ||
| 180 | | ||||
| 181 | else if (mimetype == FILES_TYPE_TAG) return QStringLiteral("mimetype != 'inode/directory' AND mimetype != ''"); | ||||
| 182 | else if (mimetype == DIRECTORIES_TYPE_TAG) return QStringLiteral("mimetype = 'inode/directory'"); | ||||
| 179 | 183 | | |||
| 180 | return QStringLiteral("mimetype LIKE '") + Common::starPatternToLike(mimetype) + QStringLiteral("' ESCAPE '\\'"); | 184 | return QStringLiteral("mimetype LIKE '") + Common::starPatternToLike(mimetype) + QStringLiteral("' ESCAPE '\\'"); | ||
| 181 | } | 185 | } | ||
| 182 | 186 | | |||
| 183 | QString dateClause(QDate start, QDate end) const { | 187 | QString dateClause(QDate start, QDate end) const { | ||
| 184 | if (end.isNull()) { | 188 | if (end.isNull()) { | ||
| 185 | // only date filtering | 189 | // only date filtering | ||
| 186 | return QStringLiteral("DATE(re.start, 'unixepoch') = '") + | 190 | return QStringLiteral("DATE(re.start, 'unixepoch') = '") + | ||
| ▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines | |||||