perform an operation when certain conditions are true

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daniel2335
    New Member
    • Dec 2007
    • 49

    perform an operation when certain conditions are true

    Is it possible to add code into the database, so that it monitors certain value and performs an operation when certain conditions are true?

    I have a table with research in each having a completion time stamp. When this time stamp matchs the current time or has passed I want it to get removed from that table and another table to be edited. Whats the best way of doing this? Im cautious not the have a script checking it too often as it may effect the database traffic. But I dont really want the detection of the timestamp expiring to be out by any more say 5 seconds.

    Thanks
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    The best way to do something like this would be to set up a cront-job (or something similar). There is really no other way. Nothing happens unless something triggers it.

    I understand you concerns about the extra load, but by timing your checks correctly and optimizing your queries you should be able to keep that in check.

    MySQL 5.1 offers Triggers, which kind of works like cron-jobs, but only for MySQL. It's worth checking out if you are using 5.1.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Please provide a meaningful title to a thread. The one you used until now will not arouse much curiosity and attract many members.

      Thread Title changed to better describe the problem scenario.
      Please read here: Use a Good Thread Title

      I changed your title from 'Maintenence' to the current one.

      moderator

      Comment

      Working...