Cleaned up the update method of the MySQLConnection class
This commit is contained in:
parent
d5bd0e4248
commit
ce8042c530
@ -117,12 +117,12 @@ public class MySQLConnection {
|
||||
*/
|
||||
public MySQLConnection update(String query, Object... params) {
|
||||
try {
|
||||
int start = 1;
|
||||
PreparedStatement ps = con.prepareStatement(query);
|
||||
for (Object current : params) {
|
||||
ps.setObject(start, current);
|
||||
start++;
|
||||
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
ps.setObject(i+1, params[i]);
|
||||
}
|
||||
|
||||
ps.executeUpdate();
|
||||
} catch (Exception err) {
|
||||
err.printStackTrace();
|
||||
|
Reference in New Issue
Block a user