summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-07-31 11:10:04 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-07-31 11:10:04 (GMT)
commiteada1f585ce2db374e51d27e269ca924075d9c52 (patch)
treeb4cae944af8e1145c25a7447bdb8186d99ae27d3
parentbe65f00925d916ed794e5bdea9996446f2c8f537 (diff)
Commit each 10000 tiles
-rw-r--r--tools/mbtile-import/MbTileWriter.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/mbtile-import/MbTileWriter.cpp b/tools/mbtile-import/MbTileWriter.cpp
index 0d2c3b0..4438121 100644
--- a/tools/mbtile-import/MbTileWriter.cpp
+++ b/tools/mbtile-import/MbTileWriter.cpp
@@ -71,11 +71,6 @@ void MbTileWriter::setReportProgress(bool report)
void MbTileWriter::addTile(const QFileInfo &file, qint32 x, qint32 y, qint32 z)
{
- ++m_tileCounter;
-
- if (m_reportProgress) {
- std::cout << "Tile " << std::right << std::setw(10) << m_tileCounter << ": ";
- }
if (!m_overwriteTiles && haveTile(x, y, z)) {
if (m_reportProgress) {
std::cout << " Skipping existing " << z << '/' << x << '/' << y << '\r';
@@ -84,11 +79,18 @@ void MbTileWriter::addTile(const QFileInfo &file, qint32 x, qint32 y, qint32 z)
return;
}
+ ++m_tileCounter;
if (m_reportProgress) {
+ std::cout << "Tile " << std::right << std::setw(10) << m_tileCounter << ": ";
std::cout << "Adding " << z << '/' << x << '/' << y << '\r';
std::cout.flush();
}
+ if (m_tileCounter % 10000 == 0) {
+ execQuery("END TRANSACTION");
+ execQuery("BEGIN TRANSACTION");
+ }
+
QFile tileContent(file.absoluteFilePath());
tileContent.open(QFile::ReadOnly);
QSqlQuery query;