Skip to content

Commit 2f70153

Browse files
author
Leon von Wedelstedt
authored
SQL: Close connection instead of statement (#4)
1 parent 1c40c6f commit 2f70153

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
}
1515

1616
group 'com.dumbdogdiner'
17-
version '2.1.0-DEV'
17+
version '2.1.1-DEV'
1818

1919
// Always run shadowJar whenever 'build' is called
2020
tasks.build.dependsOn tasks.shadowJar
@@ -57,4 +57,4 @@ apply plugin: 'java'
5757
// Bugfix for no referenced libraries when using Eclipse.
5858
apply plugin: 'eclipse'
5959

60-
apply plugin: 'com.github.johnrengelman.shadow'
60+
apply plugin: 'com.github.johnrengelman.shadow'

gradlew

100644100755
File mode changed.

src/main/java/com/dumbdogdiner/betterwhitelist_bungee/utils/SQL.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public String getDiscordIDFromMinecraft(String uuid) {
148148
// Return the first result.
149149
while (result.next()) {
150150
String id = result.getString(1);
151-
statement.close();
151+
statement.getConnection().close();
152152
return id;
153153
}
154154

@@ -181,7 +181,7 @@ public String getUuidFromDiscordId(String discordID) {
181181

182182
if (result.next()) {
183183
String uuid = result.getString(1);
184-
statement.close();
184+
statement.getConnection().close();
185185

186186
// BetterWhitelistBungee.getInstance().getLogger().info("Got '" + uuid + "' for
187187
// ID '" + discordID + "'.");
@@ -213,7 +213,7 @@ public boolean addEntry(String discordID, String uuid) {
213213
Statement statement = createStatement();
214214
statement.executeUpdate("INSERT IGNORE INTO `minecraft_whitelist` (`discordID`, `minecraft_uuid`) VALUES ('"
215215
+ discordID + "','" + uuid + "');");
216-
statement.close();
216+
statement.getConnection().close();
217217

218218
getLogger().info("Added whitelist entry: '" + discordID + "' => '" + uuid + "'");
219219

@@ -246,7 +246,7 @@ public boolean removeEntry(String discordID) {
246246
try {
247247
Statement statement = createStatement();
248248
statement.executeUpdate("DELETE FROM `minecraft_whitelist` WHERE `discordID`='" + discordID + "'");
249-
statement.close();
249+
statement.getConnection().close();
250250

251251
getLogger().info("Removed whitelist entry: '" + discordID + "'");
252252

@@ -273,7 +273,7 @@ public boolean removeEntryUsingUuid(String uuid) {
273273
try {
274274
Statement statement = createStatement();
275275
statement.executeUpdate("DELETE FROM `minecraft_whitelist` WHERE `minecraft_uuid`='" + uuid + "'");
276-
statement.close();
276+
statement.getConnection().close();
277277
return true;
278278
}
279279

0 commit comments

Comments
 (0)