Skip to content

Commit

Permalink
feat: support as
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron3S committed Jan 14, 2025
1 parent 347675e commit 788943a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.alibaba.druid.sql.ast.statement.SQLUpdateStatement;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jumpserver.chen.framework.datasource.ConnectionManager;
import org.jumpserver.chen.framework.datasource.entity.resource.Field;
import org.jumpserver.chen.framework.datasource.sql.*;
Expand Down Expand Up @@ -150,7 +151,10 @@ private void executeStatement(SQLExecutePlan plan, Statement statement, SQLQuery

for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
Field field = new Field();
field.setName(resultSet.getMetaData().getColumnName(i));

var fieldName = StringUtils.isNotEmpty(resultSet.getMetaData().getColumnLabel(i)) ?
resultSet.getMetaData().getColumnLabel(i) : resultSet.getMetaData().getColumnName(i);
field.setName(fieldName);
result.getFields().add(field);
}

Expand Down

0 comments on commit 788943a

Please sign in to comment.