Native UltraLite for Java User's Guide
Understanding UltraLite Development
Accessing and manipulating data with the Table API
UltraLite has several modes of operation when working with data. The Table object has two sets of methods for locating particular rows in a table:
find methods These methods move to the first row that exactly matches specified search values, under the sort order specified when the Table object was opened. If the search values cannot be found you are positioned before the first or after the last row.
lookup methods These methods move to the first row that matches or is greater than a specified search value, under the sort order specified when the Table object was opened.
Both sets are used in a similar manner:
Enter find or lookup mode.
The mode is entered by calling a method on the table object. For example.
t.findBegin();
Set the search values.
You do this by setting values in the current row. Setting these values affects the buffer holding the current row only, not the database. For example:
short lname = t.schema.getColumnID( "lname" ); t.setString( lname, "Kaminski" );
Only values in the columns of the index are relevant to the search.
Search for the row.
Use the appropriate method to carry out the search. For example, the following instruction looks for the first row that exactly matches the specified value in the current index:
tCustomer.findFirst();
For multi-column indexes, a value for the first column is always used, but you can omit the other columns and you can specify the number of columns as a parameter to the find method.
Search for the next instance of the row.
Use the appropriate method to carry out the search. For a find operation, findNext() locates the next instance of the parameters in the index. For a lookup, moveNext() locates the next instance.
For more information, see the following classes in the API Reference:
ianywhere.native_ultralite.Table