From: Rafael Kitover Date: Thu, 22 Mar 2012 11:41:47 +0000 (-0400) Subject: Appease DBD::Sybase compiled with new freetds X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0d6c550eecce3674e57cd458eedd5f312b80308d;p=dbsrgits%2FDBIx-Class-Historic.git Appease DBD::Sybase compiled with new freetds --- diff --git a/Changes b/Changes index 058537f..9b6a7ba 100644 --- a/Changes +++ b/Changes @@ -29,8 +29,10 @@ Revision history for DBIx::Class when using freetds - the freetds driver is just too buggy to handle the optimized path - Explicitly disable DBD::ODBC dynamic_cursors when using freetds 0.83 - or later - they made enough ODBC incompatible making it impossible - to support + or later - they made enough ODBC incompatible changes making it + impossible to support sanely + - Explicitly disable SCOPE_IDENTITY queries and statement caching for + DBD::Sybase compiled against freetds 0.83 or later - way too buggy - Fix leakage of $schema on in-memory new_related() calls - Fix more cases of $schema leakage in SQLT::Parser::DBIC - Fix leakage of $storage in ::Storage::DBI::Oracle 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 b0cdb2d..b3f048c 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm @@ -65,6 +65,28 @@ EOF } } +sub _init { + my $self = shift; + + $self->next::method(@_); + + # work around massively broken freetds versions after 0.82 + # - explicitly no scope_identity + # - no sth caching + # + # warn about the fact as well, do not provide a mechanism to shut it up + if ($self->_using_freetds and (my $ver = $self->_using_freetds_version||999) > 0.82) { + carp_once( + "Your DBD::Sybase was compiled against buggy FreeTDS version $ver. " + . 'Statement caching does not work and will be disabled.' + ); + + $self->_identity_method('@@identity'); + $self->_no_scope_identity_query(1); + $self->disable_sth_caching(1); + } +} + # invoked only if DBD::Sybase is compiled against FreeTDS sub _set_autocommit_stmt { my ($self, $on) = @_;