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.
package 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 ); }
which when run gives
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...
All those lines are there in the database all with valid date_time value (as implied by the order by date_time directive).

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.

In reply to DBIC intermittently returning rows missing date_time value by reasonablekeith

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.