-
Notifications
You must be signed in to change notification settings - Fork 667
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
Don't load folder if we encounter a db error #9477
Conversation
2a30e71
to
d777edd
Compare
Kudos, SonarCloud Quality Gate passed! |
_error = QString::fromUtf8(sqlite3_errmsg(_db)); \ | ||
} \ | ||
namespace { | ||
constexpr auto SQLITE_SLEEP_TIME = 500ms; |
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.
The sleep is probably not needed as it seems that the sqlite calls them self do block for a certain amount of time.
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.
It's a relatively large change. I can't really tell whether this fixes the mentioned issue from the code, but it does seem to fix a few corner cases.
} | ||
return false; |
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.
This was the main issue, if we failed to prepare the statement we just continued.
close(); | ||
QFile::remove(filename); | ||
QFile fileToRemove(filename); | ||
if (!fileToRemove.remove()) { |
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.
If removing the broken db failed we are not ready...
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.
What do you mean? Do we have to implement additional error handling?
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.
No just return false, the code was meant to fix a corrupted db by removing it.
However if removing the broken db fails.... this pr provides the required error handling.
close(); | ||
QFile::remove(filename); | ||
QFile fileToRemove(filename); | ||
if (!fileToRemove.remove()) { |
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.
What do you mean? Do we have to implement additional error handling?
Fixes: #9147