Subject | Re: [firebird-support] How to hold lock on record |
---|---|
Author | Bogusław Brandys |
Post date | 2004-10-29T17:30:11Z |
Ann W. Harrison wrote:
transaction started after inserting document, be better then update at
the end of single transaction ?
Ok,maybe becouse if this "generating of number" would become that last
instruction in stored procedure ,in the single transaction ,which in
turn modifies a lot of records here and there ,then commit stage will
take long time and during commit this single row will be locked (even if
this was the last instruction in transaction). Am I right ?
That will requires a
current and number is null.No problem, but I'd like to avoid such
program if I can.
Best Regards
Bogusław Brandys
> At 12:16 PM 10/29/2004, =?ISO-8859-2?Q?Bogus=B3aw_Brandys?= wrote:Please be patient, but I don't understand why would this short
>
>
>>Sorry , I didn't mention that this question is related to my previous
>>question about unbroken series of document numbers wrapped monthly.
>
>
> The most frequently used solution in this case is to insert a document
> with a null number, using an artificial primary key. Commit that.
> Then in a single short transaction, generate your document number and
> update the document to have the new number.
transaction started after inserting document, be better then update at
the end of single transaction ?
Ok,maybe becouse if this "generating of number" would become that last
instruction in stored procedure ,in the single transaction ,which in
turn modifies a lot of records here and there ,then commit stage will
take long time and during commit this single row will be locked (even if
this was the last instruction in transaction). Am I right ?
That will requires a
> scavenge program that runs from time to time, finding documents withoutOK. Such program would for example find each document which date is not
> numbers and asking their creators whether the document is still valid.
>
> Alternately, you can create a number, and store a null document under
> that number with enough information to identify the person who created
> it and the time of creation. Then you need a scavenge program that
> finds numbers without documents.
current and number is null.No problem, but I'd like to avoid such
program if I can.
Best Regards
Bogusław Brandys