Subject Re: Exclusive Lock
Author nitaligavino
--- In ib-support@y..., "Dimitry Sibiryakov" <SD@t...> wrote:
> On 30 Sep 2002 at 19:32, Guillermo Najar-Arreola wrote:
>
> >multiuser acces. How can I achieve this exlusive-lock in Firebird
for
> >a table? I'd like not doing it from my application using flags that
>
> You can play with transaction's parameters (such as
tpb_exclusive,
> tpb_lock_read, tpb_lock_write). But don't ask me - how. I don't
know.
>
> SY, Dimitry Sibiryakov.

If you are using the API calls then you can acquire an exclusive
table lock during transaction creation. Here is an example of how to
setup the char vector: (C / C++)

static char trans_locked[] =
{
/**Interbase version.*/
isc_tpb_version3,
/**Access mode.*/
isc_tpb_write,
/**Isolation level.*/
isc_tpb_concurrency,
/**Lock resolution.*/
isc_tpb_nowait,
/**Table reservation.*/
isc_tpb_lock_write,
`T',
`a',
`b',
`l',
`e',
isc_tpb_protected, // End table
/**Terminator.*/
'\0',
};

Here a tpb is created for an exclusive write lock on the table
named "Table".

After building up this tpb you can then pass it to:
isc_start_transaction(…)

Note that the size is:
int iSize = sizeof(trans_locked) – 1);
We don't consider the terminator.

I hope this is still accurate, it's been about a year since I looked
at this!
You can also look at the API Guide under the section:
"Specifying table reservation"

However, if I remember correctly the examples in the documentation
don't seem to work correctly.

Hope this helps.
Dan