bug: Fixed the resultset load alias column and replace to getColumnLabel instead of getColumnName (original name)
This commit is contained in:
parent
94098a10f3
commit
23c16c35e7
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user