<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    DBIx::Class - Extensible and flexible object &lt;-&gt; relational mapper.

GETTING HELP/SUPPORT
    The community can be found via:

    *   Web Site: &lt;http://www.dbix-class.org/&gt;

    *   IRC: irc.perl.org#dbix-class

    *   Mailing list: &lt;http://lists.scsys.co.uk/mailman/listinfo/dbix-class&gt;

    *   RT Bug Tracker:
        &lt;https://rt.cpan.org/Dist/Display.html?Queue=DBIx-Class&gt;

    *   gitweb:
        &lt;http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.
        git&gt;

    *   git: &lt;git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git&gt;

    *   twitter &lt;http://www.twitter.com/dbix_class&gt;

SYNOPSIS
    Create a schema class called MyApp/Schema.pm:

      package MyApp::Schema;
      use base qw/DBIx::Class::Schema/;

      __PACKAGE__-&gt;load_namespaces();

      1;

    Create a result class to represent artists, who have many CDs, in
    MyApp/Schema/Result/Artist.pm:

    See DBIx::Class::ResultSource for docs on defining result classes.

      package MyApp::Schema::Result::Artist;
      use base qw/DBIx::Class::Core/;

      __PACKAGE__-&gt;table('artist');
      __PACKAGE__-&gt;add_columns(qw/ artistid name /);
      __PACKAGE__-&gt;set_primary_key('artistid');
      __PACKAGE__-&gt;has_many(cds =&gt; 'MyApp::Schema::Result::CD', 'artistid');

      1;

    A result class to represent a CD, which belongs to an artist, in
    MyApp/Schema/Result/CD.pm:

      package MyApp::Schema::Result::CD;
      use base qw/DBIx::Class::Core/;

      __PACKAGE__-&gt;load_components(qw/InflateColumn::DateTime/);
      __PACKAGE__-&gt;table('cd');
      __PACKAGE__-&gt;add_columns(qw/ cdid artistid title year /);
      __PACKAGE__-&gt;set_primary_key('cdid');
      __PACKAGE__-&gt;belongs_to(artist =&gt; 'MyApp::Schema::Result::Artist', 'artistid');

      1;

    Then you can use these classes in your application's code:

      # Connect to your database.
      use MyApp::Schema;
      my $schema = MyApp::Schema-&gt;connect($dbi_dsn, $user, $pass, \%dbi_params);

      # Query for all artists and put them in an array,
      # or retrieve them as a result set object.
      # $schema-&gt;resultset returns a DBIx::Class::ResultSet
      my @all_artists = $schema-&gt;resultset('Artist')-&gt;all;
      my $all_artists_rs = $schema-&gt;resultset('Artist');

      # Output all artists names
      # $artist here is a DBIx::Class::Row, which has accessors
      # for all its columns. Rows are also subclasses of your Result class.
      foreach $artist (@all_artists) {
        print $artist-&gt;name, "\n";
      }

      # Create a result set to search for artists.
      # This does not query the DB.
      my $johns_rs = $schema-&gt;resultset('Artist')-&gt;search(
        # Build your WHERE using an SQL::Abstract structure:
        { name =&gt; { like =&gt; 'John%' } }
      );

      # Execute a joined query to get the cds.
      my @all_john_cds = $johns_rs-&gt;search_related('cds')-&gt;all;

      # Fetch the next available row.
      my $first_john = $johns_rs-&gt;next;

      # Specify ORDER BY on the query.
      my $first_john_cds_by_title_rs = $first_john-&gt;cds(
        undef,
        { order_by =&gt; 'title' }
      );

      # Create a result set that will fetch the artist data
      # at the same time as it fetches CDs, using only one query.
      my $millennium_cds_rs = $schema-&gt;resultset('CD')-&gt;search(
        { year =&gt; 2000 },
        { prefetch =&gt; 'artist' }
      );

      my $cd = $millennium_cds_rs-&gt;next; # SELECT ... FROM cds JOIN artists ...
      my $cd_artist_name = $cd-&gt;artist-&gt;name; # Already has the data so no 2nd query

      # new() makes a DBIx::Class::Row object but doesnt insert it into the DB.
      # create() is the same as new() then insert().
      my $new_cd = $schema-&gt;resultset('CD')-&gt;new({ title =&gt; 'Spoon' });
      $new_cd-&gt;artist($cd-&gt;artist);
      $new_cd-&gt;insert; # Auto-increment primary key filled in after INSERT
      $new_cd-&gt;title('Fork');

      $schema-&gt;txn_do(sub { $new_cd-&gt;update }); # Runs the update in a transaction

      # change the year of all the millennium CDs at once
      $millennium_cds_rs-&gt;update({ year =&gt; 2002 });

DESCRIPTION
    This is an SQL to OO mapper with an object API inspired by Class::DBI
    (with a compatibility layer as a springboard for porting) and a
    resultset API that allows abstract encapsulation of database operations.
    It aims to make representing queries in your code as perl-ish as
    possible while still providing access to as many of the capabilities of
    the database as possible, including retrieving related records from
    multiple tables in a single query, JOIN, LEFT JOIN, COUNT, DISTINCT,
    GROUP BY, ORDER BY and HAVING support.

    DBIx::Class can handle multi-column primary and foreign keys, complex
    queries and database-level paging, and does its best to only query the
    database in order to return something you've directly asked for. If a
    resultset is used as an iterator it only fetches rows off the statement
    handle as requested in order to minimise memory usage. It has
    auto-increment support for SQLite, MySQL, PostgreSQL, Oracle, SQL Server
    and DB2 and is known to be used in production on at least the first
    four, and is fork- and thread-safe out of the box (although your DBD may
    not be).

    This project is still under rapid development, so large new features may
    be marked EXPERIMENTAL - such APIs are still usable but may have edge
    bugs. Failing test cases are *always* welcome and point releases are put
    out rapidly as bugs are found and fixed.

    We do our best to maintain full backwards compatibility for published
    APIs, since DBIx::Class is used in production in many organisations, and
    even backwards incompatible changes to non-published APIs will be fixed
    if they're reported and doing so doesn't cost the codebase anything.

    The test suite is quite substantial, and several developer releases are
    generally made to CPAN before the branch for the next release is merged
    back to trunk for a major release.

WHERE TO GO NEXT
    DBIx::Class::Manual::DocMap lists each task you might want help on, and
    the modules where you will find documentation.

AUTHOR
    mst: Matt S. Trout &lt;mst@shadowcatsystems.co.uk&gt;

    (I mostly consider myself "project founder" these days but the AUTHOR
    heading is traditional :)

CONTRIBUTORS
    abraxxa: Alexander Hartmaier &lt;abraxxa@cpan.org&gt;

    acca: Alexander Kuznetsov &lt;acca@cpan.org&gt;

    aherzog: Adam Herzog &lt;adam@herzogdesigns.com&gt;

    Alexander Keusch &lt;cpan@keusch.at&gt;

    alnewkirk: Al Newkirk &lt;we@ana.im&gt;

    amiri: Amiri Barksdale &lt;amiri@metalabel.com&gt;

    amoore: Andrew Moore &lt;amoore@cpan.org&gt;

    andyg: Andy Grundman &lt;andy@hybridized.org&gt;

    ank: Andres Kievsky

    arc: Aaron Crane &lt;arc@cpan.org&gt;

    arcanez: Justin Hunter &lt;justin.d.hunter@gmail.com&gt;

    ash: Ash Berlin &lt;ash@cpan.org&gt;

    bert: Norbert Csongradi &lt;bert@cpan.org&gt;

    blblack: Brandon L. Black &lt;blblack@gmail.com&gt;

    bluefeet: Aran Deltac &lt;bluefeet@cpan.org&gt;

    bphillips: Brian Phillips &lt;bphillips@cpan.org&gt;

    boghead: Bryan Beeley &lt;cpan@beeley.org&gt;

    bricas: Brian Cassidy &lt;bricas@cpan.org&gt;

    brunov: Bruno Vecchi &lt;vecchi.b@gmail.com&gt;

    caelum: Rafael Kitover &lt;rkitover@cpan.org&gt;

    caldrin: Maik Hentsche &lt;maik.hentsche@amd.com&gt;

    castaway: Jess Robinson

    claco: Christopher H. Laco

    clkao: CL Kao

    da5id: David Jack Olrik &lt;djo@cpan.org&gt;

    debolaz: Anders Nor Berle &lt;berle@cpan.org&gt;

    dew: Dan Thomas &lt;dan@godders.org&gt;

    dkubb: Dan Kubb &lt;dan.kubb-cpan@onautopilot.com&gt;

    dnm: Justin Wheeler &lt;jwheeler@datademons.com&gt;

    dpetrov: Dimitar Petrov &lt;mitakaa@gmail.com&gt;

    dwc: Daniel Westermann-Clark &lt;danieltwc@cpan.org&gt;

    dyfrgi: Michael Leuchtenburg &lt;michael@slashhome.org&gt;

    felliott: Fitz Elliott &lt;fitz.elliott@gmail.com&gt;

    freetime: Bill Moseley &lt;moseley@hank.org&gt;

    frew: Arthur Axel "fREW" Schmidt &lt;frioux@gmail.com&gt;

    goraxe: Gordon Irving &lt;goraxe@cpan.org&gt;

    gphat: Cory G Watson &lt;gphat@cpan.org&gt;

    Grant Street Group &lt;http://www.grantstreet.com/&gt;

    groditi: Guillermo Roditi &lt;groditi@cpan.org&gt;

    Haarg: Graham Knop &lt;haarg@haarg.org&gt;

    hobbs: Andrew Rodland &lt;arodland@cpan.org&gt;

    ilmari: Dagfinn Ilmari Mannsåker &lt;ilmari@ilmari.org&gt;

    initself: Mike Baas &lt;mike@initselftech.com&gt;

    ironcamel: Naveed Massjouni &lt;naveedm9@gmail.com&gt;

    jawnsy: Jonathan Yu &lt;jawnsy@cpan.org&gt;

    jasonmay: Jason May &lt;jason.a.may@gmail.com&gt;

    jesper: Jesper Krogh

    jgoulah: John Goulah &lt;jgoulah@cpan.org&gt;

    jguenther: Justin Guenther &lt;jguenther@cpan.org&gt;

    jhannah: Jay Hannah &lt;jay@jays.net&gt;

    jnapiorkowski: John Napiorkowski &lt;jjn1056@yahoo.com&gt;

    jon: Jon Schutz &lt;jjschutz@cpan.org&gt;

    jshirley: J. Shirley &lt;jshirley@gmail.com&gt;

    kaare: Kaare Rasmussen

    konobi: Scott McWhirter

    littlesavage: Alexey Illarionov &lt;littlesavage@orionet.ru&gt;

    lukes: Luke Saunders &lt;luke.saunders@gmail.com&gt;

    marcus: Marcus Ramberg &lt;mramberg@cpan.org&gt;

    mattlaw: Matt Lawrence

    mattp: Matt Phillips &lt;mattp@cpan.org&gt;

    michaelr: Michael Reddick &lt;michael.reddick@gmail.com&gt;

    milki: Jonathan Chu &lt;milki@rescomp.berkeley.edu&gt;

    ned: Neil de Carteret

    nigel: Nigel Metheringham &lt;nigelm@cpan.org&gt;

    ningu: David Kamholz &lt;dkamholz@cpan.org&gt;

    Nniuq: Ron "Quinn" Straight" &lt;quinnfazigu@gmail.org&gt;

    norbi: Norbert Buchmuller &lt;norbi@nix.hu&gt;

    nuba: Nuba Princigalli &lt;nuba@cpan.org&gt;

    Numa: Dan Sully &lt;daniel@cpan.org&gt;

    ovid: Curtis "Ovid" Poe &lt;ovid@cpan.org&gt;

    oyse: Øystein Torget &lt;oystein.torget@dnv.com&gt;

    paulm: Paul Makepeace

    penguin: K J Cheetham

    perigrin: Chris Prather &lt;chris@prather.org&gt;

    peter: Peter Collingbourne &lt;peter@pcc.me.uk&gt;

    phaylon: Robert Sedlacek &lt;phaylon@dunkelheit.at&gt;

    plu: Johannes Plunien &lt;plu@cpan.org&gt;

    Possum: Daniel LeWarne &lt;possum@cpan.org&gt;

    quicksilver: Jules Bean

    rafl: Florian Ragwitz &lt;rafl@debian.org&gt;

    rainboxx: Matthias Dietrich &lt;perl@rb.ly&gt;

    rbo: Robert Bohne &lt;rbo@cpan.org&gt;

    rbuels: Robert Buels &lt;rmb32@cornell.edu&gt;

    rdj: Ryan D Johnson &lt;ryan@innerfence.com&gt;

    ribasushi: Peter Rabbitson &lt;ribasushi@cpan.org&gt;

    rjbs: Ricardo Signes &lt;rjbs@cpan.org&gt;

    robkinyon: Rob Kinyon &lt;rkinyon@cpan.org&gt;

    Robert Olson &lt;bob@rdolson.org&gt;

    Roman: Roman Filippov &lt;romanf@cpan.org&gt;

    Sadrak: Felix Antonius Wilhelm Ostmann &lt;sadrak@cpan.org&gt;

    sc_: Just Another Perl Hacker

    scotty: Scotty Allen &lt;scotty@scottyallen.com&gt;

    semifor: Marc Mims &lt;marc@questright.com&gt;

    solomon: Jared Johnson &lt;jaredj@nmgi.com&gt;

    spb: Stephen Bennett &lt;stephen@freenode.net&gt;

    Squeeks &lt;squeek@cpan.org&gt;

    sszabo: Stephan Szabo &lt;sszabo@bigpanda.com&gt;

    talexb: Alex Beamish &lt;talexb@gmail.com&gt;

    tamias: Ronald J Kimball &lt;rjk@tamias.net&gt;

    teejay : Aaron Trevena &lt;teejay@cpan.org&gt;

    Todd Lipcon

    Tom Hukins

    tonvoon: Ton Voon &lt;tonvoon@cpan.org&gt;

    triode: Pete Gamache &lt;gamache@cpan.org&gt;

    typester: Daisuke Murase &lt;typester@cpan.org&gt;

    victori: Victor Igumnov &lt;victori@cpan.org&gt;

    wdh: Will Hawes

    willert: Sebastian Willert &lt;willert@cpan.org&gt;

    wreis: Wallace Reis &lt;wreis@cpan.org&gt;

    yrlnry: Mark Jason Dominus &lt;mjd@plover.com&gt;

    zamolxes: Bogdan Lucaciu &lt;bogdan@wiz.ro&gt;

COPYRIGHT
    Copyright (c) 2005 - 2010 the DBIx::Class "AUTHOR" and "CONTRIBUTORS" as
    listed above.

LICENSE
    This library is free software and may be distributed under the same
    terms as perl itself.

</pre></body></html>