On 16/06/06, Daniel McBrearty <[EMAIL PROTECTED]> wrote:
> I'm not really getting the difference from reading
>
> http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class/ResultSet.pm#METHODS
Note the return values, search() return a resultset whereas find()
returns a single row.
> Also takes an optional key attribute, to search by a specific key or
> unique constraint. For example:
>
> my $cd = $schema->resultset('CD')->find(
> {
> artist => 'Massive Attack',
> title => 'Mezzanine',
> },
> { key => 'artist_title' }
> );
> "
>
> I don't get this - this is looking for an album where artist and title
> have the given values ... so what is the key doing, in terms of the
> actual query?
Judging by the key name "artist_title", it looks like it's a
multi-column key on both the artist and title columns.
(though in real-life, the artist col would probably be an int,
refering to a seperate Artists table).
Carl
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/