public boolean setgame(int botid, int gameid, String name, String ip, int spoofed, int reserved, int loadingtime, int left, String leftreason, int team, int colour, String spoofedrealm) {
try {
Connection connection = connection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO gameplayers (id, botid, gameid, name, ip, spoofed, reserved, loadingtime, left, leftreason, team, colour, spoofedrealm) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.setInt(1, botid);
statement.setInt(2, gameid);
statement.setString(3, name);
statement.setString(4, ip);
statement.setInt(5, spoofed);
statement.setInt(6, reserved);
statement.setInt(7, loadingtime);
statement.setInt(8, left);
statement.setString(9, leftreason);
statement.setInt(10, team);
statement.setInt(11, colour);
statement.setString(12, spoofedrealm);
statement.execute();
connectionReady(connection);
return true;
} catch (SQLException e) {
if (Main.DEBUG) {
}
Main.println("[SQLThread] Unable to add bot ban to MySQL database: " + e.getLocalizedMessage());
}
return false;
}
insert
すべてのデータを追加するメイン メソッドを作成しましたが、ステートメントにエラーが表示されません。
このエラーが発生しています:
[SQLThread] Fail: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'left, leftreason, team, colour, spoofedrealm) VALUES (NULL, 2, 146, 'Teste', '120.32' at line 1