Hi,

This isn't exactly a Symfony question as such, but I figure that someone 
else must have encountered the same issue in the past.

I'm looking to make a counter table in my database to track entries of a 
particular document type.  The goal is to be able to have a simply query 
(ex: select counter from doc_counter where doc_type="abc") that would return 
a counter value that I can use as a file number.  Within the same 
transaction, I can then increment the doc_counter and have it available for 
the next time.  I can then associate the file number to my doc stored in 
another table.

The problem I am facing is how to synchronize the queries/increments to the 
counter.  It is imperative that the filenumbers are unique (sequential). 
Unless I use some kind of syncrhonizing mechanism, I cannot be assured that 
a seperate thread won't query/increment/use the counter at the same time.

In Java, it is easy to create a synchronized class to implement this type of 
behaviour.  In PHP, I don't believe there is any such feature.

Is there anything in Symfony/Doctrine that I can leverage for this kind of 
behaviour?  As a last resort, I figure I could use database locking, but 
would rather avoid it if at all possible...

Thanks!

Eric



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to