Subject Re: Transactions and the default transaction
Author alex_vnru
--- In ib-support@y..., "Stevio" <redeagle@f...> wrote:
> In Delphi, you set up a default transaction for your database, which
I've
> done.

Stephen, I suppose you speak about IBX components, right?

> I didn't use any other transactions, but noticed that when I added a
new
> record to a table, it didn't show up outside of the application, for
example
> in IB Console, until I closed the application.

Every SQL statement is performed in transaction context. It mean
transaction within which it is performed can see result and other
transactions can it see immediately after commit of this transaction
if they are read_commited and only if they are started after commit of
this transaction if they are snapshot (concurrency).

> I then added a transaction just for the creation of the new record,
and
> committed the posting of the new record, and it did show up outside
of the
> application, but not within the application!

IBX TIBtransaction component is set to snapshot by default - it see
database state at the moment of it's start. To see commited changes
you should set it to read_commited.

> Can I set the default
> transaction for the application so that changes are committed
straight away,

Using IBX you should explicitly commit transaction at the moment
when statements made within it bringed database to new, consistent
state.

> the app, so I don't need to create 100 transactions for all the
places where
> you can change data?

To be honest, it's not absolutly wrong style, it depends on nature
of your application. But if you want result of each statement to be
immediately seen everywhere, you can keep in common datamodule one
read_commited read only transaction for read data statements and
another to start - changing data statement exec - commit.

To English-speaking folk here who like FB but can't contribute in
code development. If I did'nt missed something, transactions control
and behavior are desribed in API Reference and Programmer's Guide
only. And both are not included into free docs for IB6 Open Source.
Could'nt one of you make such a description for FB? As you can see
here, it is difficult, for example, to me, to explain this in language
which I usually only read :) And while FB starts to attract attention
of newbies, it will be very useful document.

Best regards, Alexander V.Nevsky.