X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FReplicated.pm;h=447747514dd38272da3c17fa1c9e635944407822;hp=c499fb46db05d727e81397a1558783792187b532;hb=64ae166780d0cb2b9577e506da9b9b240c146d20;hpb=b9ca4ff1e045a7863033012e98dc83b5dc95e26e diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index c499fb4..4477475 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -189,7 +189,7 @@ has 'balancer_args' => ( =head2 pool -Is a or derived class. This is a +Is a L or derived class. This is a container class for one or more replicated databases. =cut @@ -207,8 +207,8 @@ has 'pool' => ( =head2 balancer -Is a or derived class. This -is a class that takes a pool () +Is a L or derived class. This +is a class that takes a pool (L) =cut @@ -308,14 +308,12 @@ has 'write_handler' => ( backup is_datatype_numeric - _supports_insert_returning _count_select _subq_update_delete svp_rollback svp_begin svp_release relname_to_table_alias - _straight_join_to_node _dbh_last_insert_id _fix_bind_params _default_dbi_connect_attributes @@ -329,7 +327,6 @@ has 'write_handler' => ( _dbh _select_args _dbh_execute_array - _sql_maker_args _sql_maker _query_start _sqlt_version_error @@ -344,12 +341,10 @@ has 'write_handler' => ( _parse_connect_do _dbh_commit _execute_array - _placeholders_supported savepoints _sqlt_minimum_version _sql_maker_opts _conn_pid - _typeless_placeholders_supported _conn_tid _dbh_autocommit _native_data_type @@ -361,14 +356,13 @@ has 'write_handler' => ( _resolve_column_info _prune_unused_joins _strip_cond_qualifiers - _parse_order_by + _extract_order_columns _resolve_aliastypes_from_select_args _execute _do_query _dbh_sth _dbh_execute _prefetch_insert_auto_nextvals - _server_info_hash /], ); @@ -377,6 +371,24 @@ my @unimplemented = qw( _preserve_foreign_dbh _verify_pid _verify_tid + + get_use_dbms_capability + set_use_dbms_capability + get_dbms_capability + set_dbms_capability + _dbh_details + + sql_limit_dialect + + _inner_join_to_node + _group_over_selection +); + +# the capability framework +# not sure if CMOP->initialize does evil things to DBIC::S::DBI, fix if a problem +push @unimplemented, ( grep + { $_ =~ /^ _ (?: use | supports | determine_supports ) _ /x } + ( Class::MOP::Class->initialize('DBIx::Class::Storage::DBI')->get_all_method_names ) ); for my $method (@unimplemented) { @@ -418,8 +430,9 @@ around connect_info => sub { $merge->merge((delete $opts{pool_args} || {}), $self->pool_args) ); - $self->pool($self->_build_pool) - if $self->pool; + ## Since we possibly changed the pool_args, we need to clear the current + ## pool object so that next time it is used it will be rebuilt. + $self->clear_pool; } if (@opts{qw/balancer_type balancer_args/}) { @@ -738,7 +751,7 @@ sub limit_dialect { foreach my $source ($self->all_storages) { $source->limit_dialect(@_); } - return $self->master->quote_char; + return $self->master->limit_dialect; } =head2 quote_char @@ -1018,28 +1031,27 @@ sub _ping { return min map $_->_ping, $self->all_storages; } +# not using the normalized_version, because we want to preserve +# version numbers much longer than the conventional xxx.yyyzzz my $numify_ver = sub { my $ver = shift; my @numparts = split /\D+/, $ver; - my $format = '%d.' . (join '', ('%05d') x (@numparts - 1)); + my $format = '%d.' . (join '', ('%06d') x (@numparts - 1)); return sprintf $format, @numparts; }; - sub _server_info { my $self = shift; - if (not $self->_server_info_hash) { - my $min_version_info = ( + if (not $self->_dbh_details->{info}) { + $self->_dbh_details->{info} = ( reduce { $a->[0] < $b->[0] ? $a : $b } map [ $numify_ver->($_->{dbms_version}), $_ ], map $_->_server_info, $self->all_storages )->[1]; - - $self->_server_info_hash($min_version_info); # on master } - return $self->_server_info_hash; + return $self->next::method; } sub _get_server_version {