X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F74mssql.t;h=238f27aff45085de0a9fc6d307b518bd1ee6f716;hb=fe0d48d33b0529be347b1f07669415173ef1bc6c;hp=1e86e2d08c3bab58c860f13d1ba7cf7231ec7cf2;hpb=3ff5b74063e6bb299d8a7443df0e864254ea44b9;p=dbsrgits%2FDBIx-Class.git diff --git a/t/74mssql.t b/t/74mssql.t index 1e86e2d..238f27a 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -12,7 +12,7 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test' unless ($dsn); -plan tests => 4; +plan tests => 5; my $storage_type = '::DBI::MSSQL'; $storage_type = '::DBI::Sybase::MSSQL' if $dsn =~ /^dbi:Sybase:/; @@ -26,9 +26,11 @@ my $dbh = $schema->storage->dbh; $dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL DROP TABLE artist"); +$dbh->do("IF OBJECT_ID('cd', 'U') IS NOT NULL + DROP TABLE cd"); -$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(255));"); - +$dbh->do("CREATE TABLE artist (artistid INT IDENTITY PRIMARY KEY, name VARCHAR(100), rank INT DEFAULT '13', charfield CHAR(10) NULL);"); +$dbh->do("CREATE TABLE cd (cdid INT IDENTITY PRIMARY KEY, artist INT, title VARCHAR(100), year VARCHAR(100), genreid INT NULL, single_track INT NULL);"); # Just to test compat shim, Auto is in Core $schema->class('Artist')->load_components('PK::Auto::MSSQL'); @@ -48,6 +50,14 @@ my $it = $schema->resultset('Artist')->search( { }, } ); +# Test ? in data don't get treated as placeholders +my $cd = $schema->resultset('CD')->create( { + artist => 1, + title => 'Does this break things?', + year => 2007, +} ); +ok($cd->id, 'Not treating ? in data as placeholders'); + is( $it->count, 3, "LIMIT count ok" ); ok( $it->next->name, "iterator->next ok" ); $it->next; @@ -58,4 +68,6 @@ is( $it->next, undef, "next past end of resultset ok" ); END { $dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL DROP TABLE artist") if $dbh; + $dbh->do("IF OBJECT_ID('cd', 'U') IS NOT NULL DROP TABLE cd") + if $dbh; }