From: Nigel Metheringham Date: Mon, 7 Sep 2009 13:36:40 +0000 (+0000) Subject: Documentation tweak on how you handle booleans X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b604e9d68b9aa48ce22d50106e27ebc6a43d91d;p=scpubgit%2FQ-Branch.git Documentation tweak on how you handle booleans --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 06c3534..d2960a1 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1979,6 +1979,21 @@ Would give you: WHERE is_user AND NOT is_enabled +If a more complex combination is required, testing more conditions, +then you should use the and/or operators:- + + my %where = ( + -and => [ + -bool => 'one', + -bool => 'two', + -bool => 'three', + -not_bool => 'four', + ], + ); + +Would give you: + + WHERE one AND two AND three AND NOT four =head2 Nested conditions, -and/-or prefixes @@ -2101,8 +2116,10 @@ with this: TMTOWTDI. -Conditions on boolean columns can be expressed in the -same way, passing a reference to an empty string : +Conditions on boolean columns can be expressed in the same way, passing +a reference to an empty string, however using liternal SQL in this way +is deprecated - the preferred method is to use the boolean operators - +see L : my %where = ( priority => { '<', 2 },