mirror of
https://github.com/FirephoenixX02/RapidReport.git
synced 2026-05-01 13:52:36 +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
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
# Project exclude paths
|
# Project exclude paths
|
||||||
/target/
|
/target/
|
||||||
|
.idea
|
||||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
|
|
@ -1,6 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="exceptionflug" />
|
||||||
|
<option name="name" value="exceptionflug" />
|
||||||
|
<option name="url" value="https://mvn.exceptionflug.de/repository/exceptionflug-public/" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="central" />
|
<option name="id" value="central" />
|
||||||
<option name="name" value="Central Repository" />
|
<option name="name" value="Central Repository" />
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class ListReportsCommand implements SimpleCommand {
|
||||||
return;
|
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");
|
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<>();
|
CompletableFuture<ResultSet> future = new CompletableFuture<>();
|
||||||
|
|
||||||
RapidReport.INSTANCE.proxy.getScheduler().buildTask(RapidReport.INSTANCE, () -> {
|
RapidReport.INSTANCE.proxy.getScheduler().buildTask(RapidReport.INSTANCE, () -> {
|
||||||
try (Connection connection = hikariCP.getConnection();
|
try (Connection connection = hikariCP.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(statement)) {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(statement)) {
|
|
||||||
ResultSet resultSet = preparedStatement.executeQuery();
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
future.complete(resultSet);
|
future.complete(resultSet);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
@ -113,8 +112,7 @@ public class DataBaseManager {
|
||||||
for (String query : queries) {
|
for (String query : queries) {
|
||||||
// If you use the legacy way you have to check for empty queries here.
|
// If you use the legacy way you have to check for empty queries here.
|
||||||
if (query.isEmpty()) continue;
|
if (query.isEmpty()) continue;
|
||||||
try (Connection conn = hikariCP.getConnection();
|
try (Connection conn = hikariCP.getConnection(); PreparedStatement stmt = conn.prepareStatement(query)) {
|
||||||
PreparedStatement stmt = conn.prepareStatement(query)) {
|
|
||||||
stmt.execute();
|
stmt.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
RapidReport.INSTANCE.logger.info("Error executing database setup!", e);
|
RapidReport.INSTANCE.logger.info("Error executing database setup!", e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue