Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The database type is judged by enumeration. #871

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ai.chat2db.spi.sql;

import ai.chat2db.server.tools.base.constant.EasyToolsConstant;
import ai.chat2db.server.tools.base.enums.DataSourceTypeEnum;
import ai.chat2db.server.tools.common.util.I18nUtils;
import ai.chat2db.spi.ValueHandler;
import ai.chat2db.spi.jdbc.DefaultValueHandler;
Expand Down Expand Up @@ -203,7 +204,8 @@ public ExecuteResult execute(final String sql, Connection connection, boolean li
// 获取header信息
List<Header> headerList = Lists.newArrayListWithExpectedSize(col);
executeResult.setHeaderList(headerList);
int chat2dbAutoRowIdIndex = -1;// chat2db自动生成的行分页ID
// chat2db自动生成的行分页ID
int chat2dbAutoRowIdIndex = -1;

for (int i = 1; i <= col; i++) {
String name = ResultSetUtils.getColumnName(resultSetMetaData, i);
Expand Down Expand Up @@ -344,7 +346,7 @@ public List<Table> tables(Connection connection, String databaseName, String sch
ResultSet resultSet = metadata.getTables(databaseName, schemaName, tableName,
types);
// 如果connection为mysql
if ("MySQL".equalsIgnoreCase(metadata.getDatabaseProductName())) {
if (DataSourceTypeEnum.MYSQL.getCode().equalsIgnoreCase(metadata.getDatabaseProductName())) {
// 获取mysql表的comment
List<Table> tables = ResultSetUtils.toObjectList(resultSet, Table.class);
if (CollectionUtils.isNotEmpty(tables)) {
Expand Down