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

Michael Van Canneyt michael at freepascal.org
Sun Nov 28 14:59:59 CET 2010



On Sun, 28 Nov 2010, Marco van de Voort wrote:

> On Wed, Nov 24, 2010 at 08:57:48PM +0100, Michael Van Canneyt wrote:
>> The SQLDB model is in fact modeled after Firebird.
>> Firebird offers more control over the transactions.
>>
>> We did not want to take away this possibility, so we modeled sqldb on
>> the most powerful RDBMS. This adds some overhead for the others.
>
> Could you give some examples about this? postgres vs firebird?

Examples of what exactly ?

In Postgres (and in fact most other engines), you have essentially 
1 simultaneous transaction per connection. (implicit or explicit). 
When running a query, you must simply specify the connection; 
The transaction context is automatically known. There is no way to alter it.
Transaction control is limited to BEGIN; COMMIT; and SAVEPOINT.
(a bit overimplified, but essentially that is it).

Firebird allows you to have multiple transactions simultaneously per connection.
So when running a query, you must always specify 
- Database handle
- Transaction handle
This is in fact very convenient in a multi-tier server app:
There can be 1 connection to the database, but all logged-in 
users operate in their own transaction context. 
User A commits something, and this has no effect whatsoever on what user B is doing.

Michael.




More information about the Lazarus mailing list