19 files changed
+716
-5
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
**/libs/*.jar
|
**/libs/*.jar
|
||||||
|
!drivers/cache/libs/CacheDB.jar
|
||||||
!drivers/oscar/libs/oscarJDBC8.jar
|
!drivers/oscar/libs/oscarJDBC8.jar
|
||||||
!drivers/uxdb/libs/uxdbjdbc-2.1.2.3p.jre8.jar
|
!drivers/uxdb/libs/uxdbjdbc-2.1.2.3p.jre8.jar
|
||||||
gradle.properties
|
gradle.properties
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ Each agent runs as a standalone process and communicates with DBX via stdin/stdo
|
|||||||
| zookeeper | Apache ZooKeeper | go-zookeeper native agent |
|
| zookeeper | Apache ZooKeeper | go-zookeeper native agent |
|
||||||
| rabbitmq | RabbitMQ | amqp091-go native agent |
|
| rabbitmq | RabbitMQ | amqp091-go native agent |
|
||||||
| rocketmq | Apache RocketMQ | rocketmq-admin-go native agent |
|
| rocketmq | Apache RocketMQ | rocketmq-admin-go native agent |
|
||||||
|
| iris | InterSystems IRIS | InterSystems IRIS JDBC |
|
||||||
|
| cache | InterSystems Caché | InterSystems Caché JDBC (CacheDB) |
|
||||||
|
|
||||||
|
|
||||||
## Multi-JRE Support
|
## Multi-JRE Support
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ DBX 的 Agent 驱动 —— 通过 JDBC 和原生数据库驱动支持各种数
|
|||||||
| zookeeper | Apache ZooKeeper | go-zookeeper 原生 Agent |
|
| zookeeper | Apache ZooKeeper | go-zookeeper 原生 Agent |
|
||||||
| rabbitmq | RabbitMQ | amqp091-go 原生 agent |
|
| rabbitmq | RabbitMQ | amqp091-go 原生 agent |
|
||||||
| rocketmq | Apache RocketMQ | rocketmq-admin-go 原生 agent |
|
| rocketmq | Apache RocketMQ | rocketmq-admin-go 原生 agent |
|
||||||
|
| iris | InterSystems IRIS | InterSystems IRIS JDBC |
|
||||||
|
| cache | InterSystems Caché | InterSystems Caché JDBC (CacheDB) |
|
||||||
|
|
||||||
|
|
||||||
## 多 JRE 支持
|
## 多 JRE 支持
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ def legacyStandaloneProjects = ['mongodb', 'kafka'] as Set
|
|||||||
def pooledJdbcProjects = [
|
def pooledJdbcProjects = [
|
||||||
'access', 'bigquery', 'dameng', 'databend', 'databricks', 'db2', 'exasol',
|
'access', 'bigquery', 'dameng', 'databend', 'databricks', 'db2', 'exasol',
|
||||||
'firebird', 'gbase8a', 'gbase8s', 'goldendb', 'h2', 'h2-legacy', 'highgo',
|
'firebird', 'gbase8a', 'gbase8s', 'goldendb', 'h2', 'h2-legacy', 'highgo',
|
||||||
'ignite', 'ignite3', 'informix', 'iris', 'kylin', 'oceanbase-oracle', 'oscar', 'saphana',
|
'ignite', 'ignite3', 'informix', 'iris', 'cache', 'kylin', 'oceanbase-oracle', 'oscar', 'saphana',
|
||||||
'snowflake', 'spanner', 'spark', 'sqlserver-legacy', 'sundb', 'teradata', 'trino', 'uxdb',
|
'snowflake', 'spanner', 'spark', 'sqlserver-legacy', 'sundb', 'teradata', 'trino', 'uxdb',
|
||||||
'vertica', 'yashandb'
|
'vertica', 'yashandb'
|
||||||
] as Set
|
] as Set
|
||||||
|
|||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
dependencies {
|
||||||
|
implementation files('libs/CacheDB.jar')
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('shadowJar') {
|
||||||
|
manifest {
|
||||||
|
attributes('Agent-Label': 'InterSystems Cach\u00e9', 'Main-Class': 'com.dbx.agent.cache.CacheAgent')
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
@@ -0,0 +1,230 @@
|
|||||||
|
package com.dbx.agent.cache;
|
||||||
|
|
||||||
|
import com.dbx.agent.ConfiguredJdbcAgent;
|
||||||
|
import com.dbx.agent.ColumnInfo;
|
||||||
|
import com.dbx.agent.ConnectParams;
|
||||||
|
import com.dbx.agent.JdbcAgentProfile;
|
||||||
|
import com.dbx.agent.JdbcExecutor;
|
||||||
|
import com.dbx.agent.MultiSessionJsonRpcServer;
|
||||||
|
import com.dbx.agent.StandardJdbcMetadata;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public final class CacheAgent extends ConfiguredJdbcAgent {
|
||||||
|
public static final JdbcAgentProfile CACHE_PROFILE = new JdbcAgentProfile(
|
||||||
|
"com.intersys.jdbc.CacheDriver",
|
||||||
|
"jdbc:Cache://{host}:{port}/{database}",
|
||||||
|
1972,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
private String configuredDatabase = "";
|
||||||
|
|
||||||
|
public CacheAgent() {
|
||||||
|
super(CACHE_PROFILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterConnect(ConnectParams params, Connection connection) {
|
||||||
|
configuredDatabase = params.getDatabase();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object resultValue(ResultSet rs, int index, int sqlType) {
|
||||||
|
if (sqlType == Types.OTHER) {
|
||||||
|
return unchecked(() -> JdbcExecutor.normalizeResultValue(rs.getObject(index)));
|
||||||
|
}
|
||||||
|
return super.resultValue(rs, index, sqlType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listSchemas() {
|
||||||
|
return dedupeCaseInsensitiveSchemas(StandardJdbcMetadata.INSTANCE.listSchemas(requireConnection(), CACHE_PROFILE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ColumnInfo> getColumns(String schema, String table) {
|
||||||
|
return cacheColumns(requireConnection(), getProfile(), configuredDatabase, schema, table);
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ColumnInfo> cacheColumns(Connection conn, JdbcAgentProfile profile, String configuredDatabase, String schema, String table) {
|
||||||
|
List<ColumnInfo> columns;
|
||||||
|
try {
|
||||||
|
columns = informationSchemaColumns(conn, schema, table);
|
||||||
|
} catch (Exception informationSchemaUnavailable) {
|
||||||
|
// Caché releases before 2012.1 do not expose INFORMATION_SCHEMA;
|
||||||
|
// plain JDBC metadata keeps those servers browsable.
|
||||||
|
return StandardJdbcMetadata.INSTANCE.getColumns(conn, profile, configuredDatabase, schema, table);
|
||||||
|
}
|
||||||
|
if (!hasPrimaryKey(columns)) {
|
||||||
|
markPrimaryKeys(columns, cachePrimaryKeys(conn, schema, table));
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<ColumnInfo> informationSchemaColumns(Connection conn, String schema, String table) {
|
||||||
|
return unchecked(() -> {
|
||||||
|
List<ColumnInfo> columns = new ArrayList<>();
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(columnSql(schema))) {
|
||||||
|
int index = 1;
|
||||||
|
if (!isBlank(schema)) {
|
||||||
|
stmt.setString(index++, schema.trim());
|
||||||
|
}
|
||||||
|
stmt.setString(index, table);
|
||||||
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
|
while (rs.next()) {
|
||||||
|
String name = rs.getString("COLUMN_NAME");
|
||||||
|
if (isBlank(name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
columns.add(new ColumnInfo(
|
||||||
|
name,
|
||||||
|
stringOrDefault(rs, "DATA_TYPE", "Unknown"),
|
||||||
|
!"NO".equalsIgnoreCase(stringOrNull(rs, "IS_NULLABLE")),
|
||||||
|
stringOrNull(rs, "COLUMN_DEFAULT"),
|
||||||
|
"YES".equalsIgnoreCase(stringOrNull(rs, "PRIMARY_KEY")),
|
||||||
|
null,
|
||||||
|
stringOrNull(rs, "DESCRIPTION"),
|
||||||
|
intOrNull(rs, "NUMERIC_PRECISION"),
|
||||||
|
intOrNull(rs, "NUMERIC_SCALE"),
|
||||||
|
intOrNull(rs, "CHARACTER_MAXIMUM_LENGTH")
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<String> dedupeCaseInsensitiveSchemas(List<String> schemas) {
|
||||||
|
Map<String, String> byNormalizedName = new LinkedHashMap<>();
|
||||||
|
for (String schema : schemas) {
|
||||||
|
if (schema == null || schema.trim().isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String name = schema.trim();
|
||||||
|
byNormalizedName.putIfAbsent(name.toUpperCase(Locale.ROOT), name);
|
||||||
|
}
|
||||||
|
return new ArrayList<>(byNormalizedName.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<String> cachePrimaryKeys(Connection conn, String schema, String table) {
|
||||||
|
Set<String> keys = jdbcPrimaryKeys(conn, schema, table);
|
||||||
|
return keys.isEmpty() ? nativePrimaryKeys(conn, schema, table) : keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<String> jdbcPrimaryKeys(Connection conn, String schema, String table) {
|
||||||
|
Set<String> keys = new LinkedHashSet<>();
|
||||||
|
try {
|
||||||
|
DatabaseMetaData meta = conn.getMetaData();
|
||||||
|
try (ResultSet rs = meta.getPrimaryKeys(null, isBlank(schema) ? null : schema.trim(), table)) {
|
||||||
|
addPrimaryKeys(keys, rs);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<String> nativePrimaryKeys(Connection conn, String schema, String table) {
|
||||||
|
Set<String> keys = new LinkedHashSet<>();
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(primaryKeySql(schema))) {
|
||||||
|
int index = 1;
|
||||||
|
if (!isBlank(schema)) {
|
||||||
|
stmt.setString(index++, schema.trim());
|
||||||
|
}
|
||||||
|
stmt.setString(index, table);
|
||||||
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
|
addPrimaryKeys(keys, rs);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// Primary key metadata is optional for display; column listing must keep working.
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String columnSql(String schema) {
|
||||||
|
StringBuilder sql = new StringBuilder(
|
||||||
|
"SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT, "
|
||||||
|
+ "PRIMARY_KEY, DESCRIPTION, NUMERIC_PRECISION, NUMERIC_SCALE, CHARACTER_MAXIMUM_LENGTH "
|
||||||
|
+ "FROM INFORMATION_SCHEMA.COLUMNS WHERE "
|
||||||
|
);
|
||||||
|
if (!isBlank(schema)) {
|
||||||
|
sql.append("UPPER(TABLE_SCHEMA) = UPPER(?) AND ");
|
||||||
|
}
|
||||||
|
sql.append("UPPER(TABLE_NAME) = UPPER(?) ORDER BY ORDINAL_POSITION");
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addPrimaryKeys(Set<String> keys, ResultSet rs) throws Exception {
|
||||||
|
while (rs.next()) {
|
||||||
|
String column = rs.getString("COLUMN_NAME");
|
||||||
|
if (!isBlank(column)) {
|
||||||
|
keys.add(column.toUpperCase(Locale.ROOT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasPrimaryKey(List<ColumnInfo> columns) {
|
||||||
|
for (ColumnInfo column : columns) {
|
||||||
|
if (column.getIs_primary_key()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void markPrimaryKeys(List<ColumnInfo> columns, Set<String> primaryKeys) {
|
||||||
|
for (ColumnInfo column : columns) {
|
||||||
|
if (primaryKeys.contains(column.getName().toUpperCase(Locale.ROOT))) {
|
||||||
|
column.setIs_primary_key(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String primaryKeySql(String schema) {
|
||||||
|
StringBuilder sql = new StringBuilder(
|
||||||
|
"SELECT k.COLUMN_NAME "
|
||||||
|
+ "FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k "
|
||||||
|
+ "WHERE k.CONSTRAINT_TYPE = 'PRIMARY KEY' AND "
|
||||||
|
);
|
||||||
|
if (!isBlank(schema)) {
|
||||||
|
sql.append("UPPER(k.TABLE_SCHEMA) = UPPER(?) AND ");
|
||||||
|
}
|
||||||
|
sql.append("UPPER(k.TABLE_NAME) = UPPER(?) ORDER BY k.ORDINAL_POSITION");
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String stringOrDefault(ResultSet rs, String column, String fallback) throws Exception {
|
||||||
|
String value = stringOrNull(rs, column);
|
||||||
|
return isBlank(value) ? fallback : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String stringOrNull(ResultSet rs, String column) throws Exception {
|
||||||
|
String value = rs.getString(column);
|
||||||
|
return rs.wasNull() ? null : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer intOrNull(ResultSet rs, String column) throws Exception {
|
||||||
|
Object value = rs.getObject(column);
|
||||||
|
return value instanceof Number ? ((Number) value).intValue() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isBlank(String value) {
|
||||||
|
return value == null || value.trim().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new MultiSessionJsonRpcServer(CacheAgent::new).run();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,427 @@
|
|||||||
|
package com.dbx.agent.cache;
|
||||||
|
|
||||||
|
import com.dbx.agent.ColumnInfo;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DatabaseMetaData;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
class CacheAgentTest {
|
||||||
|
@Test
|
||||||
|
void skipsSchemaSwitchingBecauseCacheRejectsSetSchemaContext() {
|
||||||
|
CacheAgent agent = new CacheAgent();
|
||||||
|
|
||||||
|
assertEquals("", agent.setSchemaSQL("SQLUser"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void buildsCacheJdbcUrlWithDefaultPort() {
|
||||||
|
assertEquals(
|
||||||
|
"jdbc:Cache://db.local:1972/USER",
|
||||||
|
CacheAgent.CACHE_PROFILE.getUrlTemplate()
|
||||||
|
.replace("{host}", "db.local")
|
||||||
|
.replace("{port}", "1972")
|
||||||
|
.replace("{database}", "USER")
|
||||||
|
);
|
||||||
|
assertEquals("com.intersys.jdbc.CacheDriver", CacheAgent.CACHE_PROFILE.getDriverClass());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void dedupesSchemasCaseInsensitively() {
|
||||||
|
assertEquals(
|
||||||
|
Arrays.asList("APP", "SQLUSER", "z_user"),
|
||||||
|
CacheAgent.dedupeCaseInsensitiveSchemas(Arrays.asList("APP", "SQLUSER", "SQLUser", "app", "z_user"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void ignoresBlankSchemasWhenDeduping() {
|
||||||
|
assertEquals(
|
||||||
|
Collections.singletonList("SQLUSER"),
|
||||||
|
CacheAgent.dedupeCaseInsensitiveSchemas(Arrays.asList("", " ", null, "SQLUSER"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readsVendorOtherValuesThroughGetObject() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
ResultSet resultSet = proxy(ResultSet.class, (method, args) -> {
|
||||||
|
if ("getObject".equals(method.getName())) {
|
||||||
|
calls.add("getObject");
|
||||||
|
return new Object() {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "%List(1,2)";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if ("getString".equals(method.getName())) {
|
||||||
|
calls.add("getString");
|
||||||
|
throw new AssertionError("Caché %LIST must not use getString");
|
||||||
|
}
|
||||||
|
if ("wasNull".equals(method.getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
|
||||||
|
Object value = new CacheAgent().resultValue(resultSet, 1, Types.OTHER);
|
||||||
|
|
||||||
|
assertEquals("%List(1,2)", value);
|
||||||
|
assertEquals(Collections.singletonList("getObject"), calls);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void preservesStringPathForStandardValues() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
ResultSet resultSet = proxy(ResultSet.class, (method, args) -> {
|
||||||
|
if ("getString".equals(method.getName())) {
|
||||||
|
calls.add("getString");
|
||||||
|
return "ordinary";
|
||||||
|
}
|
||||||
|
if ("wasNull".equals(method.getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
|
||||||
|
Object value = new CacheAgent().resultValue(resultSet, 1, Types.VARCHAR);
|
||||||
|
|
||||||
|
assertEquals("ordinary", value);
|
||||||
|
assertEquals(Collections.singletonList("getString"), calls);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void preservesNullForVendorOtherValues() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
ResultSet resultSet = proxy(ResultSet.class, (method, args) -> {
|
||||||
|
if ("getObject".equals(method.getName())) {
|
||||||
|
calls.add("getObject");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ("wasNull".equals(method.getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
|
||||||
|
Object value = new CacheAgent().resultValue(resultSet, 1, Types.OTHER);
|
||||||
|
|
||||||
|
assertNull(value);
|
||||||
|
assertEquals(Collections.singletonList("getObject"), calls);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readsColumnsAndUsesInlinePrimaryKey() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = fakeConnection(
|
||||||
|
calls,
|
||||||
|
true,
|
||||||
|
Collections.emptyList(),
|
||||||
|
null,
|
||||||
|
Collections.emptyList()
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "USER", "SQLUser", "People");
|
||||||
|
|
||||||
|
assertEquals(2, columns.size());
|
||||||
|
assertEquals("ID", columns.get(0).getName());
|
||||||
|
assertEquals("INTEGER", columns.get(0).getData_type());
|
||||||
|
assertFalse(columns.get(0).getIs_nullable());
|
||||||
|
assertTrue(columns.get(0).getIs_primary_key());
|
||||||
|
assertEquals("42", columns.get(0).getColumn_default());
|
||||||
|
assertEquals("identifier", columns.get(0).getComment());
|
||||||
|
assertEquals(Integer.valueOf(10), columns.get(0).getNumeric_precision());
|
||||||
|
assertEquals(Integer.valueOf(0), columns.get(0).getNumeric_scale());
|
||||||
|
assertNull(columns.get(0).getCharacter_maximum_length());
|
||||||
|
assertEquals("NAME", columns.get(1).getName());
|
||||||
|
assertEquals("VARCHAR", columns.get(1).getData_type());
|
||||||
|
assertTrue(columns.get(1).getIs_nullable());
|
||||||
|
assertNull(columns.get(1).getColumn_default());
|
||||||
|
assertNull(columns.get(1).getComment());
|
||||||
|
assertNull(columns.get(1).getNumeric_precision());
|
||||||
|
assertNull(columns.get(1).getNumeric_scale());
|
||||||
|
assertEquals(Integer.valueOf(64), columns.get(1).getCharacter_maximum_length());
|
||||||
|
assertEquals(1, calls.size());
|
||||||
|
assertFalse(calls.get(0).contains("LIMIT"));
|
||||||
|
assertTrue(calls.get(0).contains("PRIMARY_KEY"));
|
||||||
|
assertTrue(calls.get(0).contains("DESCRIPTION"));
|
||||||
|
assertTrue(calls.get(0).contains("INFORMATION_SCHEMA.COLUMNS"));
|
||||||
|
assertTrue(calls.get(0).contains("UPPER(TABLE_SCHEMA) = UPPER(?)"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void readsDescriptionsWithoutSchemaFilter() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = fakeConnection(
|
||||||
|
calls,
|
||||||
|
true,
|
||||||
|
Collections.emptyList(),
|
||||||
|
null,
|
||||||
|
Collections.emptyList()
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "", null, "People");
|
||||||
|
|
||||||
|
assertEquals("identifier", columns.get(0).getComment());
|
||||||
|
assertNull(columns.get(1).getComment());
|
||||||
|
assertEquals(1, calls.size());
|
||||||
|
assertTrue(calls.get(0).contains("DESCRIPTION"));
|
||||||
|
assertFalse(calls.get(0).contains("TABLE_SCHEMA"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void usesJdbcPrimaryKeysWhenColumnRowsHaveNoPrimaryKey() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = fakeConnection(
|
||||||
|
calls,
|
||||||
|
false,
|
||||||
|
List.of(Map.of("COLUMN_NAME", "ID")),
|
||||||
|
null,
|
||||||
|
Collections.emptyList()
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "USER", "SQLUser", "People");
|
||||||
|
|
||||||
|
assertTrue(columns.get(0).getIs_primary_key());
|
||||||
|
assertEquals(2, calls.size());
|
||||||
|
assertTrue(calls.get(0).contains("INFORMATION_SCHEMA.COLUMNS"));
|
||||||
|
assertEquals("JDBC_PRIMARY_KEYS", calls.get(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void fallsBackToNativePrimaryKeysWhenJdbcMetadataFails() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = fakeConnection(
|
||||||
|
calls,
|
||||||
|
false,
|
||||||
|
Collections.emptyList(),
|
||||||
|
new SQLException("Caché metadata unavailable"),
|
||||||
|
List.of(Map.of("COLUMN_NAME", "ID"))
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "USER", "SQLUser", "People");
|
||||||
|
|
||||||
|
assertTrue(columns.get(0).getIs_primary_key());
|
||||||
|
assertTrue(calls.get(0).contains("INFORMATION_SCHEMA.COLUMNS"));
|
||||||
|
assertEquals("JDBC_PRIMARY_KEYS", calls.get(1));
|
||||||
|
assertTrue(calls.get(2).contains("INFORMATION_SCHEMA.KEY_COLUMN_USAGE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void leavesColumnsWithoutPrimaryKeysWhenBothSourcesAreEmpty() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = fakeConnection(
|
||||||
|
calls,
|
||||||
|
false,
|
||||||
|
Collections.emptyList(),
|
||||||
|
null,
|
||||||
|
Collections.emptyList()
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "USER", "SQLUser", "People");
|
||||||
|
|
||||||
|
assertFalse(columns.get(0).getIs_primary_key());
|
||||||
|
assertFalse(columns.get(1).getIs_primary_key());
|
||||||
|
assertTrue(calls.get(2).contains("INFORMATION_SCHEMA.KEY_COLUMN_USAGE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void fallsBackToJdbcMetadataWhenInformationSchemaIsUnavailable() {
|
||||||
|
List<String> calls = new ArrayList<>();
|
||||||
|
Connection conn = proxy(Connection.class, (method, args) -> {
|
||||||
|
if ("prepareStatement".equals(method.getName())) {
|
||||||
|
calls.add((String) args[0]);
|
||||||
|
throw new SQLException("SQLCODE -361: unknown table INFORMATION_SCHEMA.COLUMNS");
|
||||||
|
}
|
||||||
|
if ("getMetaData".equals(method.getName())) {
|
||||||
|
return jdbcFallbackMetadata(calls);
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
|
||||||
|
List<ColumnInfo> columns = CacheAgent.cacheColumns(conn, CacheAgent.CACHE_PROFILE, "USER", "SQLUser", "People");
|
||||||
|
|
||||||
|
assertEquals(1, columns.size());
|
||||||
|
assertEquals("ID", columns.get(0).getName());
|
||||||
|
assertEquals("INTEGER", columns.get(0).getData_type());
|
||||||
|
assertTrue(columns.get(0).getIs_primary_key());
|
||||||
|
assertEquals(3, calls.size());
|
||||||
|
assertTrue(calls.get(0).contains("INFORMATION_SCHEMA.COLUMNS"));
|
||||||
|
assertEquals("JDBC_PRIMARY_KEYS", calls.get(1));
|
||||||
|
assertEquals("JDBC_COLUMNS", calls.get(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseMetaData jdbcFallbackMetadata(List<String> calls) {
|
||||||
|
return proxy(DatabaseMetaData.class, (method, args) -> {
|
||||||
|
String name = method.getName();
|
||||||
|
if ("getPrimaryKeys".equals(name)) {
|
||||||
|
calls.add("JDBC_PRIMARY_KEYS");
|
||||||
|
return fakeResultSet(List.of(Map.of("COLUMN_NAME", "ID")));
|
||||||
|
}
|
||||||
|
if ("getColumns".equals(name)) {
|
||||||
|
calls.add("JDBC_COLUMNS");
|
||||||
|
return fakeResultSet(List.of(Map.of(
|
||||||
|
"COLUMN_NAME", "ID",
|
||||||
|
"TYPE_NAME", "INTEGER",
|
||||||
|
"NULLABLE", 0,
|
||||||
|
"COLUMN_DEF", "0",
|
||||||
|
"REMARKS", "identifier",
|
||||||
|
"COLUMN_SIZE", 10,
|
||||||
|
"DECIMAL_DIGITS", 0
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Connection fakeConnection(
|
||||||
|
List<String> callLog,
|
||||||
|
boolean inlinePrimaryKey,
|
||||||
|
List<Map<String, Object>> jdbcPrimaryKeys,
|
||||||
|
SQLException jdbcPrimaryKeyFailure,
|
||||||
|
List<Map<String, Object>> nativePrimaryKeys
|
||||||
|
) {
|
||||||
|
return proxy(Connection.class, (method, args) -> {
|
||||||
|
if ("prepareStatement".equals(method.getName())) {
|
||||||
|
String sql = (String) args[0];
|
||||||
|
callLog.add(sql);
|
||||||
|
return fakeStatement(sql, inlinePrimaryKey, nativePrimaryKeys);
|
||||||
|
}
|
||||||
|
if ("getMetaData".equals(method.getName())) {
|
||||||
|
return fakeMetadata(callLog, jdbcPrimaryKeys, jdbcPrimaryKeyFailure);
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static DatabaseMetaData fakeMetadata(
|
||||||
|
List<String> callLog,
|
||||||
|
List<Map<String, Object>> jdbcPrimaryKeys,
|
||||||
|
SQLException jdbcPrimaryKeyFailure
|
||||||
|
) {
|
||||||
|
return proxy(DatabaseMetaData.class, (method, args) -> {
|
||||||
|
if ("getPrimaryKeys".equals(method.getName())) {
|
||||||
|
callLog.add("JDBC_PRIMARY_KEYS");
|
||||||
|
assertEquals(null, args[0]);
|
||||||
|
assertEquals("SQLUser", args[1]);
|
||||||
|
assertEquals("People", args[2]);
|
||||||
|
if (jdbcPrimaryKeyFailure != null) {
|
||||||
|
throw jdbcPrimaryKeyFailure;
|
||||||
|
}
|
||||||
|
return fakeResultSet(jdbcPrimaryKeys);
|
||||||
|
}
|
||||||
|
if ("getColumns".equals(method.getName())) {
|
||||||
|
throw new AssertionError("Caché 2012+ columns must not use JDBC DatabaseMetaData.getColumns()");
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PreparedStatement fakeStatement(
|
||||||
|
String sql,
|
||||||
|
boolean inlinePrimaryKey,
|
||||||
|
List<Map<String, Object>> nativePrimaryKeys
|
||||||
|
) {
|
||||||
|
return proxy(PreparedStatement.class, (method, args) -> {
|
||||||
|
if ("executeQuery".equals(method.getName())) {
|
||||||
|
if (sql.contains("KEY_COLUMN_USAGE")) {
|
||||||
|
return fakeResultSet(nativePrimaryKeys);
|
||||||
|
}
|
||||||
|
return fakeResultSet(List.of(
|
||||||
|
Map.of(
|
||||||
|
"COLUMN_NAME", "ID",
|
||||||
|
"DATA_TYPE", "INTEGER",
|
||||||
|
"IS_NULLABLE", "NO",
|
||||||
|
"COLUMN_DEFAULT", "42",
|
||||||
|
"PRIMARY_KEY", inlinePrimaryKey ? "YES" : "NO",
|
||||||
|
"DESCRIPTION", "identifier",
|
||||||
|
"NUMERIC_PRECISION", 10,
|
||||||
|
"NUMERIC_SCALE", 0
|
||||||
|
),
|
||||||
|
Map.of(
|
||||||
|
"COLUMN_NAME", "NAME",
|
||||||
|
"DATA_TYPE", "VARCHAR",
|
||||||
|
"IS_NULLABLE", "YES",
|
||||||
|
"PRIMARY_KEY", "NO",
|
||||||
|
"CHARACTER_MAXIMUM_LENGTH", 64
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ResultSet fakeResultSet(List<Map<String, Object>> rows) {
|
||||||
|
final int[] index = {-1};
|
||||||
|
final boolean[] wasNull = {false};
|
||||||
|
return proxy(ResultSet.class, (method, args) -> {
|
||||||
|
String name = method.getName();
|
||||||
|
if ("next".equals(name)) {
|
||||||
|
index[0] += 1;
|
||||||
|
return index[0] < rows.size();
|
||||||
|
}
|
||||||
|
if ("getString".equals(name)) {
|
||||||
|
Object value = rows.get(index[0]).get((String) args[0]);
|
||||||
|
wasNull[0] = value == null;
|
||||||
|
return value == null ? null : String.valueOf(value);
|
||||||
|
}
|
||||||
|
if ("getInt".equals(name)) {
|
||||||
|
Object value = rows.get(index[0]).get((String) args[0]);
|
||||||
|
wasNull[0] = value == null;
|
||||||
|
return value instanceof Number ? ((Number) value).intValue() : 0;
|
||||||
|
}
|
||||||
|
if ("getObject".equals(name)) {
|
||||||
|
Object value = rows.get(index[0]).get((String) args[0]);
|
||||||
|
wasNull[0] = value == null;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if ("wasNull".equals(name)) {
|
||||||
|
return wasNull[0];
|
||||||
|
}
|
||||||
|
return defaultValue(method.getReturnType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static <T> T proxy(Class<T> type, MethodHandler handler) {
|
||||||
|
InvocationHandler invocationHandler = new InvocationHandler() {
|
||||||
|
@Override
|
||||||
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
|
return handler.handle(method, args == null ? new Object[0] : args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (T) Proxy.newProxyInstance(type.getClassLoader(), new Class<?>[]{type}, invocationHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object defaultValue(Class<?> type) {
|
||||||
|
if (Boolean.TYPE.equals(type)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Integer.TYPE.equals(type)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface MethodHandler {
|
||||||
|
Object handle(Method method, Object[] args) throws Throwable;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ db2 native-pushdown java-sql Uses SYSCAT metadata with type, filter, stable orde
|
|||||||
gbase8a native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.
|
gbase8a native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.
|
||||||
gbase8s native-pushdown java-sql Uses systables with type, filter, stable order, and SKIP/FIRST.
|
gbase8s native-pushdown java-sql Uses systables with type, filter, stable order, and SKIP/FIRST.
|
||||||
goldendb native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.
|
goldendb native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.
|
||||||
|
iris native-pushdown java-sql Tables via JDBC metadata; columns and primary keys via INFORMATION_SCHEMA.COLUMNS/KEY_COLUMN_USAGE with JDBC fallback.
|
||||||
|
cache native-pushdown java-sql Mirrors iris; plain JDBC metadata fallback covers Caché releases before 2012.1 that lack INFORMATION_SCHEMA.
|
||||||
h2 native-pushdown java-sql Uses INFORMATION_SCHEMA with type, filter, stable order, and LIMIT/OFFSET.
|
h2 native-pushdown java-sql Uses INFORMATION_SCHEMA with type, filter, stable order, and LIMIT/OFFSET.
|
||||||
hive-go shared-fallback native-go Uses HiveServer2 metadata APIs, then applies stable filtering and paging in the native agent with a SHOW TABLES fallback.
|
hive-go shared-fallback native-go Uses HiveServer2 metadata APIs, then applies stable filtering and paging in the native agent with a SHOW TABLES fallback.
|
||||||
ignite intentional-fallback java-jdbc-metadata Uses JDBC metadata from the Ignite thin driver; no portable server-side paging API, common constraints filter locally.
|
ignite intentional-fallback java-jdbc-metadata Uses JDBC metadata from the Ignite thin driver; no portable server-side paging API, common constraints filter locally.
|
||||||
|
|||||||
|
@@ -6,7 +6,7 @@ def driverModules = [
|
|||||||
'teradata', 'vertica', 'firebird', 'exasol', 'oceanbase-oracle', 'gbase8a', 'gbase8s',
|
'teradata', 'vertica', 'firebird', 'exasol', 'oceanbase-oracle', 'gbase8a', 'gbase8s',
|
||||||
'bigquery', 'kylin', 'ignite', 'ignite3', 'spanner', 'sundb', 'h2', 'h2-legacy', 'snowflake', 'trino', 'spark',
|
'bigquery', 'kylin', 'ignite', 'ignite3', 'spanner', 'sundb', 'h2', 'h2-legacy', 'snowflake', 'trino', 'spark',
|
||||||
'db2', 'informix', 'mongodb', 'highgo', 'uxdb', 'yashandb', 'oscar',
|
'db2', 'informix', 'mongodb', 'highgo', 'uxdb', 'yashandb', 'oscar',
|
||||||
'iris', 'kafka', 'sqlserver-legacy'
|
'iris', 'cache', 'kafka', 'sqlserver-legacy'
|
||||||
]
|
]
|
||||||
|
|
||||||
include(*(infrastructureModules + driverModules))
|
include(*(infrastructureModules + driverModules))
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"access": "0.1.52",
|
"access": "0.1.52",
|
||||||
"bigquery": "0.1.56",
|
"bigquery": "0.1.56",
|
||||||
|
"cache": "0.1.0",
|
||||||
"cassandra": "0.1.47",
|
"cassandra": "0.1.47",
|
||||||
"dameng": "0.1.62",
|
"dameng": "0.1.62",
|
||||||
"databend": "0.1.43",
|
"databend": "0.1.43",
|
||||||
|
|||||||
@@ -2971,7 +2971,7 @@ const isH2FileMode = computed(() => form.value.db_type === "h2" && h2ConnectionM
|
|||||||
const isH2CustomDriver = computed(() => form.value.db_type === "h2" && form.value.driver_profile === "h2-custom");
|
const isH2CustomDriver = computed(() => form.value.db_type === "h2" && form.value.driver_profile === "h2-custom");
|
||||||
const usesLocalFilePathInput = computed(() => isLocalFileTypeDb(form.value.db_type) && (form.value.db_type !== "h2" || isH2FileMode.value));
|
const usesLocalFilePathInput = computed(() => isLocalFileTypeDb(form.value.db_type) && (form.value.db_type !== "h2" || isH2FileMode.value));
|
||||||
|
|
||||||
const connectionUrlPlaceholder = computed(() => getUrlPlaceholder(form.value.db_type));
|
const connectionUrlPlaceholder = computed(() => getUrlPlaceholder(form.value.db_type, form.value.driver_profile));
|
||||||
const jdbcUsernamePlaceholder = computed(() => (form.value.driver_profile === "dremio" || isJdbcProductConnection.value ? "" : "sa"));
|
const jdbcUsernamePlaceholder = computed(() => (form.value.driver_profile === "dremio" || isJdbcProductConnection.value ? "" : "sa"));
|
||||||
const filePathPlaceholder = computed(() => {
|
const filePathPlaceholder = computed(() => {
|
||||||
if (form.value.db_type === "duckdb") return "/path/to/database.duckdb or :memory:";
|
if (form.value.db_type === "duckdb") return "/path/to/database.duckdb or :memory:";
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ const assetIcons: Record<string, string> = {
|
|||||||
nacos: "nacos.png",
|
nacos: "nacos.png",
|
||||||
consul: "consul",
|
consul: "consul",
|
||||||
iris: "iris",
|
iris: "iris",
|
||||||
|
cache: "iris",
|
||||||
influxdb: "influxdb",
|
influxdb: "influxdb",
|
||||||
influxdb3: "influxdb",
|
influxdb3: "influxdb",
|
||||||
victoriametrics: "victoriametrics.png",
|
victoriametrics: "victoriametrics.png",
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export function connectionDisplayUrlScheme(connection: Pick<ConnectionConfig, "d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function connectionUrlPlaceholder(dbType: DatabaseType): string {
|
export function connectionUrlPlaceholder(dbType: DatabaseType, driverProfile?: string): string {
|
||||||
switch (dbType) {
|
switch (dbType) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "doris":
|
case "doris":
|
||||||
@@ -258,7 +258,7 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
|
|||||||
return "spanner:///projects/{project}/instances/{instance}/databases/{database}";
|
return "spanner:///projects/{project}/instances/{instance}/databases/{database}";
|
||||||
|
|
||||||
case "iris":
|
case "iris":
|
||||||
return "iris://user:password@host:port/namespace";
|
return driverProfile === "cache" ? "cache://user:password@host:port/namespace" : "iris://user:password@host:port/namespace";
|
||||||
|
|
||||||
case "influxdb":
|
case "influxdb":
|
||||||
return "influxdb://user:password@host:port/database";
|
return "influxdb://user:password@host:port/database";
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ export const CONNECTION_PROFILES = {
|
|||||||
consul: { type: "consul", port: 8500, user: "", label: "Consul", icon: "consul", host: "127.0.0.1" },
|
consul: { type: "consul", port: 8500, user: "", label: "Consul", icon: "consul", host: "127.0.0.1" },
|
||||||
mqtt: { type: "mqtt", port: 1883, user: "", label: "MQTT", icon: "mqtt", host: "127.0.0.1" },
|
mqtt: { type: "mqtt", port: 1883, user: "", label: "MQTT", icon: "mqtt", host: "127.0.0.1" },
|
||||||
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
|
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
|
||||||
|
cache: { type: "iris", port: 1972, user: "_SYSTEM", label: "InterSystems Caché", icon: "cache" },
|
||||||
influxdb: { type: "influxdb", port: 8086, user: "", label: "InfluxDB", icon: "InfluxDB" },
|
influxdb: { type: "influxdb", port: 8086, user: "", label: "InfluxDB", icon: "InfluxDB" },
|
||||||
influxdb3: { type: "influxdb3", port: 8181, user: "", label: "InfluxDB 3.x", icon: "InfluxDB" },
|
influxdb3: { type: "influxdb3", port: 8181, user: "", label: "InfluxDB 3.x", icon: "InfluxDB" },
|
||||||
victoriametrics: { type: "victoriametrics", port: 8428, user: "", label: "VictoriaMetrics", icon: "victoriametrics" },
|
victoriametrics: { type: "victoriametrics", port: 8428, user: "", label: "VictoriaMetrics", icon: "victoriametrics" },
|
||||||
@@ -223,6 +224,7 @@ export const CONNECTION_PROFILE_ICONS = {
|
|||||||
consul: "consul",
|
consul: "consul",
|
||||||
mqtt: "mqtt",
|
mqtt: "mqtt",
|
||||||
iris: "iris",
|
iris: "iris",
|
||||||
|
cache: "cache",
|
||||||
influxdb: "influxdb",
|
influxdb: "influxdb",
|
||||||
influxdb3: "influxdb",
|
influxdb3: "influxdb",
|
||||||
victoriametrics: "victoriametrics",
|
victoriametrics: "victoriametrics",
|
||||||
@@ -322,6 +324,7 @@ export const CONNECTION_PICKER_OPTIONS = [
|
|||||||
{ value: "consul", label: "Consul", category: "registry_config" },
|
{ value: "consul", label: "Consul", category: "registry_config" },
|
||||||
{ value: "mqtt", label: "MQTT", category: "mq" },
|
{ value: "mqtt", label: "MQTT", category: "mq" },
|
||||||
{ value: "iris", label: "IRIS", category: "sql" },
|
{ value: "iris", label: "IRIS", category: "sql" },
|
||||||
|
{ value: "cache", label: "InterSystems Caché", category: "sql" },
|
||||||
{ value: "influxdb", label: "InfluxDB", category: "timeseries" },
|
{ value: "influxdb", label: "InfluxDB", category: "timeseries" },
|
||||||
{ value: "influxdb3", label: "InfluxDB 3.x", category: "timeseries" },
|
{ value: "influxdb3", label: "InfluxDB 3.x", category: "timeseries" },
|
||||||
{ value: "victoriametrics", label: "VictoriaMetrics", category: "timeseries" },
|
{ value: "victoriametrics", label: "VictoriaMetrics", category: "timeseries" },
|
||||||
|
|||||||
@@ -2651,6 +2651,15 @@
|
|||||||
"runtimeMode": "agent",
|
"runtimeMode": "agent",
|
||||||
"mcpMode": "bridge",
|
"mcpMode": "bridge",
|
||||||
"agentKey": "iris",
|
"agentKey": "iris",
|
||||||
|
"driverProfiles": [
|
||||||
|
{
|
||||||
|
"profile": "cache",
|
||||||
|
"agentKey": "cache",
|
||||||
|
"label": "InterSystems Caché",
|
||||||
|
"storeVisible": true,
|
||||||
|
"storeOrder": 51
|
||||||
|
}
|
||||||
|
],
|
||||||
"driverStoreVisible": true,
|
"driverStoreVisible": true,
|
||||||
"driverStoreOrder": 42,
|
"driverStoreOrder": 42,
|
||||||
"singleConnectionPool": true,
|
"singleConnectionPool": true,
|
||||||
|
|||||||
@@ -124,6 +124,17 @@ mod tests {
|
|||||||
assert_eq!(driver_store_entries().filter(|(key, _)| *key == "hive").count(), 1);
|
assert_eq!(driver_store_entries().filter(|(key, _)| *key == "hive").count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cache_profile_uses_dedicated_agent_under_iris() {
|
||||||
|
assert_eq!(agent_key(&DatabaseType::Iris, None), Some("iris"));
|
||||||
|
assert_eq!(agent_key(&DatabaseType::Iris, Some("iris")), Some("iris"));
|
||||||
|
assert_eq!(agent_key(&DatabaseType::Iris, Some("cache")), Some("cache"));
|
||||||
|
assert_eq!(label_for_key("cache"), Some("InterSystems Caché"));
|
||||||
|
// The Caché agent ships its own shaded CacheDB driver, so it needs its
|
||||||
|
// own driver store entry for install/upgrade/uninstall.
|
||||||
|
assert!(driver_store_entries().any(|(key, label)| key == "cache" && label == "InterSystems Caché"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn manifest_agent_keys_match_catalog_defaults() {
|
fn manifest_agent_keys_match_catalog_defaults() {
|
||||||
for entry in database_manifest::entries().iter().filter(|entry| entry.agent_key.is_some()) {
|
for entry in database_manifest::entries().iter().filter(|entry| entry.agent_key.is_some()) {
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ dialect: Iris
|
|||||||
runtimeMode: agent
|
runtimeMode: agent
|
||||||
mcpMode: bridge
|
mcpMode: bridge
|
||||||
agentKey: iris
|
agentKey: iris
|
||||||
|
driverProfiles:
|
||||||
|
- profile: cache
|
||||||
|
agentKey: cache
|
||||||
|
label: InterSystems Caché
|
||||||
|
storeVisible: true
|
||||||
|
storeOrder: 51
|
||||||
driverStoreVisible: true
|
driverStoreVisible: true
|
||||||
driverStoreOrder: 42
|
driverStoreOrder: 42
|
||||||
singleConnectionPool: true
|
singleConnectionPool: true
|
||||||
|
|||||||
@@ -699,6 +699,13 @@ profiles:
|
|||||||
port: 1972
|
port: 1972
|
||||||
user: _SYSTEM
|
user: _SYSTEM
|
||||||
category: sql
|
category: sql
|
||||||
|
- id: cache
|
||||||
|
dbType: iris
|
||||||
|
label: InterSystems Caché
|
||||||
|
icon: cache
|
||||||
|
port: 1972
|
||||||
|
user: _SYSTEM
|
||||||
|
category: sql
|
||||||
- id: influxdb
|
- id: influxdb
|
||||||
dbType: influxdb
|
dbType: influxdb
|
||||||
label: InfluxDB
|
label: InfluxDB
|
||||||
|
|||||||
Reference in new issue
Block a user