Adrian Witas

NAME

DBIx::SQLHandler - Sql statement handler.

SYNOPSIS

    use DBIx::SQLHandler
    my $sql_handler = new DBIx::SQLHandler(
      name        => 'emp_ins',
      connection  => $connection,
      sql         => "INSERT INTO emp(empno, ename) VALUES(?, ?)"
    );
    $sql_handler->execute(1, 'Smith');
    $sql_handler->execute(2, 'Witek');


    my $sql_handler = new DBIx::SQLHandler(
      name        => 'emp_upd',
      connection  => $connection,
      sql         => "UPDATE emp SET ename = ? WHERE empno = ?"
    );
    $sql_handler->execute('Smith2',1);

    or

    use DBIx::Connection;

    ...

    my $sql_handler = $connection->sql_handler(
       name => 'emp_ins'
       sql => "INSERT INTO emp(empno, ename) VALUES(?, ?)",
    );
    $sql_handler->execute(1, 'Smith');

DESCRIPTION

Represents wrapper for sql statments. It manages sql statement's information within its state. If an error occurs on any stage (prepare, execute, binding) you will get full information including connection name, sql, binding variables. Caching statements (if using name). It gathers performance statistics (optionaly).

EXPORT

None.

ATTRIBUTES

name

Statement name.

connection

Database connection.

sth

Cursor handler.

sql

SQL text for cursor.

METHODS

initialise

Prepares the sql statement.

prepare

Prepare the statement.

execute

Executes the statement.

bind_columns

Binds column to the statement.

bind_params_inout

Bind parameters to the statement.

bind_params

Bind parameters to the statement.

error_handler

Returns error messagem, takes error message, and optionally bind variables. If bind variables are passed in the sql's place holders are replaced with the bind_variables.

cleanup

COPYRIGHT AND LICENSE

The DBIx::SQLHandler 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::PLSQLHandler.




Hosting generously
sponsored by Bytemark