Contents Index Foreign key cycles Declaring default global autoincrement columns pdf/preface.pdf

UltraLite User's Guide
  Designing UltraLite Applications

Global autoincrement default column values


You can declare the default value of a column in a reference database to be of type GLOBAL AUTOINCREMENT. You can use this default for any column in which you want to maintain unique values, but it is particularly useful for primary keys. This feature simplifies the task of generating unique values in setups where data is being replicated among multiple databases, typically by MobiLink synchronization.

When you specify default global autoincrement, the domain of values for that column is partitioned. Each partition contains the same number of values. For example, if you set the partition size for an integer column in a database to 1000, one partition extends from 1001 to 2000, the next from 2001 to 3000, and so on.

For information on declaring columns as global autoincrement in your reference database, see Declaring default global autoincrement columns.

To use global autoincrement columns in your UltraLite database, you must first assign each copy of the database a unique global database identification number. UltraLite then supplies default values for the column only from the partition uniquely identified by that database's number. For example, if you assigned a database in the above example the identity number 1, the default values in that database would be chosen in the range 1001-2000. Another copy of the database, assigned the identification number 2, would supply default value for the same column in the range 2001-3000.

For information on assigning global database identification numbers, see Setting the global database identifier.

For information on using global autoincrement values in Adaptive Server Anywhere remote databases, see Maintaining unique primary keys using global autoincrement.


Declaring default global autoincrement columns
Setting the global database identifier
How default values are chosen
Determining the most recently assigned value
Detecting the number of available default values

Contents Index Foreign key cycles Declaring default global autoincrement columns pdf/preface.pdf