Subject Re: [firebird-support] Transaction
Author unordained
Note: I'm assuming you mean "database table" and not, say "grid" or "list" or other visual
component on your forms. If you meant only visual components, then there are two issues:

a) if a limitation exists, it's likely the fault of the visual components you're using, not the
server
b) several visual components on a form should probably pull data from the same transaction, as the
user likely expects data on a form to "go together" consistenly (if the same data is shown twice on
the form, you should probably never see two different versions of the data on the same form.)

Otherwise ...

A transaction can (and should) do as much work for you as you need. It may retrieve all the data
from a table, then be asked to make changes to that data, as is likely the case for you. It might
do more than that.

I very often have one transaction per form, because each form is performing a given task which I
want to be able to "undo" as a whole. If a user is entering a new bill in the accounting system,
then I have on transaction that will be a context for inserting the bill, the payments, and
everything else. It spans multiple tables, but it spans exactly one action. If I'm running a
report, I have one transaction, pulling data from several tables at once. It's one action.

There is no problem with having a transaction touching several (all) of your tables at the same
time. You should decide how to use your transactions based on:

- how many things you want to commit/rollback together as a single action
- how many things depend on seeing a single "consistent" view of the database

All parts of a given report, for example, should be looking at the same data, or you'll have
problems. All forms that perform an action should be able to undo all of the changes, and not just
some of them, if something goes wrong or the user cancels (unless you mean for it to leave a trace.)

-Philip

---------- Original Message -----------
From: Marcello Fontolan <fontolan@...>
> Hello,
>
> There is any problem open a table that uses a transaction that is
> already active and is already used by another tables?
> What is the most used, a transaction to each table?
> I used to use one transaction for each form but now I does not know if
> it is correctly.
>
> Thank you all!
------- End of Original Message -------