From: Jess Robinson Date: Sun, 16 Jul 2006 12:25:22 +0000 (+0000) Subject: Improve docs for searching, as, and some cookbook examples X-Git-Tag: v0.07002~75^2~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=acee4e4d60a59d831571937ce4148cd4ffd5ac80;p=dbsrgits%2FDBIx-Class.git Improve docs for searching, as, and some cookbook examples --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 7e9a810..65f802d 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -401,6 +401,24 @@ SQL statements: my $tag = $rs->first; print $tag->cd->artist->name; +=head2 Using relationships + +=head3 Create a new row in a related table + + my $book->create_related('author', { name => 'Fred'}); + +=head3 Search in a related table + +Only searches for books named 'Titanic' by the author in $author. + + my $author->search_related('books', { name => 'Titanic' }); + +=head3 Delete data in a related table + +Deletes only the book named Titanic by the author in $author. + + my $author->delete_related('books', { name => 'Titanic' }); + =head2 Transactions As of version 0.04001, there is improved transaction support in diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 7e94eab..82109c9 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -129,6 +129,8 @@ call it as C. columns => [qw/name artistid/], }); +For a list of attributes that can be passed to C, see L. For more examples of using this function, see L. + =cut sub search { @@ -1750,9 +1752,15 @@ use C instead: You can create your own accessors if required - see L for details. -Please note: This will NOT insert an C into the SQL statement -produced, it is used for internal access only. Thus attempting to use the accessor -in an C clause or similar will fail misrably. +Please note: This will NOT insert an C into the SQL +statement produced, it is used for internal access only. Thus +attempting to use the accessor in an C clause or similar +will fail miserably. + +To get around this limitation, you can supply literal SQL to your +C