[Bast-commits] r7606 - in DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage: . DBI DBI/ODBC DBI/Sybase DBI/Sybase/Microsoft_SQL_Server

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed Sep 9 07:40:29 GMT 2009


Author: ribasushi
Date: 2009-09-09 07:40:29 +0000 (Wed, 09 Sep 2009)
New Revision: 7606

Modified:
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle.pm
   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/Common.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server/NoBindVars.pm
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm
Log:
Much simpler

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -102,8 +102,7 @@
   $self->_identity_method('@@identity');
 }
 
-sub _rebless {
-  no warnings 'uninitialized';
+sub _init {
   my $self = shift;
 
   if (ref($self->_dbi_connect_info->[0]) ne 'CODE' &&

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Oracle.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -19,10 +19,8 @@
           ? 'DBIx::Class::Storage::DBI::Oracle::WhereJoins'
           : 'DBIx::Class::Storage::DBI::Oracle::Generic';
 
-        # Load and rebless
-        eval "require $class";
-
-        bless $self, $class unless $@;
+        $self->ensure_class_loaded ($class);
+        bless $self, $class;
     }
 }
 

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Common.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -71,7 +71,7 @@
 sub using_freetds {
   my $self = shift;
 
-  return $self->_dbh->{syb_oc_version} =~ /freetds/i;
+  return $self->_get_dbh->{syb_oc_version} =~ /freetds/i;
 }
 
 =head2 set_textsize

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server/NoBindVars.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server/NoBindVars.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server/NoBindVars.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -9,15 +9,8 @@
 /;
 use mro 'c3';
 
-sub new {
-  my $self = shift->next::method(@_);
-  $self->_rebless;
-  return $self;
-}
-
-sub _rebless {
+sub _init {
   my $self = shift;
-
   $self->disable_sth_caching(1);
 }
 

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -9,12 +9,6 @@
 /;
 use mro 'c3';
 
-sub new {
-  my $self = shift->next::method(@_); 
-  $self->_rebless;
-  return $self;
-}
-
 sub _rebless {
   my $self = shift;
   my $dbh  = $self->_get_dbh;
@@ -24,10 +18,14 @@
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;
   }
+}
 
-# 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 .)
+sub _init {
+  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;
 }
 

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-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -8,16 +8,11 @@
 use List::Util ();
 use Scalar::Util ();
 
-sub new {
-  my $self = shift->next::method(@_);
-  $self->_rebless;
-  return $self;
-}
-
-sub _rebless {
+sub _init {
   my $self = shift;
   $self->disable_sth_caching(1);
   $self->_identity_method('@@IDENTITY');
+  $self->next::method (@_);
 }
 
 sub _fetch_identity_sql { 'SELECT ' . $_[0]->_identity_method }

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-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -88,9 +88,6 @@
             $self->_rebless;
           }
         }
-
-        $self->set_textsize; # based on LongReadLen in connect_info
-
       }
       elsif (not $self->_get_dbh->{syb_dynamic_supported}) {
         # not necessarily FreeTDS, but no placeholders nevertheless
@@ -101,12 +98,18 @@
 # this is highly unlikely, but we check just in case
         $self->auto_cast(1);
       }
-
-      $self->_set_max_connect(256);
     }
   }
 }
 
+sub _init {
+  my $self = shift;
+  $self->_set_max_connect(256);
+
+  # based on LongReadLen in connect_info
+  $self->set_textsize if $self->using_freetds;
+}
+
 # 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

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI.pm	2009-09-09 07:14:20 UTC (rev 7605)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI.pm	2009-09-09 07:40:29 UTC (rev 7606)
@@ -836,7 +836,9 @@
   return $self->_sql_maker;
 }
 
+# nothing to do by default
 sub _rebless {}
+sub _init {}
 
 sub _populate_dbh {
   my ($self) = @_;
@@ -903,6 +905,8 @@
 
     $self->_driver_determined(1);
 
+    $self->_init; # run driver-specific initializations
+
     $self->_run_connection_actions
         if $started_unconnected && defined $self->_dbh;
   }




More information about the Bast-commits mailing list