we're currently using ZEOS in our application but I (chief programmer) want to change to UniDAC. We did a test some time ago, speed was much better, but I got into some trouble with my transaction. Some data arrived in my database, other data not. Due to time issues, I tabled it until now and this morning I changed again from ZEOS ti UniDAC in a copy of my code and still have some issues with transactions. Lock conflicts etc.
I will explain a typical error I get right now and how I use the connection and transactions atm.
1. I have one global connection that is used by every form. I assigned a default transaction as read-only for the test.
2. Every form runs with its own transaction (as forms can be opened in multiple instances)
3. I have calls to do stuff in the database through stored procedures. Those calls use their own transaction, too.
Now the problem:
I call a stored procedure from (3) with its own transaction. I see how the transaction is started (I tried starting it before and after assigning the transaction to the TUniStoredProcedure, same result) in both application and DBMonitor (great tool, btw. kudos). The transaction is configured as read/write.
Code: Select all
procedure TDMFAC.__On_Descontabilizar_FA(SubHookID: Integer; QHS: pQHS; UserParam: Pointer; var ErrCode: Integer);
begin
If ((QHS^.pParams.ParamByName['Clase'].Value = 'FA') Or (QHS^.pParams.ParamByName['Clase'].Value = 'DV')) Then begin
QHS^.pParams.ParamByName['Result'].Value := False;
try
if not SP_OE_DESCONTABILIZAR_DOCUMENTO.Transaction.Active then
SP_OE_DESCONTABILIZAR_DOCUMENTO.Transaction.StartTransaction;
SP_OE_DESCONTABILIZAR_DOCUMENTO.ParamByName('E').AsInteger := QHS^.pParams.ParamByName['E'].Value;
SP_OE_DESCONTABILIZAR_DOCUMENTO.ParamByName('S').AsInteger := QHS^.pParams.ParamByName['S'].Value;
SP_OE_DESCONTABILIZAR_DOCUMENTO.ParamByName('Tipo').AsString := QHS^.pParams.ParamByName['Tipo'].Value;
SP_OE_DESCONTABILIZAR_DOCUMENTO.ParamByName('Numero').AsInteger := QHS^.pParams.ParamByName['Numero'].Value;
SP_OE_DESCONTABILIZAR_DOCUMENTO.ExecProc;
QHS^.pParams.ParamByName['Result'].Value := True;
except
// do some stuff here
end;
end;
end;
If I try with a read/write-transaction as global transaction in (1), no error occurs but as I do no commit during the life-time of the program, no update is visible. So the document I try to process in the code still appears to be unprocessed and a 2nd call to the stored procedure gives me a dead-lock in no_wait transaction. Of course, the update from the first call are still pending.
It is pretty save to assume, that in the first call the read-only global transaction is used, although I assigned the read/write one.
In the 2nd call (when I use a read/write model for the global one) it appears to be used another transaction, because the lock conflict can appear only when another transaction is used.
Any idea what can cause that behavior ?
I really want to get away from ZEOS as soon as possible, but I cannot convince my boss to buy any component, if I cannot prove that it will work.
Thanks in advance,
Helge Lange