[Bast-commits] r7075 - in DBIx-Class/0.08/branches/sybase: lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/Sybase t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon Jul 20 17:06:46 GMT 2009


Author: caelum
Date: 2009-07-20 17:06:46 +0000 (Mon, 20 Jul 2009)
New Revision: 7075

Modified:
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
   DBIx-Class/0.08/branches/sybase/t/746sybase.t
Log:
change the (incorrect) version check to a check for FreeTDS

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm	2009-07-20 16:20:37 UTC (rev 7074)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm	2009-07-20 17:06:46 UTC (rev 7075)
@@ -66,11 +66,18 @@
 =head1 DESCRIPTION
 
 If you're using this driver than your version of Sybase does not support
-placeholders, or your version of L<DBD::Sybase> is too old (you need at least
-C<1.09>. You can check with:
+placeholders, or your version of L<DBD::Sybase> was compiled with FreeTDS rather
+than the Sybase OpenClient libraries. You can check with:
 
   $dbh->{syb_dynamic_supported}
 
+To see if you are using FreeTDS, run:
+
+  perl -MDBD::Sybase -le 'print grep /Sybase\./, @DynaLoader::dl_shared_objects' | xargs ldd
+
+If you see C<libct.so> or similar, rather than C<libsybct.so> then you are using
+FreeTDS.
+
 You can also enable this driver explicitly using:
 
   my $schema = SchemaClass->clone;

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-07-20 16:20:37 UTC (rev 7074)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-07-20 17:06:46 UTC (rev 7075)
@@ -31,8 +31,9 @@
 
 But your queries will be cached.
 
-You need at least version C<1.09> of L<DBD::Sybase> for placeholder support.
-Otherwise your storage will be automatically reblessed into C<::NoBindVars>.
+You need a version of L<DBD::Sybase> compiled with the Sybase OpenClient
+libraries, B<NOT> FreeTDS, for placeholder support. Otherwise your storage will
+be automatically reblessed into C<::NoBindVars>.
 
 A recommended L<DBIx::Class::Storage::DBI/connect_info> settings:
 
@@ -70,15 +71,17 @@
         $self->_rebless;
       }
       
-      if ($DBD::Sybase::VERSION < 1.09) {
+      if ($self->_using_freetds) {
         carp <<'EOF';
 
 Your version of Sybase potentially supports placeholders and query caching,
-however your version of DBD::Sybase is too old to do this properly. Please
-upgrade to at least version 1.09 if you want this feature.
+however you seem to be using FreeTDS which does not (yet?) support this.
 
-TEXT/IMAGE column support will also not work in older versions of DBD::Sybase.
+Please recompile DBD::Sybase with the Sybase OpenClient libraries if you want
+these features.
 
+TEXT/IMAGE column support will also not work under FreeTDS.
+
 See perldoc DBIx::Class::Storage::DBI::Sybase for more details.
 EOF
         $self->ensure_class_loaded($no_bind_vars);
@@ -90,6 +93,22 @@
   }
 }
 
+{
+  my $using_freetds = undef;
+
+  sub _using_freetds {
+    my $self = shift;
+    my $dbh  = $self->_dbh;
+
+    return $using_freetds if defined $using_freetds;
+
+    local $dbh->{syb_rowcount} = 1; # this is broken in freetds
+    $using_freetds = @{ $dbh->selectall_arrayref('sp_help') } != 1;
+
+    return $using_freetds;
+  }
+}
+
 sub _set_maxConnect {
   my $self = shift;
 
@@ -385,8 +404,8 @@
 
 =head1 IMAGE AND TEXT COLUMNS
 
-You need at least version C<1.09> of L<DBD::Sybase> for C<TEXT/IMAGE> column
-support.
+L<DBD::Sybase> compiled with FreeTDS will B<NOT> work with C<TEXT/IMAGE>
+columns.
 
 See L</connect_call_blob_setup> for a L<DBIx::Class::Storage::DBI/connect_info>
 setting you need to work with C<IMAGE> columns.

Modified: DBIx-Class/0.08/branches/sybase/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/sybase/t/746sybase.t	2009-07-20 16:20:37 UTC (rev 7074)
+++ DBIx-Class/0.08/branches/sybase/t/746sybase.t	2009-07-20 17:06:46 UTC (rev 7075)
@@ -46,7 +46,7 @@
 
   if ($storage_idx == 0 &&
       $schema->storage->isa('DBIx::Class::Storage::DBI::Sybase::NoBindVars')) {
-# no placeholders in this version of Sybase or DBD::Sybase
+# no placeholders in this version of Sybase or DBD::Sybase (or using FreeTDS)
       my $tb = Test::More->builder;
       $tb->skip('no placeholders') for 1..$TESTS;
       next;
@@ -130,8 +130,8 @@
 
 # mostly stolen from the blob stuff Nniuq wrote for t/73oracle.t
   SKIP: {
-    skip 'Need at least version 1.09 of DBD::Sybase to test TEXT/IMAGE', 12
-        unless $DBD::Sybase::VERSION >= 1.09;
+    skip 'TEXT/IMAGE support does not work with FreeTDS', 12
+      if $schema->storage->_using_freetds;
 
     my $dbh = $schema->storage->dbh;
     {




More information about the Bast-commits mailing list