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