X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FCookbook.pod;h=83f7cee8907e770940129b4e22e6e19a7cef9a40;hb=e66002835945589b7174d524ba5add64e714abd2;hp=98a8a4702c7172809093c0b2c3c52b947dce4a16;hpb=090550535a8ac9e4917d2c528418ea8211dc79cf;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 98a8a47..83f7cee 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -349,7 +349,7 @@ from, select, and +select attributes. my $rs = $cdrs->search({ year => { '=' => $cdrs->search( - { artist_id => { '=' => \'me.artist_id' } }, + { artist_id => { '=' => { -ident => 'me.artist_id' } } }, { alias => 'inner' } )->get_column('year')->max_rs->as_query, }, @@ -1669,7 +1669,8 @@ brackets, or a C<"> or C<'>: Check the documentation of your database for the correct quote characters to use. C needs to be set to allow the SQL -generator to put the quotes the correct place. +generator to put the quotes the correct place, and defaults to +C<.> if not supplied. In most cases you should set these as part of the arguments passed to L: @@ -1695,24 +1696,6 @@ this, you can also overload the C method for your schema class: return $rv; } -=head2 Setting limit dialect for SQL::Abstract::Limit - -In some cases, SQL::Abstract::Limit cannot determine the dialect of -the remote SQL server by looking at the database handle. This is a -common problem when using the DBD::JDBC, since the DBD-driver only -know that in has a Java-driver available, not which JDBC driver the -Java component has loaded. This specifically sets the limit_dialect -to Microsoft SQL-server (See more names in SQL::Abstract::Limit --documentation. - - __PACKAGE__->storage->sql_maker->limit_dialect('mssql'); - -The JDBC bridge is one way of getting access to a MSSQL server from a platform -that Microsoft doesn't deliver native client libraries for. (e.g. Linux) - -The limit dialect can also be set at connect time by specifying a -C key in the final hash as shown above. - =head2 Working with PostgreSQL array types You can also assign values to PostgreSQL array columns by passing array @@ -1825,9 +1808,9 @@ C). =head2 Easy migration from class-based to schema-based setup You want to start using the schema-based approach to L -(see L), but have an established class-based setup with lots -of existing classes that you don't want to move by hand. Try this nifty script -instead: +(see L), but have an +established class-based setup with lots of existing classes that you don't +want to move by hand. Try this nifty script instead: use MyDB; use SQL::Translator; @@ -1895,7 +1878,7 @@ just looking for this. For example, say that you have three columns, C, C, and C. You would like to make changes to C and have C be automagically set to the value of C squared. -You can accomplish this by overriding C: +You can accomplish this by overriding C in your L: sub store_column { my ( $self, $name, $value ) = @_; @@ -1908,6 +1891,10 @@ You can accomplish this by overriding C: Note that the hard work is done by the call to C, which redispatches your call to store_column in the superclass(es). +Generally, if this is a calculation your database can easily do, try +and avoid storing the calculated value, it is safer to calculate when +needed, than rely on the data being in sync. + =head2 Automatically creating related objects You might have a class C which has many Cs. Further, you