mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-03 16:34:19 +01:00
Add columnNames to LimboResultSet
This commit is contained in:
@@ -19,6 +19,8 @@ public class LimboResultSet {
|
||||
|
||||
private final LimboStatement statement;
|
||||
|
||||
// Name of the columns
|
||||
private String[] columnNames = new String[0];
|
||||
// Whether the result set does not have any rows.
|
||||
private boolean isEmptyResultSet = false;
|
||||
// If the result set is open. Doesn't mean it has results.
|
||||
@@ -136,6 +138,14 @@ public class LimboResultSet {
|
||||
return resultSet[columnIndex - 1];
|
||||
}
|
||||
|
||||
public String[] getColumnNames() {
|
||||
return this.columnNames;
|
||||
}
|
||||
|
||||
public void setColumnNames(String[] columnNames) {
|
||||
this.columnNames = columnNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LimboResultSet{"
|
||||
|
||||
@@ -89,6 +89,23 @@ public class LimboStatement {
|
||||
|
||||
private native void _close(long statementPointer);
|
||||
|
||||
/**
|
||||
* Initializes the column metadata, such as the names of the columns. Since {@link LimboStatement}
|
||||
* can only have a single {@link LimboResultSet}, it is appropriate to place the initialization of
|
||||
* column metadata here.
|
||||
*
|
||||
* @throws SQLException if a database access error occurs while retrieving column names
|
||||
*/
|
||||
public void initializeColumnMetadata() throws SQLException {
|
||||
final String[] columnNames = this.columnNames(statementPointer);
|
||||
if (columnNames != null) {
|
||||
this.resultSet.setColumnNames(columnNames);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private native String[] columnNames(long statementPointer) throws SQLException;
|
||||
|
||||
/**
|
||||
* Checks if the statement is closed.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user