The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Hypatia::DBI

VERSION

version 0.01

ATTRIBUTES

dsn,username,password,attributes

These are strings that are fed directly into the connect method of DBI. The dsn attribute is required and 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 is the database handle returned from the connect method of DBI. This attribute is automatically set at the time of object creation. Don't tinker with it (just use it).

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.