X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FODBC%2FMicrosoft_SQL_Server.pm;h=afd51f3ee20ba38f59c03cc2338d84dc07f58354;hb=25d3127deaaa381fdaa35b8b9d09e0483ba9e532;hp=e94c938d7cf293fa22b78909a4eea30d6d063a3d;hpb=cccd1876f48654bb612e8f3f9b16d786321340d2;p=dbsrgits%2FDBIx-Class.git 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 e94c938..afd51f3 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -177,6 +177,11 @@ insert trigger that inserts into another table with an C column. B on FreeTDS, changes made in one statement (e.g. an insert) may not be visible from a following statement (e.g. a select.) +B FreeTDS versions > 0.82 seem to have completely broken the ODBC +protocol. DBIC will not allow dynamic cursor support with such versions to +protect your data. Please hassle the authors of FreeTDS to act on the bugs that +make their driver not overly usable with DBD::ODBC. + =cut sub connect_call_use_dynamic_cursors { @@ -230,14 +235,34 @@ sub _run_connection_actions { $self->_using_dynamic_cursors(1); $self->_identity_method('@@identity'); + $self->_no_scope_identity_query($self->using_freetds); } else { $self->_using_dynamic_cursors(0); $self->_identity_method(undef); + $self->_no_scope_identity_query(undef); } } $self->next::method (@_); + + # freetds is too damn broken, some fixups + if ($self->using_freetds) { + + # no dynamic cursors starting from 0.83 + if ($self->_using_dynamic_cursors) { + my $fv = $self->_dbh_get_info('SQL_DRIVER_VER'); + $self->throw_exception( + 'Dynamic cursors (odbc_cursortype => 2) are not supported with FreeTDS > 0.82 ' + . "(you have $fv). Please hassle FreeTDS authors to fix the outstanding bugs in " + . 'their driver.' + ) if $fv > 0.82 + } + + # FreeTDS is too broken wrt execute_for_fetch batching + # just disable it outright until things quiet down + $self->_get_dbh->{odbc_disable_array_operations} = 1; + } } =head2 connect_call_use_server_cursors