diff --git a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java index c3b84f35f3..3771b2c1b0 100644 --- a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java +++ b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java @@ -56,14 +56,7 @@ public class SQLiteTileSource implements ITileSource { private OsmandApplication ctx; private boolean onlyReadonlyAvailable = false; - private static final String TILES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS tiles (" + - "x, " + - "y, " + - "z, " + - "s, " + - "image, " + - "time" + - ")"; + private static final String TILES_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS \"tiles\" (\"x\" INTEGER NOT NULL, \"y\" INTEGER NOT NULL, \"z\" INTEGER NOT NULL, \"s\" INTEGER, \"image\" BLOB, \"time\" INTEGER, PRIMARY KEY (\"x\", \"y\", \"z\"))"; public SQLiteTileSource(OsmandApplication ctx, File f, List toFindUrl){ this.ctx = ctx; @@ -106,18 +99,14 @@ public class SQLiteTileSource implements ITileSource { public void createDataBase() { db = ctx.getSQLiteAPI().getOrCreateDatabase( ctx.getAppPath(TILES_INDEX_DIR).getAbsolutePath() + "/" + name + SQLITE_EXT, true); + db.execSQL("CREATE TABLE IF NOT EXISTS info (" + - "url " + + "minzoom, " + + "maxzoom " + ");"); - db.execSQL("INSERT INTO info (url) VALUES ('" + urlTemplate + "');"); + db.execSQL("INSERT INTO info (minzoom,maxzoom) VALUES ('" + minZoom + "','" + maxZoom + "');"); -// db.execSQL("INSERT INTO info VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", -// new Object[]{minZoom, maxZoom, urlTemplate, randoms, isEllipsoid ? 1 : 0, -// invertedY ? 1 : 0, referer, timeSupported ? "yes" : "no", timeSupported ? "yes" : "no", -// getExpirationTimeMinutes(), inversiveZoom ? "BigPlanet" : ""}); - - addInfoColumn("minzoom", String.valueOf(minZoom)); - addInfoColumn("maxzoom", String.valueOf(maxZoom)); + addInfoColumn("url", urlTemplate); addInfoColumn("randoms", randoms); addInfoColumn("ellipsoid", isEllipsoid ? "1" : "0"); addInfoColumn("inverted_y", invertedY ? "1" : "0"); diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 2ebb252685..f7b4fd492e 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -1091,8 +1091,8 @@ public class SettingsHelper { JSONObject object = items.getJSONObject(i); boolean sql = object.optBoolean("sql"); String name = object.optString("name"); - int minZoom = object.optInt("minZoom", 1); - int maxZoom = object.optInt("maxZoom", 17); + int minZoom = object.optInt("minZoom"); + int maxZoom = object.optInt("maxZoom"); String url = object.optString("url"); String randoms = object.optString("randoms"); boolean ellipsoid = object.optBoolean("ellipsoid", false);