Locking views
Hi, I'm doing a project for school using Perl and MySQL. I have not started writing any scripts yet but I'm formulating some ideas to develop it. What I want to do is created a web page where a user will enter information, which will be stored on the MySQl database. That's the easy part I guess. Then a different user will open another page which will retrieve information from the same database. Now my question is: if a user opens the second page to retrieve a record, how do I stop another user from accessing that same record, but allow that user to look at the next record so both people are not working on the same request? at the same time the requests need to come up in the order in which they were entered.
Here are some of my ideas but I don't know if they would actually work:
- create a column that would hold a boolean value so that when the retrieving interface opens it only pulls records which have a "false" value for those rows that have not been completed. I think this would work if the second page would show ALL non-completed requests, but I want that second page to automatically show ONLY the next non-completed request
- along with the first idea, create a column with a running counter so that every time the submit button is clicked on the first page, a 1 gets added to that column on the next row or enter a timestamp to show the earliest. The retrieving interface would then search for the record that are is completed AND has the lowest number on the counter column or the earliest timestamp. Something like:
SELECT productID WHERE completed = "false" AND counter/timestamp= [the lowest number on that column]... i don't actually know how to get the lowest number at this time.
Any other more efficient ideas? Am I on the right track?
Any help would be highly appreciated.
Subject
Written By
Posted
Locking views
September 18, 2007 09:22AM
September 18, 2007 12:04PM
September 19, 2007 12:24AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.