|
Otros manuales para este modelo:
Resumen del manual
Av
oiding
Locks
on
T
erminal
Reads
SQLNoTermLock
()
{
/********************************************************
*******/
/*
First,
declare
the
cursor:
*/
/********************************************************
*******/
EXEC
SQL
DECLARE
C1
Cursor
FOR
SELECT
PartNumber,
SalesPrice
FROM
PurchDB.Parts;
/********************************************************
*******/
/*
Execute
the
OPEN
command
until
there
is
no
deadlock:
*/
/********************************************************
*******/
do
{
DeadLockFree
=
TRUE;
EXEC
SQL
OPEN
C1
KEEP
CURSOR
WITH
NOLOCKS;
if
(sqlca.sqlcode
!=
0)
SQLStatusCheck;
}
while
(!DeadLockFree);
/********************************************************
*******/
/*
COMMIT
WORK
to
preserve
the
cursor
position:
*/
/********************************************************
*******/
EXEC
SQL
COMMIT
WORK;
if
(sqlca.sqlcode
!=
0)
SQLStatusCheck;
/********************************************************
*******/
/*
Now
FETCH
a
row
from
the
active
set
until
EndofScan
*/
/********************************************************
*******/
while
(!
EndofScan)
{
do
{
DeadLockFree
=
TRUE;
EXEC
SQL
FETCH
C1
INTO
:PartNumber,
:PresentSalesPrice;
if
(sqlca.sqlcode
!=
0)
SQLStatusCheck();
else
{
EXEC
SQL
COMMIT
WORK;
if
(sqlca.sqlcode
!=
0)
SQLStatusCheck();
}
}
while
(!DeadLockFree);
/******************************************************** */
/*
Display
the
present
price
and
prompt
for
a
new
one:
*/
/******************************************************** */
printf("\n
Part
Number:
%d",
PartNumber);
printf("\n
Current
Sales
Price:
%10.2f",
PresentSalesPrice);
scanf
("\n
Enter
New
Sales
Price:
%10.2f",
NewSalesPrice);
Processing
with
Cursors
6-25
...Otros modelos de este manual:
Software - MPE/iX 6.5 Operating System (1.21 mb)
Software - MPE/iX 7.0 Operating System (1.21 mb)
Software - MPE/iX 7.5 Operating System (1.21 mb)