mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-23 18:04:27 +01:00
call TursoDB::load from constructor
This commit is contained in:
@@ -98,7 +98,7 @@ public final class TursoDB implements AutoCloseable {
|
||||
* @throws InternalError if the native library cannot be loaded from either the system path or the
|
||||
* JAR file.
|
||||
*/
|
||||
public static void load() {
|
||||
private static void load() {
|
||||
new SingletonHolder();
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ public final class TursoDB implements AutoCloseable {
|
||||
private TursoDB(String url, String filePath) throws SQLException {
|
||||
this.url = url;
|
||||
this.filePath = filePath;
|
||||
load();
|
||||
open(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ public final class TursoDBFactory {
|
||||
throw new IllegalArgumentException("filePath should not be empty");
|
||||
}
|
||||
|
||||
TursoDB.load();
|
||||
|
||||
try {
|
||||
return databaseHolder.computeIfAbsent(
|
||||
url, (Sneaky<String, TursoDB, SQLException>) u -> TursoDB.create(u, filePath));
|
||||
|
||||
@@ -12,7 +12,6 @@ public class TursoDBTest {
|
||||
|
||||
@Test
|
||||
void db_should_open_and_close_normally() throws Exception {
|
||||
TursoDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
TursoDB db = TursoDB.create("jdbc:turso" + dbPath, dbPath);
|
||||
|
||||
@@ -23,7 +22,6 @@ public class TursoDBTest {
|
||||
|
||||
@Test
|
||||
void throwJavaException_should_throw_appropriate_java_exception() throws Exception {
|
||||
TursoDB.load();
|
||||
String dbPath = TestUtils.createTempFile();
|
||||
TursoDB db = TursoDB.create("jdbc:turso:" + dbPath, dbPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user