8 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
10 #warn "$dsn $user $pass";
12 plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
13 unless ($dsn && $user);
17 DBICTest::Schema->compose_connection('MySQLTest' => $dsn, $user, $pass);
19 my $dbh = MySQLTest->schema->storage->dbh;
21 $dbh->do("DROP TABLE IF EXISTS artist;");
23 $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));");
25 #'dbi:mysql:host=localhost;database=dbic_test', 'dbic_test', '');
27 MySQLTest::Artist->load_components('PK::Auto');
29 # test primary key handling
30 my $new = MySQLTest::Artist->create({ name => 'foo' });
31 ok($new->artistid, "Auto-PK worked");
35 MySQLTest::Artist->create({ name => 'Artist ' . $_ });
37 my $it = MySQLTest::Artist->search( {},
40 order_by => 'artistid' }
42 is( $it->count, 3, "LIMIT count ok" );
43 is( $it->next->name, "Artist 2", "iterator->next ok" );
46 is( $it->next, undef, "next past end of resultset ok" );
48 my $test_type_info = {
53 'default_value' => undef,
56 'data_type' => 'VARCHAR',
59 'default_value' => undef,
62 'data_type' => 'VARCHAR',
65 'default_value' => undef,
70 my $type_info = MySQLTest->schema->storage->columns_info_for('artist');
71 is_deeply($type_info, $test_type_info, 'columns_info_for - column data types');
76 $dbh->do("DROP TABLE artist");