Impelemted it for SQL style storage
This commit is contained in:
parent
f55dba6186
commit
63a3e03c24
4 changed files with 12 additions and 12 deletions
|
|
@ -145,7 +145,7 @@ public class MariaDBMapStorage extends MapStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(long hash, BufferOutputStream encImage) {
|
public boolean write(long hash, BufferOutputStream encImage, long timestamp) {
|
||||||
if (mapkey == null) return false;
|
if (mapkey == null) return false;
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
boolean err = false;
|
boolean err = false;
|
||||||
|
|
@ -166,7 +166,7 @@ public class MariaDBMapStorage extends MapStorage {
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
||||||
stmt.setLong(1, hash);
|
stmt.setLong(1, hash);
|
||||||
stmt.setLong(2, System.currentTimeMillis());
|
stmt.setLong(2, timestamp);
|
||||||
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
stmt.setInt(5, mapkey);
|
stmt.setInt(5, mapkey);
|
||||||
|
|
@ -181,7 +181,7 @@ public class MariaDBMapStorage extends MapStorage {
|
||||||
stmt.setInt(3, y);
|
stmt.setInt(3, y);
|
||||||
stmt.setInt(4, zoom);
|
stmt.setInt(4, zoom);
|
||||||
stmt.setLong(5, hash);
|
stmt.setLong(5, hash);
|
||||||
stmt.setLong(6, System.currentTimeMillis());
|
stmt.setLong(6, timestamp);
|
||||||
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class MySQLMapStorage extends MapStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(long hash, BufferOutputStream encImage) {
|
public boolean write(long hash, BufferOutputStream encImage, long timestamp) {
|
||||||
if (mapkey == null) return false;
|
if (mapkey == null) return false;
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
boolean err = false;
|
boolean err = false;
|
||||||
|
|
@ -167,7 +167,7 @@ public class MySQLMapStorage extends MapStorage {
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
||||||
stmt.setLong(1, hash);
|
stmt.setLong(1, hash);
|
||||||
stmt.setLong(2, System.currentTimeMillis());
|
stmt.setLong(2, timestamp);
|
||||||
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
stmt.setInt(5, mapkey);
|
stmt.setInt(5, mapkey);
|
||||||
|
|
@ -182,7 +182,7 @@ public class MySQLMapStorage extends MapStorage {
|
||||||
stmt.setInt(3, y);
|
stmt.setInt(3, y);
|
||||||
stmt.setInt(4, zoom);
|
stmt.setInt(4, zoom);
|
||||||
stmt.setLong(5, hash);
|
stmt.setLong(5, hash);
|
||||||
stmt.setLong(6, System.currentTimeMillis());
|
stmt.setLong(6, timestamp);
|
||||||
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ public class PostgreSQLMapStorage extends MapStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(long hash, BufferOutputStream encImage) {
|
public boolean write(long hash, BufferOutputStream encImage, long timestamp) {
|
||||||
if (mapkey == null) return false;
|
if (mapkey == null) return false;
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
boolean err = false;
|
boolean err = false;
|
||||||
|
|
@ -170,7 +170,7 @@ public class PostgreSQLMapStorage extends MapStorage {
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
stmt = c.prepareStatement("UPDATE " + tableTiles + " SET HashCode=?, LastUpdate=?, Format=?, Image=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
||||||
stmt.setLong(1, hash);
|
stmt.setLong(1, hash);
|
||||||
stmt.setLong(2, System.currentTimeMillis());
|
stmt.setLong(2, timestamp);
|
||||||
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(4, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
stmt.setInt(5, mapkey);
|
stmt.setInt(5, mapkey);
|
||||||
|
|
@ -185,7 +185,7 @@ public class PostgreSQLMapStorage extends MapStorage {
|
||||||
stmt.setInt(3, y);
|
stmt.setInt(3, y);
|
||||||
stmt.setInt(4, zoom);
|
stmt.setInt(4, zoom);
|
||||||
stmt.setLong(5, hash);
|
stmt.setLong(5, hash);
|
||||||
stmt.setLong(6, System.currentTimeMillis());
|
stmt.setLong(6, timestamp);
|
||||||
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
stmt.setBinaryStream(8, new BufferInputStream(encImage.buf, encImage.len), encImage.len);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class SQLiteMapStorage extends MapStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean write(long hash, BufferOutputStream encImage) {
|
public boolean write(long hash, BufferOutputStream encImage, long timestamp) {
|
||||||
if (mapkey == null) return false;
|
if (mapkey == null) return false;
|
||||||
Connection c = null;
|
Connection c = null;
|
||||||
boolean err = false;
|
boolean err = false;
|
||||||
|
|
@ -160,7 +160,7 @@ public class SQLiteMapStorage extends MapStorage {
|
||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE Tiles SET HashCode=?, LastUpdate=?, Format=?, Image=?, ImageLen=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
stmt = c.prepareStatement("UPDATE Tiles SET HashCode=?, LastUpdate=?, Format=?, Image=?, ImageLen=? WHERE MapID=? AND x=? and y=? AND zoom=?;");
|
||||||
stmt.setLong(1, hash);
|
stmt.setLong(1, hash);
|
||||||
stmt.setLong(2, System.currentTimeMillis());
|
stmt.setLong(2, timestamp);
|
||||||
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(3, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBytes(4, encImage.buf);
|
stmt.setBytes(4, encImage.buf);
|
||||||
stmt.setInt(5, encImage.len);
|
stmt.setInt(5, encImage.len);
|
||||||
|
|
@ -176,7 +176,7 @@ public class SQLiteMapStorage extends MapStorage {
|
||||||
stmt.setInt(3, y);
|
stmt.setInt(3, y);
|
||||||
stmt.setInt(4, zoom);
|
stmt.setInt(4, zoom);
|
||||||
stmt.setLong(5, hash);
|
stmt.setLong(5, hash);
|
||||||
stmt.setLong(6, System.currentTimeMillis());
|
stmt.setLong(6, timestamp);
|
||||||
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
stmt.setInt(7, map.getImageFormat().getEncoding().ordinal());
|
||||||
stmt.setBytes(8, encImage.buf);
|
stmt.setBytes(8, encImage.buf);
|
||||||
stmt.setInt(9, encImage.len);
|
stmt.setInt(9, encImage.len);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue