Fix timestamps with entries

This commit is contained in:
Ammar Askar
2012-12-15 00:21:44 +05:00
parent ff9b5be91f
commit a14e48fafb

View File

@@ -15,7 +15,6 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.sql.*; import java.sql.*;
import java.sql.Date;
import java.util.*; import java.util.*;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
@@ -443,7 +442,7 @@ public class Consumer extends TimerTask
final String table = getWorldConfig(loc.getWorld()).table; final String table = getWorldConfig(loc.getWorld()).table;
PreparedStatement ps1 = connection.prepareStatement("INSERT INTO `" + table + "` (date, playerid, replaced, type, data, x, y, z) VALUES(?, " + playerID(playerName) + ", ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS); PreparedStatement ps1 = connection.prepareStatement("INSERT INTO `" + table + "` (date, playerid, replaced, type, data, x, y, z) VALUES(?, " + playerID(playerName) + ", ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
ps1.setDate(1, new Date(date)); ps1.setTimestamp(1, new Timestamp(date * 1000));
ps1.setInt(2, replaced); ps1.setInt(2, replaced);
ps1.setInt(3, type); ps1.setInt(3, type);
ps1.setInt(4, data); ps1.setInt(4, data);
@@ -536,7 +535,7 @@ public class Consumer extends TimerTask
} }
sql += "?)"; sql += "?)";
PreparedStatement ps = connection.prepareStatement(sql); PreparedStatement ps = connection.prepareStatement(sql);
ps.setDate(1, new Date(date)); ps.setTimestamp(1, new Timestamp(date * 1000));
if (!noID) { if (!noID) {
ps.setInt(2, id); ps.setInt(2, id);
ps.setString(3, message); ps.setString(3, message);