From: Peter Rabbitson Date: Sat, 7 Apr 2012 09:18:46 +0000 (+0200) Subject: Revert 796acb6a - latest FreeTDS does not support MARs in any form X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=94f9fbefc7e247e2319b2472787e974fcf8cbb97;p=dbsrgits%2FDBIx-Class-Historic.git Revert 796acb6a - latest FreeTDS does not support MARs in any form It looked like this was the case due to a botched test, which would allow a silent reconnection to take place. What was thought to be a proper MARs configuration turned out to be simply two connections working in sync (view patch with diff -w) --- diff --git a/Changes b/Changes index 8994856..b7aef49 100644 --- a/Changes +++ b/Changes @@ -12,7 +12,6 @@ Revision history for DBIx::Class unique constraint - dbicadmin now better supports catalyst-style config files, by unrolling 'config_info' hashkeys - - MSSQL MARS over DBD::ODBC now works with freetds >= 0.91 - Multiple Improvements MSSQL over DBD::ADO - Transaction support - Support for VARCHAR(MAX)/VARBINARY(MAX)/NVARCHAR(MAX) datatypes 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 7f8339a..7a149f2 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -128,9 +128,8 @@ sub connect_call_use_mars { if ($dsn !~ /MARS_Connection=/) { if ($self->_using_freetds) { - my $v = $self->_using_freetds_version; - $self->throw_exception("FreeTDS 0.91 or later required for MARS support, you have $v") - if $v < 0.91; + $self->throw_exception('FreeTDS does not support MARS at the time of ' + .'writing.'); } if (exists $self->_server_info->{normalized_dbms_version} && diff --git a/t/746mssql.t b/t/746mssql.t index 0193753..9b6ce5b 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -62,7 +62,7 @@ my %opts = ( }, use_server_cursors => { opts => { on_connect_call => 'use_server_cursors' } }, - NO_OPTION => + plain => { opts => {}, required => 1 }, ); @@ -80,8 +80,9 @@ for my $opts_name (keys %opts) { } else { skip -"on_connect_call option '$opts_name' not functional in this configuration: $_", -1; + "on_connect_call option '$opts_name' not functional in this configuration: $_", + 1 + ; } }; @@ -111,32 +112,40 @@ SQL skip 'not a multiple active statements configuration', 1 if $opts_name eq 'plain'; - my $artist_rs = $schema->resultset('Artist'); + $schema->storage->ensure_connected; - $artist_rs->delete; + lives_ok { - $artist_rs->create({ name => "Artist$_" }) for (1..3); + no warnings 'redefine'; + local *DBI::connect = sub { die "NO RECONNECTS!!!" }; - my $forward = $artist_rs->search({}, - { order_by => { -asc => 'artistid' } }); - my $backward = $artist_rs->search({}, - { order_by => { -desc => 'artistid' } }); + my $artist_rs = $schema->resultset('Artist'); - my @map = ( - [qw/Artist1 Artist3/], [qw/Artist2 Artist2/], [qw/Artist3 Artist1/] - ); - my @result; + $artist_rs->delete; - while (my $forward_row = $forward->next) { - my $backward_row = $backward->next; - push @result, [$forward_row->name, $backward_row->name]; - } + $artist_rs->create({ name => "Artist$_" }) for (1..3); + + my $forward = $artist_rs->search({}, + { order_by => { -asc => 'artistid' } }); + my $backward = $artist_rs->search({}, + { order_by => { -desc => 'artistid' } }); + + my @map = ( + [qw/Artist1 Artist3/], [qw/Artist2 Artist2/], [qw/Artist3 Artist1/] + ); + my @result; + + while (my $forward_row = $forward->next) { + my $backward_row = $backward->next; + push @result, [$forward_row->name, $backward_row->name]; + } - is_deeply \@result, \@map, "multiple active statements in $opts_name"; + is_deeply \@result, \@map, "multiple active statements in $opts_name"; - $artist_rs->delete; + $artist_rs->delete; - is($artist_rs->count, 0, '$dbh still viable'); + is($artist_rs->count, 0, '$dbh still viable'); + } "Multiple active statements survive $opts_name"; } # Test populate