8 a ccessing tables with sql commands – HEIDENHAIN TNC 620 (73498x-01) ISO programming User Manual

Page 240

Advertising
background image

240

Programming: Q parameters

8.8 A

ccessing tables with SQL commands

Result set

The selected rows are numbered in ascending order within the result
set, starting from 0. This numbering is referred to as the index. The
index is used for read- and write-accesses, enabling a row of the result
set to be specifically addressed.

It can often be advantageous to sort the rows in the result set. Do this
by specifying the table column containing the sorting criteria. Also
select ascending or descending order (SQL SELECT ... ORDER BY ...).

The selected rows that were transferred to the result set are
addressed with the HANDLE. All following SQL commands use the
handle to refer to this "set of selected columns and rows."

When concluding a transaction, the handle is released (SQL COMMIT...
or SQL ROLLBACK...). It is then no longer valid.

You can edit more than one result set at the same time. The SQL
server assigns a new handle for each "Select" command.

"Binding" Q parameters to columns

The NC program does not have direct access to the table entries in the
result set. The data must be transferred in Q parameters. In the other
direction, the data is first prepared in the Q parameters and then
transferred to the result set.

Specify with SQL BIND ... which table columns are mapped to which
Q parameters. The Q parameters are "bound" (assigned) to the
columns. Columns that are not bound to Q parameters are not
included in the read-/write-processes.

If a new table row is generated with SQL INSERT..., the columns not
bound to Q parameters are filled with default values.

Advertising