mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-03-12 14:39:19 +01:00
Restore functionality of deprecated SQLite connection acquisition
If the connection is closed, no new SQLite connection is created in plugins still using the
deprecated method.
Introduced in 0ae9c6fcdb
This commit is contained in:
parent
c3fb050444
commit
296f82f50e
@ -42,16 +42,8 @@ public class SQLiteConnector implements DatabaseConnector {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void connect(ConnectionCallback callback) {
|
public void connect(ConnectionCallback callback) {
|
||||||
if (this.connection == null) {
|
|
||||||
try {
|
|
||||||
this.connection = DriverManager.getConnection(this.connectionString);
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
this.plugin.getLogger().severe("An error occurred retrieving the SQLite database connection: " + ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
callback.accept(this.connection);
|
callback.accept(getConnection());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.plugin.getLogger().severe("An error occurred executing an SQLite query: " + ex.getMessage());
|
this.plugin.getLogger().severe("An error occurred executing an SQLite query: " + ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user