This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[NX:URLyBird] Question of owner field.  RSS feed

 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the db.db file, every record have the field named size specifies the maximum number of people permitted in this room. And it's value is from 2 to 6.
My problem is when one client update the record to booking the room, but now the isn't full, then another client booking the room later, which client's name will be added to the owner field? Whether add all their names?
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo,
your have first to lock the record (so, that nobidy can change it.
Then you ckech if the room is still available.
If so, you book it and unlock the record.
That way the situation you just have described can never occur, since at the time a second client aquired a lock, the record will be booked by first client. Second client should get then just a message that a room is booked and should refresh search results.
Vlad
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Vlad.
Thanks for reply.
I think you don't understand my meaning, because my english isn't good. I'm a chinese.
I said that since every room can hold 2-6 men, then whether it can be booked 2-6 times. Because in my country, if take place this condition, the room will be hired by several people. So, the owner field should book whose name?
 
Davidd Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Leo,
One room is just booked once.
Regards
Davidd
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!