From: Brandon L. Black Date: Fri, 16 Jun 2006 20:45:16 +0000 (+0000) Subject: further changes to the Sybase / MSSQL storage stuff X-Git-Tag: v0.07002~75^2~109 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=81092e2d683da60a94ad7d356cdff8bfbb49012f;p=dbsrgits%2FDBIx-Class.git further changes to the Sybase / MSSQL storage stuff --- diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index 38653f6..e355ce9 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -3,7 +3,7 @@ package DBIx::Class::Storage::DBI::MSSQL; use strict; use warnings; -use base qw/DBIx::Class::Storage::DBI::Sybase/; +use base qw/DBIx::Class::Storage::DBI/; sub last_insert_id { my( $id ) = $_[0]->_dbh->selectrow_array('SELECT @@IDENTITY' ); @@ -26,13 +26,17 @@ DBIx::Class::Storage::DBI::MSSQL - Storage::DBI subclass for MSSQL =head1 SYNOPSIS -This subclass supports MSSQL. As MSSQL is usually used via a -differently-named DBD such as L, it does not get -autodetected by DBD-type like the other drivers, and you will need to -specify this storage driver manually, as in: +This subclass supports MSSQL, and can in theory be used directly +via the C mechanism: $schema->storage_type('::DBI::MSSQL'); - $schema->connect_info('dbi:Sybase:....', ...); + $schema->connect_info('dbi:....', ...); + +However, as there is no L, you will probably want to use +one of the other DBD-specific MSSQL classes, such as +L. These classes will +merge this class with a DBD-specific class to obtain fully +correct behavior for your scenario. =head1 AUTHORS diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index 3a20a1c..87acdde 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -13,7 +13,9 @@ DBIx::Class::Storage::DBI::Sybase - Storage::DBI subclass for Sybase =head1 SYNOPSIS -This subclass supports L. +This subclass supports L for real Sybase databases. If +you are using an MSSQL database via L, see +L. =head1 AUTHORS diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm new file mode 100644 index 0000000..1b87d65 --- /dev/null +++ b/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm @@ -0,0 +1,30 @@ +package DBIx::Class::Storage::DBI::Sybase::MSSQL; + +use strict; +use warnings; + +use base qw/DBIx::Class::Storage::DBI::MSSQL DBIx::Class::Storage::DBI::Sybase/; + +1; + +=head1 NAME + +DBIx::Class::Storage::DBI::Sybase::MSSQL - Storage::DBI subclass for MSSQL via +DBD::Sybase + +=head1 SYNOPSIS + +This subclass supports MSSQL connected via L. + + $schema->storage_type('::DBI::Sybase::MSSQL'); + $schema->connect_info('dbi:Sybase:....', ...); + +=head1 AUTHORS + +Brandon L Black + +=head1 LICENSE + +You may distribute this code under the same terms as Perl itself. + +=cut diff --git a/t/74mssql.t b/t/74mssql.t index 8061ba1..204a640 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -14,7 +14,11 @@ plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test plan tests => 4; -DBICTest::Schema->storage_type('::DBI::MSSQL'); +my $storage_type = '::DBI::MSSQL'; +$storage_type = '::DBI::Sybase::MSSQL' if $dsn =~ /^dbi:Sybase:/; +# Add more for others in the future when they exist (ODBC? ADO? JDBC?) + +DBICTest::Schema->storage_type($storage_type); DBICTest::Schema->compose_connection( 'MSSQLTest' => $dsn, $user, $pass ); my $dbh = MSSQLTest->schema->storage->dbh;