Carp::croak "[$func] Fatal: ", @_;
}
+# original SQLA treated anything false as "use the default"
+# in addition a lot of CPAN seems to supply undef's for "use the default"
+# (say hi to Class::DBI::Sweet)
+sub BUILDARGS {
+ my $class = shift;
+ my $args = { ref $_[0] eq 'HASH' ? %{$_[0]} : @_ };
+
+ defined $args->{$_} or delete $args->{$_}
+ for keys %$args;
+
+ $args;
+}
+
+# many subclasses on CPAN assume they can dump a bunch of extra new()
+# parameters, and then get back at them via $obj->{foo}. YAY
+# (Class::DBI::Sweet says hi back)
+sub BUILD {
+ my ($self, $args) = @_;
+ %{$self} = (%$args, %$self);
+ $self;
+}
+
has converter => (is => 'lazy', clearer => 'clear_converter');
has case => (
sub _converter_args {
my ($self) = @_;
Scalar::Util::weaken($self);
+
+{
+ sqla_instance => $self,
lower_case => $self->case,
default_logic => $self->logic,
bind_meta => not($self->bindtype eq 'normal'),
renderer_will_quote => (
defined($self->quote_char) and $self->always_quote
),
+
+ legacy_convert_handler => ($self->can('_convert') != \&_convert) ? 1 : 0,
}
}
is => 'ro'
);
+has legacy_convert_handler => (
+ is => 'ro'
+);
+has sqla_instance => (
+ is => 'ro', weak => 1
+);
+
has default_logic => (
is => 'ro', coerce => sub { uc($_[0]) }, default => sub { 'OR' }
);
sub _maybe_convert_dq {
my ($self, $dq) = @_;
+
+ # do in void ctx - nothing seems to be using any of this
+ if ($self->legacy_convert_handler and $dq->{type} eq 'Identifier') {
+ $self->sqla_instance->_convert( join '.', @{$dq->{elements}} )
+ }
+
if (my $c = $self->{where_convert}) {
Operator({ 'SQL.Naive' => 'apply' }, [
Identifier($self->_sqlcase($c)),