Maintaining state in UltraLite Palm applications
You can save the state of tables and cursors when an application is closed by suspending the connection instead of closing
The current state is only stored for tables that are open when the connection object remains open.
Whenever your UltraLite application is closed or the user switches to another application, UltraLite saves the state of any
open cursors and tables.
- When the user returns to the application, call the appropriate open methods:
- For embedded SQL, call the following functions:
- For C++, call the following functions:
- Confirm the connection was restored properly by checking that the SQLCODE is SQLE_CONNECTION_RESTORED.
- For cursor objects, including instances of generated result set classes, you can do one of the following:
- Ensure the object is closed when the user switches away from the application, and call Open when you next need the object.
If you choose this option, the current position is not restored.
- Do not close the object when the user switches away, and call Reopen when you next need to access the object. The current
position is then maintained, but the application takes more memory in the Palm when the user is using other applications.
- For table objects, including instances of generated table classes, you cannot save a position. You must close table objects
before a user moves away from the application, and Open them when the user needs them again. Do not use Reopen on table objects.
Closing a connection rolls back any uncommitted transactions. By not closing connection objects, any outstanding transactions
are saved (not committed), so that when the application restarts, those transactions appear and can be committed or rolled
back. Uncommitted changes are not synchronized.