ODBC Server Reference Manual

Using Pass-Through Mode
HP NonStop ODBC Server Reference Manual429151-002
6-20
Locking Data
Locking Data
The following examples show how to use pass-through mode to lock data.
Locking or Unlocking a Table
You can obtain an exclusive lock by using the LOCK statement in pass-through mode:
select "tdm: sql lock table $vol3.prsntabs.employee
in exclusive mode"
update $vol3_pertabs..employee
set salary = salary * 1.15
where deptnum = 2500
select "tdm: sql unlock table $vol3.prsntabs.employee"
You do not need to update the mapping tables after locking or unlocking a table. The
preceding UPDATE statement is not executed using pass-through mode.
Using PREPARE, EXECUTE, and RELEASE Statements
The following examples show how to use the PREPARE, EXECUTE, and RELEASE
statements.
The following statement prepares an INSERT statement and saves it as EMPIN:
select "tdm: sql prepare empin
from insert into $vol3.prsntabs.employee
values (?, ?, ?, ?, ?, ?)"
The following statement executes the prepared statement, specifying a value for each
column (EMPNUM, FIRST_NAME, LAST_NAME, DEPTNUM, JOBCODE, SALARY) of
the EMPLOYEE table:
select "tdm: sql execute empin
using 606, 'Amy', 'Ryan', 3100, 300, 55000"
The following statement releases the prepared statement:
select "tdm: sql release empin"
Managing Traces
The following example statement sets several trace options:
select "tdm: set tra_name trace01 tra_log_tablename
data_disk01_persnl..logtab1 log_to_hometerm y tra_error y"
The following example statement starts a server trace:
select "tdm: set tra_mode_on y"
The following example statement stops a server trace:
select "tdm: set tra_mode_on n"