mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 20:58:40 +01:00
Add ImageLen for SQLLite to PHP (standalone server)
This commit is contained in:
parent
4e9739a212
commit
495a6f7ec2
@ -161,7 +161,7 @@ public class SQLiteMapStorage extends MapStorage {
|
|||||||
stmt.setLong(2, System.currentTimeMillis());
|
stmt.setLong(2, System.currentTimeMillis());
|
||||||
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.buf.length);
|
stmt.setInt(5, encImage.len);
|
||||||
stmt.setInt(6, mapkey);
|
stmt.setInt(6, mapkey);
|
||||||
stmt.setInt(7, x);
|
stmt.setInt(7, x);
|
||||||
stmt.setInt(8, y);
|
stmt.setInt(8, y);
|
||||||
@ -177,7 +177,7 @@ public class SQLiteMapStorage extends MapStorage {
|
|||||||
stmt.setLong(6, System.currentTimeMillis());
|
stmt.setLong(6, System.currentTimeMillis());
|
||||||
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.buf.length);
|
stmt.setInt(9, encImage.len);
|
||||||
}
|
}
|
||||||
//stmt.executeUpdate();
|
//stmt.executeUpdate();
|
||||||
doExecuteUpdate(stmt);
|
doExecuteUpdate(stmt);
|
||||||
@ -640,7 +640,7 @@ public class SQLiteMapStorage extends MapStorage {
|
|||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE Faces SET Image=?,ImageLen=? WHERE PlayerName=? AND TypeID=?;");
|
stmt = c.prepareStatement("UPDATE Faces SET Image=?,ImageLen=? WHERE PlayerName=? AND TypeID=?;");
|
||||||
stmt.setBytes(1, encImage.buf);
|
stmt.setBytes(1, encImage.buf);
|
||||||
stmt.setInt(2, encImage.buf.length);
|
stmt.setInt(2, encImage.len);
|
||||||
stmt.setString(3, playername);
|
stmt.setString(3, playername);
|
||||||
stmt.setInt(4, facetype.typeID);
|
stmt.setInt(4, facetype.typeID);
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ public class SQLiteMapStorage extends MapStorage {
|
|||||||
stmt.setString(1, playername);
|
stmt.setString(1, playername);
|
||||||
stmt.setInt(2, facetype.typeID);
|
stmt.setInt(2, facetype.typeID);
|
||||||
stmt.setBytes(3, encImage.buf);
|
stmt.setBytes(3, encImage.buf);
|
||||||
stmt.setInt(4, encImage.buf.length);
|
stmt.setInt(4, encImage.len);
|
||||||
}
|
}
|
||||||
//stmt.executeUpdate();
|
//stmt.executeUpdate();
|
||||||
doExecuteUpdate(stmt);
|
doExecuteUpdate(stmt);
|
||||||
@ -753,14 +753,14 @@ public class SQLiteMapStorage extends MapStorage {
|
|||||||
else if (exists) {
|
else if (exists) {
|
||||||
stmt = c.prepareStatement("UPDATE MarkerIcons SET Image=?,ImageLen=? WHERE IconName=?;");
|
stmt = c.prepareStatement("UPDATE MarkerIcons SET Image=?,ImageLen=? WHERE IconName=?;");
|
||||||
stmt.setBytes(1, encImage.buf);
|
stmt.setBytes(1, encImage.buf);
|
||||||
stmt.setInt(2, encImage.buf.length);
|
stmt.setInt(2, encImage.len);
|
||||||
stmt.setString(3, markerid);
|
stmt.setString(3, markerid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stmt = c.prepareStatement("INSERT INTO MarkerIcons (IconName,Image,ImageLen) VALUES (?,?,?);");
|
stmt = c.prepareStatement("INSERT INTO MarkerIcons (IconName,Image,ImageLen) VALUES (?,?,?);");
|
||||||
stmt.setString(1, markerid);
|
stmt.setString(1, markerid);
|
||||||
stmt.setBytes(2, encImage.buf);
|
stmt.setBytes(2, encImage.buf);
|
||||||
stmt.setInt(3, encImage.buf.length);
|
stmt.setInt(3, encImage.len);
|
||||||
}
|
}
|
||||||
doExecuteUpdate(stmt);
|
doExecuteUpdate(stmt);
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
@ -78,7 +78,7 @@ else {
|
|||||||
|
|
||||||
$db = new SQLite3($dbfile, SQLITE3_OPEN_READONLY);
|
$db = new SQLite3($dbfile, SQLITE3_OPEN_READONLY);
|
||||||
|
|
||||||
$stmt = $db->prepare('SELECT Tiles.Image,Tiles.Format,Tiles.HashCode,Tiles.LastUpdate FROM Maps JOIN Tiles WHERE Maps.WorldID=:wid AND Maps.MapID=:mapid AND Maps.Variant=:var AND Maps.ID=Tiles.MapID AND Tiles.x=:x AND Tiles.y=:y and Tiles.zoom=:zoom');
|
$stmt = $db->prepare('SELECT Tiles.Image,Tiles.Format,Tiles.HashCode,Tiles.LastUpdate,Tiles.ImageLen FROM Maps JOIN Tiles WHERE Maps.WorldID=:wid AND Maps.MapID=:mapid AND Maps.Variant=:var AND Maps.ID=Tiles.MapID AND Tiles.x=:x AND Tiles.y=:y and Tiles.zoom=:zoom');
|
||||||
$stmt->bindValue(':wid', $world, SQLITE3_TEXT);
|
$stmt->bindValue(':wid', $world, SQLITE3_TEXT);
|
||||||
$stmt->bindValue(':mapid', $prefix, SQLITE3_TEXT);
|
$stmt->bindValue(':mapid', $prefix, SQLITE3_TEXT);
|
||||||
$stmt->bindValue(':var', $variant, SQLITE3_TEXT);
|
$stmt->bindValue(':var', $variant, SQLITE3_TEXT);
|
||||||
@ -97,7 +97,13 @@ if (isset($row[1])) {
|
|||||||
}
|
}
|
||||||
header('ETag: \'' . $row[2] . '\'');
|
header('ETag: \'' . $row[2] . '\'');
|
||||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $row[3]/1000) . ' GMT');
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $row[3]/1000) . ' GMT');
|
||||||
echo rtrim($row[0], "\0");
|
if ($row[4] > 0) {
|
||||||
|
$v = substr($row[0], 0, $row[4]);
|
||||||
|
} else {
|
||||||
|
$v = rtrim($row[0], "\0");
|
||||||
|
}
|
||||||
|
header('Content-Length: ' . strlen($v));
|
||||||
|
echo $v;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
header('Location: ../images/blank.png');
|
header('Location: ../images/blank.png');
|
||||||
|
Loading…
Reference in New Issue
Block a user