public interface Cursor
Modifier and Type | Field and Description |
---|---|
static int |
FIELD_TYPE_BLOB
Value returned by
columnType(int) if the specified column type is blob |
static int |
FIELD_TYPE_FLOAT
Value returned by
columnType(int) if the specified column type is float |
static int |
FIELD_TYPE_INTEGER
Value returned by
columnType(int) if the specified column type is integer |
static int |
FIELD_TYPE_NULL
Value returned by
columnType(int) if the specified column is null |
static int |
FIELD_TYPE_STRING
Value returned by
columnType(int) if the specified column type is string |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the cursor and release all resource associated
|
java.lang.String |
columnName(int index)
Returns the column name at the given zero-based column index
|
int |
columnType(int index)
Returns data type of the given column's value.
|
byte[] |
getBlob(int index)
Returns the value of the requested column as a byte array.
|
int |
getColumnCount()
Return total number of columns
|
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. |
int |
getCount() |
float |
getFloat(int index)
Returns the value of the requested column as a float.
|
int |
getInt(int index)
Returns the value of the requested column as a long.
|
long |
getLong(int index)
Returns the value of the requested column as a long.
|
java.lang.String |
getString(int index)
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 |
moveToFirst()
Move the cursor to the first row.
|
boolean |
moveToNext()
Move the cursor to the next row.
|
static final int FIELD_TYPE_NULL
columnType(int)
if the specified column is nullstatic final int FIELD_TYPE_INTEGER
columnType(int)
if the specified column type is integerstatic final int FIELD_TYPE_FLOAT
columnType(int)
if the specified column type is floatstatic final int FIELD_TYPE_STRING
columnType(int)
if the specified column type is stringstatic final int FIELD_TYPE_BLOB
columnType(int)
if the specified column type is blobint getCount()
int getColumnCount()
int columnType(int index)
java.lang.String columnName(int index)
boolean moveToFirst()
java.lang.String getString(int index)
int getInt(int index)
long getLong(int index)
float getFloat(int index)
byte[] getBlob(int index)
boolean isAfterLast()
boolean moveToNext()
void close()
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)