Alexander Hartmaier wrote:
That's my preferred way of doing this and it works great.
I second that.
Also, using NOW() in MySQL breaks the query cache. Not an issue here but
worth bearing in mind.
Iain.
___
List:
The lazy man's way out is:
use DateTime;
use DateTime::Duration;
my @users = $rs-search({state=$state});
for my $user (@users) {
my $duration = DateTime::Duration-new(DateTime-now -
$user-last_modified);
$user-delete if ($duration-seconds $limit);
}
Probably more generic rather than
Kiffin Gish schrieb:
The lazy man's way out is:
use DateTime;
use DateTime::Duration;
my @users = $rs-search({state=$state});
for my $user (@users) {
my $duration = DateTime::Duration-new(DateTime-now -
$user-last_modified);
$user-delete if ($duration-seconds $limit);
}
On Tue, 2010-01-26 at 19:51 +0100, Bernhard Graf wrote:
Kiffin Gish schrieb:
The lazy man's way out is:
use DateTime;
use DateTime::Duration;
my @users = $rs-search({state=$state});
for my $user (@users) {
my $duration = DateTime::Duration-new(DateTime-now -
On Tue, Jan 26, 2010 at 16:16, Kiffin Gish kiffin.g...@planet.nl wrote:
Very true, but there must be better ways to do this than the reactions
so far.
What's wrong with:
$rs-search({
state = $state,
last_modified = [ TIMEDIFF( NOW(), ? SECONDS, $seconds ],
})-delete_all;
Standard
shouldn't that be
$rs-search({
state = $state,
last_modified = *\*[ TIMEDIFF( NOW(), ? SECONDS, $seconds ],
})-delete_all;
Justin
On Tue, Jan 26, 2010 at 2:24 PM, Rob Kinyon rob.kin...@gmail.com wrote:
On Tue, Jan 26, 2010 at 16:16, Kiffin Gish kiffin.g...@planet.nl wrote:
Very true, but
Drew Taylor wrote:
I'm not a DBIC expert, but I don't think so. The [...] construct creates
an arrayref, so the leading '\' would just create a reference to a
reference which is probably NOT what you want. :-) Perhaps you're
thinking about passing a scalar ref to put raw SQL into the query,
On Tue, Jan 26, 2010 at 10:42 PM, Peter Rabbitson
rabbit+d...@rabbit.usrabbit%2bd...@rabbit.us
wrote:
Drew Taylor wrote:
I'm not a DBIC expert, but I don't think so. The [...] construct creates
an arrayref, so the leading '\' would just create a reference to a
reference which is probably
Octavian Rasnita wrote:
Is the following SQL
TIMEDIFF( NOW(), ? SECONDS
a standard SQL code supported by more databases?
Until now I was using SQL codes like
now() - interval ? second
but I am not sure if the keyword interval is used in other databases
than MySQL.
Thanks.
Octavian
On Sun, Jan 24, 2010 at 02:44, Octavian Rasnita octav...@fcc.ro wrote:
From: Rob Kinyon rob.kin...@gmail.com
$rs-search({
state = $state,
last_modified = [ TIMEDIFF( NOW(), ? SECONDS, $seconds ],
})-delete_all;
Standard SQL::Abstract stuff, described in both the DBIC cookbook and
the
I want to delete all rows with a given state which have not been
modified for a given time in seconds.
my @rows = rs-search({ state = $state }, { last_modified = ??? });
$_-delete for (@rows);
How can I best do this?
--
Kiffin Gish kiffin.g...@planet.nl
Gouda, The Netherlands
From: Rob Kinyon rob.kin...@gmail.com
On Sat, Jan 23, 2010 at 16:28, Kiffin Gish kiffin.g...@planet.nl wrote:
I want to delete all rows with a given state which have not been
modified for a given time in seconds.
my @rows = rs-search({ state = $state }, { last_modified = ??? });
$_-delete for
12 matches
Mail list logo