[Bast-commits] r7931 - in DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI: . Sybase

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sun Nov 22 12:27:44 GMT 2009


Author: caelum
Date: 2009-11-22 12:27:43 +0000 (Sun, 22 Nov 2009)
New Revision: 7931

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
Log:
override _run_connection_actions for internal connection setup in sybase stuff, much cleaner this way

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm	2009-11-22 12:03:31 UTC (rev 7930)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm	2009-11-22 12:27:43 UTC (rev 7931)
@@ -31,7 +31,7 @@
   local $dbh->{PrintError} = 0;
 
   if ($dbh->{syb_no_child_con}) {
-# ping is impossible with an active statement, we return false if so
+# if extra connections are not allowed, then ->ping is reliable
     my $ping = eval { $dbh->ping };
     return $@ ? 0 : $ping;
   }

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-11-22 12:03:31 UTC (rev 7930)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-11-22 12:27:43 UTC (rev 7931)
@@ -20,13 +20,15 @@
   }
 }
 
-sub _init {
+sub _run_connection_actions {
   my $self = shift;
 
   # LongReadLen doesn't work with MSSQL through DBD::Sybase, and the default is
   # huge on some versions of SQL server and can cause memory problems, so we
   # fix it up here (see Sybase/Common.pm)
   $self->set_textsize;
+
+  $self->next::method(@_);
 }
 
 sub _dbh_begin_work {

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-11-22 12:03:31 UTC (rev 7930)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-11-22 12:27:43 UTC (rev 7931)
@@ -120,9 +120,6 @@
   my $self = shift;
   $self->_set_max_connect(256);
 
-# this is also done on _populate_dbh, but storage may not be reblessed yet
-  $self->_syb_setup_connection;
-
 # create storage for insert/(update blob) transactions,
 # unless this is that storage
   return if $self->_is_extra_storage;
@@ -182,26 +179,17 @@
   $self->next::method;
 }
 
-sub _populate_dbh {
-  my $self = shift;
-
-  $self->next::method(@_);
-
-  $self->_syb_setup_connection;
-}
-
-# Set up session settings for Sybase databases for the connection, called from
-# _populate_dbh and _init (before _driver_determined .)
+# Set up session settings for Sybase databases for the connection.
 #
 # Make sure we have CHAINED mode turned on if AutoCommit is off in non-FreeTDS
 # DBD::Sybase (since we don't know how DBD::Sybase was compiled.) If however
 # we're using FreeTDS, CHAINED mode turns on an implicit transaction which we
 # only want when AutoCommit is off.
-sub _syb_setup_connection {
+#
+# Also SET TEXTSIZE for FreeTDS because LongReadLen doesn't work.
+sub _run_connection_actions {
   my $self = shift;
 
-  return unless $self->_driver_determined; # otherwise we screw up MSSQL
-
   if ($self->_is_bulk_storage) {
 # this should be cleared on every reconnect
     $self->_began_bulk_work(0);
@@ -220,6 +208,8 @@
       $self->_dbh->do('SET CHAINED ON');
     }
   }
+
+  $self->next::method(@_);
 }
 
 =head2 connect_call_blob_setup




More information about the Bast-commits mailing list