HomePhabricator
Diffusion Comm 725ce1367367

[native] Add SQLiteQueryExecutor code for inserting into the search table

Description

[native] Add SQLiteQueryExecutor code for inserting into the search table

Summary:
issue: ENG-8642
Usage of SQLiteStatementWrapper, bindStringToSQL, bindResult, sqlite3_step based on rekeyAllEntities
The UPDATE case is for edits - we want to update the entry for the original message. We want original_message_id to always point at the oldest message, message_id to point at the newest edit, and`processed_content` to be the content of the newest edit.
original_message_id == message_id means that the message is the original message, not an edit.

Test Plan:
Added the following code at the end of updateMessageSearchResult, and verified that a non zero count if found after calling the function.

std::string query =
  "SELECT * FROM message_search";

comm::SQLiteStatementWrapper preparedSQL1(
    db,
    query,
    "Failed to fetch from search");
int count  = 0;
for (int stepResult = sqlite3_step(preparedSQL1); stepResult == SQLITE_ROW;
    stepResult = sqlite3_step(preparedSQL1)) {
  count++;
}
Logger::log("message search row count: "+ std::to_string(count));

Update tested with tests while developing search query

Reviewers: tomek, marcin, kamil

Reviewed By: tomek, kamil

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D12778

Details

Provenance
inkaAuthored on Jul 16 2024, 7:44 AM
Reviewer
tomek
Differential Revision
D12778: [native] Add SQLiteQueryExecutor code for inserting into the search table
Parents
rCOMMb6f1abd14fe2: [native](web) Add message_search fts5 table
Branches
Unknown
Tags
Unknown