java.lang.Object | ||
↳ | com.tencent.wcdb.database.SQLiteClosable | |
↳ | com.tencent.wcdb.CursorWindow |
A buffer containing multiple cursor rows.
A CursorWindow
is read-write when initially created and used locally.
When sent to a remote process (by writing it to a Parcel), the remote process
receives a read-only view of the cursor window. Typically the cursor window
will be allocated by the producer, filled with data, and then sent to the
consumer for reading.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Creator<CursorWindow> | CREATOR |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CursorWindow(String name)
Creates a new empty cursor window and gives it a name.
| |||||||||||
CursorWindow(boolean localWindow)
This constructor is deprecated.
There is no longer a distinction between local and remote
cursor windows. Use the
CursorWindow(String) constructor instead.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
allocRow()
Allocates a new row at the end of this cursor window.
| ||||||||||
void |
clear()
Clears out the existing contents of the window, making it safe to reuse
for new data.
| ||||||||||
void |
copyStringToBuffer(int row, int column, CharArrayBuffer buffer)
Copies the text of the field at the specified row and column index into
a CharArrayBuffer.
| ||||||||||
int | describeContents() | ||||||||||
void |
freeLastRow()
Frees the last row in this cursor window.
| ||||||||||
byte[] |
getBlob(int row, int column)
Gets the value of the field at the specified row and column index as a byte array.
| ||||||||||
double |
getDouble(int row, int column)
Gets the value of the field at the specified row and column index as a
double . | ||||||||||
float |
getFloat(int row, int column)
Gets the value of the field at the specified row and column index as a
float . | ||||||||||
int |
getInt(int row, int column)
Gets the value of the field at the specified row and column index as an
int . | ||||||||||
long |
getLong(int row, int column)
Gets the value of the field at the specified row and column index as a
long . | ||||||||||
int |
getNumRows()
Gets the number of rows in this window.
| ||||||||||
short |
getShort(int row, int column)
Gets the value of the field at the specified row and column index as a
short . | ||||||||||
int |
getStartPosition()
Gets the start position of this cursor window.
| ||||||||||
String |
getString(int row, int column)
Gets the value of the field at the specified row and column index as a string.
| ||||||||||
int |
getType(int row, int column)
Returns the type of the field at the specified row and column index.
| ||||||||||
boolean |
isBlob(int row, int column)
This method is deprecated.
Use
getType(int, int) instead.
| ||||||||||
boolean |
isFloat(int row, int column)
This method is deprecated.
Use
getType(int, int) instead.
| ||||||||||
boolean |
isLong(int row, int column)
This method is deprecated.
Use
getType(int, int) instead.
| ||||||||||
boolean |
isNull(int row, int column)
This method is deprecated.
Use
getType(int, int) instead.
| ||||||||||
boolean |
isString(int row, int column)
This method is deprecated.
Use
getType(int, int) instead.
| ||||||||||
static CursorWindow | newFromParcel(Parcel p) | ||||||||||
boolean |
putBlob(byte[] value, int row, int column)
Copies a byte array into the field at the specified row and column index.
| ||||||||||
boolean |
putDouble(double value, int row, int column)
Puts a double-precision floating point value into the field at the
specified row and column index.
| ||||||||||
boolean |
putLong(long value, int row, int column)
Puts a long integer into the field at the specified row and column index.
| ||||||||||
boolean |
putNull(int row, int column)
Puts a null value into the field at the specified row and column index.
| ||||||||||
boolean |
putString(String value, int row, int column)
Copies a string into the field at the specified row and column index.
| ||||||||||
boolean |
setNumColumns(int columnNum)
Sets the number of columns in this window.
| ||||||||||
void |
setStartPosition(int pos)
Sets the start position of this cursor window.
| ||||||||||
String | toString() | ||||||||||
void | writeToParcel(Parcel dest, int flags) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.tencent.wcdb.database.SQLiteClosable
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Creates a new empty cursor window and gives it a name.
The cursor initially has no rows or columns. Call setNumColumns(int)
to
set the number of columns before adding any rows to the cursor.
name | The name of the cursor window, or null if none. |
---|
This constructor is deprecated.
There is no longer a distinction between local and remote
cursor windows. Use the CursorWindow(String)
constructor instead.
Creates a new empty cursor window.
The cursor initially has no rows or columns. Call setNumColumns(int)
to
set the number of columns before adding any rows to the cursor.
localWindow | True if this window will be used in this process only, false if it might be sent to another processes. This argument is ignored. |
---|
Allocates a new row at the end of this cursor window.
Clears out the existing contents of the window, making it safe to reuse for new data.
The start position (getStartPosition()
), number of rows (getNumRows()
),
and number of columns in the cursor are all reset to zero.
Copies the text of the field at the specified row and column index into a CharArrayBuffer.
The buffer is populated as follows:
FIELD_TYPE_NULL
, then the buffer
is set to an empty string.FIELD_TYPE_STRING
, then the buffer
is set to the contents of the string.FIELD_TYPE_INTEGER
, then the buffer
is set to a string representation of the integer in decimal, obtained by formatting the
value with the printf
family of functions using
format specifier %lld
.FIELD_TYPE_FLOAT
, then the buffer is
set to a string representation of the floating-point value in decimal, obtained by
formatting the value with the printf
family of functions using
format specifier %g
.FIELD_TYPE_BLOB
, then a
SQLiteException
is thrown.row | The zero-based row index. |
---|---|
column | The zero-based column index. |
buffer | The CharArrayBuffer to hold the string. It is automatically resized if the requested string is larger than the buffer's current capacity. |
Frees the last row in this cursor window.
Gets the value of the field at the specified row and column index as a byte array.
The result is determined as follows:
FIELD_TYPE_NULL
, then the result
is null
.FIELD_TYPE_BLOB
, then the result
is the blob value.FIELD_TYPE_STRING
, then the result
is the array of bytes that make up the internal representation of the
string value.FIELD_TYPE_INTEGER
or
FIELD_TYPE_FLOAT
, then a SQLiteException
is thrown.row | The zero-based row index. |
---|---|
column | The zero-based column index. |
Gets the value of the field at the specified row and column index as a
double
.
The result is determined as follows:
FIELD_TYPE_NULL
, then the result
is 0.0
.FIELD_TYPE_STRING
, then the result
is the value obtained by parsing the string value with strtod
.
FIELD_TYPE_INTEGER
, then the result
is the integer value converted to a double
.FIELD_TYPE_FLOAT
, then the result
is the double
value.FIELD_TYPE_BLOB
, then a
SQLiteException
is thrown.row | The zero-based row index. |
---|---|
column | The zero-based column index. |
double
.
Gets the value of the field at the specified row and column index as a
float
.
The result is determined by invoking getDouble(int, int)
and converting the
result to float
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
float
.
Gets the value of the field at the specified row and column index as an
int
.
The result is determined by invoking getLong(int, int)
and converting the
result to int
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
int
.
Gets the value of the field at the specified row and column index as a long
.
The result is determined as follows:
FIELD_TYPE_NULL
, then the result
is 0L
.FIELD_TYPE_STRING
, then the result
is the value obtained by parsing the string value with strtoll
.
FIELD_TYPE_INTEGER
, then the result
is the long
value.FIELD_TYPE_FLOAT
, then the result
is the floating-point value converted to a long
.FIELD_TYPE_BLOB
, then a
SQLiteException
is thrown.row | The zero-based row index. |
---|---|
column | The zero-based column index. |
long
.
Gets the number of rows in this window.
Gets the value of the field at the specified row and column index as a
short
.
The result is determined by invoking getLong(int, int)
and converting the
result to short
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
short
.
Gets the start position of this cursor window.
The start position is the zero-based index of the first row that this window contains
relative to the entire result set of the Cursor
.
Gets the value of the field at the specified row and column index as a string.
The result is determined as follows:
FIELD_TYPE_NULL
, then the result
is null
.FIELD_TYPE_STRING
, then the result
is the string value.FIELD_TYPE_INTEGER
, then the result
is a string representation of the integer in decimal, obtained by formatting the
value with the printf
family of functions using
format specifier %lld
.FIELD_TYPE_FLOAT
, then the result
is a string representation of the floating-point value in decimal, obtained by
formatting the value with the printf
family of functions using
format specifier %g
.FIELD_TYPE_BLOB
, then a
SQLiteException
is thrown.row | The zero-based row index. |
---|---|
column | The zero-based column index. |
Returns the type of the field at the specified row and column index.
The returned field types are:
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
This method is deprecated.
Use getType(int, int)
instead.
Returns true if the field at the specified row and column index
has type FIELD_TYPE_BLOB
or FIELD_TYPE_NULL
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
FIELD_TYPE_BLOB
or
FIELD_TYPE_NULL
.
This method is deprecated.
Use getType(int, int)
instead.
Returns true if the field at the specified row and column index
has type FIELD_TYPE_FLOAT
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
FIELD_TYPE_FLOAT
.
This method is deprecated.
Use getType(int, int)
instead.
Returns true if the field at the specified row and column index
has type FIELD_TYPE_INTEGER
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
FIELD_TYPE_INTEGER
.
This method is deprecated.
Use getType(int, int)
instead.
Returns true if the field at the specified row and column index
has type FIELD_TYPE_NULL
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
FIELD_TYPE_NULL
.
This method is deprecated.
Use getType(int, int)
instead.
Returns true if the field at the specified row and column index
has type FIELD_TYPE_STRING
or FIELD_TYPE_NULL
.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
FIELD_TYPE_STRING
or FIELD_TYPE_NULL
.Copies a byte array into the field at the specified row and column index.
value | The value to store. |
---|---|
row | The zero-based row index. |
column | The zero-based column index. |
Puts a double-precision floating point value into the field at the specified row and column index.
value | The value to store. |
---|---|
row | The zero-based row index. |
column | The zero-based column index. |
Puts a long integer into the field at the specified row and column index.
value | The value to store. |
---|---|
row | The zero-based row index. |
column | The zero-based column index. |
Puts a null value into the field at the specified row and column index.
row | The zero-based row index. |
---|---|
column | The zero-based column index. |
Copies a string into the field at the specified row and column index.
value | The value to store. |
---|---|
row | The zero-based row index. |
column | The zero-based column index. |
Sets the number of columns in this window.
This method must be called before any rows are added to the window, otherwise it will fail to set the number of columns if it differs from the current number of columns.
columnNum | The new number of columns. |
---|
Sets the start position of this cursor window.
The start position is the zero-based index of the first row that this window contains
relative to the entire result set of the Cursor
.
pos | The new zero-based start position. |
---|