Correctifs du commit précédent
This commit is contained in:
@@ -62,7 +62,7 @@ public class MPMessageTable extends SQLTable<MPMessageElement> {
|
||||
public List<MPMessageElement> getAllUnreadForPlayer(String player) throws SQLException {
|
||||
if (!AbstractCommandExecutor.isValidPlayerName(player)) return null;
|
||||
|
||||
return getAll("viewerNick = "+player+" AND read = 0", "time ASC", null, null);
|
||||
return getAll("viewerNick = '"+player+"' AND wasRead = 0", "time ASC", null, null);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.data_model;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
@@ -87,9 +88,16 @@ public abstract class SQLElement {
|
||||
st.setString(i+1, values[i]);
|
||||
}
|
||||
|
||||
id = st.executeUpdate();
|
||||
st.close();
|
||||
st.executeUpdate();
|
||||
|
||||
ResultSet rs = st.getGeneratedKeys();
|
||||
if(rs.next())
|
||||
{
|
||||
id = rs.getInt(1);
|
||||
}
|
||||
|
||||
saved = true;
|
||||
st.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
Reference in New Issue
Block a user