use Test::Warn;
use lib qw(t/lib);
use DBICTest;
+use DBIx::Class::_Util 'sigwarn_silencer';
use Path::Class::File ();
use Math::BigInt;
use List::Util qw/shuffle/;
# [ 10000, "ntn" ],
my $start_id = 'populateXaaaaaa';
-my $rows = 10_000;
+my $rows = 10;
my $offset = 3;
$schema->populate('Artist', [ [ qw/artistid name/ ], map { [ ($_ + $offset) => $start_id++ ] } shuffle ( 1 .. $rows ) ] );
my $rs = $schema->resultset('Artist');
$rs->delete;
throws_ok {
+ # this warning is correct, but we are not testing it here
+ # what we are after is the correct exception when an int
+ # fails to coerce into a sqlite rownum
+ local $SIG{__WARN__} = sigwarn_silencer( qr/datatype mismatch.+ foo as integer/ );
+
$rs->populate([
{
artistid => 1,
name => 'foo3',
},
]);
-} qr/\Qexecute_for_fetch() aborted with 'datatype mismatch\E\b/, 'bad slice';
+} qr/\Qexecute_for_fetch() aborted with 'datatype mismatch\E\b/, 'bad slice fails PK insert';
is($rs->count, 0, 'populate is atomic');
# test all kinds of population with stringified objects
warnings_like {
+ local $ENV{DBIC_RT79576_NOWARN};
+
my $rs = $schema->resultset('Artist')->search({}, { columns => [qw(name rank)], order_by => 'artistid' });
# the stringification has nothing to do with the artist name
}, 'empty has_many relationship accepted by populate');
done_testing;
+
+use DDP; use Data::Dumper;
+my $q = $schema->resultset('Artist')
+ ->search({
+ },
+ {
+ columns => [qw/name rank/]
+ })->as_query;
+ use DDP; p $q;
+#p $q;
+#diag Dumper($q);
+#p $schema->resultset('Artist')->result_source;
+#p Dumper $q;
+$schema->storage->insert_bulk($schema->resultset('Artist')->result_source, [qw/name rank/], $q);