Updated the consumer methods in the MySQLConnection
This commit is contained in:
parent
b28b2606cb
commit
fefbebeb3a
@ -99,12 +99,26 @@ public class MySQLConnection {
|
|||||||
* @param consumer The consumer
|
* @param consumer The consumer
|
||||||
* @param params The optional parameters
|
* @param params The optional parameters
|
||||||
*/
|
*/
|
||||||
public void getResult(String query, SQLConsumer<ResultSet> consumer, Object... params) {
|
public void getResultSet(String query, SQLConsumer<ResultSet> consumer, Object... params) {
|
||||||
try {
|
try {
|
||||||
ResultSet resultSet = getResultSet(query, params);
|
consumer.accept(getResultSet(query, params));
|
||||||
consumer.accept(resultSet);
|
} catch (Exception e) {
|
||||||
resultSet.close();
|
LOG.error(e.getMessage());
|
||||||
} catch (Exception ignored) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run an action with a result from your server
|
||||||
|
*
|
||||||
|
* @param query The search query
|
||||||
|
* @param consumer The consumer
|
||||||
|
* @param params The optional parameters
|
||||||
|
*/
|
||||||
|
public void getResult(String query, SQLConsumer<ResultManager> consumer, Object... params) {
|
||||||
|
try {
|
||||||
|
consumer.accept(getResult(query, params));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user