Skip to content

Commit e95b6de

Browse files
committed
upgraded bundled SQLite to 3.8.7.1;
fixed pocoproject#590: Poco::Data::SQlite doesn't support URI filenames
1 parent fa4989e commit e95b6de

4 files changed

Lines changed: 6432 additions & 3617 deletions

File tree

‎Data/SQLite/src/SessionImpl.cpp‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#include <cstdlib>
2929

3030

31+
#ifndef SQLITE_OPEN_URI
32+
#define SQLITE_OPEN_URI 0
33+
#endif
34+
35+
3136
namespace Poco {
3237
namespace Data {
3338
namespace SQLite {
@@ -150,7 +155,7 @@ class ActiveConnector
150155

151156
inline int connectImpl()
152157
{
153-
return sqlite3_open(_connectString.c_str(), _ppDB);
158+
return sqlite3_open_v2(_connectString.c_str(), _ppDB, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, NULL);
154159
}
155160

156161
std::string _connectString;
@@ -184,7 +189,8 @@ void SessionImpl::open(const std::string& connect)
184189
close();
185190
Utility::throwException(rc);
186191
}
187-
} catch (SQLiteException& ex)
192+
}
193+
catch (SQLiteException& ex)
188194
{
189195
throw ConnectionFailedException(ex.displayText());
190196
}

‎Data/SQLite/src/Utility.cpp‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
#endif
3030

3131

32+
#ifndef SQLITE_OPEN_URI
33+
#define SQLITE_OPEN_URI 0
34+
#endif
35+
36+
3237
namespace Poco {
3338
namespace Data {
3439
namespace SQLite {
@@ -55,6 +60,7 @@ const std::string Utility::SQLITE_TIME_FORMAT = "%H:%M:%S";
5560
Utility::TypeMap Utility::_types;
5661
Poco::Mutex Utility::_mutex;
5762

63+
5864
Utility::Utility()
5965
{
6066
Poco::Mutex::ScopedLock l(_mutex);
@@ -217,7 +223,7 @@ bool Utility::fileToMemory(sqlite3* pInMemory, const std::string& fileName)
217223
sqlite3* pFile;
218224
sqlite3_backup* pBackup;
219225

220-
rc = sqlite3_open(fileName.c_str(), &pFile);
226+
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READONLY | SQLITE_OPEN_URI, NULL);
221227
if(rc == SQLITE_OK )
222228
{
223229
pBackup = sqlite3_backup_init(pInMemory, "main", pFile, "main");
@@ -240,7 +246,7 @@ bool Utility::memoryToFile(const std::string& fileName, sqlite3* pInMemory)
240246
sqlite3* pFile;
241247
sqlite3_backup* pBackup;
242248

243-
rc = sqlite3_open(fileName.c_str(), &pFile);
249+
rc = sqlite3_open_v2(fileName.c_str(), &pFile, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI, NULL);
244250
if(rc == SQLITE_OK )
245251
{
246252
pBackup = sqlite3_backup_init(pFile, "main", pInMemory, "main");
@@ -306,6 +312,4 @@ void* Utility::eventHookRegister(sqlite3* pDB, RollbackCallbackType callbackFn,
306312
}
307313

308314

309-
310-
311315
} } } // namespace Poco::Data::SQLite

0 commit comments

Comments
 (0)