Subject Re: [IBO] Transaction Commit Problem
Author jfgreco915
I call commit whenever you save. After about 30-50 edits and saves it
slows down. All it is is basic updates/inserts depending upon the
situation. I appreciate the help!

This is the EDIT button, it puts the form into edit mode.

procedure TBrokerMaint.btnEditClick(Sender: TObject);
begin
if fBrokerCode <> '' then
begin
Edit(True);
Common.LoanScapeSQL.StartTransaction;
end
else
ShowMessage('You must choose a broker first.');
end;


This is the SAVE button. The GatherForm and GatherMemo just setup the
SQL properly.:

procedure TBrokerMaint.btnSaveClick(Sender: TObject);
var
qryTarget : TIBOQuery;
begin
try
qryTarget:= TIBOQuery.Create(self);
qryTarget.DataBaseName := 'DBShea';

GatherForm(False,'BROKER',dtsData,qryTarget,['BROKERCODE']);
qryTarget.ParamByName('BROKERCODE').Asstring := fBrokerCode;
if debugging then qryTarget.SQL.SaveToFile('BrokerMaint.xx');
qryTarget.ExecSQL;

GatherMemo( cddNOTES, false,'BROKER',qryTarget,['BROKERCODE'] );
qryTarget.ParamByName('BROKERCODE').Asstring := fBrokerCode;
if debugging then qryTarget.SQL.SaveToFile('BrokerNotes.xx');
qryTarget.ExecSQL;

Common.LoanScapeSQL.Commit;
except
on E: exception do
begin
SQLErrorFileAndDialog( qryTarget,
E,
'Unable to save Broker',
'SHEA2' );
end;
end;
FreeAndNil(qryTarget);
Edit(False);
end;

This is the CANCEL button:

procedure TBrokerMaint.btnCancelClick(Sender: TObject);
begin
Edit(False);
doQueries;
if Common.LoanScapeSQL.InTransaction then
Common.LoanScapeSQL.Rollback;
inherited;
end;

--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 02:46 AM 8/03/2007, you wrote:
> >I have a form that displays data from the database. It has an edit
> >button that enables the field inputs on the form to be editable and
> >also starts a transaction. If you click edit it displays two more
> >buttons a Cancel and a Save button.
>
> This sounds kinda wrong. An open dataset is already in a
> transaction. Your edit button should simply put the dataset into
> edit mode. Then save should post the work, or cancel should abort
> it. Either one will return the dataset to browse mode. At some point
> during the editing task, you will want to commit the transaction.
>
>
> >Here is my problem if you use this form over and over again the Commit
> >time seems to take longer and longer.
>
> What is "over and over again"? 100 edits? 10,000? At what point do
> you commit? i.e. what event prompts a commit?
>
> >Closing the form and opening it
> >back up does not speed it up at all. You have to close the application
> >and reopen and then it builds up again to eventually take longer and
> >longer each time.
> >
> >Is this a known issue? Has anyone seen this before?
> >
> >Any help would be greatly appreciated!
>
> Help us by showing the code that runs when those buttons are clicked
> and describing the event where you commit the transaction. Also
> indicate the transaction settings of the various transactions.
>
> Helen
>