If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > monitoring table change

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-11-03, 19:37
blobon blobon is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
monitoring table change

Hi people,

i am after a method that is able to check a table in a mysql server to see if any new rows have been added.

see, i have 2 scripts (php), one on a secure server and one on a public server (both running freebsd)

when a user makes an update request. the non secure script will place a record in to a table. the secure script then needs to act on this record.

i want to be able to check if a record has been added so that the secure script will imediately perform its action, not run a cron to perform a select every 5 minutes. other wise there could be a delay

thanks.

Blob On
Reply With Quote
  #2 (permalink)  
Old 11-17-03, 16:08
vanekl vanekl is offline
Registered User
 
Join Date: Nov 2003
Posts: 91
Well, your version of MySQL probably doesn't support
triggers, so you have to roll your own, so to speak.

You could make sure every one of your tables has a
timestamp field, so the secure server could poll every
minute or so all records with a timestamp that is less
than 60 seconds old.

Or, the way I did it, is I write a tiny file to a directory
every time I add a record to the unsecure DB, and
a directory watcher program I wrote instantly notices
every time a
new file is created in this directory and tells the secure
server to get to work because it knows that a new record
was just added. This week I'm on the Wintel platform so
my directory watcher program is of no use to you (it's
written in VBasic).
You may want to check out
http://www.25thandclement.com/~willi...cts/watch.html
fam: http://oss.sgi.com/projects/fam/
for directory watchers that work on UNIX if you need
instantanious notification btn your databases.

-lv
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On