mirror of
https://github.com/FirephoenixX02/RapidReport.git
synced 2026-04-26 03:26:22 +02:00
Add Report List Command + DataBaseManager
This commit is contained in:
parent
df2838a6a2
commit
de4c49e4d4
4 changed files with 10 additions and 6 deletions
|
|
@ -40,7 +40,7 @@ public class ListReportsCommand implements SimpleCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
commandSource.sendRichMessage(RapidReport.INSTANCE.getChatPrefix() + "<red>Fetching first 10 reports for player <gray>" + args[0] + "<red> from database...");
|
||||
commandSource.sendRichMessage(RapidReport.INSTANCE.getChatPrefix() + "<red>Fetching first 10 reports for player <gray>" + args[0] + "<red> from database...");
|
||||
|
||||
CompletableFuture<ResultSet> future = RapidReport.INSTANCE.getDataBaseManager().getSQLStatementResultAsync("SELECT * FROM rapid_report_reports WHERE reportedName = '" + args[0] + "' LIMIT 10");
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,7 @@ public class DataBaseManager {
|
|||
CompletableFuture<ResultSet> future = new CompletableFuture<>();
|
||||
|
||||
RapidReport.INSTANCE.proxy.getScheduler().buildTask(RapidReport.INSTANCE, () -> {
|
||||
try (Connection connection = hikariCP.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(statement)) {
|
||||
try (Connection connection = hikariCP.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(statement)) {
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
future.complete(resultSet);
|
||||
} catch (SQLException e) {
|
||||
|
|
@ -113,8 +112,7 @@ public class DataBaseManager {
|
|||
for (String query : queries) {
|
||||
// If you use the legacy way you have to check for empty queries here.
|
||||
if (query.isEmpty()) continue;
|
||||
try (Connection conn = hikariCP.getConnection();
|
||||
PreparedStatement stmt = conn.prepareStatement(query)) {
|
||||
try (Connection conn = hikariCP.getConnection(); PreparedStatement stmt = conn.prepareStatement(query)) {
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
RapidReport.INSTANCE.logger.info("Error executing database setup!", e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue