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