From: Andy Grundman Date: Fri, 12 Aug 2005 19:54:48 +0000 (+0000) Subject: Added MySQL LIMIT tests X-Git-Tag: v0.03001~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=502784de832bed70358d2b4f65fec135ba344946;p=dbsrgits%2FDBIx-Class.git Added MySQL LIMIT tests --- diff --git a/t/11mysql.t b/t/11mysql.t index cd91dfb..45e0f51 100644 --- a/t/11mysql.t +++ b/t/11mysql.t @@ -24,8 +24,26 @@ $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY MySQLTest::Artist->load_components('PK::Auto::MySQL'); +# test primary key handling my $new = MySQLTest::Artist->create({ name => 'foo' }); - ok($new->artistid, "Auto-PK worked"); +# test LIMIT support +for (1..6) { + MySQLTest::Artist->create({ name => 'Artist ' . $_ }); +} +my $it = MySQLTest::Artist->search( {}, + { rows => 3, + offset => 2, + order_by => 'artistid' } +); +is( $it->count, 3, "LIMIT count ok" ); +is( $it->next->name, "Artist 2", "iterator->next ok" ); +$it->next; +$it->next; +is( $it->next, undef, "next past end of resultset ok" ); + +# clean up our mess +$dbh->do("DROP TABLE artist"); + 1;