In the future there will be a need to get the database version in different places, that being said extracting logic to separate function.
Details
Check if logged database version is propper (could be compared with user_version visible after connecting to the database).
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Looks good, can we maybe move get_database_version() closer to where it's used though (it's like 200 lines above the only usage)? Feel free to leave as is if you had a reason to place it where you did.
Well I thought that SQLiteQueryExecutor.cpp is divided into logical parts
- operations on the database using raw SQL
- operations connected to directly database file
- encryption code
- migrations
- operation on the database using ORM
so If I am wrong and it'll be better to place it lower it's still okay to me, I was just trying to fit this in the best place
In the future there will be a need to get the database version in different places, that being said extracting logic to separate function.
What do you mean by "other" places? If you think about calling this function from different places inside SQliteQueryExecutor then this differential is fine and ready to be accepted. But if you want to call this function somewhere in C++ outside of SQliteQueryExecutor, then we have a few problems:
- This function is not defined in SQLiteQueryExecutor.h neither as a class method nor free function. So we are not able to call it outside of SQLIteQueryExecutor
- If we want to call this function outside of SQLiteQueryExecutor.h should it be free function or method? If method then we also need to introduce it as virtual in DatabaseQueryExecutor abstract class
I need your answer regarding "other places" in the code we want to call this function from and your thoughts on 1 and 2 if you want to call this function outside of SQLiteQueryExecutor.
I think it's obvious that it'll be called only inside SQLiteQueryExecutor because I didn't add this to SQLiteQueryExecutor.h, different places (not "other" places) means multiple lines inside SQLiteQueryExecutor - sorry for confusing you if the word is not proper for this case.