NAME

Catalyst::Model::DBIS - DBIx::Simple model class

SYNOPSIS

$c->model('DBIS')->insert('test_log_db', {
    user_agent      => $c->req->user_agent,
    insert_datetime => ['NOW()'],
});

$c->stash->{users} = $c->model('DBIS')->select(
    'tickets', '*', {
        status => $c->req->param('status') || 0,
    },
)->hashes;

$c->model('DBIS')->query('SELECT 1 + 1')->into( $c->stash->{answer} );

DESCRIPTION

Note: This is a super simple DBIx::Simple model. If you're interested this, Catalyst::Model::DBIC::Schema help you I promise. Catalyst::Model::DBIS will be deprecated.

CREATE APP MODEL CLASS

Using helper...(see Catalyst::Helper::Model::DBIS)

% ./script/myapp_create.pl model DBIS DBIS dsn user password

Or manually create in lib/MyApp/Model/DBIS.pm

package MyApp::Model::DBIS;
use strict;
use base 'Catalyst::Model::DBIS';

__PACKAGE__->config(
    connect_info => [
        'dbi:mysql:myapp_db',
        'myapp_user',
        'myapp_pass',
        { RaiseError => 1 },
        { on_connect_do => [ 'set names utf8' ] },
    ],
);

1;

CONFIG

In lib/MyApp/Model/DBIS.pm as above, or in myapp.yaml file like this.

Model::DBIS:
connect_info:
    - dbi:SQLite:dbname=myapp.db
connect_info

List of arguments to DBI->connect(). See DBI for more description.

on_connect_do

This module emulates DBIx::Class's on_connect_do feature. connect_info can take a hash at the end.

AUTHOR

Naoki Tomita <tomita@cpan.org>

LICENSE

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

SEE ALSO

Catalyst::Helper::Model::DBIS, DBIx::Simple