|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.database.BufferedCursor
public class BufferedCursor
Caches all rows in memory for bidirectional or random access. Suitable for small cursors.
The buffered cursor may throw an OutOfMemoryError if
it is used with very large data queries.
| Constructor Summary | ||
|---|---|---|
|
BufferedCursor(Cursor cursor)
Creates buffered cursor based on given delegate. |
|
| Method Summary | ||
|---|---|---|
|
void |
close()
Closes the cursor, releasing all of its resources and making it completely invalid. |
|
boolean |
first()
Navigates to the first row. |
|
int |
getColumnIndex(String columnName)
Returns the zero-based index for a given column name. |
|
String |
getColumnName(int columnIndex)
Returns the column name at a given zero-based column index. |
|
int |
getPosition()
Returns the current cursor position. |
|
Row |
getRow()
Retrieves the current row with its values. |
|
boolean |
isEmpty()
Determines if the cursor contains rows. |
|
boolean |
last()
Moves the cursor to the last row. |
|
boolean |
next()
Moves the cursor to the next row. |
|
boolean |
position(int rowId)
Moves the cursor to an absolute row position. |
|
boolean |
prev()
Navigates to the previous row, if it exists. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedCursor(Cursor cursor)
throws NullPointerException
NullPointerException - If the cursor parameter is NULL.| Method Detail |
|---|
public boolean first()
throws DatabaseException
first in interface Cursortrue if there is at least one row in the cursor, false if the
cursor is empty.
DatabaseException - If the cursor was closed.
public int getPosition()
throws DatabaseException
Cursor
If the cursor was not navigated through Cursor.next(), Cursor.last() or
similar methods, then its current position is before the first row and is
marked as -1.
getPosition in interface CursorDatabaseException - If the cursor was closed.Cursor.getPosition()
public Row getRow()
throws DatabaseException
Cursor
The cursor must be positioned on a row for this method to return a non-null
value. When the cursor is first opened, the cursor is positioned before the first row and
this method returns null. Call Cursor.first() or
Cursor.next() to navigate to the first row and then call getRow() to
get the data.
getRow in interface Cursornull if the cursor contains no rows or is not
positioned on a row.
DatabaseException - If the cursor was closed.Cursor.getRow()
public boolean last()
throws DatabaseException
Cursor
If the cursor is empty, the method returns false.
last in interface Cursortrue if the move succeeded; otherwise false.
DatabaseException - If the last row cannot be retrieved from the database
or if the cursor was closed.Cursor.last()
public boolean next()
throws DatabaseException
Cursor
Calling the next() method the first time positions the cursor on the first
row, if it is available. If the cursor is positioned on the last
row then calling next() moves the pointer after the last row, and row
data access methods will return invalid data.
next in interface Cursortrue if the move succeeded; otherwise false.
DatabaseExceptionCursor.next()
public boolean position(int rowId)
throws DatabaseException
Cursor
If a negative position is specified, the cursor position is not changed and false is returned, and row
data access methods will return invalid data.
If the specified row is after the last one, the cursor will be positioned at the last row and false is returned,
and row data access methods will return invalid data.
If the cursor has no rows, then it will be positioned at -1 and false is returned, and row
data access methods will return invalid data.
Call getPosition() to confirm the current position.
position in interface CursorrowId - Zero-based position to move to.
true if the move succeeded; otherwise false.
DatabaseException - If the cursor was closed.net.rim.device.api.database.Cursor#position()
public boolean prev()
throws DatabaseException
prev in interface Cursortrue if there is a previous row; otherwise false.
DatabaseException - If the cursor was closed.
public void close()
throws DatabaseException
Cursor
close in interface CursorDatabaseException - Never thrown but is kept for backwards compatibility.Cursor.close()
public boolean isEmpty()
throws DatabaseException
Cursor
Information about whether the cursor is empty or not is available
only after navigating to a row through any of the following methods:
Cursor.first(), Cursor.next(), Cursor.last(). If the cursor was
never navigated then this method returns true, meaning that
no rows were fetched.
isEmpty in interface Cursortrue if the cursor contains no rows or hasn't been
navigated, false otherwise.
DatabaseException - If the cursor was closed.Cursor.isEmpty()
public int getColumnIndex(String columnName)
throws DatabaseException
Cursor
Column metadata is available only after navigation to
the first row. Call Cursor.next() or Cursor.first() before calling
this method.
getColumnIndex in interface CursorcolumnName - The name of the target column.
DatabaseException - If the cursor was closed.Cursor.getColumnIndex(String)
public String getColumnName(int columnIndex)
throws DatabaseException
Cursor
Column metadata is available only after navigation to
the first row. Call Cursor.next() or Cursor.first() before calling
this method.
getColumnName in interface CursorcolumnIndex - The zero-based index of the target column.
null if the given column index is larger than the number of columns.
DatabaseException - If the cursor was closed.Cursor.getColumnName(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal