This differential refactors all remove queries not to use ORM.
Details
- Reviewers
kamil michal - Commits
- rCOMMc3e6f54bffbe: Refactor all remove queries not to use ORM
Execute tests in https://phab.comm.dev/D10711. Remove queries are covered there.
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp | ||
---|---|---|
1114–1125 | you can call executeQuery and use something like this: UPDATE OR REPLACE drafts SET key = $newKey, text = (SELECT text FROM drafts WHERE key = $oldKey) WHERE key = $oldKey | |
1117 | length() seems more natural | |
1220 | we can define it below, under if statement | |
native/cpp/CommonCpp/DatabaseManagers/entities/EntityQueryHelpers.h | ||
139–147 | I think you can do something like this | |
145 | I think it's better to allow the caller to add ; - it could be confusing because array is not always the last part of SQL query |
native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp | ||
---|---|---|
1114–1125 | I am hesitant about this. It would be hard to write a template function that could handle a query like this for any table. Additionally from you comment: https://phab.comm.dev/D10707#inline-65624 I assume that you didn't want to write such query for message table since it would be unnecessarily complicated. I think we don't have to force ourselves to write SQL query for everything just because we are removing ORM. I think it is fine to use a sequence of calls to SQLiteQueryExecutor methods. If you disagree the request changes and I will replace this with single query. | |
1117 | The convention across our C++ code is to use size() when checking for an empty string. | |
native/cpp/CommonCpp/DatabaseManagers/entities/EntityQueryHelpers.h | ||
139–147 | We can't - such constructor doesn't exist: https://en.cppreference.com/w/cpp/string/basic_string/basic_string |
- Refactor getSQLStatementArray function not to end statement
- Move moveDraft and rekeyMessage refactor one diff up.
native/cpp/CommonCpp/DatabaseManagers/entities/EntityQueryHelpers.h | ||
---|---|---|
139–147 | ahh right |