Geoffrey

 view release on metacpan or  search on metacpan

lib/Geoffrey/Action/Function.pm  view on Meta::CPAN

package Geoffrey::Action::Function;

use utf8;
use 5.016;
use strict;
use warnings;

$Geoffrey::Action::Function::VERSION = '0.000206';

use parent 'Geoffrey::Role::Action';

sub add {
    my ( $self, $hr_params ) = @_;
    my $function = $self->converter->function;
    if ( !$function ) {
        require Geoffrey::Exception::NotSupportedException;
        Geoffrey::Exception::NotSupportedException::throw_converter_type();
    }
    if ( !$function->add ) {
        require Geoffrey::Exception::NotSupportedException;
        Geoffrey::Exception::NotSupportedException::throw_action();
    }
    require Ref::Util;
    if ( !Ref::Util::is_hashref($hr_params) ) {
        require Geoffrey::Exception::General;
        Geoffrey::Exception::General::throw_wrong_ref( __PACKAGE__ . '::add', 'hash' );
    }
    my $args = join q/,/, @{ $hr_params->{args} };
    require Geoffrey::Utils;
    return $self->do(
        Geoffrey::Utils::replace_spare(
            $function->add,
            [
                $hr_params->{name},             $args,
                $hr_params->{result_data_type}, $hr_params->{prosrc},
                $hr_params->{language},         $hr_params->{cost},
            ]
        )
    );
}

sub list {
    my ( $self, $schema ) = @_;
    my $function = $self->converter->function;
    if ( !$function ) {
        require Geoffrey::Exception::NotSupportedException;
        Geoffrey::Exception::NotSupportedException::throw_converter_type();
    }
    if ( !$function->list ) {
        require Geoffrey::Exception::NotSupportedException;
        Geoffrey::Exception::NotSupportedException::throw_action();
    }
    return $function->information( $self->do_arrayref( $function->list($schema) ) );
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Geoffrey::Action::Function - Action for functions

=head1 VERSION

Version 0.000206

=head1 DESCRIPTION

=head1 SYNOPSIS

=head1 SUBROUTINES/METHODS

=head2 add

Execute sql statements can lead very likely to incompatibilities.

=head2 list 
    
Not needed!



( run in 1.554 second using v1.01-cache-2.11-cpan-39bf76dae61 )