Subject Re: [firebird-support] how to forbid a stored procedure to be executed simultaneous by multiple thread
Author Alexandre Benson Smith
Em 5/5/2012 04:28, nathanelrick escreveu:
> Hello,
>
> i need to forbid a stored procedure to be executed simultaneous by multiple thread. is there any way to do this ?
>
> thanks by advance
>

You will need some kind of semaphore, there is a couple of ways to
achieve it.

1.) Update a record in the beginning of the procedure, when the second
call tries to update the same record you will get a conflict, handle it
and quit the procedure
2.) Insert a record in a table, commit, and check it in the beginning of
the SP and exit
3.) External Tables are outside transaction control, you could try to use it
4.) I think it's not your case, but if the calls are in the same
connection you could use RDB$SET_CONTEXT()

see you !