Please sign in to comment.
Add a db pool in a slightly elegant way without having to modify the …
…existing code base TOO much!: Database pools required you to get a Connection object and then close it afterwards. LWC has 2000+ lines of database code. Modifying every instance of this is extremely (!!) time consuming and very inconvenient. Instead of doing this we exploit the fact that in LWC's usecase, once a PreparedStatement or ResultSet is closed, everything above it is closed, e.g a close chain: ResultSet -> PreparedStatement -> Connection. This is done automatically by the new backing AutoClosingPreparedStatement and AutoClosingResultSet. This however did require manually modifying anything that used raw Statement objects. This means that this build truly is a "dev" build not an unreleased stable build. Care should be taken with this build.
- Loading branch information...
Showing with 1,359 additions and 454 deletions.
- +3 −0 build.xml
- BIN lib/dbpool-5.0.jar
- +4 −1 src/main/java/com/griefcraft/io/BackupManager.java
- +8 −3 src/main/java/com/griefcraft/lwc/LWC.java
- +0 −6 src/main/java/com/griefcraft/migration/DatabaseMigrator.java
- +7 −2 src/main/java/com/griefcraft/modules/admin/AdminCleanup.java
- +5 −9 src/main/java/com/griefcraft/modules/admin/AdminQuery.java
- +468 −0 src/main/java/com/griefcraft/sql/AutoClosingPreparedStatement.java
- +805 −0 src/main/java/com/griefcraft/sql/AutoClosingResultSet.java
- +43 −101 src/main/java/com/griefcraft/sql/Database.java
- +15 −313 src/main/java/com/griefcraft/sql/PhysDB.java
- +1 −13 src/main/java/com/griefcraft/sql/Table.java
- +0 −6 src/main/java/com/griefcraft/util/DatabaseThread.java
Oops, something went wrong.