forked from LogBlock/LogBlock
Merge pull request #427 from frymaster/timezone-fix
Use unix timestamps in queries.
This commit is contained in:
@@ -464,8 +464,8 @@ public class Consumer extends TimerTask
|
|||||||
PreparedStatement ps1 = null;
|
PreparedStatement ps1 = null;
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
try {
|
try {
|
||||||
ps1 = connection.prepareStatement("INSERT INTO `" + table + "` (date, playerid, replaced, type, data, x, y, z) VALUES(?, " + playerID(playerName) + ", ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
ps1 = connection.prepareStatement("INSERT INTO `" + table + "` (date, playerid, replaced, type, data, x, y, z) VALUES(FROM_UNIXTIME(?), " + playerID(playerName) + ", ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps1.setTimestamp(1, new Timestamp(date * 1000));
|
ps1.setLong(1, date );
|
||||||
ps1.setInt(2, replaced);
|
ps1.setInt(2, replaced);
|
||||||
ps1.setInt(3, type);
|
ps1.setInt(3, type);
|
||||||
ps1.setInt(4, data);
|
ps1.setInt(4, data);
|
||||||
@@ -574,7 +574,7 @@ public class Consumer extends TimerTask
|
|||||||
boolean noID = false;
|
boolean noID = false;
|
||||||
Integer id;
|
Integer id;
|
||||||
|
|
||||||
String sql = "INSERT INTO `lb-chat` (date, playerid, message) VALUES (?, ";
|
String sql = "INSERT INTO `lb-chat` (date, playerid, message) VALUES (FROM_UNIXTIME(?), ";
|
||||||
if ((id = playerIDAsInt(playerName)) == null) {
|
if ((id = playerIDAsInt(playerName)) == null) {
|
||||||
noID = true;
|
noID = true;
|
||||||
sql += playerID(playerName) + ", ";
|
sql += playerID(playerName) + ", ";
|
||||||
@@ -586,7 +586,7 @@ public class Consumer extends TimerTask
|
|||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
try {
|
try {
|
||||||
ps = connection.prepareStatement(sql);
|
ps = connection.prepareStatement(sql);
|
||||||
ps.setTimestamp(1, new Timestamp(date * 1000));
|
ps.setLong(1, date);
|
||||||
if (!noID) {
|
if (!noID) {
|
||||||
ps.setInt(2, id);
|
ps.setInt(2, id);
|
||||||
ps.setString(3, message);
|
ps.setString(3, message);
|
||||||
|
Reference in New Issue
Block a user