- Fix a bug in update_all() resulting in the first row receiving a
different dataset than the subsequent ones
- Accomodate MSAccess supporting only 'INNER JOIN' (not plain 'JOIN')
+ - InflateColumn::DateTime option datetime_undef_if_invalid no longer
+ masks missing dependency exceptions (RT#66823)
0.08192 2011-05-10 04:20 (UTC)
* Fixes
inflate => sub {
my ($value, $obj) = @_;
- my $dt = try
- { $obj->_inflate_to_datetime( $value, $infcopy ) }
- catch {
- $self->throw_exception ("Error while inflating ${value} for ${column} on ${self}: $_")
- unless $infcopy->{datetime_undef_if_invalid};
- undef; # rv
- };
+ # propagate for error reporting
+ $infcopy->{__dbic_colname} = $column;
+
+ my $dt = $obj->_inflate_to_datetime( $value, $infcopy );
return (defined $dt)
? $obj->_post_inflate_datetime( $dt, $infcopy )
my $parser = $self->_datetime_parser;
my $preferred_method = sprintf($method_fmt, $info->{ _ic_dt_method });
- my $method = $parser->can($preferred_method) ? $preferred_method : sprintf($method_fmt, 'datetime');
- return $parser->$method($value);
+ my $method = $parser->can($preferred_method) || sprintf($method_fmt, 'datetime');
+
+ return try {
+ $parser->$method($value);
+ }
+ catch {
+ $self->throw_exception ("Error while inflating ${value} for $info->{__dbic_colname} on ${self}: $_")
+ unless $info->{datetime_undef_if_invalid};
+ undef; # rv
+ };
}
sub _inflate_to_datetime {
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use lib qw(t/lib);
+use DBICTest;
+
+my $no_class = '_DBICTEST_NONEXISTENT_CLASS_';
+
+my $schema = DBICTest->init_schema();
+$schema->storage->datetime_parser_type($no_class);
+
+my $event = $schema->resultset('Event')->find(1);
+
+# test that datetime_undef_if_invalid does not eat the missing dep exception
+throws_ok {
+ my $dt = $event->starts_at;
+} qr{Can't locate ${no_class}\.pm};
+
+done_testing;
id => { data_type => 'integer', is_auto_increment => 1 },
# this MUST be 'date' for the Firebird and SQLAnywhere tests
- starts_at => { data_type => 'date' },
+ starts_at => { data_type => 'date', datetime_undef_if_invalid => 1 },
created_on => { data_type => 'timestamp' },
varchar_date => { data_type => 'varchar', size => 20, is_nullable => 1 },