From: Norbert Buchmuller Date: Wed, 2 Sep 2009 03:14:11 +0000 (+0200) Subject: Fixed wrong literal SQL + bind examples (missing operator and placeholders). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d7afa8f9e26d835ef67f93cfd1f24c1f1bfd8c6;p=dbsrgits%2FDBIx-Class-Historic.git Fixed wrong literal SQL + bind examples (missing operator and placeholders). --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index e168c36..6aa9f31 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -423,14 +423,14 @@ specification as you would any column: With quoting on, or for a more portable solution, use literal SQL values with placeholders: - $rs->search(\[ 'YEAR(date_of_birth)', [ dummy => 1979 ] ]); + $rs->search(\[ 'YEAR(date_of_birth) = ?', [ dummy => 1979 ] ]); # Equivalent SQL: # SELECT * FROM employee WHERE YEAR(date_of_birth) = ? $rs->search({ name => 'Bob', - -nest => \[ 'YEAR(date_of_birth)', [ dummy => 1979 ] ], + -nest => \[ 'YEAR(date_of_birth) = ?', [ dummy => 1979 ] ], }); # Equivalent SQL: diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index df12b83..cf75fd2 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -247,7 +247,7 @@ documentation for details. To use an SQL function on the left hand side of a comparison: - ->search({ -nest => \[ 'YEAR(date_of_birth)', [ dummy => 1979 ] ] }); + ->search({ -nest => \[ 'YEAR(date_of_birth) = ?', [ dummy => 1979 ] ] }); Or, if you have quoting off: