ResultSetpublic class TableResultSet extends AbsResultSet
The result set is stored in a two-dimensional Object array,
and the addRow() method is used to add rows to the result set.
SystemCapability.Data#DATA_APPDATAMGR| 限定符和类型 | 类 | 说明 |
|---|---|---|
class |
TableResultSet.RowBuilder |
Represents the row builder of the matrix result set.
|
ResultSet.ColumnTypeDEFAULT_POS, isClosed, pos| 构造器 | 说明 |
|---|---|
TableResultSet(String[] columnNames) |
A constructor used to create a
TableResultSet instance with specified column names. |
TableResultSet(String[] columnNames,
int initialCapacity) |
A constructor used to create a
TableResultSet instance with specified column names and capacity. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addRow(Iterable<?> columnValues) |
Adds a row that contains column values of the iterator type to the end of a result set.
|
void |
addRow(Object[] columnValues) |
Adds a row that contains an array of column values to the end of a result set.
|
TableResultSet.RowBuilder |
addRowByBuilder() |
Adds a row to the end of a result set and obtains a builder.
|
String[] |
getAllColumnNames() |
Obtains the names of all columns in a result set.
|
byte[] |
getBlob(int columnIndex) |
Obtains the value of the specified column in the current row as a byte array.
|
int |
getColumnCount() |
Obtains the number of columns in the result set.
|
ResultSet.ColumnType |
getColumnTypeForIndex(int columnIndex) |
Obtains the data type based on the specified column index.
|
double |
getDouble(int columnIndex) |
Obtains the value of the specified column in the current row as a double.
|
float |
getFloat(int columnIndex) |
Obtains the value of the specified column in the current row as a float.
|
int |
getInt(int columnIndex) |
Obtains the value of the specified column in the current row as an int.
|
long |
getLong(int columnIndex) |
Obtains the value of the specified column in the current row as a long.
|
int |
getRowCount() |
Obtains the number of rows in the result set.
|
short |
getShort(int columnIndex) |
Obtains the value of the specified column in the current row as a short.
|
String |
getString(int columnIndex) |
Obtains the value of the specified column in the current row as a string.
|
boolean |
goToRow(int rowIndex) |
Go to the specified row of the result set.
|
boolean |
isColumnNull(int columnIndex) |
Checks whether the value of the specified column in the current row is null.
|
close, finalize, getAffectedByUris, getColumnIndexForName, getColumnNameForIndex, getExtensions, getRowIndex, goTo, goToFirstRow, goToLastRow, goToNextRow, goToPreviousRow, isAtFirstRow, isAtLastRow, isClosed, isEnded, isStarted, notifyChange, registerObserver, setAffectedByUris, setExtensions, unregisterObserverpublic TableResultSet(String[] columnNames, int initialCapacity)
TableResultSet instance with specified column names and capacity.
The TableResultSet instance can be initialized based on the input capacity and column names.
columnNames - Indicates an array of the column names. The sequence of columns is determined by the array.initialCapacity - Indicates the initial capacity of the TableResultSet instance.public TableResultSet(String[] columnNames)
TableResultSet instance with specified column names.
The TableResultSet instance can be initialized based on the input column names.
columnNames - Indicates an array of the column names. The sequence of columns is determined by the array.public TableResultSet.RowBuilder addRowByBuilder()
The obtained builder can be used to set column values for the added row.
public void addRow(Object[] columnValues)
columnValues - Indicates the column values in the same sequence as those specified during the result set
construction.IllegalArgumentException - Throws this exception if columnValues.length is not equal to
columnNames.length.public void addRow(Iterable<?> columnValues)
columnValues - Indicates the column values in the same sequence as those specified during the result set
construction.IllegalArgumentException - Throws this exception if columnValues.size() is not equal to
columnNames.length.public int getRowCount()
ResultSetgetRowCount 在接口中 ResultSetgetRowCount 在类中 AbsResultSetpublic String[] getAllColumnNames()
ResultSetThe column names are returned as a string array, in which the strings are in the same order as the columns in the result set.
getAllColumnNames 在接口中 ResultSetgetAllColumnNames 在类中 AbsResultSetpublic int getColumnCount()
ResultSetThe returned number is equal to the length of the string array returned by the
getAllColumnNames method.
getColumnCount 在接口中 ResultSetgetColumnCount 在类中 AbsResultSetResultSet.getAllColumnNames()public ResultSet.ColumnType getColumnTypeForIndex(int columnIndex)
ResultSetThe return value is of the enumeration type, which can be an integer, float, String, Blob, or null.
columnIndex - Indicates the specified column index.public byte[] getBlob(int columnIndex)
ResultSetThe implementation class determines whether to throw an exception if the value of the specified column in the current row is null or the specified column is not of the Blob type.
getBlob 在接口中 ResultSetgetBlob 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public String getString(int columnIndex)
ResultSetThe implementation class determines whether to throw an exception if the value of the specified column in the current row is null or the specified column is not of the string type.
getString 在接口中 ResultSetgetString 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public short getShort(int columnIndex)
he implementation class determines whether to throw an exception if the value of the specified column
in the current row is null, the specified column is not of the integer type, or the integer is beyond
the range [Short.MIN_VALUE, Short.MAX_VALUE].
getShort 在接口中 ResultSetgetShort 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public int getInt(int columnIndex)
The implementation class determines whether to throw an exception if the value of the specified column
in the current row is null, the specified column is not of the integer type, or the integer is beyond
the range [Integer.MIN_VALUE, Integer.MAX_VALUE].
getInt 在接口中 ResultSetgetInt 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public long getLong(int columnIndex)
The implementation class determines whether to throw an exception if the value of the specified column
in the current row is null, the specified column is not of the integer type, or the integer is beyond the
range [Long.MIN_VALUE, Long.MAX_VALUE].
getLong 在接口中 ResultSetgetLong 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public float getFloat(int columnIndex)
The implementation class determines whether to throw an exception if the value of the specified column in
the current row is null, the specified column is not of the floating-point type, or the floating-point value
cannot be represented by a float.
getFloat 在接口中 ResultSetgetFloat 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public double getDouble(int columnIndex)
The implementation class determines whether to throw an exception if the value of the specified column
in the current row is null, the specified column is not of the floating-point type, or the floating-point
value cannot be represented by a double.
getDouble 在接口中 ResultSetgetDouble 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.public boolean isColumnNull(int columnIndex)
ResultSetisColumnNull 在接口中 ResultSetisColumnNull 在类中 AbsResultSetcolumnIndex - Indicates the specified column index, which starts from 0.true if the value of the specified column in the current row is null;
returns false otherwise.public boolean goToRow(int rowIndex)
ResultSetgoToRow 在接口中 ResultSetgoToRow 在类中 AbsResultSetrowIndex - Indicates the index of the specified row, which starts from 0.true if the result set is moved successfully; returns false otherwise.