View on
MetaCPAN
Alex Pavlovic > Catalyst-Model-DBI-0.20 > Catalyst::Model::DBI

Download:
Catalyst-Model-DBI-0.20.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Module Version: 0.20   Source   Latest Release: Catalyst-Model-DBI-0.32

NAME ^

Catalyst::Model::DBI - DBI Model Class

SYNOPSIS ^

        # use the helper
        create model DBI DBI dsn user password
        
        # lib/MyApp/Model/DBI.pm
        package MyApp::Model::DBI;
        
        use base 'Catalyst::Model::DBI';
        
        __PACKAGE__->config(
                dsn           => 'dbi:Pg:dbname=myapp',
                password      => '',
                user          => 'postgres',
                options       => { AutoCommit => 1 },
        );
        
        1;
        
        my $dbh = $c->model('DBI')->dbh;
        #do something with $dbh ...

DESCRIPTION ^

This is the DBI model class.

METHODS ^

new

Initializes DBI connection

$self->dbh

Returns the current database handle.

$self->stay_connected

Returns a connected database handle.

$self->connected

Returns true if the database handle is active and pingable.

$self->connect

Connects to the database and returns the handle.

$self->disconnect

Executes rollback if AutoCommit is active, disconnects and unsets the database handle.

SEE ALSO ^

Catalyst, DBI

AUTHOR ^

Alex Pavlovic, alex.pavlovic@taskforce-1.com

COPYRIGHT ^

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: