[Bast-commits] r9109 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Apr 8 16:38:59 GMT 2010


Author: caelum
Date: 2010-04-08 17:38:59 +0100 (Thu, 08 Apr 2010)
New Revision: 9109

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm
Log:
use min dbms_version for ::Replicated

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm	2010-04-08 16:17:29 UTC (rev 9108)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm	2010-04-08 16:38:59 UTC (rev 9109)
@@ -367,12 +367,6 @@
     _dbh_sth
     _dbh_execute
     _prefetch_insert_auto_nextvals
-  /,
-
-  # TODO these need to be spread out to ALL servers not just the master
-  qw/
-    _get_server_version
-    _server_info
     _server_info_hash
   /],
 );
@@ -1016,6 +1010,33 @@
   return min map $_->_ping, $self->all_storages;
 }
 
+sub _server_info {
+  my $self = shift;
+
+  if (not $self->_server_info_hash) {
+    no warnings 'numeric'; # in case dbms_version doesn't normalize
+
+    my @infos = 
+      map $_->[1],
+      sort { $a->[0] <=> $b->[0] } 
+      map [ (defined $_->{normalized_dbms_version} ? $_->{normalized_dbms_version}
+              : $_->{dbms_version}), $_ ],
+      map $_->_server_info, $self->all_storages;
+
+    my $min_version_info = $infos[0];
+
+    $self->_server_info_hash($min_version_info); # on master
+  }
+
+  return $self->_server_info_hash;
+}
+
+sub _get_server_version {
+  my $self = shift;
+
+  return $self->_server_info->{dbms_version};
+}
+
 =head1 GOTCHAS
 
 Due to the fact that replicants can lag behind a master, you must take care to




More information about the Bast-commits mailing list