diff --git a/DynmapCore/src/main/java/org/dynmap/storage/mssql/MicrosoftSQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/mssql/MicrosoftSQLMapStorage.java index 96b00510..f37ec4f8 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/mssql/MicrosoftSQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/mssql/MicrosoftSQLMapStorage.java @@ -672,22 +672,29 @@ public class MicrosoftSQLMapStorage extends MapStorage { } try { c = getConnection(); - // Query tiles for given mapkey - Statement stmt = c.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + ";"); - while (rs.next()) { - StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); - final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); - if(cb != null) - cb.tileFound(st, encoding); - if(cbBase != null && st.zoom == 0) - cbBase.tileFound(st, encoding); - st.cleanup(); + boolean done = false; + + while (!done) { + // Query tiles for given mapkey + Statement stmt = c.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + " LIMIT 100;"); + int cnt = 0; + while (rs.next()) { + StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); + final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); + if(cb != null) + cb.tileFound(st, encoding); + if(cbBase != null && st.zoom == 0) + cbBase.tileFound(st, encoding); + st.cleanup(); + cnt++; + } + rs.close(); + stmt.close(); + if (cnt < 100) done = true; } if(cbEnd != null) cbEnd.searchEnded(); - rs.close(); - stmt.close(); } catch (SQLException x) { logSQLException("Tile enum error", x); err = true; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java index 7e4a743e..84008484 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java @@ -792,22 +792,28 @@ public class MySQLMapStorage extends MapStorage { } try { c = getConnection(); - // Query tiles for given mapkey - Statement stmt = c.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + ";"); - while (rs.next()) { - StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); - final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); - if(cb != null) - cb.tileFound(st, encoding); - if(cbBase != null && st.zoom == 0) - cbBase.tileFound(st, encoding); - st.cleanup(); + boolean done = false; + while (!done) { + // Query tiles for given mapkey + Statement stmt = c.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + " LIMIT 100;"); + int cnt = 0; + while (rs.next()) { + StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); + final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); + if(cb != null) + cb.tileFound(st, encoding); + if(cbBase != null && st.zoom == 0) + cbBase.tileFound(st, encoding); + st.cleanup(); + cnt++; + } + rs.close(); + stmt.close(); + if (cnt < 100) done = true; } if(cbEnd != null) cbEnd.searchEnded(); - rs.close(); - stmt.close(); } catch (SQLException x) { logSQLException("Tile enum error", x); err = true; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java index bf8e107e..fbe75262 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/postgresql/PostgreSQLMapStorage.java @@ -698,22 +698,29 @@ public class PostgreSQLMapStorage extends MapStorage { } try { c = getConnection(); - // Query tiles for given mapkey - Statement stmt = c.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + ";"); - while (rs.next()) { - StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); - final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); - if(cb != null) - cb.tileFound(st, encoding); - if(cbBase != null && st.zoom == 0) - cbBase.tileFound(st, encoding); - st.cleanup(); + boolean done = false; + + while (!done) { + // Query tiles for given mapkey + Statement stmt = c.createStatement(); + ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM " + tableTiles + " WHERE MapID=" + mapkey + " LIMIT 100;"); + int cnt = 0; + while (rs.next()) { + StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); + final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); + if(cb != null) + cb.tileFound(st, encoding); + if(cbBase != null && st.zoom == 0) + cbBase.tileFound(st, encoding); + st.cleanup(); + cnt++; + } + rs.close(); + stmt.close(); + if (cnt < 100) done = true; } if(cbEnd != null) cbEnd.searchEnded(); - rs.close(); - stmt.close(); } catch (SQLException x) { logSQLException("Tile enum error", x); err = true; diff --git a/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java index b6c82f8b..46cdbb25 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/sqllte/SQLiteMapStorage.java @@ -641,23 +641,28 @@ public class SQLiteMapStorage extends MapStorage { } try { c = getConnection(); - // Query tiles for given mapkey - Statement stmt = c.createStatement(); - //ResultSet rs = stmt.executeQuery("SELECT x,y,zoom,Format FROM Tiles WHERE MapID=" + mapkey + ";"); - ResultSet rs = doExecuteQuery(stmt, "SELECT x,y,zoom,Format FROM Tiles WHERE MapID=" + mapkey + ";"); - while (rs.next()) { - StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); - final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); - if(cb != null) - cb.tileFound(st, encoding); - if(cbBase != null && st.zoom == 0) - cbBase.tileFound(st, encoding); - st.cleanup(); + boolean done = false; + while (!done) { + // Query tiles for given mapkey + Statement stmt = c.createStatement(); + ResultSet rs = doExecuteQuery(stmt, "SELECT x,y,zoom,Format FROM Tiles WHERE MapID=" + mapkey + " LIMIT 100;"); + int cnt = 0; + while (rs.next()) { + StorageTile st = new StorageTile(world, map, rs.getInt("x"), rs.getInt("y"), rs.getInt("zoom"), var); + final MapType.ImageEncoding encoding = MapType.ImageEncoding.fromOrd(rs.getInt("Format")); + if(cb != null) + cb.tileFound(st, encoding); + if(cbBase != null && st.zoom == 0) + cbBase.tileFound(st, encoding); + st.cleanup(); + cnt++; + } + rs.close(); + stmt.close(); + if (cnt < 100) done = true; } if(cbEnd != null) cbEnd.searchEnded(); - rs.close(); - stmt.close(); } catch (SQLException x) { logSQLException("Tile enum error", x); err = true;