Jump to content


Photo

Auto delete options


  • Please log in to reply
7 replies to this topic

#1 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 08 June 2006 - 09:10 AM

I'm curious if there is a way to autodelete rows after a period of time of inactivity or only after a period of time. Maybe there is a way with scheduled tasks or another way, which checks rows for a time and delete rows that are created one day ago?

Triggers or procedures can solve this? In mysql or pgsql or another database is such thing exists?

Thank you for your time.
Roy Simkes
Yet Another Parkyeri Developer

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 June 2006 - 06:08 AM

The "old school" way is to use a CRON job; but MySQL 5.1 supposedly has an event scheduler which will allow you to do just this without an external program (though I've never actually used it). In principle, you could add a trigger to run, but that's too much extra work for every single statement.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 9911782

9911782
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 09 June 2006 - 07:17 AM

[!--quoteo(post=381758:date=Jun 8 2006, 11:08 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 8 2006, 11:08 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
The "old school" way is to use a CRON job; but MySQL 5.1 supposedly has an event scheduler which will allow you to do just this without an external program (though I've never actually used it). In principle, you could add a trigger to run, but that's too much extra work for every single statement.
[/quote]

Hi

I have the same problem with my website.

How does this CRON job work and where do I get it.

#4 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 09 June 2006 - 07:52 AM

Yeah a simple example could be great with cron as i did not understand too much from the examples I found. Also can I work with cron in windows.

And also what if i implement in my code such an execution. At every time my page will be called that function will be executed. But I think it's better if I implement it as a scheduled task.
Roy Simkes
Yet Another Parkyeri Developer

#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 June 2006 - 04:54 PM

AFAIK, Windows has a different task scheduler -- something with AT command, I think. And I agree -- scheduling is definitely the way to go.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#6 radalin

radalin
  • Members
  • PipPipPip
  • Advanced Member
  • 179 posts

Posted 09 June 2006 - 09:44 PM

Do you know if there is such an option like a scheduled task in postgresql
Roy Simkes
Yet Another Parkyeri Developer

#7 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 June 2006 - 08:17 AM

[!--quoteo(post=382072:date=Jun 9 2006, 05:44 PM:name=radalin)--][div class=\'quotetop\']QUOTE(radalin @ Jun 9 2006, 05:44 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Do you know if there is such an option like a scheduled task in postgresql
[/quote]
I have no idea... never used it.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#8 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 10 June 2006 - 09:49 AM

There is a "wincron" package avilable - try Google
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users