beautypg.com

Sql commit, Sql rollback, 10 .9 a ccessing t a bles with sql commands – HEIDENHAIN TNC 320 (340 551-01) User Manual

Page 355

background image

HEIDENHAIN TNC 320

355

1

0

.9 A

ccessing T

a

bles with SQL Commands

SQL COMMIT

SQL COMMIT

transfers all rows in the result set back to the table. A lock

set with SELECT...FOR UPDATE is canceled.

The handle given in the SQL SELECT command loses its validity.

8

Parameter no. for result:

Q parameter in which the

SQL server reports the result:
0: No error occurred.
1: Error occurred (incorrect handle or equal entries in
columns requiring unique entries)

8

Data bank: SQL access ID:

Q parameter with the

handle for identifying the result set (also see SQL
SELECT

).

SQL ROLLBACK

The execution of SQL ROLLBACK depends on whether INDEX is
programmed:

„

If INDEX is not programmed: The result set is not written back to the
table (any changes/insertions are discarded). The transaction is
closed and the handle given in the SQL SELECT command loses its
validity. Typical application: Ending a transaction solely containing
read-accesses.

„

If INDEX is programmed: The indexed row remains. All other rows
are deleted from the result set. The transaction is not concluded. A
lock set with SELECT...FOR UPDATE remains for the indexed row. For
all other rows it is reset.

8

Parameter no. for result:

Q parameter in which the

SQL server reports the result:
0: No error occurred.
1: Error occurred (incorrect handle)

8

Data bank: SQL access ID:

Q parameter with the

handle for identifying the result set (also see SQL
SELECT

).

8

Data bank: Index for SQL result:

Row that is to

remain in the result set. Either enter the row number
directly or program the Q parameter containing the
index.

Example:

11 SQL BIND Q881 "TAB_EXAMPLE.MEAS_NO"

12 SQL BIND Q882 "TAB_EXAMPLE.MEAS_X"

13 SQL BIND Q883 "TAB_EXAMPLE.MEAS_Y"

14 SQL BIND Q884 "TAB_EXAMPLE.MEAS_Z"

. . .

20 SQL Q5 "SELECT MEAS_NO,MEAS_X,MEAS_Y,
MEAS_Z FROM TAB_EXAMPLE"

. . .

30 SQL FETCH Q1 HANDLE Q5 INDEX+Q2

. . .

40 SQL UPDATE Q1 HANDLE Q5 INDEX+Q2

. . .

50 SQL COMMIT Q1 HANDLE Q5

Example:

11 SQL BIND Q881 "TAB_EXAMPLE.MEAS_NO"

12 SQL BIND Q882 "TAB_EXAMPLE.MEAS_X"

13 SQL BIND Q883 "TAB_EXAMPLE.MEAS_Y"

14 SQL BIND Q884 "TAB_EXAMPLE.MEAS_Z"

. . .

20 SQL Q5 "SELECT MEAS_NO,MEAS_X,MEAS_Y,
MEAS_Z FROM TAB_EXAMPLE"

. . .

30 SQL FETCH Q1 HANDLE Q5 INDEX+Q2

. . .

50 SQL ROLLBACK Q1 HANDLE Q5