From: Rafael Kitover <rkitover@cpan.org>
Date: Fri, 23 Mar 2012 13:04:53 +0000 (-0400)
Subject: support FreeTDS 0.91 with Sybase ASE + DBD::Sybase
X-Git-Tag: v0.08197~64
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfec318fdd1beb78915622f6187afc63275c356e;p=dbsrgits%2FDBIx-Class.git

support FreeTDS 0.91 with Sybase ASE + DBD::Sybase

Requires disabling statement caching.
---

diff --git a/Changes b/Changes
index 20d3d29..2a4216b 100644
--- a/Changes
+++ b/Changes
@@ -33,7 +33,10 @@ Revision history for DBIx::Class
           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
+          MSSQL on DBD::Sybase compiled against freetds 0.83 or later - way too
+          buggy
+        - Disable statement caching when using Sybase ASE and DBD::Sybase
+          compiled against freetds 0.83 or later
         - 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/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm
index 17a7690..a66f190 100644
--- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm
+++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm
@@ -118,6 +118,17 @@ EOF
 
 sub _init {
   my $self = shift;
+
+  $self->next::method(@_);
+
+  if ($self->_using_freetds && (my $ver = $self->_using_freetds_version||999) > 0.82) {
+    carp_once(
+      "Buggy FreeTDS version $ver detected, statement caching will not work and"
+    . 'will be disabled.'
+    );
+    $self->disable_sth_caching(1);
+  }
+
   $self->_set_max_connect(256);
 
 # create storage for insert/(update blob) transactions,