View on
MetaCPAN
Barry King > Apache-Wyrd > Apache::Wyrd::Query

Download:
Apache-Wyrd-0.98.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.98   Source  

NAME ^

Apache::Wyrd::Query - SQL-handle (DBI) object for Wyrds

SYNOPSIS ^

        <Apache::Wyrd::Query>
          update table set row='value' where row='old_value';
          delete from table where row='obsolete value'
        </Apache::Wyrd::Query>
        
        <Apache::Wyrd::Query query="delete from table where row=23" />

        <Apache::Wyrd::Query>
          update table set row=$:row_value where row='old_value'
          <Apache::Wyrd::Var name="row_value">value</Apache::Wyrd::Var>
        </Apache::Wyrd::Query>

DESCRIPTION ^

Provides a DBI-style statement handle to the Wyrd that encloses it. The parent must implement the register_query method to make use of it. The Query Wyrd passes a reference of itself to the register_query method.

HTML ATTRIBUTES

cols

What columns the statement will return. Automatically defined under MySQL. Dev Note: Derived classes for other DBAs should subclass the _set_cols method for DBDs other than MySQL if the automatic maintenance of this attribute is to be accomplished and required.

query

What statement to execute. If not defined, will default to the enclosed text. Multiple queries can be given, separated by a semicolon. If output is expected (via the sh method), only the final query in a series will be used.

PERL METHODS

(format: (returns) name (arguments after self))

(scalar) activate (void)

Activate the Database Query, prepping the Query object to begin producing data. Should be called before any calls to sh.

arrayref cols (void)

Return the column names, as an arrayref.

(void) set_var (Apache::Wyrd::Var)

Use the Var object to change the value-placemarkers of the query. Items with a setter-style placemarker which matches the name of the object will be replaced with the object's value. This is for right-hand values only, as the value will be quoted by DBI.

(void) sh (Apache::Wyrd::Var)

The DBI statement handle.

BUGS/CAVEATS/RESERVED METHODS ^

Reserves the _setup, _format_output, and _generate_output methods.

AUTHOR ^

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO ^

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE ^

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

syntax highlighting: