Contents Index Data manipulation internals Accessing the values of the current row

Native UltraLite for Java User's Guide
  Understanding UltraLite Development
    Accessing and manipulating data with the Table API

Scrolling through the rows of a table


The following code opens the MyTable table and scrolls through its rows, displaying the value of the MyColumn column for each row.

Table t = conn.getTable( "MyTable" );
short colID = t.schema.getColumnID( "MyColumn" );
t.open();
t.moveBeforeFirst();
while ( t.moveNext() ){
   System.out.println( t.getString( colID ) );
}

You expose the rows of the table to the application when you open the table object. By default, the rows are exposed in order by primary key value, but you can specify an index to access the rows in a particular order. The following code moves to the first row of the MyTable table as ordered by the ix_col index.

Table t = conn.getTable("MyTable");
t.open( "ix_col" );
t.moveFirst();

For more information, see ianywhere.native_ultralite.Table ianywhere.native_ultralite.TableSchema and ianywhere.native_ultralite.Connection in the online API Reference.


Contents Index Data manipulation internals Accessing the values of the current row