4 # Copied from 71mysql.t, manually using NoBindVars. This is to give that code
5 # wider testing, since virtually nobody who regularly runs the test suite
6 # is using DBD::Sybase+FreeTDS+MSSQL -- blblack
11 use DBI::Const::GetInfoType;
13 my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
15 #warn "$dsn $user $pass";
17 plan skip_all => 'Set $ENV{DBICTEST_MYSQL_DSN}, _USER and _PASS to run this test'
18 unless ($dsn && $user);
22 { # Fake storage driver for mysql + no bind variables
23 package DBIx::Class::Storage::DBI::MySQLNoBindVars;
26 DBIx::Class::Storage::DBI::NoBindVars
27 DBIx::Class::Storage::DBI::mysql
29 $INC{'DBIx/Class/Storage/DBI/MySQLNoBindVars.pm'} = 1;
32 # XXX Class::C3 doesn't like some of the Storage stuff happening late...
33 Class::C3::reinitialize();
35 my $schema = DBICTest::Schema->clone;
36 $schema->storage_type('::DBI::MySQLNoBindVars');
37 $schema->connection($dsn, $user, $pass);
39 my $dbh = $schema->storage->dbh;
41 $dbh->do("DROP TABLE IF EXISTS artist;");
43 $dbh->do("CREATE TABLE artist (artistid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), charfield CHAR(10));");
45 $schema->class('Artist')->load_components('PK::Auto');
47 # test primary key handling
48 my $new = $schema->resultset('Artist')->create({ name => 'foo' });
49 ok($new->artistid, "Auto-PK worked");
53 $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
55 my $it = $schema->resultset('Artist')->search( {},
58 order_by => 'artistid' }
60 is( $it->count, 3, "LIMIT count ok" );
61 is( $it->next->name, "Artist 2", "iterator->next ok" );
64 is( $it->next, undef, "next past end of resultset ok" );
68 $dbh->do("DROP TABLE artist") if $dbh;