Subject | Re: Locking tables |
---|---|
Author | Adam |
Post date | 2005-04-22T13:23:53Z |
Hello Gustavo,
The easiest way I know is to have a table that acts as a gate.
eg
TableLock
(
TableName
)
Then when you discover you need to use TableA, run the query
update tablelock
set tablename = tablename
where tablename = 'TableA';
If everything that tries to access tableA must first "seek permission"
from the tablelock table, you can do it this way.
But it is worth remembering that Firebird has multi-version records.
This means that in many cases, you do not actually need to lock the
table to maintain isolation. The changes made by other transactions
will not be visible to your transaction, so you can carry on as if
nothing had happenned.
may get near the end of its processing and have to roll back because
some other transaction has modified a record you want to modify?
Adam
The easiest way I know is to have a table that acts as a gate.
eg
TableLock
(
TableName
)
Then when you discover you need to use TableA, run the query
update tablelock
set tablename = tablename
where tablename = 'TableA';
If everything that tries to access tableA must first "seek permission"
from the tablelock table, you can do it this way.
But it is worth remembering that Firebird has multi-version records.
This means that in many cases, you do not actually need to lock the
table to maintain isolation. The changes made by other transactions
will not be visible to your transaction, so you can carry on as if
nothing had happenned.
>>Sometimes my application does processing on big tables that last aWhen the transaction commits it has completed. Are you worried that it
>>lot of time and it needs to be sure that it can complete the
>>operation when it commits the transaction.
may get near the end of its processing and have to roll back because
some other transaction has modified a record you want to modify?
Adam