ResultSetpublic abstract class AbsResultSet extends Object implements ResultSet
This class provides basic implementation for ResultSet, and is supposed to be extended by ResultSet implementation class.
SystemCapability.Data#DATA_APPDATAMGRResultSet.ColumnType| 限定符和类型 | 字段 | 说明 |
|---|---|---|
protected static int |
DEFAULT_POS |
The default position of the result set.
|
protected boolean |
isClosed |
Indicates whether the result set is closed.
|
protected int |
pos |
Indicates the result set position.
|
| 构造器 | 说明 |
|---|---|
AbsResultSet() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
close() |
Closes the result set.
|
protected void |
finalize() |
Releases an object .
|
List<Uri> |
getAffectedByUris() |
Obtains the list of URIs registered to observe changes that affect the result set.
|
abstract String[] |
getAllColumnNames() |
Obtains the names of all columns in a result set.
|
abstract 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.
|
abstract 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.
|
abstract float |
getFloat(int columnIndex) |
Obtains the value of the specified column in the current row as a float.
|
abstract int |
getInt(int columnIndex) |
Obtains the value of the specified column in the current row as an int.
|
abstract long |
getLong(int columnIndex) |
Obtains the value of the specified column in the current row as a long.
|
abstract int |
getRowCount() |
Obtains the number of rows in the result set.
|
int |
getRowIndex() |
Obtains the current index of the result set.
|
abstract short |
getShort(int columnIndex) |
Obtains the value of the specified column in the current row as a short.
|
abstract 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.
|
abstract 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.
|
abstract 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.
|
protected void |
notifyChange() |
Notify all Observers that this ResultSet has changed.
|
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.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetColumnTypeForIndexprotected static final int DEFAULT_POS
protected boolean isClosed
protected int pos
public abstract int getRowCount()
ResultSetgetRowCount 在接口中 ResultSetpublic abstract 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 在接口中 ResultSetpublic abstract 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.
public abstract 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.
public abstract short getShort(int columnIndex)
ResultSet
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].
public abstract int getInt(int columnIndex)
ResultSet
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].
public abstract long getLong(int columnIndex)
ResultSetThe 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].
public abstract float getFloat(int columnIndex)
ResultSetThe 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.
public abstract double getDouble(int columnIndex)
ResultSetThe 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.
public abstract boolean isColumnNull(int columnIndex)
ResultSetisColumnNull 在接口中 ResultSetcolumnIndex - 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 abstract boolean goToRow(int rowIndex)
ResultSetpublic int getRowIndex()
ResultSetThe result set index starts from 0.
getRowIndex 在接口中 ResultSetpublic boolean goTo(int offset)
ResultSetpublic boolean goToFirstRow()
ResultSetgoToFirstRow 在接口中 ResultSettrue if the result set is moved successfully;
returns false otherwise, for example, if the result set is empty.public boolean goToLastRow()
ResultSetgoToLastRow 在接口中 ResultSettrue if the result set is moved successfully;
returns false otherwise, for example, if the result set is empty.public boolean goToNextRow()
ResultSetgoToNextRow 在接口中 ResultSettrue if the result set is moved successfully;
returns false otherwise, for example, if the result set is already in the last row.public boolean goToPreviousRow()
ResultSetgoToPreviousRow 在接口中 ResultSettrue if the result set is moved successfully;
returns false otherwise, for example, if the result set is already in the first row.public boolean isAtFirstRow()
ResultSetisAtFirstRow 在接口中 ResultSettrue if the result set is positioned at the first row; returns false otherwise.public boolean isAtLastRow()
ResultSetisAtLastRow 在接口中 ResultSettrue if the result set is positioned at the last row; returns false otherwise.public boolean isStarted()
ResultSetpublic boolean isEnded()
ResultSetpublic int getColumnCount()
ResultSetThe returned number is equal to the length of the string array returned by the
getAllColumnNames method.
getColumnCount 在接口中 ResultSetResultSet.getAllColumnNames()public int getColumnIndexForName(String columnName)
ResultSetThe column name is passed as an input parameter.
getColumnIndexForName 在接口中 ResultSetcolumnName - Indicates the name of the specified column in the result set.public String getColumnNameForIndex(int columnIndex)
ResultSetThe column index is passed as an input parameter.
getColumnNameForIndex 在接口中 ResultSetcolumnIndex - Indicates the index of the specified column in the result set.public void setExtensions(PacMap extensions)
ResultSetYou can set extensions based on your service requirements.
setExtensions 在接口中 ResultSetextensions - Indicates the extensions to set.ResultSet.getExtensions()public PacMap getExtensions()
ResultSetThe extensions you will obtain are those set based on your service requirements.
getExtensions 在接口中 ResultSetResultSet.setExtensions(ohos.utils.PacMap)public void setAffectedByUris(Object context, List<Uri> uris)
ResultSetAfter setting the URIs, call the ResultSet#registerObserver method to register an observer
that listens for data changes.
setAffectedByUris 在接口中 ResultSetcontext - Indicates the context.uris - Uri list to observe changes which affect this ResultSet.ResultSet.registerObserver(ohos.data.rdb.DataObserver)public List<Uri> getAffectedByUris()
ResultSetThe list of URIs is set using the ResultSet#setAffectedByUris method.
getAffectedByUris 在接口中 ResultSetpublic void registerObserver(DataObserver observer)
ResultSetWhen a notification of the change of data with a specified URI is received, this observer will be triggered.
registerObserver 在接口中 ResultSetobserver - Indicates the observer to be registered.ResultSet.setAffectedByUris(java.lang.Object, java.util.List<ohos.utils.net.Uri>),
ResultSet.unregisterObserver(ohos.data.rdb.DataObserver)public void unregisterObserver(DataObserver observer)
ResultSetThis method is used to release the observer before the component to which the observer belongs is destroyed.
unregisterObserver 在接口中 ResultSetobserver - Indicates the observer to be deregistered.public void close()
ResultSetCalling this method on the result set will release all of its resources and makes it ineffective.
close 在接口中 ResultSetResultSet.isClosed()public boolean isClosed()
ResultSetIf the result set is closed by calling the close method, true will be returned.
isClosed 在接口中 ResultSettrue if the result set is closed; returns false otherwise.ResultSet.close()protected void finalize()
Use this method if no call will be made to any method of this object.
finalize 在类中 ObjectWeakReference,
PhantomReferenceprotected void notifyChange()