X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F71mysql.t;h=836c846a6d96f0f986371787b544f2be39449c3f;hb=6a9992417a9b274d874519fd42f1b331d5ac91e6;hp=d8254dba5d3416b7d5b9c4efab266ad935238cfe;hpb=b5963465440da3fac2f38651f6470355b07a3a9d;p=dbsrgits%2FDBIx-Class.git diff --git a/t/71mysql.t b/t/71mysql.t index d8254db..836c846 100644 --- a/t/71mysql.t +++ b/t/71mysql.t @@ -114,7 +114,7 @@ $schema->populate ('BooksInLibrary', [ # (mysql doesn't seem to like subqueries with equally named columns) # -SKIP: { +{ # try a ->has_many direction (due to a 'multi' accessor the select/group_by group is collapsed) my $owners = $schema->resultset ('Owners')->search ( { 'books.id' => { '!=', undef }}, @@ -126,7 +126,7 @@ SKIP: { is ($_->count, 2, 'Prefetched grouped search returns correct count'); } - # try a ->prefetch direction (no select collapse) + # try a ->belongs_to direction (no select collapse) my $books = $schema->resultset ('BooksInLibrary')->search ( { 'owner.name' => 'wiggle' }, { prefetch => 'owner', distinct => 1 } @@ -155,41 +155,36 @@ SKIP: { is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); } +my $cd = $schema->resultset ('CD')->create ({}); +my $producer = $schema->resultset ('Producer')->create ({}); +lives_ok { $cd->set_producers ([ $producer ]) } 'set_relationship doesnt die'; + + ## Can we properly deal with the null search problem? ## ## Only way is to do a SET SQL_AUTO_IS_NULL = 0; on connect ## But I'm not sure if we should do this or not (Ash, 2008/06/03) +# +# There is now a built-in function to do this, test that everything works +# with it (ribasushi, 2009/07/03) NULLINSEARCH: { - - ok my $artist1_rs = $schema->resultset('Artist')->search({artistid=>6666}) - => 'Created an artist resultset of 6666'; - + my $ansi_schema = DBICTest::Schema->connect ($dsn, $user, $pass, { on_connect_call => 'set_ansi_mode' }); + + ok my $artist1_rs = $ansi_schema->resultset('Artist')->search({artistid=>6666}) + => 'Created an artist resultset of 6666'; + is $artist1_rs->count, 0 - => 'Got no returned rows'; - - ok my $artist2_rs = $schema->resultset('Artist')->search({artistid=>undef}) - => 'Created an artist resultset of undef'; - - TODO: { - local $TODO = "need to fix the row count =1 when select * from table where pk IS NULL problem"; - is $artist2_rs->count, 0 - => 'got no rows'; - } + => 'Got no returned rows'; - my $artist = $artist2_rs->single; - - is $artist => undef - => 'Nothing Found!'; -} - -my $cd = $schema->resultset ('CD')->create ({}); + ok my $artist2_rs = $ansi_schema->resultset('Artist')->search({artistid=>undef}) + => 'Created an artist resultset of undef'; -my $producer = $schema->resultset ('Producer')->create ({}); + is $artist2_rs->count, 0 + => 'got no rows'; -lives_ok { $cd->set_producers ([ $producer ]) } 'set_relationship doesnt die'; + my $artist = $artist2_rs->single; -# clean up our mess -END { - #$dbh->do("DROP TABLE artist") if $dbh; + is $artist => undef + => 'Nothing Found!'; }