FileDocCategorySizeDatePackage
TableResult.javaAPI DocAndroid 1.5 API2462Wed May 06 22:41:06 BST 2009SQLite

TableResult

public class TableResult extends Object implements Callback
Class representing an SQLite result set as returned by the Database.get_table convenience method.

Example:
...
SQLite.Database db = new SQLite.Database();
db.open("db", 0);
System.out.print(db.get_table("select * from TEST"));
...
Example output:
id|firstname|lastname|
0|John|Doe|
1|Speedy|Gonzales|
...

Fields Summary
public int
ncolumns
Number of columns in the result set.
public int
nrows
Number of rows in the result set.
public String[]
column
Column names of the result set.
public String[]
types
Types of columns of the result set or null.
public Vector
rows
Rows of the result set. Each row is stored as a String array.
Constructors Summary
public TableResult()
Create an empty result set.

    clear();
    
Methods Summary
public voidclear()
Clear result set.

    column = new String[0];
    types = null;
    rows = new Vector();
    ncolumns = nrows = 0;
    
public voidcolumns(java.lang.String[] coldata)
Callback method used while the query is executed.

    column = coldata;
    ncolumns = column.length;
    
public booleannewrow(java.lang.String[] rowdata)
Callback method used while the query is executed.

    if (rowdata != null) {
        rows.addElement(rowdata);
        nrows++;
    }
    return false;
    
public java.lang.StringtoString()
Make String representation of result set.

    StringBuffer sb = new StringBuffer();
    int i;
    for (i = 0; i < ncolumns; i++) {
        sb.append(column[i] == null ? "NULL" : column[i]);
        sb.append('|");
    }
    sb.append('\n");
    for (i = 0; i < nrows; i++) {
        int k;
        String row[] = (String[]) rows.elementAt(i);
        for (k = 0; k < ncolumns; k++) {
        sb.append(row[k] == null ? "NULL" : row[k]);
        sb.append('|");
        }
        sb.append('\n");
    }
    return sb.toString();
    
public voidtypes(java.lang.String[] types)
Callback method used while the query is executed.

    this.types = types;