Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » UltraLite - C and C++ Programming » Application Development » Developing UltraLite applications for the Palm OS

 

Maintaining state in UltraLite Palm applications (deprecated)

You can save the state of tables and cursors when an application is closed by suspending the connection instead of closing it.

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.

  1. When the user returns to the application, call the appropriate open methods:

    • For embedded SQL, call the following functions:

      • db_init
      • EXEC SQL CONNECT
    • For C++, call the following functions:

      • ULSqlca.Initialize
      • ULInitDatabaseManager
      • OpenConnection
  2. Confirm the connection was restored properly by checking that the SQLCODE is SQLE_CONNECTION_RESTORED.

  3. 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.

  4. 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.


Restoring state in UltraLite Palm applications (deprecated)
Saving, retrieving, and clearing encryption keys on Palm OS