mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 06:27:21 +00:00
[improvement][headless] Fix the issue of retrieving empty table information in H2 (#1789)
This commit is contained in:
@@ -45,8 +45,8 @@ public abstract class BaseDbAdaptor implements DbAdaptor {
|
||||
List<String> tablesAndViews = new ArrayList<>();
|
||||
DatabaseMetaData metaData = getDatabaseMetaData(connectionInfo);
|
||||
|
||||
try (ResultSet resultSet =
|
||||
metaData.getTables(schemaName, schemaName, null, new String[] {"TABLE", "VIEW"})) {
|
||||
try {
|
||||
ResultSet resultSet = getResultSet(schemaName, metaData);
|
||||
while (resultSet.next()) {
|
||||
String name = resultSet.getString("TABLE_NAME");
|
||||
tablesAndViews.add(name);
|
||||
@@ -57,6 +57,11 @@ public abstract class BaseDbAdaptor implements DbAdaptor {
|
||||
return tablesAndViews;
|
||||
}
|
||||
|
||||
protected ResultSet getResultSet(String schemaName, DatabaseMetaData metaData)
|
||||
throws SQLException {
|
||||
return metaData.getTables(schemaName, schemaName, null, new String[] {"TABLE", "VIEW"});
|
||||
}
|
||||
|
||||
public List<DBColumn> getColumns(ConnectInfo connectInfo, String schemaName, String tableName)
|
||||
throws SQLException {
|
||||
List<DBColumn> dbColumns = Lists.newArrayList();
|
||||
|
||||
@@ -2,7 +2,13 @@ package com.tencent.supersonic.headless.core.adaptor.db;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.Constants;
|
||||
import com.tencent.supersonic.common.pojo.enums.TimeDimensionEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Slf4j
|
||||
public class H2Adaptor extends BaseDbAdaptor {
|
||||
|
||||
@Override
|
||||
@@ -30,6 +36,11 @@ public class H2Adaptor extends BaseDbAdaptor {
|
||||
return column;
|
||||
}
|
||||
|
||||
protected ResultSet getResultSet(String schemaName, DatabaseMetaData metaData)
|
||||
throws SQLException {
|
||||
return metaData.getTables(schemaName, null, null, new String[] {"TABLE", "VIEW"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String functionNameCorrector(String sql) {
|
||||
return sql;
|
||||
|
||||
Reference in New Issue
Block a user