1
總是0,我跟着this例如獲得一個插入的記錄的最後一個ID,問題是,我的應用程序有時會返回0
。我試圖用SQL開發人員測試它的最後插入的ID選擇回報在Informix中
INSERT INTO ...
execute function sysmaster:yieldn(1); // wait 1 second
select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1;
總是返回0. 1秒鐘的等待只是爲了模擬我的應用程序中的流量。
有人可以解釋我dbinfo('sqlca.sqlerrd1')
是什麼意思。
PS:
我從IBM site
嘗試的例子當我執行:
insert into fst_tab VALUES (0,1);
insert into fst_tab VALUES (0,4);
insert into fst_tab VALUES (0,6);
execute function sysmaster:yieldn(1);
insert into sec_tab values (dbinfo('sqlca.sqlerrd1'));
select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1;
返回正確的ID,但是當我評論插入線:
insert into fst_tab VALUES (0,1);
insert into fst_tab VALUES (0,4);
insert into fst_tab VALUES (0,6);
execute function sysmaster:yieldn(1);
//insert into sec_tab values (dbinfo('sqlca.sqlerrd1'));
select dbinfo('sqlca.sqlerrd1') from informix.systables where tabid=1;
然後我t返回0
。
PS2:
我的分貝:
- Informix Dynamic Server的12.10.FC5
- IBM Informix JDBC驅動程序用於IBM Informix Dynamic Server的3.70.JC2
hm以及你如何在PS中解釋例子,當它在等待後返回正確的ID – hudi
我會把它留給你作爲練習。 – mustaccio
hm好吧,你能解釋我怎麼能保證dbinfo將在插入多線程應用程序後立即被調用,我需要在1s插入幾個插入? – hudi