The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Pg::CallFunction - Simple interface for calling PostgreSQL functions from Perl

VERSION

version 0.002

SYNOPSIS

    use DBI;
    use DBIx::Pg::CallFunction;

    my $dbh = DBI->connect("dbi:Pg:dbname=joel", 'joel', '');
    my $pg = DBIx::Pg::CallFunction->new($dbh);

Returning single-row single-column values:

    my $userid = $pg->get_userid_by_username({'username' => 'joel'});
    # returns scalar 123

Returning multi-row single-column values:

    my $hosts = $pg->get_user_hosts({userid => 123});
    # returns array ref ['127.0.0.1', '192.168.0.1', ...]

Returning single-row multi-column values:

    my $user_details = $pg->get_user_details({userid => 123});
    # returns hash ref { firstname=>..., lastname=>... }

Returning multi-row multi-column values:

    my $user_friends = $pg->get_user_friends({userid => 123});
    # returns array ref of hash refs [{ userid=>..., firstname=>..., lastname=>...}, ...]

DESCRIPTION

This module provides a simple efficient way to call PostgreSQL functions with from Perl code. It only support functions with named arguments, or functions with no arguments at all. This limitation reduces the mapping complexity, as multiple functions in PostgreSQL can share the same name, but with different input argument types.

OTHER INFORMATION

Limitations and Caveats

Requires PostgreSQL 9.0 or later.

Joel Jacobson http://www.joelonsql.com

Copyright (c) Joel Jacobson, Sweden, 2012. All rights reserved. You may use and distribute on the same terms as Perl 5.10.1.

# vim: ts=8:sw=4:sts=4:et