SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    locking a db for x minutes after a query takes place?

    Hi,

    Is it possible to query a db and from then for say 5 minutes to lock the db? tables are a mixture of innodb and myIsam, if that makes a difference. MySQL 5.0

    bazz

  2. #2
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    586
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uhmm I think you can't lock a db but you can lock tables.
    Don't Panic

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    okay, i'll bite

    why do you want to lock the database?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi rudy,

    OK, it's for a booking system.

    Say, if I get a phone call for a booking and I look at my online booking system, the page may need to be refreshed to show accurate stuff. It may take me a few minutes to discuss the requirements of the customer and I want to make sure that my 'page refresh' doesn't go out of date.

    I want to stop it from accepting any new boookings for a few minutes so that any room I want to pick, isn't snuck into by someone else. I suppose it is just an initial plan to prioritise bookings from the business itself.

    bazz

  5. #5
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why do ideas come to me after I have asked a question.

    Maybe I could set a value in the db when I have refreshed the page, from 1 to 0. then I could make the availability to website visitors, conditional on that value being 1?

    bazz

  6. #6
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IBazz View Post
    why do ideas come to me after I have asked a question.

    Maybe I could set a value in the db when I have refreshed the page, from 1 to 0. then I could make the availability to website visitors, conditional on that value being 1?

    bazz
    That's it. I was about to suggest you to go through PHP solution(changing some flags etc.) rather than DB(table locking).

  7. #7
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I'll do it that way as it is simpler, easier than racking my brain and probably, the better way

    bazz


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •