Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface Row

Known subtypesRowExt

The Row interface is returned by com.codename1.db.Cursor#getRow() to provide access to the content of an individual row.

Column indexes are zero-based. A SQL NULL reads back as null from #getString(int) and #getBlob(int), and as 0 from the numeric getters; use RowExt#wasNull() to tell a stored zero from a NULL.

while (cur.next()) {
    Row row = cur.getRow();
    int id = row.getInteger(0);
    String body = row.getString(1);
    System.out.println(id + ": " + body);
}

See the com.codename1.db package documentation for the full contract.

Methods

public abstract byte[] getBlob(int index) throws IOExceptionGets column value by index.
public abstract double getDouble(int index) throws IOExceptionGets column value by index.
public abstract float getFloat(int index) throws IOExceptionGets column value by index.
public abstract int getInteger(int index) throws IOExceptionGets column value by index.
public abstract long getLong(int index) throws IOExceptionGets column value by index.
public abstract short getShort(int index) throws IOExceptionGets column value by index.
public abstract String getString(int index) throws IOExceptionGets column value by index.
public abstract int getColumnType(int index) throws IOExceptionReturns how the value in a column of the current row is stored.

Method details

getBlob

public abstract byte[] getBlob(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

byte [] data

getDouble

public abstract double getDouble(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a double data from the database

getFloat

public abstract float getFloat(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a float data from the database

getInteger

public abstract int getInteger(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a int data from the database

getLong

public abstract long getLong(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a long data from the database

getShort

public abstract short getShort(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a short data from the database

getString

public abstract String getString(int index) throws IOException
Gets column value by index.

Parameters

index int
starts with zero

Returns

a String data from the database

getColumnType

public abstract int getColumnType(int index) throws IOException

Returns how the value in a column of the current row is stored.

SQLite types values rather than columns, so one column can hold an integer in one row and text in the next, and the typed getters convert whatever is stored. A caller that has to hand a value back as it was written – a scripting layer, a generic exporter – asks this first.

Parameters

index int
the zero-based column index

Returns

one of Database#COLUMN_NULL, Database#COLUMN_INTEGER, Database#COLUMN_FLOAT, Database#COLUMN_TEXT, Database#COLUMN_BLOB, or Database#COLUMN_UNKNOWN when the engine cannot tell

Throws

IOException
if the cursor is closed, not on a row, or the index is out of range