Added query overload for updating
This commit is contained in:
parent
da526d50e3
commit
00c5842a34
@ -71,6 +71,13 @@ public class DatabaseProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int query(String sql, Object... params) throws SQLException {
|
||||||
|
try (PreparedStatement stmt = getConnection().prepareStatement(sql)) {
|
||||||
|
resolveParameters(stmt, params);
|
||||||
|
return stmt.executeUpdate(sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int insert(String sql, Object... params) throws SQLException {
|
public int insert(String sql, Object... params) throws SQLException {
|
||||||
try (PreparedStatement query = getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
try (PreparedStatement query = getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
||||||
resolveParameters(query, params);
|
resolveParameters(query, params);
|
||||||
|
Loading…
Reference in New Issue
Block a user