SQL-Interpolate

 view release on metacpan or  search on metacpan

lib/DBIx/Interpolate.pm  view on Meta::CPAN


our @EXPORT;
our %EXPORT_TAGS = (all => [qw(
    attr
    dbi_interp
    key_field
    make_dbi_interp
)]);
our @EXPORT_OK = @{$EXPORT_TAGS{all}};

sub _wrap(&);

# internal helper function to filter use parameters
sub _filter_params {
    my ($skip_names, $skip_keys, @parts) = @_;
    my @out;
    my %skip_names = map {($_=>1)} @$skip_names;
    my %skip_keys  = map {($_=>1)} @$skip_keys;
    while (@parts) {
        if ($skip_names{$parts[0]})   { shift @parts; }
        elsif ($skip_keys{$parts[0]}) { shift @parts; shift @parts; }

lib/DBIx/Interpolate.pm  view on Meta::CPAN

        if (my $max = $attr->{MaxRows}) {
            push @col, @values while @col<$max && $sth->fetch;
        }
        else {
            push @col, @values while $sth->fetch;
        }
        return \@col;
    };
}

sub _wrap(&) {
    my $code = shift;
    my $x;
    my @x;
    my $want = wantarray();
    eval {
        if ($want) { @x = $code->(); }
        else       { $x = $code->(); }
    };
    if ($@) { croak $@; }
    return $want ? @x : $x;



( run in 0.493 second using v1.01-cache-2.11-cpan-49f99fa48dc )