ksding 发表于 2010-12-29 12:01

ESQL/C中如何使用游标稳定性?SET ISOLATION to CURSOR STABILITY

ESQL中:
$declare update_cursor cursor for select no from ksding_esql_test for update;
$begin ;
$open update_cursor;
while(SQLCODE==0)
{
        $fetch update_cursor into $kno;
        if(kno==5)
        {
                $update ksding_esql_test set no=no*10 where current of update_cursor;
                tmp=getchar();
        }
}
$commit;
$close update_cursor;
$free update_cursor;

ksding_esql_test表(行锁)中记录:
1        str1
2        str2
3        str3
4        str4
5        str5
6        str6
7        str7
8        str8



感觉应该是读到5的时候将5的那行锁定,不影响其他程序对其他行的读取。
但实际情况是其他程序再读取时,前4行可以读取到(有锁表报错)但不能更新,5行及其后续各行完全读不出来(除非使用脏读)。

有没有办法让游标在读取新行后释放掉在已经走过的行上的锁?

ksding 发表于 2010-12-30 11:06

已解决,是informix锁机制的问题,和游标无关。
:em08:
页: [1]
查看完整版本: ESQL/C中如何使用游标稳定性?SET ISOLATION to CURSOR STABILITY