Jason W. May > DBIx-Librarian-0.6 > DBIx::Librarian::Statement

Download:
DBIx-Librarian-0.6.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.4   Source  

NAME ^

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

SYNOPSIS ^

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 ^

new
  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.

execute
  $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 ^

Jason W. May <jmay@pobox.com>

COPYRIGHT ^

Copyright (C) 2001-2003 Jason W. May. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.