Contents Index ULEnableFileDB function ULEnablePalmRecordDB function pdf/preface.pdf

UltraLite User's Guide
  The Embedded SQL Interface
    Library function reference

ULEnableGenericSchema function


Prototype 

void ULEnableGenericSchema( SQLCA * sqlca );

Description 

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 upgrading 
It 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:

  1. Any tables that were in the old schema but not in the new schema are dropped.

  2. Any tables that are in the new schema but were not in the old are created.

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

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

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

Parameters 

sqlca    A pointer to the SQLCA. This argument is supplied even in C++ API applications.

See also 

Deploying UltraLite applications


Contents Index ULEnableFileDB function ULEnablePalmRecordDB function pdf/preface.pdf