Sybase SQL Remote DC38133-01-0902-01 User Manual

Page of 485
Chapter 7. SQL Remote Design for Adaptive Server Anywhere
If the public option Global_database_id is set to the default value of
2147483647, a null value is inserted into the column. Should null values not
be permitted, the attempt to insert the row causes an error. This situation
arises, for example, if the column is contained in the table’s primary key.
Because the public option Global_database_id cannot be set to negative
values, the values chosen are always positive. The maximum identification
number is restricted only by the column data type and the partition size.
Null default values are also generated when the supply of values within the
partition has been exhausted. In this case, a new value of
Global_database_id should be assigned to the database to allow default
values to be chosen from another partition. Attempting to insert the null
value causes an error if the column does not permit nulls. To detect that the
supply of unused values is low and handle this condition, create an event of
type GlobalAutoincrement.
Should the values in a particular partition become exhausted, you can assign
a new database id to that database. You can assign new database id numbers
in any convenient manner. However, one possible technique is to maintain a
pool of unused database id values. This pool is maintained in the same
manner as a pool of primary keys.
You can set an event handler to automatically notify the database
administrator (or carry out some other action) when the partition is nearly
exhausted. For more information, see
For more information, see
For further information on pools, see
Using primary key pools
The primary key pool is a table that holds a set of primary key values for
each database in the SQL Remote installation. Each remote user receives
their own set of primary key values. When a remote user inserts a new row
into a table, they use a stored procedure to select a valid primary key from
the pool. The pool is maintained by periodically running a procedure at the
consolidated database that replenishes the supply.
The method is described using a simple example database consisting of sales
representatives and their customers. The tables are much simpler than you
would use in a real database; this allows us to focus just on those issues
important for replication.
133