MySQL gurus, Question for you! Neep help!

MySQL 5.1.6 has a new procedure called an Event (temporal trigger), but my school doesn’t have this version (it is pre-release anyway).

I have a final project we are working on in which I would like to regularly check the timestamps of a table and if an entry is X days old, it deletes it from one row and inserts it into an archive table. We are using MySQL 5.0.18 and I heard the rumor that PL/SQL was included in 5.0? If so, is there an ability to automatically run a process at a specific time with PL/SQL?

I am guessing such things are possible with PERL, but is is possible for a PERL script to run at regular intervals automatically without having somebody type ./scriptname or use some alias?

It isn’t absolutely necessary for the project itself. We can have one large table to hold all entries, but if we go live with the website, I would like one table to hold all entries that occur in the last X days, and everything older than X days goes into an Archive table.

Assuming you have some flavor of Unix, you do this using a cron job.

The server we use at school runs Red-Hat Linux and I checked to see if it was in the Man pages. We might not be able to work it in depending on if we are going to have root access (because we wont). However, we can probably set something up like this on a semi-dedicated or fully dedicated hosting plan if we decide to carry the project on past the project due date.

Thanks!

You don’t need root access to run a cron job. Each user can have their own crontab. Of course, the site must be configured to allow this in the first place.

Cron is the daemon. Crontab is what you would use. Type in “man 5 crontab” to see the file format.