X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FCookbook.pod;h=014ff381b591edad8a1e896786e2665b3a97ce3e;hb=997a3638a92234ac9f0a1a49984110cb73fb4dbb;hp=7fe2058a8e6873b48c31be0aae7d9477e3186446;hpb=b1d821deddb9183fb96810d71a046ee8abe71d13;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 7fe2058..014ff38 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -326,10 +326,10 @@ You can write subqueries relatively easily in DBIC. }); my $rs = $schema->resultset('CD')->search({ - artist_id => { 'IN' => $inside_rs->get_column('id')->as_query }, + artist_id => { -in => $inside_rs->get_column('id')->as_query }, }); -The usual operators ( =, !=, IN, NOT IN, etc.) are supported. +The usual operators ( '=', '!=', -in, -not_in, etc.) are supported. B: You have to explicitly use '=' when doing an equality comparison. The following will B work: @@ -1078,7 +1078,7 @@ If you want to get a filtered result set, you can just add add to $attr as follo __PACKAGE__->has_many('pages' => 'Page', 'book', { where => { scrap => 0 } } ); -=head2 Many-to-many relationships +=head2 Many-to-many relationship bridges This is straightforward using L: @@ -1370,14 +1370,21 @@ retry if the server goes away mid-operations, unlike C. L will connect to a database and create a L and associated sources by examining the database. -The recommend way of achieving this is to use the +The recommend way of achieving this is to use the L utility or the +L helper, as described in +L. + +Alternatively, use the L method: perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib \ - -e 'make_schema_at("My::Schema", { debug => 1 }, [ "dbi:Pg:dbname=foo","postgres" ])' + -e 'make_schema_at("My::Schema", \ + { db_schema => 'myschema', components => ["InflateColumn::DateTime"] }, \ + [ "dbi:Pg:dbname=foo", "username", "password" ])' -This will create a tree of files rooted at C<./lib/My/Schema/> containing -source definitions for all the tables found in the C database. +This will create a tree of files rooted at C<./lib/My/Schema/> containing source +definitions for all the tables found in the C schema in the C +database. =head2 Creating DDL SQL @@ -1911,10 +1918,10 @@ L: $self->squared( $value * $value ); } - $self->next::method(@_); + $self->$orig(@_); } -Note that the hard work is done by the call to C, which +Note that the hard work is done by the call to C<< $self->$orig >>, which redispatches your call to store_column in the superclass(es). Generally, if this is a calculation your database can easily do, try