NAME
DBIx::ProcedureCall::CLI - command line interface to DBIx::ProcedureCall
SYNOPSIS
# get DSN for environment variables DBI_DSN
perl -MDBIx::ProcedureCall::CLI -e function sysdate
# specify DSN on command line
perl -MDBIx::ProcedureCall::CLI -e function dbi:Oracle:.... sysdate
# parameters
perl -MDBIx::ProcedureCall::CLI -e procedure dbms_random.initialize 12345
# OUT parameters
perl -MDBIx::ProcedureCall::CLI -e procedure foo :bar
# IN/OUT parameters
perl -MDBIx::ProcedureCall::CLI -e procedure foo :bar=99
DESCRIPTION
This is a command line interface to DBIx::ProcedureCall. It connects to the database (using either DBI environment variables or a DSN given as the first parameter), runs a stored procedure or function, and prints the return value (if any).
Run it like this:
perl -MDBIx::ProcedureCall::CLI -e <function or procedure> [DSN] <procedure name> [parameters ...]
Procedures and functions
DBIx::ProcedureCall needs to know if you are about to call a function or a procedure (because the SQL is different). So you have to use either "function" or "procedure".
Parameters
All arguments after the procedure name are used as parameters when calling the stored procedure.
Only positional parameters are supported (no named parameters).
IN parameters
Unless the argument starts with a colon(:), it is used as a literal parameter value.
OUT parameters
If the argument starts with a colon (like :blah), the program creates a bind variable with that name, which can be used to receive OUT parameter values from the procedure.
IN/OUT parameters
IN/OUT parameters are OUT parameters with an initial value, that is specifed like
:blah=foo
Attributes
You can specify optional attributes for the stored procedure you want to call.
This is mostly useful for functions that return result sets, where you need to specify :fetch.
Please see DBIx::ProcedureCall for details.
Connection parameters
The easiest way to specify the DNS, username and password to connect is to use the three DBI environment variables DBI_DSN, DBI_USER and DBI_PASS.
You can also specify the DSN as an optional argument before the procedure name:
perl -MDBIx::ProcedureCall::CLI -e function dbi:Oracle:.... sysdate
LIMITATIONS
Because of the way the optional DSN is detected, you cannot call a procedure called dbi and apply attributes to it.
Because of the way OUT parameters are specified, you cannot use strings starting with a colon (:) as parameters to the stored procedures.
You cannot specify how you want to bind the parameters. They will all be bound using the defaults of the DBI driver (usually VARCHAR). In most case, this works fine.
AUTHOR
Thilo Planz, <thilo@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2005 by Thilo Planz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.