[Bast-commits] r7596 - SQL-Abstract/1.x/trunk/lib/SQL

nigel at dev.catalyst.perl.org nigel at dev.catalyst.perl.org
Mon Sep 7 13:36:40 GMT 2009


Author: nigel
Date: 2009-09-07 13:36:40 +0000 (Mon, 07 Sep 2009)
New Revision: 7596

Modified:
   SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
Log:
Documentation tweak on how you handle booleans

Modified: SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2009-09-07 13:31:38 UTC (rev 7595)
+++ SQL-Abstract/1.x/trunk/lib/SQL/Abstract.pm	2009-09-07 13:36:40 UTC (rev 7596)
@@ -1979,8 +1979,23 @@
 
     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
 
 So far, we've seen how multiple conditions are joined with a top-level
@@ -2101,8 +2116,10 @@
 
 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</"Unary operators: bool"> :
 
     my %where = (
         priority  => { '<', 2 },




More information about the Bast-commits mailing list