Im doing something screwy here... I need the DB to return me a true or false depending on if the date is bigger than than the end date
my $dates = $c->model('Foo::Bar')->search( { bar_id => $c->session->{bar_id} }, { select => [ { IF => [ 'DATE_ADD ("'.$date.'", INTERVAL 1 DAY ) > bar_end', 1, 0 ] }, { DATE_FORMAT => [ { DATE_SUB => [ '"'.$date.'"', 'INTERVAL 1 DAY' ] }, '"%d-%m-%Y"' ] } ], as => [ qw/ next_date prev_date /] } ); Which produces the following... SELECT IF( DATE_ADD ("2006-06-05", INTERVAL 1 DAY ) < bar_end, 1, 0 ), DATE_FORMAT( DATE_SUB( "2006-06-05", INTERVAL 1 DAY ), "%d-%m-%Y" ) FROM bar me WHERE ( bar_id = ? ) Which looks fine to me and if I run it in mysql works, but code tells me... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '("2006-06-05", INTERVAL 1 DAY ) < bar_end, 1, 0 ), DATE_FORMAT( DATE_SUB( "' at line 1 at /home/clock/cvs/branding/script/../lib/Foo/Controller/Bar.pm line 211 Any ideas? _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/