# FIXME - what the flying fuck... work around RT#76395
# DBD::SQLite warns on binding >32 bit values with 32 bit IVs
sub _dbh_execute {
- if (DBIx::Class::_ENV_::IV_SIZE < 8) {
-
- if (! defined $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT) {
- $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT = (
- modver_gt_or_eq('DBD::SQLite', '1.37')
- ) ? 1 : 0;
- }
-
- local $SIG{__WARN__} = sigwarn_silencer( qr/datatype mismatch/ )
- if $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT;
+ if (
+ DBIx::Class::_ENV_::IV_SIZE < 8
+ and
+ ! defined $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT
+ ) {
+ $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT = (
+ modver_gt_or_eq('DBD::SQLite', '1.37')
+ ) ? 1 : 0;
}
+ local $SIG{__WARN__} = sigwarn_silencer( qr/
+ \Qdatatype mismatch: bind\E \s (?:
+ param \s+ \( \d+ \) \s+ [-+]? \d+ (?: \. 0*)? \Q as integer\E
+ |
+ \d+ \s type \s @{[ DBI::SQL_BIGINT() ]} \s as \s [-+]? \d+ (?: \. 0*)?
+ )
+ /x ) if DBIx::Class::_ENV_::IV_SIZE < 8 and $DBD::SQLite::__DBIC_CHECK_dbd_mishandles_bound_BIGINT;
+
shift->next::method(@_);
}
my $v_desc = sprintf '%s (%d bit signed int)', $bi, $v_bits;
- my $w;
+ my @w;
+ local $SIG{__WARN__} = sub { $_[0] =~ /datatype mismatch/ ? push @w, @_ : warn @_ };
+
lives_ok {
- local $SIG{__WARN__} = sigwarn_silencer( qr/datatype mismatch/ );
$row = $schema->resultset('BigIntArtist')->create({ bigint => $bi });
- } "Insering value $bi ($v_desc)" or next;
-
- is ($w, undef, 'No mismatch warning on bigints' );
+ } "Insering value ($v_desc)" or next;
# explicitly using eq, to make sure we did not nummify the argument
# which can be an issue on 32 bit ivsize
"value in database correct ($v_desc)"
);
+
+ is_deeply (\@w, [], 'No mismatch warnings on bigint operations' );
}
done_testing;