-
Notifications
You must be signed in to change notification settings - Fork 38.7k
wallet: refactor: dedup sqlite statement preparations/deletions #21540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet: refactor: dedup sqlite statement preparations/deletions #21540
Conversation
|
Code review ACK 966089a |
|
Concept ACK - the resulting code is significantly more readable IMO and this makes the consistent treatment obvious and enforced. Logically, the underlying values in |
966089a to
0df8012
Compare
|
Thanks for reviewing!
Agreed, using std::map here is like using a sledgehammer to crack a nut 😄 I changed the code to use |
|
reACK 0df8012. The only change is replacing map with array |
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to change this method, but not the Close method?
0df8012 to
ea19cc8
Compare
|
Took in the suggestions by MarcoFalke (#21540 (review)): applied |
|
ACK ea19cc8 |
meshcollider
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK ea19cc8
|
It was while testing this I noticed #21628. However the issue is also present in master. |
…tions/deletions ea19cc8 wallet: refactor: dedup sqlite statement deletions (Sebastian Falbesoner) 9a36709 wallet: refactor: dedup sqlite statement preparations (Sebastian Falbesoner) Pull request description: This refactoring PR deduplicates repeated SQLite statement preparation calls (`sqlite3_prepare_v2(...)`) / deletions (`sqlite3_finalize(...)`) and its surrounding logic by putting each prepared statement and its corresponding text representation into a ~std::map~ ~`std::array`~ `std::vector`. This should be more readable and less error-prone, e.g. in case an additional statement needs to be added in the future or the error handling has to be adapted. ACKs for top commit: achow101: ACK ea19cc8 meshcollider: utACK ea19cc8 Tree-SHA512: ced89869b2147e088e7a4cda2acbbdd4a806f66dbc2d6999953d0d702c0655aa53c0eb699cc7e5e3732f2d24206d577a9d9e1b5de7f439100dead2696ade1092
This refactoring PR deduplicates repeated SQLite statement preparation calls (
sqlite3_prepare_v2(...)) / deletions (sqlite3_finalize(...)) and its surrounding logic by putting each prepared statement and its corresponding text representation into astd::mapstd::arraystd::vector. This should be more readable and less error-prone, e.g. in case an additional statement needs to be added in the future or the error handling has to be adapted.