my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-plan skip_all => <<EOM unless $dsn && $user;
-Set \$ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
+plan skip_all => <<'EOM' unless $dsn && $user;
+Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
( NOTE: This test drops and creates tables called 'artist', 'cd',
'timestamp_primary_key_test', 'track', 'casecheck', 'array_test' and
'sequence_test' as well as following sequences: 'pkid1_seq', 'pkid2_seq' and
-'nonpkid_seq''. as well as following schemas: 'dbic_t_schema',
+'nonpkid_seq'. as well as following schemas: 'dbic_t_schema',
'dbic_t_schema_2', 'dbic_t_schema_3', 'dbic_t_schema_4', and 'dbic_t_schema_5')
EOM
# Check that datetime_parser returns correctly before we explicitly connect.
SKIP: {
- eval { require DateTime::Format::Pg };
- skip "DateTime::Format::Pg required", 2 if $@;
+ skip (
+ "Pg parser detection test needs " . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg'),
+ 2
+ ) unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg');
my $store = ref $s->storage;
is($store, 'DBIx::Class::Storage::DBI', 'Started with generic storage');
$it->next;
$it->next;
is( $it->next, undef, "next past end of resultset ok" );
+
+ # Limit with select-lock
+ lives_ok {
+ $schema->txn_do (sub {
+ isa_ok (
+ $schema->resultset('Artist')->find({artistid => 1}, {for => 'update', rows => 1}),
+ 'DBICTest::Schema::Artist',
+ );
+ });
+ } 'Limited FOR UPDATE select works';
}
# check if we indeed do support stuff
arrayfield => [5, 6],
});
+ my $afield_rs = $schema->resultset('ArrayTest')->search({
+ arrayfield => \[ '= ?' => [arrayfield => [3, 4]] ], #Todo anything less ugly than this?
+ });
+
my $count;
lives_ok {
- $count = $schema->resultset('ArrayTest')->search({
- arrayfield => \[ '= ?' => [arrayfield => [3, 4]] ], #Todo anything less ugly than this?
- })->count;
+ $count = $afield_rs->count
} 'comparing arrayref to pg array data does not blow up';
is($count, 1, 'comparing arrayref to pg array data gives correct result');
+
+ TODO: {
+ local $TODO = 'No introspection of scalarref conditions :(';
+ my $row = $afield_rs->create({});
+ is_deeply ($row->arrayfield, [3,4], 'Array value taken from $rs condition');
+ $row->discard_changes;
+ is_deeply ($row->arrayfield, [3,4], 'Array value made it to storage');
+ }
}
my $cds = $artist->cds_unordered->search({
year => { '!=' => 2010 }
}, { prefetch => 'liner_notes' });
-TODO: {
- todo_skip 'update resultset with a prefetch over a might_have rel', 1;
- $cds->update({ year => '2010' });
-}
-
+lives_ok { $cds->update({ year => '2010' }) } 'Update on prefetched rs';
## Test SELECT ... FOR UPDATE
SKIP: {
- if(eval "require Sys::SigAction" && !$@) {
+ if(eval { require Sys::SigAction }) {
Sys::SigAction->import( 'set_sig_handler' );
}
else {