Download Print this page

HEIDENHAIN MANUALplus 620 Technical Manual page 1621

Hide thumbs Also See for MANUALplus 620:

Advertisement

8.12.6 Access to tables via SQL commands
Selecting the data
January 2012
The NC software accesses the tables via a server. Accesses from the NC
program, the PLC program and the editor are synchronized with each other,
and locked against each other. This server is controlled with SQL commands.
The server is based on a transaction model which performs read or write
operations for more than one row or column in such a way that they cannot be
interrupted by other read or write operations.
A transaction consists of the following steps
Selecting data
Reading data
Editing data (if required)
Confirming or rejecting the changes
To select data, use the SQL statement SELECT. The SELECT statement finds
the columns of the rows of a table, which satisfy the entered WHERE
condition.
The table is usually designated by a synonym. These synonyms are
configuration data which can also be created, assigned and deleted via the
SQL server. In addition, you can specify a table by using its path name,
provided that you enclose the path name in single quotation marks.
The result of the query is a result set which is created and managed by the
SQL server. The SQL server assigns a handle to the result set, which enables
you to identify the result set for reading/editing data and completing the
transaction. The handle is the result of the query, which is visible in the NC
program. The value 0 indicates an invalid handle, i.e. it was not possible to
create a result set for that query. If no rows that satisfy the specified condition
are found, an empty result set is created and assigned a valid handle.
The ORDER BY function sorts the rows in the result set according to the
values of a column in increasing or decreasing order. The row numbers in the
result set are listed in increasing order and are not related to the row numbers
in the table file.
You can create a dynamic query, for example, by replacing the comparison
value in the WHERE condition with a reference to a Q parameter. To do this,
program a colon (:) instead of the value and enclose the Q parameter in single
quotation marks (e.g. 'Q2'). During interpretation this expression is replaced
by the current content of the Q parameter.
The FOR UPDATE function locks the selected rows for the duration of the
transaction. As a result, third parties can only read the data, but cannot edit
them. However, this query cannot be executed if it is to access data that have
already been locked.
8.12 Tables
1621

Advertisement

loading