Subject | Changing the Transaction on a prepared SQL statement |
---|---|
Author | Ed Dressel |
Post date | 2011-12-28T16:47:58Z |
I need to change the transaction on a prepared SQL statement in a DSQL (but it could be in a cursor as well). Is that allowed?
I tested it in an example, and it worked fine:
<sample>
procedure TForm1.GetOrderInfo(aTx: TIB_Transaction; const aOrderNo: integer;
out aCustomerNo: integer; out aSaleDate: TDateTime);
begin
dsqlGetClientID.IB_Transaction := aTx; // aTx is different each time
if not dsqlGetClientID.Prepared then
dsqlGetClientID.Prepare;
dsqlGetClientID.Params[0].AsInteger := aOrderNo;
dsqlGetClientID.ExecSQL;
aCustomerNo := dsqlGetClientID.FieldByName('CustNo').Asinteger;
aSaleDate := dsqlGetClientID.FieldByName('SaleDate').AsDateTime;
end;
</sample>
but I was curious if this is okay in a production environment?
Thank you,
Ed Dressel
I tested it in an example, and it worked fine:
<sample>
procedure TForm1.GetOrderInfo(aTx: TIB_Transaction; const aOrderNo: integer;
out aCustomerNo: integer; out aSaleDate: TDateTime);
begin
dsqlGetClientID.IB_Transaction := aTx; // aTx is different each time
if not dsqlGetClientID.Prepared then
dsqlGetClientID.Prepare;
dsqlGetClientID.Params[0].AsInteger := aOrderNo;
dsqlGetClientID.ExecSQL;
aCustomerNo := dsqlGetClientID.FieldByName('CustNo').Asinteger;
aSaleDate := dsqlGetClientID.FieldByName('SaleDate').AsDateTime;
end;
</sample>
but I was curious if this is okay in a production environment?
Thank you,
Ed Dressel