forked from qt-creator/qt-creator
Sqlite: Add condition to index
Change-Id: I83851b2f9cd516f21bc7e8987c1b60efaa019bb1 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -43,14 +43,16 @@ enum class IndexType
|
||||
class Index
|
||||
{
|
||||
public:
|
||||
Index(Utils::SmallString &&tableName,
|
||||
Index(Utils::SmallStringView tableName,
|
||||
Utils::SmallStringVector &&columnNames,
|
||||
IndexType indexType=IndexType::Normal)
|
||||
: m_tableName(std::move(tableName)),
|
||||
m_columnNames(std::move(columnNames)),
|
||||
m_indexType(indexType)
|
||||
{
|
||||
}
|
||||
IndexType indexType = IndexType::Normal,
|
||||
Utils::SmallStringView condition = {})
|
||||
: m_tableName(std::move(tableName))
|
||||
, m_columnNames(std::move(columnNames))
|
||||
, m_indexType(indexType)
|
||||
, m_condition{condition}
|
||||
|
||||
{}
|
||||
|
||||
Utils::SmallString sqlStatement() const
|
||||
{
|
||||
@@ -67,7 +69,9 @@ public:
|
||||
m_tableName,
|
||||
"(",
|
||||
m_columnNames.join(", "),
|
||||
")"});
|
||||
")",
|
||||
m_condition.hasContent() ? " WHERE " : "",
|
||||
m_condition});
|
||||
}
|
||||
|
||||
void checkTableName() const
|
||||
@@ -86,6 +90,7 @@ private:
|
||||
Utils::SmallString m_tableName;
|
||||
Utils::SmallStringVector m_columnNames;
|
||||
IndexType m_indexType;
|
||||
Utils::SmallString m_condition;
|
||||
};
|
||||
|
||||
using SqliteIndices = std::vector<Index>;
|
||||
|
||||
Reference in New Issue
Block a user