DBIx::Connection::PostgreSQL::PLSQL - PLSQL block wrapper for PostgreSQL
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);
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
Return sql statement defintion. Takes sql name.
Prepares plsql block
Initialises plsql block, checks for changes, recreated if necessary.
Removes existing function that acts as plsql block wrapper.
Returns plsql block weapper as plsql function
Initialises sql that will be used to invoke postgres function (plsql block)
Binds and executes plsql block.
Returns variable precision.
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',
Returns
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.
Adrian Witas, adrian@webapp.strefa.pl
See also DBIx::Connection DBIx::QueryCursor DBIx::SQLHandler.
To install DBIx::Connection, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Connection
CPAN shell
perl -MCPAN -e shell install DBIx::Connection
For more information on module installation, please visit the detailed CPAN module installation guide.