Page MenuHomePhabricator

[native/sqlite] introduce function to set database version
ClosedPublic

Authored by kamil on Oct 17 2022, 5:56 AM.
Tags
None
Referenced Files
F1783213: D5376.diff
Sat, May 18, 10:17 AM
Unknown Object (File)
Fri, May 17, 4:19 PM
Unknown Object (File)
Mon, May 6, 2:39 AM
Unknown Object (File)
Sun, Apr 21, 8:27 AM
Unknown Object (File)
Sun, Apr 21, 8:27 AM
Unknown Object (File)
Sun, Apr 21, 8:26 AM
Unknown Object (File)
Sun, Apr 21, 8:21 AM
Unknown Object (File)
Fri, Apr 19, 11:04 PM

Details

Summary

In the future there will be a need to update database version in different places, that being said extracting logic to separate function.
Additionally, added error handling which will detect if SQL was executed without failure.

Test Plan
  • Check if logged database version is propper (could be compared with user_version visible after connecting to the database).
  • Check if the version is set correctly after migrations (to test eg. logout user, after this version should be set to the highest currently possible).

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil edited the test plan for this revision. (Show Details)
kamil added a reviewer: atul.
kamil edited the summary of this revision. (Show Details)
kamil published this revision for review.Oct 17 2022, 6:40 AM

Looks good, thanks for adding that error handling/logging

This revision is now accepted and ready to land.Oct 19 2022, 1:06 PM
marcin requested changes to this revision.Oct 20 2022, 12:27 PM

Same concerns and questions as in D5375.

This revision now requires changes to proceed.Oct 20 2022, 12:27 PM

Same concerns and questions as in D5375.

Same response as in D5375

marcin requested changes to this revision.Oct 21 2022, 1:31 AM
marcin added inline comments.
native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
575 ↗(On Diff #17606)

Is it OK to ignore failure to set database version? This function returns false if SQL query fails but its return value is not checked against. I am not saying we need to check for every SQL query failure. I just want to be sure that this is conscious decision to ignore it here.

This revision now requires changes to proceed.Oct 21 2022, 1:31 AM
kamil requested review of this revision.Oct 21 2022, 1:48 AM
kamil added inline comments.
native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
575 ↗(On Diff #17606)

Is it OK to ignore failure to set database version?

It's not but this diff only extracts logic to function (and adds checks for errors) for now, and keeps the previous behavior - where code ignore errors.

Handling these errors would be introduced in another diff - it's not part of this stack, we need a proper architecture for handling this, I am currently implementing this (tasks).

marcin added a reviewer: tomek.
This revision is now accepted and ready to land.Oct 24 2022, 2:58 AM