shared: sqlitesearch: reformat - no functional change
This commit is contained in:
parent
a6f73d724a
commit
344eaa402e
@ -37,7 +37,6 @@ QString SqliteSearch::fieldToColumn(QueryField field)
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
QString SqliteSearch::createSortSql(const QVector<SortCondition> sortConditions)
|
||||
{
|
||||
QString sortsql;
|
||||
@ -69,7 +68,7 @@ QString SqliteSearch::createSortSql(const QVector<SortCondition> sortConditions)
|
||||
|
||||
QPair<QString, QVector<QString>> createNonArgPair(QString key)
|
||||
{
|
||||
return { " " + key + " ", QVector<QString>() };
|
||||
return {" " + key + " ", QVector<QString>()};
|
||||
}
|
||||
|
||||
QPair<QString, QVector<QString>> SqliteSearch::createSql(const Token &token)
|
||||
@ -100,23 +99,24 @@ QPair<QString, QVector<QString>> SqliteSearch::createSql(const Token &token)
|
||||
}
|
||||
if(token.type == FILTER_PATH_STARTS)
|
||||
{
|
||||
return { " file.path LIKE ? || '%' ", { value } };
|
||||
return {" file.path LIKE ? || '%' ", {value}};
|
||||
}
|
||||
if(token.type == FILTER_PATH_ENDS)
|
||||
{
|
||||
return { " file.path LIKE '%' || ? ", { value } };
|
||||
return {" file.path LIKE '%' || ? ", {value}};
|
||||
}
|
||||
if(token.type == FILTER_PATH_CONTAINS)
|
||||
{
|
||||
return { " file.path LIKE '%' || ? || '%' ", { value } } ;
|
||||
return {" file.path LIKE '%' || ? || '%' ", {value}};
|
||||
}
|
||||
if(token.type == FILTER_CONTENT_PAGE)
|
||||
{
|
||||
return { " content.page = ?", { value } };
|
||||
return {" content.page = ?", {value}};
|
||||
}
|
||||
if(token.type == FILTER_CONTENT_CONTAINS)
|
||||
{
|
||||
return { " content.id IN (SELECT content_fts.ROWID FROM content_fts WHERE content_fts.content MATCH ?) " , { value } };
|
||||
return {" content.id IN (SELECT content_fts.ROWID FROM content_fts WHERE content_fts.content MATCH ?) ",
|
||||
{value}};
|
||||
}
|
||||
throw QSSGeneralException("Unknown token passed (should not happen)");
|
||||
}
|
||||
@ -146,7 +146,10 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
|
||||
{
|
||||
sortSql = "ORDER BY file.mtime DESC, content.page ASC";
|
||||
}
|
||||
prepSql = "SELECT file.path AS path, group_concat(content.page) AS pages, file.mtime AS mtime, file.size AS size, file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid WHERE 1=1 AND " + whereSql + " GROUP BY file.path " + sortSql;
|
||||
prepSql =
|
||||
"SELECT file.path AS path, group_concat(content.page) AS pages, file.mtime AS mtime, file.size AS size, "
|
||||
"file.filetype AS filetype FROM file INNER JOIN content ON file.id = content.fileid WHERE 1=1 AND " +
|
||||
whereSql + " GROUP BY file.path " + sortSql;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -154,7 +157,9 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
|
||||
{
|
||||
sortSql = "ORDER BY file.mtime DESC";
|
||||
}
|
||||
prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS filetype FROM file WHERE 1=1 AND " + whereSql + " " + sortSql;
|
||||
prepSql = "SELECT file.path AS path, '0' as pages, file.mtime AS mtime, file.size AS size, file.filetype AS "
|
||||
"filetype FROM file WHERE 1=1 AND " +
|
||||
whereSql + " " + sortSql;
|
||||
}
|
||||
|
||||
QSqlQuery dbquery(*db);
|
||||
@ -169,8 +174,6 @@ QSqlQuery SqliteSearch::makeSqlQuery(const QSSQuery &query)
|
||||
return dbquery;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QVector<SearchResult> SqliteSearch::search(const QSSQuery &query)
|
||||
{
|
||||
QVector<SearchResult> results;
|
||||
|
Loading…
Reference in New Issue
Block a user