reasonablekeith has asked for the wisdom of the Perl Monks concerning the following question:
I have a Catalyst app that builds some graphs which is occasionally giving screwy results. It will be fine, and then the result set suddenly returns, missing values. I've boiled an example down to the code as follows.
which when run givespackage myapp::Controller::tests::report; use strict; use warnings; use parent 'Catalyst::Controller'; sub day_simple :Local :Args(2) { my ( $self, $c, $test_id, $passed_date) = @_; my @passed_date_split = split /\D/, $passed_date; my $formatted_passed_date = join '-', @passed_date_split; my $tests_rs = $c->model('DB::Tests')->search( { name => { '=', $test_id }, date_time => { '>=', "$formatted_passed_date 00:00:00", +'<=', "$formatted_passed_date 23:59:59" }, }, { order_by => 'date_time', }, ); my $output = ""; while (my $row = $tests_rs->next) { $output .= $row->get_column('date_time') . ", " . $row->get_co +lumn('time_taken') . "<br/>\n"; } $c->response->body( $output ); }
All those lines are there in the database all with valid date_time value (as implied by the order by date_time directive).2009-06-24 00:03:41, 0.952 2009-06-24 00:14:06, 0.968 2009-06-24 00:24:31, 0.968 2009-06-24 00:34:50, 0.812 2009-06-24 00:45:17, 0.844 2009-06-24 00:55:49, 1.577 , 0.921 2009-06-24 01:16:29, 0.812 2009-06-24 01:26:50, 1.39 2009-06-24 01:37:35, 8.387 2009-06-24 01:48:24, 1.181 , 0.847 2009-06-24 02:09:19, 1.739 2009-06-24 02:19:49, 0.877 etc...
Very wierdly, runing a select over this table from a mysql command shell seems to clear this problem, and the values start returning normally for a while, but the problem always comes back. Bouncing apache has no effect.
I'm running active perl v5.10.0, apache 2.2.11.0, Win Server 2003, DBIx::Class v0.08010, Catalyst 5.71001 and modperl 1.99.
Any help/pointers much appreciated.
Thanks.
Rob
---
my name's not Keith, and I'm not reasonable.
my name's not Keith, and I'm not reasonable.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBIC intermittently returning rows missing date_time value
by moritz (Cardinal) on Jun 25, 2009 at 15:59 UTC | |
Re: DBIC intermittently returning rows missing date_time value
by reasonablekeith (Deacon) on Jun 26, 2009 at 07:51 UTC | |
by Anonymous Monk on Jun 26, 2009 at 08:14 UTC | |
by reasonablekeith (Deacon) on Jun 29, 2009 at 11:00 UTC | |
by Corion (Patriarch) on Jun 29, 2009 at 11:04 UTC | |
by reasonablekeith (Deacon) on Jun 29, 2009 at 11:17 UTC | |
|
Back to
Seekers of Perl Wisdom