From: Alexander Hartmaier Date: Tue, 2 Apr 2013 14:54:23 +0000 (+0200) Subject: Removed usage of plain_value bind value workaround in the cookbook X-Git-Tag: v0.08250~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3bc50bf9ede81fc810fac966b230ef0f91244fec;p=dbsrgits%2FDBIx-Class.git Removed usage of plain_value bind value workaround in the cookbook --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 70b8b82..8648b7c 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -421,26 +421,23 @@ you create an index on the return value of the function in question.) However, it can be accomplished with C when necessary by resorting to literal SQL: - $rs->search(\[ 'YEAR(date_of_birth) = ?', [ plain_value => 1979 ] ]); + $rs->search( + \[ 'YEAR(date_of_birth) = ?', 1979 ] + ); # Equivalent SQL: # SELECT * FROM employee WHERE YEAR(date_of_birth) = ? $rs->search({ -and => [ name => 'Bob', - \[ 'YEAR(date_of_birth) = ?', [ plain_value => 1979 ] ], + \[ 'YEAR(date_of_birth) = ?', 1979 ] ]}); # Equivalent SQL: # SELECT * FROM employee WHERE name = ? AND YEAR(date_of_birth) = ? -Note: the C string in the C<< [ plain_value => 1979 ] >> part -should be either the same as the name of the column (do this if the type of the -return value of the function is the same as the type of the column) or in the -case of a function it's currently treated as a dummy string (it is a good idea -to use C or something similar to convey intent). The value is -currently only significant when handling special column types (BLOBs, arrays, -etc.), but this may change in the future. +Note: the syntax for specifying the bind value's datatype and value is +explained in L. See also L. diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index 051ae30..7f063b7 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -242,15 +242,7 @@ documentation for details. To use an SQL function on the left hand side of a comparison you currently need to resort to literal SQL: - ->search( \[ 'YEAR(date_of_birth) = ?', [ plain_value => 1979 ] ] ); - -Note: the C string in the C<< [ plain_value => 1979 ] >> part -should be either the same as the name of the column (do this if the type of the -return value of the function is the same as the type of the column) or in the -case of a function it's currently treated as a dummy string (it is a good idea -to use C or something similar to convey intent). The value is -currently only significant when handling special column types (BLOBs, arrays, -etc.), but this may change in the future. + ->search( \[ 'YEAR(date_of_birth) = ?', 1979 ] ); =item .. find more help on constructing searches?