commit 6f06d916641d380afed76780c215ced9d55988e9 parent ee19d90cedc7c9b6a793d5b64dfd87dfdaf15768 Author: JohnMcPMS <johnmcp@microsoft.com> Date: Wed, 11 Mar 2020 21:34:25 -0700 Fix missed change for incoming search; use substring for now (#52) Diffstat:
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp b/src/AppInstallerCLICore/Workflows/WorkflowBase.cpp @@ -27,7 +27,7 @@ namespace AppInstaller::Workflow OpenIndexSource(); // Construct query - MatchType matchType = MatchType::Fuzzy; + MatchType matchType = MatchType::Substring; if (m_argsRef.Contains(ExecutionArgs::Type::Exact)) { matchType = MatchType::Exact; diff --git a/src/AppInstallerRepositoryCore/Microsoft/Schema/1_0/SearchResultsTable.cpp b/src/AppInstallerRepositoryCore/Microsoft/Schema/1_0/SearchResultsTable.cpp @@ -153,6 +153,7 @@ namespace AppInstaller::Repository::Microsoft::Schema::V1_0 SQLite::Statement statement = builder.Prepare(m_connection); ExecuteStatementForMatchType(statement, match, bindIndex, MatchUsesLike(match), value); + AICLI_LOG(Repo, Verbose, << "Search found " << m_connection.GetChanges() << " rows"); } void SearchResultsTable::RemoveDuplicateManifestRows() @@ -175,6 +176,7 @@ namespace AppInstaller::Repository::Microsoft::Schema::V1_0 EndParenthetical(); builder.Execute(m_connection); + AICLI_LOG(Repo, Verbose, << "Removed " << m_connection.GetChanges() << " duplicate rows"); } void SearchResultsTable::PrepareToFilter() @@ -209,6 +211,7 @@ namespace AppInstaller::Repository::Microsoft::Schema::V1_0 SQLite::Statement statement = builder.Prepare(m_connection); ExecuteStatementForMatchType(statement, match, bindIndex, MatchUsesLike(match), value); + AICLI_LOG(Repo, Verbose, << "Filter kept " << m_connection.GetChanges() << " rows"); } void SearchResultsTable::CompleteFilter() @@ -218,6 +221,7 @@ namespace AppInstaller::Repository::Microsoft::Schema::V1_0 builder.DeleteFrom(GetQualifiedName()).Where(s_SearchResultsTable_Filter).Equals(false); builder.Execute(m_connection); + AICLI_LOG(Repo, Verbose, << "Filter deleted " << m_connection.GetChanges() << " rows"); } std::vector<std::pair<SQLite::rowid_t, ApplicationMatchFilter>> SearchResultsTable::GetSearchResults(size_t limit) diff --git a/src/AppInstallerRepositoryCore/SQLiteWrapper.cpp b/src/AppInstallerRepositoryCore/SQLiteWrapper.cpp @@ -105,11 +105,16 @@ namespace AppInstaller::Repository::SQLite return result; } - int64_t Connection::GetLastInsertRowID() + rowid_t Connection::GetLastInsertRowID() { return sqlite3_last_insert_rowid(m_dbconn.get()); } + int Connection::GetChanges() + { + return sqlite3_changes(m_dbconn.get()); + } + Statement::Statement(Connection& connection, std::string_view sql, bool persistent) { m_id = GetNextStatementId(); diff --git a/src/AppInstallerRepositoryCore/SQLiteWrapper.h b/src/AppInstallerRepositoryCore/SQLiteWrapper.h @@ -135,7 +135,11 @@ namespace AppInstaller::Repository::SQLite ~Connection() = default; - int64_t GetLastInsertRowID(); + // Gets the last inerted rowid to the database. + rowid_t GetLastInsertRowID(); + + // Gets the count of changed rows for the last executed statement. + int GetChanges(); operator sqlite3* () const { return m_dbconn.get(); }