UltraLite User's Guide
The Embedded SQL Interface
Library function reference
void ULEnableGenericSchema( SQLCA * sqlca );
When a new UltraLite application is deployed to a device, UltraLite be default re-creates an empty database, losing any data that was in the database before the new application was deployed. If you call ULEnableGenericSchema, the existing database is instead upgraded to the schema of the new application.
This function can be used by C++ API applications as well as embedded SQL applications. It must be called before dbinit or ULData.Open(). An exception is the Palm Computing Platform, where there is no need to close all cursors before upgrading. Immediately following an upgrade on the Palm Computing Platform the LAUNCH_SUCCESS_FIRST launch code is returned.
Backup before upgradingIt is strongly recommended that you backup your data before attempting an upgrade, either by copying the database file or by synchronizing. |
The schema upgrading process uses matching names in the old and new schema. It proceeds as follows:
Any tables that were in the old schema but not in the new schema are dropped.
Any tables that are in the new schema but were not in the old are created.
For any table that exists in both old and new, but with a different definition, columns are added and dropped as needed. If a new column is not nullable and has no default value, it is filled with zeros (numeric data types), the empty string (character data types) and an empty binary value.
Columns whose properties have changed are then modified.
Caution If an error occurs during conversion for any row, that row is dropped and the SQL warning SQLE_ROW_DROPPED_DURING_SCHEMA_UPGRADE is set. |
Indexes and constraints are rebuilt. This step may also result in rows being dropped if, for example, an index is redefined as UNIQUE but has duplicate values.
In general, adding constraints to tables that have data in them or carrying out unpredictable column conversions may result in lost rows.
sqlca A pointer to the SQLCA. This argument is supplied even in C++ API applications.
Deploying UltraLite applications