UltraLite C++ User's Guide
Understanding UltraLite Development
Accessing and manipulating data with the Table API
UltraLite exposes the rows in a table to your application one at a time. The Table object has a current position, which may be on a row, before the first row, or after the last row of the table.
When your application changes its row (by using one of the navigation methods on the Table object) UltraLite makes a copy of the row in a buffer. Any operations to get or set values affect only the copy of data in this buffer. They do not affect the data in the database. For example, the following statement changes the value of the ID column in the buffer to 3.
TableSchema ts = t->GetSchema(); ULValue id = ts->GetColumnID( "ID" ); t.Set( id, 3 );
UltraLite uses the values in the buffer for a variety of purposes, depending on the kind of operation you are carrying out. UltraLite has four different modes of operation, in addition to a default mode, and in each mode the buffer is used for a different purpose.
Insert mode The data in the buffer is added to the table as a new row when the insert method is called.
Update mode The data in the buffer replaces the current row when the update method is called.
Find mode The data in the buffer is used to locate rows when one of the find methods is called.
Lookup mode The data in the buffer is used to locate rows when one of the lookup methods is called.
Whichever mode you are using, there is a similar sequence of operations:
Enter the mode.
The Table methods set UltraLite into the mode.
Set the values in the buffer.
Use the set methods to set values in the buffer.
Carry out the operation.
Use a Table method to carry out an operation such as insert, update, or find using the values in the buffer. The UltraLite mode is set back to the default method and you must enter a new mode before performing another data manipulation or searching operation.