beautypg.com

Getnextkey – Kofax DM API User Manual

Page 221

background image

DM API M

ETHODS

AND

P

ROPERTIES

201

GetNextKey

Most of the tables in the DM SQL database have a

SYSTEM_ID

column

as their primary key. DM generates primary key values for new rows in
those tables by calling the GetNextKey method with no input
parameter. Primary key values that are generated with no input
parameter receive their key value from the

TBNAME

column that has a

value of

SYSTEMKEY

. Because so many tables obtain their primary key

values from this pool of numbers, the generic name of

SYSTEMKEY

is

used. There is no

SYSTEMKEY

table.

You are not required to store primary key values generated in this
manner—with no input parameter—in a column named

SYSTEM_ID

.

For example, the

LOOKUPS

table uses the

METHODNUM

column as its

primary key, but it is generated in the same manner as other tables that
use the more common

SYSTEM_ID

column as a primary key. You can

do the same thing with tables that your custom applications require,
whether you name your primary key column

SYSTEM_ID

or something

different.

Some DM SQL database tables maintain primary keys that do not
generate key values by incrementing the

SYSTEMKEY

column value.

One example of this occurs in the

PROFILE

table where the

DOCNUMBER

column is shown as an “alternate” primary key. DM uses this primary
key to manage the Document File Store, where the actual document
content resides. You will see this in the

DOCS_UNIQUE_KEYS

table with

its

TBNAME

column set to “

DOCSADM.PROFILE

”.

As a developer using the DM API to create your customized
applications or enhancements to the basic product, you have complete
flexibility to manage primary keys for the tables you create. You can
maintain separate key entries in the

DOCS_UNIQUE_KEYS

table for the

tables you create, or you can retrieve key values from the

SYSTEMKEY

pool that DM supports. With a maximum key value in excess of 2
billion, neither the

SYSTEMKEY

nor other

DOCS_UNIQUE_KEYS

table

entries are likely to exhaust the available pool of key values.

Note: Oracle supports system-generated sequences through use of a
CREATE SEQUENCE

SQL statement. DM uses this instead of the

DOCS_UNIQUE_KEYS

table to manage primary key values in Oracle

databases. These columns are stored in the DUAL table. The previous
discussion of primary key usage is all relevant to Oracle users, with the