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

Michael Van Canneyt michael at freepascal.org
Wed Nov 24 21:18:49 CET 2010



On Wed, 24 Nov 2010, Alexsander Rosa wrote:

> Could you point which files should be patched?

I think it could be done by simply patching sqldb.pp itself.

My suggestion:

1. Add an option 'autotransaction' to TSQLConnection. Best in the form of
    TSQLConnectionOption = (coAutoTransaction);
    TSQLConnectionOptions = set of TSQLConnectionOption;
    Property TSQLConnection.ConnectionOptions = TSQLConnectionOptions
2. Add code to TSQLQuery to automatically create a TSQLTransaction
    (owned and available as function from TSQLConnection)
    if none is assigned explicitly and coAutoTransaction is in TSQLConnection.ConnectionOptions.
    (create an internal TSQLAutoTransaction component, and create that) 
3. If such a transaction is created (you can check if the class of the transaction is TSQLAutoTransaction),
    do a commit after all Executed statements.

If it is done like this, the behaviour can be refined later on with more options.

Michael.

> 
> 2010/11/24 Michael Van Canneyt <michael at freepascal.org>
> 
>
>       On Wed, 24 Nov 2010, Alexsander Rosa wrote:
>
>             But it is transparent to the libpq programmer; why it's not transparent with sqldb?
> 
> 
> Correction: it can be transparant in libpq.
> 
> But we can make it so in SQLDB.
> 
> 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.
> 
> What we neglected to do is add what Martin added: offer a less intrusive way for the programmer to use it (i.e. create a default transaction in the
> background if none is specified, and close the transaction once the data is read).
> 
> But we'll do that too, all in good time.
> 
> If someone is in a hurry, patches are definitely accepted.
> 
> Michael.
> 
> 
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
> 
> 
> 
> 
> --
> Atenciosamente,
> Alexsander da Rosa
> Linux User #113925
> 
> "Extremismo na defesa da liberdade não é defeito.
> Moderação na busca por justiça não é virtude."
> -- Barry Goldwater
> 
>


More information about the Lazarus mailing list