Generating Unique Values Using a Component
When a primary key column is based on this domain, a <TableName>GETSEQUENCENUMBER method is added to the component definition. Parameters are added for the other primary key columns.
This method is invoked when inserting a record.
Consider an ORDERLINES component table with three columns:
The ORDERLINES component gets an ORDERLINESGETSEQUENCENUMBER method with two parameters:
If the following SQL statement is executed:
INSERT INTO ORDERLINES( order_id, amount )
VALUES( 3341, 159.95 )
The ORDERLINESGETSEQUENCENUMBER method of the ORDERLINES table component is invoked to get a new orderline_id within order 3341:
You can also have a component generate the unique values for a DATABASE table. This way, you can program your own sequence generation, and you can use non-integer data types.