From: Rafael Kitover Date: Sun, 3 Jan 2010 23:30:51 +0000 (+0000) Subject: fix _rebless into sybase/mssql/nobindvars X-Git-Tag: v0.08116~76 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=918ab8aed49581928f45573c1e14e1264031b1f2;p=dbsrgits%2FDBIx-Class.git fix _rebless into sybase/mssql/nobindvars --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm index 9666a00..0173fac 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm @@ -13,7 +13,11 @@ sub _rebless { my $self = shift; my $dbh = $self->_get_dbh; + return if ref $self ne __PACKAGE__; + if (not $self->_typeless_placeholders_supported) { + require + DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars; bless $self, 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars'; $self->_rebless; diff --git a/t/74mssql.t b/t/74mssql.t index 02e1950..04efcf6 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -31,13 +31,18 @@ for my $storage_type (@storage_types) { $schema = DBICTest::Schema->clone; - if ($storage_idx != 0) { # autodetect - $schema->storage_type("::$storage_type"); - } - $schema->connection($dsn, $user, $pass); - $schema->storage->ensure_connected; + if ($storage_idx != 0) { # autodetect + no warnings 'redefine'; + local *DBIx::Class::Storage::DBI::_typeless_placeholders_supported = + sub { 0 }; +# $schema->storage_type("::$storage_type"); + $schema->storage->ensure_connected; + } + else { + $schema->storage->ensure_connected; + } if ($storage_idx == 0 && ref($schema->storage) =~ /NoBindVars\z/) { my $tb = Test::More->builder;