[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Undo Changes
From:       spameden <spameden () gmail ! com>
Date:       2013-07-06 10:44:45
Message-ID: CAHCALex-mPeDrc2VthV7=AuctgaXNmjF7xS4Y5=mK-vREfH1Uw () mail ! gmail ! com
[Download RAW message or body]


2013/7/6 Rafael Ribeiro - iPhone <rafaelribeiro.sp@gmail.com>

> Dear Coleagues,
>
> I would like to listen your opinion about a situation.
>
> There is a function that is able to REMOVE all data from an specific date ?
>

are you talking about removing whole data from the tables or just specific
data inserted at some time?

you can do this different ways..

First way:
1) add a field indicating current time of insertion (for example:
insert_date)
2) DELETE FROM table WHERE insert_date <= DATE_SUB(NOW(),INTERVAL 3 HOURS)
3) set up a cronjob to execute this php script every 3 hours or you can
just delete data via cronjob (all data):

Second way:
1) TRUNCATE table
2) also via cronjob running every 3 hours



> I mean ... We are developing a demo script website, where users can join
> and test our system.
>
> We need a database reset every 3 hours ... Delete all new data and back
> all changes to a default point.
>
> Better do that with php or mysql has an internal function that handle this.
>
> Rafael Ribeiro
> Sent by iPhone
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic