Ver Mensaje Individual
  #3  
Antiguo 31-08-2011
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.043
Reputación: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
En la web de fibplus puedes descargar unos tutoriales (FIBplus devguide1.pdf y FIBplus devguide2.pdf), en uno de ellos dice:

Cita:
Working with transactions
A transaction is an operation of database transfer from one consistent state to another.
All operations with the dataset (data/metadata changes) are done in the context of a
transaction. To understand special FIBPlus features completely you need to know about
InterBase / FIBPlus transactions. Please read the topic «Working with Transaction» in
ApiGuide.pdf for InterBase.
All the changes done in the transaction can be either committed (in case there are no errors) by
Commit or rolled back (Rollback). Besides these basic methods TpFIBTransaction has their
context saving analogues: CommitRetaining and RollbackRetaining, i.e. on the client side, these
will not close a TpFibQuery or TpFibDataset.
To start the transaction you should call the StartTransaction method or set the Active property
to True. To commit the transaction call Commit/CommitRetaing, to roll it back -
Rollback/RollbackRetaining.
TpFIBQuery and TpFIBDataSet components have some properties which help to control
transactions automatically. In particular they are: the TpFIBDataSet.AutoCommit property; the
poStartTransaction parameter in TpFIBDataSet.Options; qoStartTransaction and
qoCommitTransaction in TpFIBQuery.Options.
How to set transaction parameters
Transaction parameters are not a trivial topic and require much explanation, so FIBPlus
DevGuide won’t cover the subject in detail. We highly recommend you to read InterBase
ApiGuide.pdf to understand how transactions work.
Nevertheless in most cases you do not need to know about all peculiarities of transaction control
at the API level. FIBPlus has a number of mechanisms which help developers’ work easier. I.e.
TpFIBTransaction has three basic transaction types: tpbDefault, tpbReadCommited,
tpbRepeatableRead. At design time you can also create special types of your own in the
TpFIBTransaction editor and use them as internal ones. Set the transaction type to set its
parameters::
TpbDefault – parameters must be set in TRParams
tbpReadCommited – shows the ReadCommited isolation level
tbpRepeatableRead – shows the RepeatableRead isolation level
Planning to use transactions in the application
Efficient InterBase/Firebird applications depend heavily on correct transaction use. In a multi-
generation architecture (record versioning) Update transactions retain record versions.
So in general try to make the Update transactions as short as possible. Read-only transactions
can remain open because they do not retain versions.
Responder Con Cita