Hi all,

In brief. 
NT4 + WO3.5 + Linux/ MySQL (no locking functionality)

I need to generate a unique ID for a ' Certificate '. The problem is I cannot use the 
table's primary key generation mechanism because this number is generated by appending 
a number (1...n) to a letter (A.....Z) AND this letter is the name of one of many 
BOOKS that can be available or not when the user generates the certificate. This books 
are constantly travelling from town to town , so the user picks the one which is 
available at the moment he generates and prints the certificate.
(Weird mechanism which I cannot change right now and is imposed by LAW).

The other thing is I actually generate a record for this certificate in advance 
(status = certificate not emitted)  so I use a common interger PK to uniquely identify 
the record.
Then when the certificate is emmitted I have to sign the number (A555...).


Now the question is which is the best way to implement this so I can generate this as 
UNIQUE values?
I have an entity called Books with the attributes Name (A....Z) and CurrentIndex (also 
PK, Date, User...) 
I thought about ' Locking on a column' while getting the last value from the choosen 
BOOK and storing the increment, then releasing the lock.
But what if another user tries to get the last value at the same time. How can iterate 
until the certificate gets its number without alerting the user that he cannot 
generate the new value until the other user frees the record?

I will appreciate any help. And many thanks in advance.....


Ale

Reply via email to