mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-07 18:24:20 +01:00
only initialize DriverPropertyInfo once
This commit is contained in:
@@ -7,23 +7,16 @@ import java.util.Properties;
|
||||
/** Turso Configuration. */
|
||||
public final class TursoConfig {
|
||||
|
||||
private Properties pragma;
|
||||
private static final DriverPropertyInfo[] driverPropertyInfo = driverPropertyInfo();
|
||||
|
||||
private final Properties pragma;
|
||||
|
||||
public TursoConfig(Properties properties) {
|
||||
this.pragma = properties;
|
||||
}
|
||||
|
||||
public static DriverPropertyInfo[] getDriverPropertyInfo() {
|
||||
return Arrays.stream(Pragma.values())
|
||||
.map(
|
||||
p -> {
|
||||
DriverPropertyInfo info = new DriverPropertyInfo(p.pragmaName, null);
|
||||
info.description = p.description;
|
||||
info.choices = p.choices;
|
||||
info.required = false;
|
||||
return info;
|
||||
})
|
||||
.toArray(DriverPropertyInfo[]::new);
|
||||
return driverPropertyInfo;
|
||||
}
|
||||
|
||||
public Properties toProperties() {
|
||||
@@ -49,4 +42,17 @@ public final class TursoConfig {
|
||||
return pragmaName;
|
||||
}
|
||||
}
|
||||
|
||||
private static DriverPropertyInfo[] driverPropertyInfo() {
|
||||
return Arrays.stream(Pragma.values())
|
||||
.map(
|
||||
p -> {
|
||||
DriverPropertyInfo info = new DriverPropertyInfo(p.pragmaName, null);
|
||||
info.description = p.description;
|
||||
info.choices = p.choices;
|
||||
info.required = false;
|
||||
return info;
|
||||
})
|
||||
.toArray(DriverPropertyInfo[]::new);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import tech.turso.TursoErrorCode;
|
||||
import tech.turso.annotations.NativeInvocation;
|
||||
import tech.turso.annotations.VisibleForTesting;
|
||||
@@ -38,7 +37,7 @@ public final class TursoDB implements AutoCloseable {
|
||||
* Enum representing different architectures and their corresponding library paths and file
|
||||
* extensions.
|
||||
*/
|
||||
enum Architecture {
|
||||
private enum Architecture {
|
||||
MACOS_ARM64("libs/macos_arm64/lib_turso_java.dylib", ".dylib"),
|
||||
MACOS_X86("libs/macos_x86/lib_turso_java.dylib", ".dylib"),
|
||||
LINUX_X86("libs/linux_x86/lib_turso_java.so", ".so"),
|
||||
|
||||
Reference in New Issue
Block a user