sqlite: let sqlite automatically rollback if needed to avoid potential rollback against no transaction
This commit is contained in:
parent
ef69f00867
commit
1653fe0b93
1 changed files with 10 additions and 4 deletions
|
@ -207,9 +207,17 @@ public:
|
||||||
bool one_success = false;
|
bool one_success = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
ds->execute("PRAGMA synchronous=OFF");
|
ds->execute("PRAGMA synchronous=OFF");
|
||||||
ds->execute("BEGIN IMMEDIATE TRANSACTION");
|
ds->execute("BEGIN IMMEDIATE TRANSACTION");
|
||||||
|
|
||||||
|
/*
|
||||||
|
ds->execute("PRAGMA journal_mode=WAL");
|
||||||
|
ds->execute("PRAGMA fullfsync=1");
|
||||||
|
ds->execute("PRAGMA locking_mode = EXCLUSIVE");
|
||||||
|
ds->execute("BEGIN EXCLUSIVE TRANSACTION");
|
||||||
|
*/
|
||||||
|
|
||||||
// first drop the index if it already exists
|
// first drop the index if it already exists
|
||||||
std::ostringstream spatial_index_drop_sql;
|
std::ostringstream spatial_index_drop_sql;
|
||||||
spatial_index_drop_sql << "DROP TABLE IF EXISTS " << index_table;
|
spatial_index_drop_sql << "DROP TABLE IF EXISTS " << index_table;
|
||||||
|
@ -278,7 +286,6 @@ public:
|
||||||
}
|
}
|
||||||
catch (mapnik::datasource_exception const& ex)
|
catch (mapnik::datasource_exception const& ex)
|
||||||
{
|
{
|
||||||
ds->execute("ROLLBACK");
|
|
||||||
if (!existed)
|
if (!existed)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -297,7 +304,6 @@ public:
|
||||||
}
|
}
|
||||||
else if (!existed)
|
else if (!existed)
|
||||||
{
|
{
|
||||||
ds->execute("ROLLBACK");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boost::filesystem::remove(index_db);
|
boost::filesystem::remove(index_db);
|
||||||
|
|
Loading…
Reference in a new issue