#
# Some of the methods defined here will be around()-ed by code at the
# end of ::ResultSourceProxy. The reason for this strange arrangement
-# is that the list of around()s of methods in this # class depends
+# is that the list of around()s of methods in this class depends
# directly on the list of may-not-be-defined-yet methods within
# ::ResultSourceProxy itself.
# If this sounds terrible - it is. But got to work with what we have.
dbic_internal_try fail_on_internal_call
refdesc emit_loud_diag
);
+use DBIx::Class::SQLMaker::Util qw( normalize_sqla_condition extract_equality_conditions );
+use DBIx::Class::ResultSource::FromSpec::Util 'fromspec_columns_info';
use SQL::Abstract 'is_literal_value';
use Devel::GlobalDestruction;
use Scalar::Util qw( blessed weaken isweak refaddr );
use namespace::clean;
+# This global is present for the afaik nonexistent, but nevertheless possible
+# case of folks using stock ::ResultSet with a completely custom Result-class
+# hierarchy, not derived from DBIx::Class::Row at all
+# Instead of patching stuff all over the place - this would be one convenient
+# place to override things if need be
+our $__expected_result_class_isa = 'DBIx::Class::Row';
+
my @hashref_attributes = qw(
source_info resultset_attributes
_columns _unique_constraints _relationships
$args->{columns_info} ||= $self->columns_info;
- my $vals = $self->schema->storage->_extract_fixed_condition_columns(
+ my $vals = extract_equality_conditions(
$args->{values},
($args->{carp_on_nulls} ? 'consider_nulls' : undef ),
);
$cols->{$args->{carp_on_nulls} ? 'undefined' : 'missing'}{$col} = undef;
}
else {
- # we need to inject back the '=' as _extract_fixed_condition_columns
+ # we need to inject back the '=' as extract_equality_conditions()
# will strip it from literals and values alike, resulting in an invalid
# condition in the end
$cols->{present}{$col} = { '=' => $vals->{$col} };
$args->{require_join_free_condition} ||= !!$args->{infer_values_based_on};
- $self->throw_exception( "Argument 'self_result_object' must be an object inheriting from DBIx::Class::Row" )
+ $self->throw_exception( "Argument 'self_result_object' must be an object inheriting from '$__expected_result_class_isa'" )
if (
exists $args->{self_result_object}
and
- ( ! defined blessed $args->{self_result_object} or ! $args->{self_result_object}->isa('DBIx::Class::Row') )
+ (
+ ! defined blessed $args->{self_result_object}
+ or
+ ! $args->{self_result_object}->isa( $__expected_result_class_isa )
+ )
)
;
my $rel_rsrc = $self->related_source($args->{rel_name});
- my $storage = $self->schema->storage;
if (exists $args->{foreign_values}) {
}
elsif (defined blessed $args->{foreign_values}) {
- $self->throw_exception( "Objects supplied as 'foreign_values' ($args->{foreign_values}) must inherit from DBIx::Class::Row" )
- unless $args->{foreign_values}->isa('DBIx::Class::Row');
+ $self->throw_exception( "Objects supplied as 'foreign_values' ($args->{foreign_values}) must inherit from '$__expected_result_class_isa'" )
+ unless $args->{foreign_values}->isa( $__expected_result_class_isa );
carp_unique(
"Objects supplied as 'foreign_values' ($args->{foreign_values}) "
qw( columns relationships )
;
- my $equivalencies = $storage->_extract_fixed_condition_columns(
+ my $equivalencies = extract_equality_conditions(
$args->{foreign_values},
'consider nulls',
);
) for keys %$jfc;
(
- length ref $_
- and
defined blessed($_)
and
- $_->isa('DBIx::Class::Row')
+ $_->isa( $__expected_result_class_isa )
and
$self->throw_exception (
"The join-free condition returned for $exception_rel_id may not "
and
$ret->{join_free_condition} ne UNRESOLVABLE_CONDITION
and
- my $jfc = $storage->_collapse_cond( $ret->{join_free_condition} )
+ my $jfc = normalize_sqla_condition( $ret->{join_free_condition} )
) {
- my $jfc_eqs = $storage->_extract_fixed_condition_columns($jfc, 'consider_nulls');
+ my $jfc_eqs = extract_equality_conditions( $jfc, 'consider_nulls' );
if (keys %$jfc_eqs) {
# (may already be there, since easy to calculate on the fly in the HASH case)
if ( ! $ret->{identity_map} ) {
- my $col_eqs = $storage->_extract_fixed_condition_columns($ret->{condition});
+ my $col_eqs = extract_equality_conditions($ret->{condition});
my $colinfos;
for my $lhs (keys %$col_eqs) {
# there is no way to know who is right and who is left in a cref
# therefore a full blown resolution call, and figure out the
# direction a bit further below
- $colinfos ||= $storage->_resolve_column_info([
+ $colinfos ||= fromspec_columns_info([
{ -alias => $args->{self_alias}, -rsrc => $self },
{ -alias => $args->{foreign_alias}, -rsrc => $rel_rsrc },
]);