bug: Fixed the resultset load alias column and replace to getColumnLabel instead of getColumnName (original name)

This commit is contained in:
Sambo Chea 2023-03-29 09:17:01 +07:00
parent 94098a10f3
commit 23c16c35e7
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
2 changed files with 6 additions and 3 deletions

View File

@ -34,7 +34,11 @@ public final class ResultSetUtil {
IntStream.range(0, columnCount).forEach(i -> { IntStream.range(0, columnCount).forEach(i -> {
try { try {
columns.add(metaData.getColumnName(i + 1)); String str = metaData.getColumnLabel(i + 1);
if (str == null || str.isEmpty()) {
str = metaData.getColumnName(i + 1);
}
columns.add(str);
} catch (SQLException e) { } catch (SQLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -2,7 +2,6 @@ package com.cubetiqs.sql;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.sql.SQLException;
import java.util.List; import java.util.List;
public class ConnectionTests { public class ConnectionTests {
@ -19,7 +18,7 @@ public class ConnectionTests {
JdbcDataFactory factory = ConnectionFactory JdbcDataFactory factory = ConnectionFactory
.createDataFactory(builder); .createDataFactory(builder);
IExecuteResult<List<Object>> result = factory.queryForList("select * from um"); IExecuteResult<List<Object>> result = factory.queryForList("select Status as gg from um");
System.out.println(result.getData()); System.out.println(result.getData());
factory.tryClose(); factory.tryClose();