From a14adc5f3aa8cc47dab92b71d2f3568261acfaa7 Mon Sep 17 00:00:00 2001 From: simonpoole Date: Tue, 23 Mar 2021 20:28:43 +0100 Subject: [PATCH] Expose the connection object The default for SQLite is to auto commit, this can be very expensive. Exposing the connection allows us to set auto commit false before extensive operations and then commit once finished. --- src/main/java/org/imintel/mbtiles4j/MBTilesReader.java | 9 +++++++++ src/main/java/org/imintel/mbtiles4j/MBTilesWriter.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/org/imintel/mbtiles4j/MBTilesReader.java b/src/main/java/org/imintel/mbtiles4j/MBTilesReader.java index 7e6432e..adb9714 100644 --- a/src/main/java/org/imintel/mbtiles4j/MBTilesReader.java +++ b/src/main/java/org/imintel/mbtiles4j/MBTilesReader.java @@ -91,4 +91,13 @@ public int getMinZoom() throws MBTilesReadException { throw new MBTilesReadException("Could not get min zoom", e); } } + + /** + * Expose the Connection object + * + * @return the current Connection object + */ + public Connection getConnection() { + return connection; + } } diff --git a/src/main/java/org/imintel/mbtiles4j/MBTilesWriter.java b/src/main/java/org/imintel/mbtiles4j/MBTilesWriter.java index 2be28e5..d63ad78 100644 --- a/src/main/java/org/imintel/mbtiles4j/MBTilesWriter.java +++ b/src/main/java/org/imintel/mbtiles4j/MBTilesWriter.java @@ -126,4 +126,13 @@ public File close() { return file; } + /** + * Expose the Connection object + * This is for example useful for turning off auto commit. + * + * @return the current Connection object + */ + public Connection getConnection() { + return connection; + } }