NAME

Hypatia::DBI

VERSION

version 0.029

ATTRIBUTES

dsn,username,password,attributes

These are strings that are fed directly into the connect method of DBI. The <dsn> attribute is not required as long as you pass an active database handle into the dbh attribute (see below). Both username and password default to "" (which is useful if, for example, you're using a SQLite database). The hash reference attributes contains any optional key-value pairs to be passed to DBI's connect method. See the DBI documentation for more details.

query,table

These strings represent the source of the data within the database represented by dsn. In other words, if your data source is from DBI, then you can pull data via a table name (table) or via a query (query). Don't set both of these, as this will cause your script to die.

dbh

This optional attribute is the database handle that will be used to grab the data. If it is not supplied, then a connection will be made using the dsn,username,password, and attributes attributes (if possible).

METHODS

data(@columns,{query=>$query}])

This method grabs the resulting data from the query returned by the build_query method. The returned data structure is a hash reference of array references where the keys correspond to column names (ie the elements of the @columns array) and the values of the hash reference are the values of the given column returned by the query from the _build_query method.

The optional hash reference argument allows for the overriding of the query generated by the _build_query method.

AUTHOR

Jack Maney <jack@jackmaney.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Jack Maney.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.