I'm currently using Delphi XE7 with IBDAC 5.4.12.
I have the following code in a procedure, that is located in a simple unit(not a form nor a datamodule):
Code: Select all
var
vDB: TIBCConnection;
vTR: TIBCTransaction;
vQuery: TIBCSQL;
begin
vDB := TIBCConnection.Create(nil);
vTR := TIBCTransaction.Create(nil);
vQuery := TIBCSQL.Create(nil);
try
vTR.DefaultConnection := vDB;
vTR.IsolationLevel := iblReadCommitted;
vDB.DefaultTransaction := vTR;
vDB.AutoCommit := False;
vQuery.AutoCommit := False;
SetupIBDACConnection(vDB, Demo); // A procedure that populates the TIBCConnection properties.
vDB.Open;
vQuery.Transaction := vTR;
vTR.StartTransaction;
vQuery.SQL.Add('INSERT INTO PATIENT_ACCESS_LOG ');
vQuery.SQL.Add
(' (PATIENTNO, SECTION, DESCRIPTION_TEXT, USERNAME, PAL_DATE, PAL_TIMESTAMP, EMPLOYEE_ID) ');
vQuery.SQL.Add(' VALUES (' + IntToStr(PatientNo) + ', ''' + Section +
''', ''' + DescriptionText + ''', ''' + Username +
''', CURRENT_DATE, CURRENT_TIMESTAMP, ' + IntToStr(Employee_ID) + ') ');
vQuery.Execute;
finally
if vTR.Active then
vTR.Commit;
if vDB.Connected then
vDB.Disconnect;
if Assigned(vQuery) then
vQuery.Free;
if Assigned(vTR) then
vTR.Free;
if Assigned(vDB) then
vDB.Free;
end;
end;
All I did was simply converted this code from FIB Plus(in Delphi 7) to IBDAC(in Delphi XE7). The code worked with FIB Plus(in Delphi 7), but I'm wondering if there is something different that I should do for IBDAC.