From: Rafael Kitover Date: Tue, 14 Jul 2009 22:14:09 +0000 (+0000) Subject: unfuck ensure_connected for odbc/mssql X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1da8d083227d3db4dee8f6392d7d06a66fd7155c;p=dbsrgits%2FDBIx-Class-Historic.git unfuck ensure_connected for odbc/mssql --- diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm index 028d9d6..0a58c76 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -77,8 +77,9 @@ sub connect_call_use_dynamic_cursors { if (not exists $dbi_attrs->{odbc_cursortype}) { # turn on support for multiple concurrent statements, unless overridden $self->_dbi_connect_info->[-1] = { %$dbi_attrs, odbc_cursortype => 2 }; - # will take effect next connection + my $connected = defined $self->_dbh; $self->disconnect; + $self->ensure_connected if $connected; $self->_using_dynamic_cursors(1); } } @@ -138,8 +139,9 @@ sub connect_call_use_mars { if ($dsn !~ /MARS_Connection=/) { $self->_dbi_connect_info->[0] = "$dsn;MARS_Connection=Yes"; - # will take effect next connection + my $connected = defined $self->_dbh; $self->disconnect; + $self->ensure_connected if $connected; } }