Subject | Re: [firebird-support] Re: Locking tables |
---|---|
Author | Thomas Miller |
Post date | 2005-01-12T18:54:06Z |
Good reason to use Locking. There is locking capability built in.
I don't know the exact syntax. Someone else here should be able
to give an example.
It is a "select for update locked" type syntax.
nagypapi wrote:
Thomas Miller
Wash DC Delphi SIG Chairperson
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork
http://www.bss-software.com
http://www.cpcug.org/user/delphi/index.html
https://sourceforge.net/projects/uopl/
http://sourceforge.net/projects/dbexpressplus
I don't know the exact syntax. Someone else here should be able
to give an example.
It is a "select for update locked" type syntax.
nagypapi wrote:
>--
>
>>So why do you need it or do you need to learn more about versioning?
>>
>>
>How I came to ask this question:
>Let's say my table is full of conference room reservations, each
>record having a starttime timestamp and duration (or endtime timestamp)
>Now if I let out a room I have to check if the requested time period
>conflicts with any records in the table (20:00->21:30 conflicts with
>21:00->22:00)
>And only after this check can I insert the record
>(these two steps are done by a SP)
>So what I need is that nobody should be able to update the table AFTER
>the SP checks for conflicting records
>
>Now this can be accomplished with the SET TRANSACTION method, but if I
>really have to compare it to locks:
>"SET TRANSACTION starts a transaction" [langref.pdf,153. page]
>This means I cannot set transaction in a SP, which would be
>appropriate (I need the lock because of the way the SP works, not
>because of the client...). This is especially ugly, because for
>performance reasons I am going to use the RESERVING table1,table2
>parameter (with SNAPSHOT isolation), which means I have to specify the
>table names in my java client (and all this because of how the SP
>works, all I'd want to do is call the SP with a few arguments, let the
>SP handle the metadata). Pray tell me if I'm missing something.
>
>And to answer Ann's question:
>You can use the LOCK statement anywhere in a transaction, evidently in
>a SP too
>(I must add I haven't tried Postgre because I'm a firebird fan, and am
>also needing it as a win service (Postgre is still in RC), but I've
>been reading a lot of documentation today :) )
>
>Regards,
>John
>
>
>
>>nagypapi wrote:
>>
>>
>>
>>>I was wondering, are there any plans to implement explicit table
>>>locking as is in PostgreSQL:
>>>http://www.postgresql.org/docs/7.4/interactive/explicit-locking.html
>>>http://www.postgresql.org/docs/7.4/interactive/sql-lock.html
>>>
>>>This topic was more or less previously discussed in firebird-java, and
>>>we got to the conclusion that setting the transaction isolation level
>>>is a possible solution, but explicit locking seems more appropriate
>>>and flexible (from a java programmer's point of view)
>>>John
>>>
>>>
>>>
>>>
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>--
>>Thomas Miller
>>Wash DC Delphi SIG Chairperson
>>Delphi Client/Server Certified Developer
>>BSS Accounting & Distribution Software
>>BSS Enterprise Accounting FrameWork
>>
>>http://www.bss-software.com
>>http://www.cpcug.org/user/delphi/index.html
>>https://sourceforge.net/projects/uopl/
>>http://sourceforge.net/projects/dbexpressplus
>>
>>
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
Thomas Miller
Wash DC Delphi SIG Chairperson
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork
http://www.bss-software.com
http://www.cpcug.org/user/delphi/index.html
https://sourceforge.net/projects/uopl/
http://sourceforge.net/projects/dbexpressplus