NAME

DBIx::Connection::PostgreSQL::PLSQL - PLSQL block wrapper for PostgreSQL

SYNOPSIS

    use DBIx::PLSQLHandler;

    my $plsql_handler = new DBIx::PLSQLHandler(
        name        => 'test_proc',
        connection  => $connection,
        plsql       => "
        DECLARE
        var1 INT;
        BEGIN
        var1 := :var2 + :var3;
        END;",
	bind_variables => {
            var2 => {type => 'SQL_INTEGER'},
            var3 => {type => 'SQL_INTEGER'}
	}
    );
    $plsql_handler->execute(var2 => 12, var3 => 8);

    or

    use DBIx::Connection;


    my $plsql_handler = $connection->plsql_handler(
        name        => 'test_proc',
        connection  => $connection,
        plsql       => "
        DECLARE
        var1 INT;
        BEGIN
        :var1 := :var2 + :var3;
        END;",
	bind_variables => {
            var1 => {type => 'SQL_INTEGER'},
            var2 => {type => 'SQL_INTEGER'},
            var3 => {type => 'SQL_INTEGER'}
	}
    );

    my $result_set = $plsql_handler->execute(var2 => 12, var3 => 8);

DESCRIPTION

This class creates and invokes plsql function dynamicly that wraps defined plsql block. This module check if body of plsql block has been changed then it recreated wraper function for changed plsql block

methods

prepare

Prepares plsql block

initialise_plsql_block

Initialises plsql block, checks for changes, recreated if necessary.

drop_plsql_block

Removes existing function that acts as plsql block wrapper.

plsql_block_wrapper

Returns plsql block weapper as plsql function

initialise_sql

Initialises sql that will be used to invoke postgres function (plsql block)

execute

Binds and executes plsql block.

type_precision

Returns variable precision.

type_map

Mapping between DBI and specyfic postgres types. The following mapping is defined:

SQL_DECIMAL => 'numeric',
SQL_VARCHAR => 'varchar',
SQL_DATE    =>'date',
SQL_CHAR    =>'varchar',
SQL_DOUBLE  =>'float8',
SQL_INTEGER =>'int4',
SQL_BOOLEAN =>'boolean',
get_type

Returns

COPYRIGHT

The DBIx::Connection::PostgreSQL::PLSQL module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.

AUTHOR

Adrian Witas, adrian@webapp.strefa.pl

See also DBIx::Connection DBIx::QueryCursor DBIx::SQLHandler.