Subject | Re: [IBO] Ensure table consistency |
---|---|
Author | jeffplata |
Post date | 2007-02-07T03:34:27Z |
Hello Set,
Thanks for your reply. I wanted the SP to get exclusive hold of the
tables it will be working upon once it is started. And then other
users are not allowed to edit the table, instead they should get a
feedback that the table is "busy" if they attempt to do so. If I
understand correctly, tiConcurrency allows for a transaction to start
updating tables and at commit time, the table is check if it was not
updated by other users, rolled back if changed by other, committed
otherwise. I do not want this to happen with the subject SP. Before it
executes, it's either a "go" or "no go" based on the availability of
the affected table. Something like dBaseIII+'s USE EXLUSIVE.
If it helps, here's my code to call the SP:
with tib_storedproc.Create(nil) do
try
//ib_transaction.Isolation := tiConsistency;
storedprocname := 'do_postsl';
autodefineparams := false;
parambyname('aperiod').AsString := aperiod;
execute;
finally
free;
end;
TIA.
Jeff
--- In IBObjects@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
Thanks for your reply. I wanted the SP to get exclusive hold of the
tables it will be working upon once it is started. And then other
users are not allowed to edit the table, instead they should get a
feedback that the table is "busy" if they attempt to do so. If I
understand correctly, tiConcurrency allows for a transaction to start
updating tables and at commit time, the table is check if it was not
updated by other users, rolled back if changed by other, committed
otherwise. I do not want this to happen with the subject SP. Before it
executes, it's either a "go" or "no go" based on the availability of
the affected table. Something like dBaseIII+'s USE EXLUSIVE.
If it helps, here's my code to call the SP:
with tib_storedproc.Create(nil) do
try
//ib_transaction.Isolation := tiConsistency;
storedprocname := 'do_postsl';
autodefineparams := false;
parambyname('aperiod').AsString := aperiod;
execute;
finally
free;
end;
TIA.
Jeff
--- In IBObjects@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
>UPDATE
> Hi Jeff!
>
> If you just want to ascertain that all statements sees the same values
> throughout your transaction, I think tiConcurrency should be enough. If
> others change records (UPDATE/DELETE records that you also try to
> or DELETE, INSERT isn't affected) while you try to run your updatemore
> script, you will get an exception upon commit.
>
> tiConsistency sounds a bit extreme.
>
> Take a look at http://www.ibobjects.com/TechInfo.html#trantutor for
> information about transactions.postedsls(gl,sl,normbalance,period,bdr,bcr,cdr,ccr,edr,ecr)
>
> HTH,
> Set
> -donating to Firebirds future development is now easier than it was 24
> hours ago. Take a look at the upper left corner of www.firebirdsql.org.
>
> jeffplata wrote:
> > In firebird, I have a SP that sums table1 and inserts the totals into
> > table2. After this, the SP updates table1 to mark the just finished
> > process. In IBO, I use a ib_storedproc to execute the SP. What can I
> > do to ensure that table1 will not be updated by other users while the
> > SP is doing its thing? Will tiConsistency apply help here? I tried it
> > with ib_storedproc but the combo seems incorrect and I just can't get
> > it to work.
> >
> > Actual SP follows:
> > [code]
> > begin
> > delete from postedsls where period>=:aperiod;
> >
> > insert into
> > selectgl,sl,normbalance,:aperiod,beg_debit,beg_credit,debit,credit,
> > end_debit,end_credit
> > from view_sl_balance(:aperiod);
> >
> > update jevs set posted='1' where jevperiod=:aperiod;
> > end
> > [/code]
> >
> > TIA.
>