Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting and colliding licenses in db

Status
Not open for further replies.

DaveC426913

Programmer
Jul 28, 2003
274
0
0
CA
I've got a list of clients in a table, with the number of licenses they're allowed to have and the number of licenses currently in use. I don't need to assign a unique license to a user, just as long as I ensure that there are not more users than licences allowed.

As soon as a new user starts the registration process, I need to increment the 'Licenses used' field, otherwise I might have collisions (such as two users vying for one remaining license). If that user fails to complete the registration process, I'll decrement the counter again, to make it available for the next user.

Here's my problem: since this is a web form, the user could, upon failing the registration, simply close his browser. Thus there is no "place" for me to know that they've failed. That counter has no reason to get decrmented.

I suppose I could time it, but that's so inelegant and over-engineered. More to the point, it is not user-transparent.
 
Oops. So the question is:

How - or where - can I ensure that the counter gets decremented after reg failure? Or is there a better way to approach transactions and rollback?

I do NOT need a highly-engineered or high-security design, just enough to get the job done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top