[Bast-commits] r6061 - in DBIx-Class/0.08/branches/sybase_mssql:
lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/Sybase t
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Thu Apr 30 21:05:24 GMT 2009
Author: arcanez
Date: 2009-04-30 22:05:24 +0100 (Thu, 30 Apr 2009)
New Revision: 6061
Added:
DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
Modified:
DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase.pm
DBIx-Class/0.08/branches/sybase_mssql/t/74mssql.t
Log:
fixes for MSSQL via Sybase
Copied: DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm (from rev 6058, DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm)
===================================================================
--- DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm (rev 0)
+++ DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm 2009-04-30 21:05:24 UTC (rev 6061)
@@ -0,0 +1,37 @@
+package DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server DBIx::Class::Storage::DBI::Sybase/;
+
+1;
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server - Storage::DBI subclass for MSSQL via
+DBD::Sybase
+
+=head1 SYNOPSIS
+
+This subclass supports MSSQL connected via L<DBD::Sybase>.
+
+ $schema->storage_type('::DBI::Sybase::Microsoft_SQL_Server');
+ $schema->connect_info('dbi:Sybase:....', ...);
+
+=head1 BUGS
+
+Currently, this doesn't work right unless you call C<Class::C3::reinitialize()>
+after connecting.
+
+=head1 AUTHORS
+
+Brandon L Black <blblack at gmail.com>
+
+Justin Hunter <justin.d.hunter at gmail.com>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut
Property changes on: DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-04-30 20:58:39 UTC (rev 6060)
+++ DBIx-Class/0.08/branches/sybase_mssql/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-04-30 21:05:24 UTC (rev 6061)
@@ -8,10 +8,10 @@
sub _rebless {
my $self = shift;
- my $dbh = $self->schema->storage->dbh;
- my $DBMS_VERSION = @{$dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2];
- if ($DBMS_VERSION =~ /^Microsoft /i) {
- my $subclass = 'DBIx::Class::Storage::DBI::Sybase::MSSQL';
+ my $dbtype = eval { @{$self->_dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] };
+ unless ( $@ ) {
+ $dbtype =~ s/\W/_/gi;
+ my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
bless $self, $subclass;
$self->_rebless;
Modified: DBIx-Class/0.08/branches/sybase_mssql/t/74mssql.t
===================================================================
--- DBIx-Class/0.08/branches/sybase_mssql/t/74mssql.t 2009-04-30 20:58:39 UTC (rev 6060)
+++ DBIx-Class/0.08/branches/sybase_mssql/t/74mssql.t 2009-04-30 21:05:24 UTC (rev 6061)
@@ -7,20 +7,17 @@
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};
-#warn "$dsn $user $pass";
-
plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test'
unless ($dsn);
plan tests => 6;
-
my $schema = DBICTest::Schema->clone;
$schema->connection($dsn, $user, $pass);
my $dbh = $schema->storage->dbh;
-isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::Sybase::MSSQL');
+isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server');
$dbh->do("IF OBJECT_ID('artist', 'U') IS NOT NULL
DROP TABLE artist");
More information about the Bast-commits
mailing list