FB and ZConnection, One per DataModule or One per Applicatio

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
louis
Expert Boarder
Expert Boarder
Posts: 107
Joined: 02.01.2009, 19:41

FB and ZConnection, One per DataModule or One per Applicatio

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
louis
Expert Boarder
Expert Boarder
Posts: 107
Joined: 02.01.2009, 19:41

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Post Reply