Example of key property use in a GET map function

Assume the table in the database is defined as follows:

table1(c1 int, c2 varchar(10), c3 date, primary key(c1, c3))

Assume further that the adapter is used in a GET function defined as follows:

GET("AZSQL", "-URL connection -USER username -PASSWORD password -TABLE table1", inputdata)

Since in this case the adapter command -KEY is not specified, the adapter determines that the table table1 has columns c1 and c3 in its primary key, and generates SELECT lookup statement text as follows (fully-qualified table name and quoted identifiers omitted for clarity):

SELECT c1, c2, c3 FROM table1 WHERE c1 = ? and c3 = ?

Furthermore, the adapter assumes that the input data is a record with the fields that match the order and names of the columns in the primary key, meaning c1 field followed by the c3 field.

If, however the adapter command line included -KEY command as follows:

GET("AZSQL", "-URL connection -USER username -PASSWORD password -TABLE table1 -KEY c2,c3", inputdata)

the adapter would generate the SELECT lookup statement text as follows (fully-qualified table name and quoted identifiers omitted again for clarity):

SELECT c1, c2, c3 FROM table1 where c2 = ? and c3 = ?

and it would further assume that input data is a record with the fields that match the order and names of the columns in the KEY command, meaning c2 field followed by the c3 field.