public interface Cursor
extends java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
static int |
FIELD_TYPE_BLOB
Value if the specified column type is blob
|
static int |
FIELD_TYPE_FLOAT
Value if the specified column type is float
|
static int |
FIELD_TYPE_INTEGER
Value if the specified column type is integer
|
static int |
FIELD_TYPE_NULL
Value if the specified column is null
|
static int |
FIELD_TYPE_STRING
Value if the specified column type is string
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the Cursor, releasing all of its resources and making it completely invalid.
|
byte[] |
getBlob(int columnIndex)
Returns the value of the requested column as a byte array.
|
int |
getColumnIndex(java.lang.String columnName)
Returns the zero-based index for the given column name, or -1 if the column doesn't exist.
|
int |
getColumnIndexOrThrow(java.lang.String columnName)
Returns the zero-based index for the given column name, or throws
IllegalArgumentException if the column doesn't exist. |
java.lang.String |
getColumnName(int columnIndex)
Returns the column name at the given zero-based column index.
|
double |
getDouble(int columnIndex)
Returns the value of the requested column as a double.
|
float |
getFloat(int columnIndex)
Returns the value of the requested column as a float.
|
int |
getInt(int columnIndex)
Returns the value of the requested column as an int.
|
long |
getLong(int columnIndex)
Returns the value of the requested column as a long.
|
int |
getShort(int columnIndex)
Returns the value of the requested column as a short.
|
java.lang.String |
getString(int columnIndex)
Returns the value of the requested column as a String.
|
boolean |
isAfterLast()
Returns whether the cursor is pointing to the position after the last
row.
|
boolean |
isNull(int columnIndex)
Returns
true if the value in the indicated column is null. |
boolean |
moveToNext()
Move the cursor to the next row.
|
static final int FIELD_TYPE_NULL
static final int FIELD_TYPE_INTEGER
static final int FIELD_TYPE_FLOAT
static final int FIELD_TYPE_STRING
static final int FIELD_TYPE_BLOB
boolean moveToNext()
This method will return false if the cursor is already past the last entry in the result set.
boolean isAfterLast()
int getColumnIndex(java.lang.String columnName)
getColumnIndexOrThrow(String) instead, which
will make the error more clear.columnName - the name of the target column.getColumnIndexOrThrow(String)int getColumnIndexOrThrow(java.lang.String columnName)
throws java.lang.IllegalArgumentException
IllegalArgumentException if the column doesn't exist. If you're not sure if
a column will exist or not use getColumnIndex(String) and check for -1, which
is more efficient than catching the exceptions.columnName - the name of the target column.java.lang.IllegalArgumentException - if the column does not existgetColumnIndex(String)java.lang.String getColumnName(int columnIndex)
columnIndex - the zero-based index of the target column.java.lang.String getString(int columnIndex)
The result and whether this method throws an exception when the column value is null or the column type is not a string type is implementation-defined.
columnIndex - the zero-based index of the target column.int getShort(int columnIndex)
The result and whether this method throws an exception when the
column value is null, the column type is not an integral type, or the
integer value is outside the range [Short.MIN_VALUE,
Short.MAX_VALUE] is implementation-defined.
columnIndex - the zero-based index of the target column.int getInt(int columnIndex)
The result and whether this method throws an exception when the
column value is null, the column type is not an integral type, or the
integer value is outside the range [Integer.MIN_VALUE,
Integer.MAX_VALUE] is implementation-defined.
columnIndex - the zero-based index of the target column.long getLong(int columnIndex)
The result and whether this method throws an exception when the
column value is null, the column type is not an integral type, or the
integer value is outside the range [Long.MIN_VALUE,
Long.MAX_VALUE] is implementation-defined.
columnIndex - the zero-based index of the target column.float getFloat(int columnIndex)
The result and whether this method throws an exception when the
column value is null, the column type is not a floating-point type, or the
floating-point value is not representable as a float value is
implementation-defined.
columnIndex - the zero-based index of the target column.double getDouble(int columnIndex)
The result and whether this method throws an exception when the
column value is null, the column type is not a floating-point type, or the
floating-point value is not representable as a double value is
implementation-defined.
columnIndex - the zero-based index of the target column.byte[] getBlob(int columnIndex)
The result and whether this method throws an exception when the column value is null or the column type is not a blob type is implementation-defined.
columnIndex - the zero-based index of the target column.boolean isNull(int columnIndex)
true if the value in the indicated column is null.columnIndex - the zero-based index of the target column.void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeable