Skip to content

Commit

Permalink
v3.2.2 - MySQL fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Realizedd committed Feb 5, 2019
1 parent 3d78f09 commit 57a6808
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
}

group 'me.realized'
version '3.2.1'
version '3.2.2'

project.tasks.assemble.dependsOn project.tasks.shadowJar
jar.enabled = false
Expand Down Expand Up @@ -104,7 +104,7 @@ dependencies {
compile 'com.zaxxer:HikariCP:2.7.8'
compile 'org.slf4j:slf4j-nop:1.7.25'
compile 'org.bstats:bstats-bukkit:1.2'
compile 'org.inventivetalent.spiget-update:bukkit:1.4.0'
compile 'org.inventivetalent.spiget-update:bukkit:1.4.2-SNAPSHOT'
}

shadowJar {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Feb 05 08:05:17 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ private void insertCache(final Connection connection, final Map<UUID, Long> cach
}

private OptionalLong select(final Connection connection, final String key, final boolean create) throws Exception {
connection.setAutoCommit(false);

try (PreparedStatement selectStatement = connection.prepareStatement(Query.SELECT_ONE.query)) {
selectStatement.setString(1, key);

Expand All @@ -410,24 +408,14 @@ private OptionalLong select(final Connection connection, final String key, final

return OptionalLong.of(resultSet.getLong("tokens"));
}
} finally {
connection.commit();
}
}

private void update(final Connection connection, final String key, final long value) throws Exception {
connection.setAutoCommit(false);

try (PreparedStatement selectStatement = connection.prepareStatement(Query.SELECT_ONE.query)) {
selectStatement.setString(1, key);

try (ResultSet resultSet = selectStatement.executeQuery()) {
resultSet.next();
resultSet.updateLong("tokens", value);
resultSet.updateRow();
}
} finally {
connection.commit();
try (PreparedStatement statement = connection.prepareStatement(Query.UPDATE.query)) {
statement.setLong(1, value);
statement.setString(2, key);
statement.execute();
}
}

Expand Down

0 comments on commit 57a6808

Please sign in to comment.