2
Would Open a Table in Mode Exclusive in the Firebird for Delphi preventing other users from opening the Table?
I use Delphi 10.1 and Firedac for connection to the database.
2
Would Open a Table in Mode Exclusive in the Firebird for Delphi preventing other users from opening the Table?
I use Delphi 10.1 and Firedac for connection to the database.
5
You will need to have good transactional control to succeed with this type of treatment.
Use the with lock
and a block will be made on the table data, preventing changes or deletions of the selected data!
Ex:
Blocking a record:
SELECT * FROM CLIENTES WHERE CODIGO = 255 WITH LOCK
this way the Client of code 255 will be blocked for changes/exclusions.
For the entire table do not use filters.
Source: Firebird.Org
1
I managed to do so:
// Eu desativei o "AutoCommit" pois sem desativar não Funciona.
DM.TFDConnection.TxOptions.AutoCommit := False;
DM.TFDQuery.Close;
DM.TFDQuery.SQL.Clear;
// Trava a Linha da tabela com essa SQL
vSql := 'SELECT * FROM TABELA '+
'WHERE FIELD1 = FIELD1 WITH LOCK';
DM.TFDQuery.SQL.Add(vSql);
DM.TFDQuery.Open;
{ Aqui você faz o que tem que fazer antes de Desbloquear}
Depois destarva Com "COMMIT" ou "ROLLBACK"
DM.TFDConnection.TxOptions.AutoCommit := True;
I hope I’ve helped.
I haven’t tested whether DM.TFDConnection.TxOptions.AutoCommit := True;
unlock the table.
I’ll try here to see how it goes.
Browser other questions tagged delphi firebird delphi-10
You are not signed in. Login or sign up in order to post.
beauty understands... More like I would one
TFDtable
? typetbUsuarios.open
only in Exclusive mode boqueado the whole table...– Edu Mendonça
This open will execute a certain SQL query? If so.... add the
with lock
– Junior Moreira
No. This is a Component
TFDTable
firedac– Edu Mendonça
the
TFDTable
has the optionExclusive
which is a boolean, and has an equivalent option in the propertyUpdateOption
.– Junior Moreira
I’ve never done this I’m new to Delphi ... would have how to test if the registration is even blocked?
– Edu Mendonça