DBIx::ResultSet::Connector - Access result sets via DBIx::Connector.
use DBIx::ResultSet; # Same arguments as DBI and DBIx::Connector. my $connector = DBIx::ResultSet->connect( $dsn, $user, $pass, $attr, #optional ); # Get a resultset for the users table. my $users_rs = $connector->resultset('users'); # Use the proxied txn() method to do a bunch of inserts # within a single transaction that will automatically # re-connect if the DB connection is lost during the # transaction (fixup). $connector->txn(fixup => sub{ foreach my $user_name (@new_user_names) { $users_rs->insert({ user_name=>$user_name }); } }); # Format dates and times in the DB's format. print $connector->format_datetime( DateTime->now() ); print $connector->format_date( DateTime->now() ); print $connector->format_time( DateTime->now() );
This module is a lightweight wrapper around SQL::Abstract, SQL::Abstract::Limit, DBIx::Connector, and the various DateTime::Format modules. This module is primarly a factory for creating new DBIx::ResultSet objects via the resultset() method.
This is the actual connect method that is called by DBIx::ResultSet See <DBIx::RestultSet/connect> for more information.
# Get a resultset for the users table. my $users_rs = $connector->resultset('users');
Returns a new DBIx::ResultSet object tied to the specified table.
print $connector->format_datetime( DateTime->now() );
Returns the date and time in the DB's format.
print $connector->format_date( DateTime->now() );
Returns the date in the DB's format.
print $connector->format_time( DateTime->now() );
Returns the time in the DB's format.
Holds the underlying DBIx::Connector object. The dbh(), run(), txn(), and svp() methods are proxied.
A SQL::Abstract::Limit object for use by DBIx::ResultSet.
my $formatter = $connector->datetime_formatter(); print $formatter->format_date( DateTime->now() );
This returns the DateTime::Format::* class that is appropriate for your database connection.
Aran Clary Deltac <bluefeet@gmail.com>
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install DBIx::ResultSet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::ResultSet
CPAN shell
perl -MCPAN -e shell install DBIx::ResultSet
For more information on module installation, please visit the detailed CPAN module installation guide.