backport to 2.0.x series the sqlite3_open_v2 usage from master - refs #854

This commit is contained in:
Dane Springmeyer 2012-03-14 15:08:39 -07:00
parent 7a10befa11
commit 34ddc65e30
2 changed files with 21 additions and 20 deletions

View file

@ -14,6 +14,10 @@ For a complete change history, see the SVN log.
Mapnik 2.0.1
------------
- Fixed SQLite open stability across platforms/versions (#854)
- Fixed `mapnik-config --version` (#903)
- Switched back to "libmapnik" and "import mapnik" rather than "mapnik2" (#941)
- Support for PostGIS 2.0 (#956,#1083)
@ -28,7 +32,7 @@ Mapnik 2.0.1
- Restored Python 2.5 compatibility (#904)
- Fixed ability to save to jpeg format from python (7387afd9)
- Fixed ability to save to jpeg format from python (7387afd9) (#896)
Mapnik 2.0.0
@ -238,8 +242,6 @@ Mapnik 0.7.0 Release
- Python: Fixed potential crash if pycairo support is enabled but python-cairo module is missing (#392)
- Python: Added 'mapnik.mapnik_svn_revision()' function to svn revision of Mapnik was compiled at.
- Python: Added 'mapnik.has_pycairo()' function to test for pycairo support (r1278) (#284)
- Python: Added 'mapnik.register_plugins()' and 'mapnik.register_fonts()' functions (r1256)

View file

@ -142,27 +142,26 @@ public:
sqlite_connection (const std::string& file)
: db_(0)
{
// sqlite3_open_v2 is available earlier but
// shared cache not available until >= 3.6.18
#if SQLITE_VERSION_NUMBER >= 3006018
int rc = sqlite3_enable_shared_cache(1);
#if SQLITE_VERSION_NUMBER >= 3005000
int mode = SQLITE_OPEN_READWRITE;
#if SQLITE_VERSION_NUMBER >= 3006018
// shared cache flag not available until >= 3.6.18
mode |= SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_SHAREDCACHE;
#endif
const int rc = sqlite3_open_v2 (file_.c_str(), &db_, mode, 0);
#else
#warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.5.x which may make rendering slow..."
const int rc = sqlite3_open (file_.c_str(), &db_);
#endif
if (rc != SQLITE_OK)
{
throw mapnik::datasource_exception (sqlite3_errmsg (db_));
}
int mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_SHAREDCACHE;
if (sqlite3_open_v2 (file.c_str(), &db_, mode, NULL))
#else
#warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.6.18 which may make rendering slow..."
if (sqlite3_open (file.c_str(), &db_))
#endif
{
std::ostringstream s;
s << "Sqlite Plugin: ";
throw mapnik::datasource_exception (sqlite3_errmsg (db_));
s << "Sqlite Plugin: " << sqlite3_errmsg (db_);
throw mapnik::datasource_exception (s.str());
}
//sqlite3_enable_load_extension(db_, 1);
sqlite3_busy_timeout(db_,5000);
}
~sqlite_connection ()