Updated: 2023-10-19

OLE DB Property of Rowset and Command — «auto_gen_key_rule»

Name:
auto_gen_key_rule
Type:
VT_BSTR
R/W:
R/W
Default:
EMPTY
IBProvider:
2, 3, 5

This property defines a list with the key generation rules when a new row is inserted:

auto_gen_key_rule ::= <gen_key_rule>[;<gen_key_rule>]

<gen_key_rule> ::= {GEN | GEN_N | GEN_NI }.GeneratorName.<column_id>

<column_id> ::= {<aliase_column_name> | <full_column_name>}

<aliase_column_name> ::= name of column in result set

<full_columns_name> ::= BaseTableName.BaseColumnName

Description of control markers:

Marker Description
GEN Always generate the new value of a column
GEN_N Generate the new value if the column value is NOT OK (is NULL or has DEFAULT value)
GEN_NI Generate the new value if a column is not initialized (has DEFAULT value)

Using these rules, the rowset can automatically use generators for determining the values of the key (and not only) columns.

When you define names of a generator, table and column you may use quoted names.

Example

If there is ID column in table MY_TABLE then you can define follow rule of key generation with using of GEN_ID_MY_TABLE generator:

auto_gen_key_rule=«GEN_NI.GEN_ID_MY_TABLE.ID»
auto_gen_key_rule=«GEN_NI.GEN_ID_MY_TABLE.MY_TABLE.ID»

If user did not set any value in column ID, then provider uses generator GEN_ID_MY_TABLE to get unique value.

Other properties of group

Other sets of properties