Skip to content

Commit

Permalink
allow to handle hot-journal (fixes pocoproject#3135)
Browse files Browse the repository at this point in the history
Before, when executing the Poco::Data::SQLite::Utility::fileToMemory method
for a SQLite database with an existing hot journal, the method returns successfully,
but the resulting in-memory database is corrupted.

This is because if a hot journal exists, this can not processed
correctly if only read only access to the database is available.
  • Loading branch information
Florian Kauer committed Nov 17, 2020
1 parent ff64d51 commit 196c530
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Data/SQLite/src/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ bool Utility::fileToMemory(sqlite3* pInMemory, const std::string& fileName)
sqlite3* pFile;
sqlite3_backup* pBackup;

rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READONLY | SQLITE_OPEN_URI, NULL);
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI, NULL);
if(rc == SQLITE_OK )
{
pBackup = sqlite3_backup_init(pInMemory, "main", pFile, "main");
Expand Down

0 comments on commit 196c530

Please sign in to comment.