DBIx::Librarian::Statement - an active SQL statement in a Librarian


DBIx-Librarian documentation  | view source Contained in the DBIx-Librarian distribution.

Index


NAME

Top

DBIx::Librarian::Statement - an active SQL statement in a Librarian

SYNOPSIS

Top

Internal class used by DBIx::Librarian. Implementation of BUILDER pattern (Librarian is the Director, Statement is the Builder).

Recognizes the following extensions to the SQL SELECT directive:

    SELECT*	return zero or more rows as an array
    SELECT?	return zero or one rows as a scalar
    SELECT1	return exactly one row as a scalar

For the SELECT? and SELECT1 flavors, an exception will be raised if more than one row is returned. For the SELECT1 flavor, an exception will be raised if no rows are found.

The default behavior for an unadorned SELECT is multi-row SELECT*.

METHODS

Top

  my $stmt = new DBIx::Librarian::Statement ($dbh, $sql);

Prepares the SQL statement in $sql against the database connection in $dbh. Handles bind variables and direct substitution.

  $stmt->execute($data);

Returns the number of rows affected for INSERTs, UPDATEs and DELETES; zero for SELECTs. Croaks on any database error or if any SELECT criteria are violated.

AUTHOR

Top

Jason W. May <jmay@pobox.com>

COPYRIGHT

Top


DBIx-Librarian documentation  | view source Contained in the DBIx-Librarian distribution.