Board index » delphi » Transactions and the default transaction

Transactions and the default transaction

In Delphi, you set up a default transaction for your database, which I've
done.

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.

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!

What am I doing wrong? Do I need to set something in the Transaction Editor?
I haven't set anything in there at the moment. Can I set the default
transaction for the application so that changes are committed straight away,
changes are seen outside of the app. and the changes are also seen inside
the app, so I don't need to create 100 transactions for all the places where
you can change data?

Thanks,
Stephen

 

Re:Transactions and the default transaction


In article <3c8f42fc_2@dnews>, redea...@freeuk.com says...

Hi,

Quote
> 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.

> What am I doing wrong? Do I need to set something in the Transaction Editor?

No, you need to call Transaction.Commit, when you want your changes to
be 'made permanent' in the database.  There is no auto-commit, although
you could put a call to commit in the afterpost event of a dataset, if
you don't need the control.

J

Re:Transactions and the default transaction


Hi,

Quote
"Stevio" <redea...@freeuk.com> wrote in message news:3c8f42fc_2@dnews...
> In Delphi, you set up a default transaction for your database, which I've
> done.

> 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.

Because you do not commit transaction that is used for updates (in case -
your default transaction)

Quote

> 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!

Because your transaction (in case - default transaction) is started before
you commit changes from other transaction (the new one for updates). When
you start transaction you get snapshot of data in this moment (according
options in transaction component) and the future updates are not reflected
in this transaction. After you make changes from some transaction you must
restart other transactions (Commit and then StartTransaction) to see changes
made by other transaction.

I can recommend you to read very carefully all about transactions in IB
Documentation and Delphi Help - this is the key of your DB applications with
IB.

I use default transaction for my read-only queries and other transaction
components for every logical update unit.

I hope that you understand my English ;)

Miro.

Other Threads