Skip to content
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

wxSQLite3Database::SetJournalMode always returns DELETE #107

Closed
carlosrllodra opened this issue Nov 1, 2022 · 1 comment
Closed

wxSQLite3Database::SetJournalMode always returns DELETE #107

carlosrllodra opened this issue Nov 1, 2022 · 1 comment

Comments

@carlosrllodra
Copy link

Hello.

I have found that calling wxSQLite3Database::SetJournalMode() always returns WXSQLITE_JOURNALMODE_DELETE (the default return value).

The reason is PRAGMA journal_mode is returning mode name as a lowercase string, but ConvertJournalMode(const wxString&...) called at the end of SetJournalMode() does case-sensitive comparisons against uppercase mode names, so they never match...

It is solved by just setting caseSensitve=false argument when calling mode.IsSameAs():

/* static */
wxSQLite3JournalMode wxSQLite3Database::ConvertJournalMode(const wxString& mode)
{
wxSQLite3JournalMode journalMode;
if (mode.IsSameAs(wxS("DELETE"), false)) journalMode = WXSQLITE_JOURNALMODE_DELETE;
else if (mode.IsSameAs(wxS("PERSIST"), false)) journalMode = WXSQLITE_JOURNALMODE_PERSIST;
// Etc etc...

Best regards

utelle added a commit that referenced this issue Nov 1, 2022
Method `wxSQLite3Database::ConvertJournalMode(const wxString& mode)` checked the journal mode string against upper case values. This failed, because `PRAGMA journal_mode` returns the journal mode in lower case. The comparison is now done case insensitive.
@utelle
Copy link
Owner

utelle commented Nov 1, 2022

Thanks for reporting and analyzing the problem.

Commit 534e38a applies your suggested fix.

@utelle utelle closed this as completed Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants