mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-30 06:24:21 +01:00
Add columnNames to LimboResultSet
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.github.tursodatabase.core;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.github.tursodatabase.TestUtils;
|
||||
@@ -28,4 +30,26 @@ class LimboStatementTest {
|
||||
assertTrue(stmt.isClosed());
|
||||
assertFalse(stmt.getResultSet().isOpen());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_initializeColumnMetadata() throws Exception {
|
||||
runSql("CREATE TABLE users (name TEXT, age INT, country TEXT);");
|
||||
runSql("INSERT INTO users VALUES ('seonwoo', 30, 'KR');");
|
||||
|
||||
final LimboStatement stmt = connection.prepare("SELECT * FROM users");
|
||||
stmt.initializeColumnMetadata();
|
||||
final LimboResultSet rs = stmt.getResultSet();
|
||||
final String[] columnNames = rs.getColumnNames();
|
||||
|
||||
assertEquals(columnNames[0], "name");
|
||||
assertEquals(columnNames[1], "age");
|
||||
assertEquals(columnNames[2], "country");
|
||||
}
|
||||
|
||||
private void runSql(String sql) throws Exception {
|
||||
LimboStatement stmt = connection.prepare(sql);
|
||||
while (stmt.execute()) {
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user