Page 1 of 1

FB and ZConnection, One per DataModule or One per Applicatio

Posted: 19.09.2010, 11:37
by louis
Hallo,
I try to understanding usage of TZConnection.

Is usefull use One TZConnection per DataModule or One TZConnection per Application what is the difference from the two way?

I try to develop an application with more (like 50) DataModule. Any of this DataModule have a lot of TZQuery.

Thanks, Luigi

Posted: 19.09.2010, 23:05
by mdaems
Luigi,

It all depends on your needs.

When you use One connection per App, connection overhead is smallest and all querys are handled one by one using one transaction.
Using one (or more) ZConnections per datamodule allows multiple simultanious connections from within the same App. This also means you'll have to think about which connection sees which updates all the time.

Mark

Posted: 20.09.2010, 11:22
by louis
mdaems wrote:When you use One connection per App, connection overhead is smallest and all querys are handled one by one using one transaction.
Mark
Ok.
I understand that if I start a transaction like Conn.StartTransaction the property AutoCommit becomes False and viceversa?

I have
- One connection per App with AutoCommit=True;
- two forms (Form1 and Form2) open on Screen each with a TDataModule to edit different data tables in the same database; The queries are set to CachedUpdates=True.

If I start a transaction explicitly with Conn.StartTransaction within one TDataModule suspend editind on form1 and pass focus on Form2 and edit+post changes, what happens to this data? are AutoCommitted or Not?

Thanks, Luigi.

Posted: 13.10.2010, 20:54
by mdaems
Starttransaction temporarily disables autocommit until the next rollback or commit. So none of the updates/deletes/inserts issued after Starttransaction will be committed until commit or connection.close.

Mark