X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract.pm;h=e0f1cad7cb548f8c856ff470d13f9d1a3ef07eb0;hb=6e0c655267da36dc4db61dde8788a8b65a671631;hp=93e03939809986540f67f77b65dac9c19bb26c81;hpb=4f30591bc0678f8a5d657e79c6985606b064cd1d;p=dbsrgits%2FSQL-Abstract.git diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 93e0393..e0f1cad 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1320,7 +1320,9 @@ the huge section on L at the bottom. =item sqltrue, sqlfalse Expressions for inserting boolean values within SQL statements. -By default these are C<1=1> and C<1=0>. +By default these are C<1=1> and C<1=0>. They are used +by the special operators C<-in> and C<-not_in> for generating +correct SQL even when the argument is an empty array (see below). =item logic @@ -1639,7 +1641,7 @@ This simple code will create the following: A field associated to an empty arrayref will be considered a logical false and will generate 0=1. -=head2 Key-value pairs +=head2 Specific comparison operators If you want to specify a different type of operator for your comparison, you can use a hashref for a given column: @@ -1766,6 +1768,12 @@ Which would generate: The reverse operator C<-not_in> generates SQL C and is used in the same way. +If the argument to C<-in> is an empty array, 'sqlfalse' is generated +(by default : C<1=0>). Similarly, C<< -not_in => [] >> generates +'sqltrue' (by default : C<1=1>). + + + Another pair of operators is C<-between> and C<-not_between>, used with an arrayref of two values: