Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

public class LibSqlConstants {

public static final Pattern CONNECTION_URL_EXAMPLE = Pattern.compile("jdbc:dbeaver:libsql:<server-url>");
public static final Pattern CONNECTION_URL_PATTERN = Pattern.compile("jdbc:dbeaver:libsql:(.+)");
public static final String CONNECTION_URL_EXAMPLES = "jdbc:dbeaver:libsql:<hostname>, libsql://<hostname>";
public static final String CONNECTION_PROTOCOLS_REGEXP = "jdbc:dbeaver:libsql:(https://)?(libsql://)?|libsql://";
public static final Pattern CONNECTION_URL_PATTERN =
Pattern.compile("(" + CONNECTION_PROTOCOLS_REGEXP + ")[a-z0-9.-]+");

public static final int DRIVER_VERSION_MAJOR = 1;
public static final int DRIVER_VERSION_MINOR = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ public Connection connect(String url, Properties info) throws SQLException {
if (!matcher.matches()) {
throw new LibSqlException(
"Invalid connection URL: " + url +
".\nExpected URL format: " + LibSqlConstants.CONNECTION_URL_EXAMPLE);
".\nExpected URL formats: " + LibSqlConstants.CONNECTION_URL_EXAMPLES);
}
String targetUrl = matcher.group(1);
String targetUrl = matcher.group(0)
.replaceAll(LibSqlConstants.CONNECTION_PROTOCOLS_REGEXP, "https://");

Map<String, Object> props = new LinkedHashMap<>();
for (Enumeration<?> pne = info.propertyNames(); pne.hasMoreElements(); ) {
Expand Down
Loading