#1 2012-01-02 14:56:52

gaddlord
Member
Registered: 2012-01-02
Posts: 8
Website

Improve SynSQLite3 with transactions DEFERRED, IMMEDIATE, EXCLUSIVE

I miss the ability to specify what is the transaction type.

I suggest we add:

type
  TTransactionBehaviour = (
    tbDeferred,
    tbImmediate,
    tbExclusive);
const
  TTransactionBehaviourTokens: array[TTransactionBehaviour] of string = (
    'DEFERRED', 'IMMEDIATE', 'EXCLUSIVE');

and modify BeginTransaction to:


procedure TSQLDataBase.TransactionBegin(const Behaviour: TTransactionBehaviour = tbDeferred);
begin
  if self=nil then
    exit; // avoid GPF in case of call from a static-only server
  if fTransactionActive then begin
    Execute('ROLLBACK TRANSACTION;');
    fTransactionActive := false;
  end;
  Execute('BEGIN ' + TTransactionBehaviourTokens[Behaviour] + ' TRANSACTION;');
  fTransactionActive := true;
end;

Can you include this in the next version or give me access to patch it myself in SVN?

Offline

#2 2012-01-03 10:06:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Improve SynSQLite3 with transactions DEFERRED, IMMEDIATE, EXCLUSIVE

Nice idea.

I've added this parameter to the trunk.
See http://synopse.info/fossil/info/ad74af8201

Thanks for the suggestion and interest.

Offline

Board footer

Powered by FluxBB