Subject RE: [firebird-support] get_lock / release_lock
Author Helen Borrie
At 05:45 PM 31/07/2008, you wrote:
>I have an old app: vfp + odbc + mysql.
>I try to replace mysql with minimal change in code.
>In this app when a user is add/modify/delete a document the get_lock()
>function is called and if the lock is get then the user can continue
>otherwise don't.

That is how Firebird works - automatically. Replace this get_lock() mechanism with an exception routine and it is done.

>I read about RDB$SET_CONTEXT / RDB$GET_CONTEXT, but "... variables may be read and written to and by whom are determined by namespace which they belong to.".
>I need RDB$SET_CONTEXT / RDB$GET_CONTEXT but in a global context.

No, you don't. Each transaction works inside its own context. A transaction knows when it has a lock (and when it hasn't). All your application has to do is try the operation: if it succeeds then it has the lock; if it fails, then it is denied the lock.