SharedResultSetpublic interface ResultSet
The abstract class AbsResultSet implements some methods in the ResultSet interface.
AbsResultSetSystemCapability.Data#DATA_APPDATAMGR| 限定符和类型 | 接口 | 说明 |
|---|---|---|
static class |
ResultSet.ColumnType |
Defines the data types of columns in the result set.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
close() |
Closes the result set.
|
List<Uri> |
getAffectedByUris() |
Obtains the list of URIs registered to observe changes that affect the result set.
|
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.
|
int |
getColumnIndexForName(String columnName) |
Obtains the column index based on the specified column name.
|
String |
getColumnNameForIndex(int columnIndex) |
Obtains the column name based on the specified column index.
|
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.
|
PacMap |
getExtensions() |
Obtains extensions of the result set.
|
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.
|
int |
getRowIndex() |
Obtains the current index of 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 |
goTo(int offset) |
Go to the specified row of the result set forwards or backwards by an offset relative to its current position.
|
boolean |
goToFirstRow() |
Go to the first row of the result set.
|
boolean |
goToLastRow() |
Go to the last row of the result set.
|
boolean |
goToNextRow() |
Go to the next row of the result set.
|
boolean |
goToPreviousRow() |
Go to the previous row of the result set.
|
boolean |
goToRow(int rowIndex) |
Go to the specified row of the result set.
|
boolean |
isAtFirstRow() |
Checks whether the result set is positioned at the first row.
|
boolean |
isAtLastRow() |
Checks whether the result set is positioned at the last row.
|
boolean |
isClosed() |
Checks whether the current result set is closed.
|
boolean |
isColumnNull(int columnIndex) |
Checks whether the value of the specified column in the current row is null.
|
boolean |
isEnded() |
Checks whether the result set is positioned after the last row.
|
boolean |
isStarted() |
Checks whether a result set has been moved.
|
void |
registerObserver(DataObserver observer) |
Registers an observer that listens for data changes.
|
void |
setAffectedByUris(Object context,
List<Uri> uris) |
Sets the URIs of the data to be observed.
|
void |
setExtensions(PacMap extensions) |
Sets extensions of the result set.
|
void |
unregisterObserver(DataObserver observer) |
Deregisters an observer that listens for data changes.
|
String[] getAllColumnNames()
The column names are returned as a string array, in which the strings are in the same order as the columns in the result set.
int getColumnCount()
The returned number is equal to the length of the string array returned by the
getAllColumnNames method.
getAllColumnNames()ResultSet.ColumnType getColumnTypeForIndex(int columnIndex)
The return value is of the enumeration type, which can be an integer, float, String, Blob, or null.
columnIndex - Indicates the specified column index.int getColumnIndexForName(String columnName)
The column name is passed as an input parameter.
columnName - Indicates the name of the specified column in the result set.String getColumnNameForIndex(int columnIndex)
The column index is passed as an input parameter.
columnIndex - Indicates the index of the specified column in the result set.int getRowCount()
int getRowIndex()
The result set index starts from 0.
boolean goTo(int offset)
offset - Indicates the offset relative to the current position.true if the result set is moved successfully and does not go beyond the range;
returns false otherwise.boolean goToRow(int rowIndex)
rowIndex - Indicates the index of the specified row, which starts from 0.true if the result set is moved successfully; returns false otherwise.boolean goToFirstRow()
true if the result set is moved successfully;
returns false otherwise, for example, if the result set is empty.boolean goToLastRow()
true if the result set is moved successfully;
returns false otherwise, for example, if the result set is empty.boolean goToNextRow()
true if the result set is moved successfully;
returns false otherwise, for example, if the result set is already in the last row.boolean goToPreviousRow()
true if the result set is moved successfully;
returns false otherwise, for example, if the result set is already in the first row.boolean isEnded()
true if the result set is positioned after the last row;
returns false otherwise.boolean isStarted()
true if the result set has been moved; returns false
if the result set has not been moved or the result set is empty.boolean isAtFirstRow()
true if the result set is positioned at the first row; returns false otherwise.boolean isAtLastRow()
true if the result set is positioned at the last row; returns false otherwise.byte[] getBlob(int columnIndex)
The 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.
columnIndex - Indicates the specified column index, which starts from 0.String getString(int columnIndex)
The 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.
columnIndex - Indicates the specified column index, which starts from 0.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].
columnIndex - Indicates the specified column index, which starts from 0.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].
columnIndex - Indicates the specified column index, which starts from 0.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].
columnIndex - Indicates the specified column index, which starts from 0.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.
columnIndex - Indicates the specified column index, which starts from 0.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.
columnIndex - Indicates the specified column index, which starts from 0.boolean isColumnNull(int columnIndex)
columnIndex - 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.boolean isClosed()
If the result set is closed by calling the close method, true will be returned.
true if the result set is closed; returns false otherwise.close()void close()
Calling this method on the result set will release all of its resources and makes it ineffective.
isClosed()void setExtensions(PacMap extensions)
You can set extensions based on your service requirements.
extensions - Indicates the extensions to set.getExtensions()PacMap getExtensions()
The extensions you will obtain are those set based on your service requirements.
setExtensions(ohos.utils.PacMap)void setAffectedByUris(Object context, List<Uri> uris)
After setting the URIs, call the ResultSet#registerObserver method to register an observer
that listens for data changes.
context - Indicates the context.uris - Uri list to observe changes which affect this ResultSet.registerObserver(ohos.data.rdb.DataObserver)List<Uri> getAffectedByUris()
The list of URIs is set using the ResultSet#setAffectedByUris method.
void registerObserver(DataObserver observer)
When a notification of the change of data with a specified URI is received, this observer will be triggered.
observer - Indicates the observer to be registered.setAffectedByUris(java.lang.Object, java.util.List<ohos.utils.net.Uri>),
unregisterObserver(ohos.data.rdb.DataObserver)void unregisterObserver(DataObserver observer)
This method is used to release the observer before the component to which the observer belongs is destroyed.
observer - Indicates the observer to be deregistered.