4 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
6 #warn "$dsn $user $pass";
8 plan skip_all, 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
9 unless ($dsn && $user);
13 DBICTest::Schema->compose_connection('MySQLTest' => $dsn, $user, $pass);
15 my $dbh = MySQLTest::Artist->storage->dbh;
17 $dbh->do("DROP TABLE IF EXISTS artist;");
19 $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255));");
21 #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
23 MySQLTest::Artist->load_components('PK::Auto::MySQL');
25 # test primary key handling
26 my $new = MySQLTest::Artist->create({ name => 'foo' });
27 ok($new->artistid, "Auto-PK worked");
31 MySQLTest::Artist->create({ name => 'Artist ' . $_ });
33 my $it = MySQLTest::Artist->search( {},
36 order_by => 'artistid' }
38 is( $it->count, 3, "LIMIT count ok" );
39 is( $it->next->name, "Artist 2", "iterator->next ok" );
42 is( $it->next, undef, "next past end of resultset ok" );
45 $dbh->do("DROP TABLE artist");