[Lazarus] What is a TSQLTransaction and why do I need one?

Joost van der Sluis joost at cnoc.nl
Tue Nov 30 11:14:20 CET 2010


On Tue, 2010-11-30 at 09:16 +0100, Luca Olivetti wrote:
> En/na Joost van der Sluis ha escrit:
> 
> > This can be done perfectly with sqldb. But which are the cases which are
> > difficult?
> 
> When you have a visual database component (e.g. a dbgrid) that needs the 
> connection opened all the time (otherwise it wouldn't show any data) and 
> locks the database for other uses.
> Mind me, it happens also with zeos when you select a 
> TransactIsolationLevel different than tiNone, but there you have the option.
> An use case I have (but it's not the only one) is a dbgrid opened on a 
> read only query (i.e. just to show data), while all data modification is 
> done with a different connection (that signals a refresh to the display 
> one when data is changed).
> I also don't understand the transaction model of zeos, so even if I'm 
> using it, when I need transactions I issue them explicitly 
> (DbConnection.ExecuteDirect('BEGIN')...DbConnection.ExecuteDirect('COMMIT')).

That's what I though. So setting the transaction isolation level is the
issue. And the 'problem' is that sqldb uses another default transaction
isolation setting then Zeos does. 

Well, you can already set the transaction isolation setting with sqldb.
Use TSQLTransaction.Params for that. I'll have to search what the
precise setting is, though.

Joost.





More information about the Lazarus mailing list