Skip to content

Commit 4fa3a72

Browse files
committed
Added test to read all system table columns
1 parent 52ba3b8 commit 4fa3a72

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

jdbc/src/test/java/tech/ydb/jdbc/impl/YdbDatabaseMetaDataImplTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import org.junit.jupiter.api.BeforeEach;
1818
import org.junit.jupiter.api.Test;
1919
import org.junit.jupiter.api.extension.RegisterExtension;
20+
import org.slf4j.Logger;
21+
import org.slf4j.LoggerFactory;
2022

2123
import tech.ydb.jdbc.YdbConst;
2224
import tech.ydb.jdbc.YdbDatabaseMetaData;
@@ -31,6 +33,8 @@
3133
import tech.ydb.test.junit5.YdbHelperExtension;
3234

3335
public class YdbDatabaseMetaDataImplTest {
36+
private static final Logger logger = LoggerFactory.getLogger(YdbDatabaseMetaDataImplTest.class);
37+
3438
@RegisterExtension
3539
private static final YdbHelperExtension ydb = new YdbHelperExtension();
3640

@@ -612,6 +616,19 @@ public void getColumns() throws SQLException {
612616
rs.assertNoRows();
613617
}
614618

619+
@Test
620+
public void getAllColumnsTest() throws SQLException {
621+
// Get all columns from all tables, include system tables. Test checks if jdbc driver reads it all successfully
622+
ResultSet rs = metaData.getColumns(null, null, null, null);
623+
Assertions.assertTrue(rs.next());
624+
do {
625+
logger.info("read column {} [{}] -> {}[{}]",
626+
rs.getString("TABLE_NAME"), rs.getString("COLUMN_NAME"),
627+
rs.getString("TYPE_NAME"), rs.getInt("DATA_TYPE"));
628+
} while (rs.next());
629+
rs.close();
630+
}
631+
615632
@Test
616633
public void getPrimaryKeys() throws SQLException {
617634
TableAssert primaryKeys = new TableAssert();

0 commit comments

Comments
 (0)