3 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
5 #warn "$dsn $user $pass";
7 plan skip_all, 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
8 unless ($dsn && $user);
12 DBICTest::Schema->compose_connection('MySQLTest' => $dsn, $user, $pass);
14 my $dbh = MySQLTest::Artist->storage->dbh;
16 $dbh->do("DROP TABLE IF EXISTS artist;");
18 $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255));");
20 #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
22 MySQLTest::Artist->load_components('PK::Auto::MySQL');
24 # test primary key handling
25 my $new = MySQLTest::Artist->create({ name => 'foo' });
26 ok($new->artistid, "Auto-PK worked");
30 MySQLTest::Artist->create({ name => 'Artist ' . $_ });
32 my $it = MySQLTest::Artist->search( {},
35 order_by => 'artistid' }
37 is( $it->count, 3, "LIMIT count ok" );
38 is( $it->next->name, "Artist 2", "iterator->next ok" );
41 is( $it->next, undef, "next past end of resultset ok" );
44 $dbh->do("DROP TABLE artist");