Catalyst-Model-DBIC-Schema

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      }

    In short, there are three techniques available for obtaining a DBIC
    resultset object:

      # the long way
      my $rs = $c->model('FilmDB')->schema->resultset('Actor');

      # using the shortcut method on the model object
      my $rs = $c->model('FilmDB')->resultset('Actor');

      # using the generated class directly
      my $rs = $c->model('FilmDB::Actor');

    In order to add methods to a DBIC resultset, you cannot simply add them
    to the source (row, table) definition class; you must define a separate
    custom resultset class. This is just a matter of making a
    "lib/MyApp/Schema/ResultSet/Actor.pm" class that inherits from
    DBIx::Class::ResultSet, if you are using "load_namespaces" in
    DBIx::Class::Schema, the default for helper script generated schemas.

    See "Predefined searches" in DBIx::Class::Manual::Cookbook for
    information on definining your own DBIx::Class::ResultSet classes for
    use with "load_classes" in DBIx::Class::Schema, the old default.

CONFIG PARAMETERS
  schema_class
    This is the classname of your DBIx::Class::Schema Schema. It needs to be
    findable in @INC, but it does not need to be inside the
    "Catalyst::Model::" namespace. This parameter is required.

  connect_info
    This is a hashref or arrayref of connection parameters, which are
    specific to your "storage_type" (see your storage type documentation for
    more details). If you only need one parameter (e.g. the DSN), you can
    just pass a string.

    This is not required if "schema_class" already has connection
    information defined inside itself (which isn't highly recommended, but
    can be done.)

    For DBIx::Class::Storage::DBI, which is the only supported
    "storage_type" in DBIx::Class at the time of this writing, the
    parameters are your dsn, username, password, and connect options
    hashref.

    See "connect_info" in DBIx::Class::Storage::DBI for a detailed
    explanation of the arguments supported.

    Examples:

      connect_info => {
        dsn => 'dbi:Pg:dbname=mypgdb',
        user => 'postgres',
        password => ''
      }

      connect_info => {
        dsn => 'dbi:SQLite:dbname=foo.db',
        on_connect_do => [
          'PRAGMA synchronous = OFF',
        ]
      }

      connect_info => {
        dsn => 'dbi:Pg:dbname=mypgdb',
        user => 'postgres',
        password => '',
        pg_enable_utf8 => 1,
        on_connect_do => [
          'some SQL statement',
          'another SQL statement',
        ],
      }

    Or using Config::General:

        <Model::FilmDB>
            schema_class   MyApp::Schema::FilmDB
            traits Caching
            <connect_info>
                dsn   dbi:Pg:dbname=mypgdb
                user   postgres
                password ""
                auto_savepoint 1
                quote_names 1
                on_connect_do   some SQL statement
                on_connect_do   another SQL statement
            </connect_info>
            user_defined_schema_accessor foo
        </Model::FilmDB>

    or

        <Model::FilmDB>
            schema_class   MyApp::Schema::FilmDB
            connect_info   dbi:SQLite:dbname=foo.db
        </Model::FilmDB>

    Or using YAML:

      Model::MyDB:
          schema_class: MyDB
          traits: Caching
          connect_info:
              dsn: dbi:Oracle:mydb
              user: mtfnpy
              password: mypass
              LongReadLen: 1000000
              LongTruncOk: 1
              on_connect_call: 'datetime_setup'
              quote_names: 1

    The old arrayref style with hashrefs for DBI then DBIx::Class options is
    also supported:

      connect_info => [
        'dbi:Pg:dbname=mypgdb',
        'postgres',
        '',
        {



( run in 1.070 second using v1.01-cache-2.11-cpan-39bf76dae61 )