[Bast-commits] r5798 - SQL-Abstract/1.x/trunk/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Mar 22 22:24:07 GMT 2009


Author: ribasushi
Date: 2009-03-22 22:24:07 +0000 (Sun, 22 Mar 2009)
New Revision: 5798

Modified:
   SQL-Abstract/1.x/trunk/t/00new.t
   SQL-Abstract/1.x/trunk/t/01generate.t
   SQL-Abstract/1.x/trunk/t/02where.t
Log:
Reverting massive test breakage by LDAMI - this stuff can not happen in 1.x, has to wait for 2.x (some tests changes are reasonable, acking where appropriate)

Modified: SQL-Abstract/1.x/trunk/t/00new.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/00new.t	2009-03-22 22:17:44 UTC (rev 5797)
+++ SQL-Abstract/1.x/trunk/t/00new.t	2009-03-22 22:24:07 UTC (rev 5798)
@@ -17,6 +17,8 @@
 # the test was not consistent with the doc: hashrefs should not be
 # influenced by the current logic, they always mean 'AND'. So 
 # { a => 4, b => 0} should ALWAYS mean ( a = ? AND b = ? ).
+#
+# acked by RIBASUSHI
               stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )'
       },
       #2
@@ -39,6 +41,7 @@
               args => {cmp => "=", logic => 'or'},
 # LDNOTE idem
 #              stmt => 'SELECT * FROM test WHERE ( a = ? OR b = ? )'
+# acked by RIBASUSHI
               stmt => 'SELECT * FROM test WHERE ( a = ? AND b = ? )'
       },
       #6
@@ -51,6 +54,7 @@
               args => {logic => "or", cmp => "like"},
 # LDNOTE idem
 #              stmt => 'SELECT * FROM test WHERE ( a LIKE ? OR b LIKE ? )'
+# acked by RIBASUSHI
               stmt => 'SELECT * FROM test WHERE ( a LIKE ? AND b LIKE ? )'
       },
       #8
@@ -87,15 +91,7 @@
       #14
       {
               args => {convert => "upper"},
-# LDNOTE : modified the test below, because modified the semantics
-# of "e => { '!=', [qw(f g)] }" : generating "e != 'f' OR e != 'g'"
-# is nonsense (will always be true whatever the value of e). Since
-# this is a 'negative' operator, we must apply the Morgan laws and
-# interpret it as "e != 'f' AND e != 'g'" (and actually the user
-# should rather write "e => {-not_in => [qw/f g/]}".
-
-#              stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) OR ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )',
-              stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) AND ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )',
+              stmt => 'SELECT * FROM test WHERE ( ( UPPER(hostname) IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) AND ( ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) OR ( UPPER(ticket) = UPPER(?) ) ) ) OR ( UPPER(tack) BETWEEN UPPER(?) AND UPPER(?) ) OR ( ( ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) OR ( UPPER(a) = UPPER(?) ) ) AND ( ( UPPER(e) != UPPER(?) ) OR ( UPPER(e) != UPPER(?) ) ) AND UPPER(q) NOT IN ( UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?), UPPER(?) ) ) )',
               where => [ { ticket => [11, 12, 13], 
                            hostname => { in => ['ntf', 'avd', 'bvd', '123'] } },
                         { tack => { between => [qw/tick tock/] } },

Modified: SQL-Abstract/1.x/trunk/t/01generate.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/01generate.t	2009-03-22 22:17:44 UTC (rev 5797)
+++ SQL-Abstract/1.x/trunk/t/01generate.t	2009-03-22 22:24:07 UTC (rev 5798)
@@ -253,13 +253,10 @@
                                            tasty => { '!=', [qw(yes YES)] },
                                            -nest => [ face => [ -or => {'=', 'mr.happy'}, {'=', undef} ] ] },
                         ],
-# LDNOTE : modified the test below, same reasons as #14 in 00where.t
               stmt   => 'UPDATE taco_punches SET one = ?, three = ? WHERE ( ( ( ( ( face = ? ) OR ( face IS NULL ) ) ) )'
-#                      . ' AND ( ( bland != ? ) AND ( bland != ? ) ) AND ( ( tasty != ? ) OR ( tasty != ? ) ) )',
-                      . ' AND ( ( bland != ? ) AND ( bland != ? ) ) AND ( ( tasty != ? ) AND ( tasty != ? ) ) )',
+                      . ' AND ( ( bland != ? ) AND ( bland != ? ) ) AND ( ( tasty != ? ) OR ( tasty != ? ) ) )',
               stmt_q => 'UPDATE `taco_punches` SET `one` = ?, `three` = ? WHERE ( ( ( ( ( `face` = ? ) OR ( `face` IS NULL ) ) ) )'
-#                      . ' AND ( ( `bland` != ? ) AND ( `bland` != ? ) ) AND ( ( `tasty` != ? ) OR ( `tasty` != ? ) ) )',
-                      . ' AND ( ( `bland` != ? ) AND ( `bland` != ? ) ) AND ( ( `tasty` != ? ) AND ( `tasty` != ? ) ) )',
+                      . ' AND ( ( `bland` != ? ) AND ( `bland` != ? ) ) AND ( ( `tasty` != ? ) OR ( `tasty` != ? ) ) )',
               bind   => [qw(2 4 mr.happy yes YES yes YES)],
       },             
       #29            
@@ -268,26 +265,18 @@
               args   => ['jeff', '*', { name => {'like', '%smith%', -not_in => ['Nate','Jim','Bob','Sally']},
                                        -nest => [ -or => [ -and => [age => { -between => [20,30] }, age => {'!=', 25} ],
                                                                    yob => {'<', 1976} ] ] } ],
-# LDNOTE : original test below was WRONG with respect to the doc.
-# [-and, [cond1, cond2], cond3] should mean (cond1 OR cond2) AND cond3
-# instead of (cond1 AND cond2) OR cond3. 
-# Probably a misconception because of '=>' notation 
-# in [-and => [cond1, cond2], cond3].
-# Also some differences in parentheses, but without impact on semantics.
-#               stmt   => 'SELECT * FROM jeff WHERE ( ( ( ( ( ( ( age BETWEEN ? AND ? ) AND ( age != ? ) ) ) OR ( yob < ? ) ) ) )'
-#                       . ' AND name NOT IN ( ?, ?, ?, ? ) AND name LIKE ? )',
-#               stmt_q => 'SELECT * FROM `jeff` WHERE ( ( ( ( ( ( ( `age` BETWEEN ? AND ? ) AND ( `age` != ? ) ) ) OR ( `yob` < ? ) ) ) )'
-#                       . ' AND `name` NOT IN ( ?, ?, ?, ? ) AND `name` LIKE ? )',
-              stmt   => 'SELECT * FROM jeff WHERE ( ( ( ( ( age BETWEEN ? AND ? ) OR ( age != ? ) ) AND ( yob < ? ) ) )'
-                      . ' AND ( name NOT IN ( ?, ?, ?, ? ) AND name LIKE ? ) )',
-              stmt_q => 'SELECT * FROM `jeff` WHERE ( ( ( ( ( `age` BETWEEN ? AND ? ) OR ( `age` != ? ) ) AND ( `yob` < ? ) ) )'
-                      . ' AND ( `name` NOT IN ( ?, ?, ?, ? ) AND `name` LIKE ? ) )',
+              stmt   => 'SELECT * FROM jeff WHERE ( ( ( ( ( ( ( age BETWEEN ? AND ? ) AND ( age != ? ) ) ) OR ( yob < ? ) ) ) )'
+                      . ' AND name NOT IN ( ?, ?, ?, ? ) AND name LIKE ? )',
+              stmt_q => 'SELECT * FROM `jeff` WHERE ( ( ( ( ( ( ( `age` BETWEEN ? AND ? ) AND ( `age` != ? ) ) ) OR ( `yob` < ? ) ) ) )'
+                      . ' AND `name` NOT IN ( ?, ?, ?, ? ) AND `name` LIKE ? )',
               bind   => [qw(20 30 25 1976 Nate Jim Bob Sally %smith%)]
       },             
       #30            
       {              
               func   => 'update',
 # LDNOTE : removed the "-maybe", because we no longer admit unknown ops
+#
+# acked by RIBASUSHI
 #              args   => ['fhole', {fpoles => 4}, [-maybe => {race => [-and => [qw(black white asian)]]},
               args   => ['fhole', {fpoles => 4}, [          {race => [-and => [qw(black white asian)]]},
                                                             {-nest => {firsttime => [-or => {'=','yes'}, undef]}},
@@ -311,6 +300,8 @@
               func   => 'select',
 # LDNOTE: modified test below because we agreed with MST that literal SQL
 #         should not automatically insert a '='; the user has to do it
+#
+# acked by MSTROUT
 #              args   => ['test', '*', { a => \["to_date(?, 'MM/DD/YY')", '02/02/02']}],
               args   => ['test', '*', { a => \["= to_date(?, 'MM/DD/YY')", '02/02/02']}],
               stmt   => q{SELECT * FROM test WHERE ( a = to_date(?, 'MM/DD/YY') )},
@@ -530,9 +521,9 @@
       {
               func   => 'select',
               new    => {bindtype => 'columns'},
-              args   => ['test', '*', { -or => [ -and => [ a => 'a', b => 'b' ],-and => [ c => 'c', d => 'd' ]  ]  }],
-              stmt   => 'SELECT * FROM test WHERE ( ( ( ( ( a = ? ) AND ( b = ? ) ) ) OR ( ( ( c = ? ) AND ( d = ? ) ) ) ) )',
-              stmt_q => 'SELECT * FROM `test` WHERE ( ( ( ( ( `a` = ? ) AND ( `b` = ? ) ) ) OR ( ( ( `c` = ? ) AND ( `d` = ? ) ) ) ) )',
+              args   => ['test', '*', { -or => [ -and => [ a => 'a', b => 'b' ], -and => [ c => 'c', d => 'd' ]  ]  }],
+              stmt   => 'SELECT * FROM test WHERE ( a = ? AND b = ? ) OR ( c = ? AND d = ?  )',
+              stmt_q => 'SELECT * FROM `test` WHERE ( `a` = ? AND `b` = ?  ) OR ( `c` = ? AND `d` = ? )',
               bind   => [[a => 'a'], [b => 'b'], [ c => 'c'],[ d => 'd']],
       },          
       

Modified: SQL-Abstract/1.x/trunk/t/02where.t
===================================================================
--- SQL-Abstract/1.x/trunk/t/02where.t	2009-03-22 22:17:44 UTC (rev 5797)
+++ SQL-Abstract/1.x/trunk/t/02where.t	2009-03-22 22:24:07 UTC (rev 5798)
@@ -83,8 +83,9 @@
         },
         order => \'ticket, requestor',
 #LDNOTE: modified parentheses
-#        stmt => " WHERE ( completion_date BETWEEN ? AND ? AND status = ? ) ORDER BY ticket, requestor",
-        stmt => " WHERE ( ( completion_date BETWEEN ? AND ? ) AND status = ? ) ORDER BY ticket, requestor",
+#
+# acked by RIBASUSHI
+        stmt => "WHERE ( ( completion_date BETWEEN ? AND ? ) AND status = ? ) ORDER BY ticket, requestor",
         bind => [qw/2002-10-01 2003-02-06 completed/],
     },
 
@@ -132,7 +133,8 @@
         },
         order => \'requestor, ticket',
 #LDNOTE: modified parentheses
-#        stmt => " WHERE ( priority BETWEEN ? AND ? AND requestor IS NULL ) ORDER BY requestor, ticket",
+#
+# acked by RIBASUSHI
         stmt => " WHERE ( ( priority BETWEEN ? AND ? ) AND requestor IS NULL ) ORDER BY requestor, ticket",
         bind => [qw/1 3/],
     },
@@ -147,7 +149,8 @@
 	    },
         },
 # LDNOTE : modified test below, just parentheses differ
-#        stmt => " WHERE ( id = ? AND num <= ? AND num > ? )",
+#
+# acked by RIBASUSHI
         stmt => " WHERE ( id = ? AND ( num <= ? AND num > ? ) )",
         bind => [qw/1 20 10/],
     },
@@ -160,10 +163,7 @@
                    wix => {'in' => [qw/zz yy/]},
                    wux => {'not_in'  => [qw/30 40/]}
                  },
-# LDNOTE: modified parentheses for BETWEEN (trivial).
-# Also modified the logic of "not_like" (severe, same reasons as #14 in 00where.t)
-#        stmt => " WHERE ( ( ( foo NOT LIKE ? ) OR ( foo NOT LIKE ? ) OR ( foo NOT LIKE ? ) ) AND ( ( fum LIKE ? ) OR ( fum LIKE ? ) ) AND nix BETWEEN ? AND ? AND nox NOT BETWEEN ? AND ? AND wix IN ( ?, ? ) AND wux NOT IN ( ?, ? ) )",
-        stmt => " WHERE ( ( foo NOT LIKE ? AND foo NOT LIKE ? AND foo NOT LIKE ? ) AND ( ( fum LIKE ? ) OR ( fum LIKE ? ) ) AND ( nix BETWEEN ? AND ? ) AND ( nox NOT BETWEEN ? AND ? ) AND wix IN ( ?, ? ) AND wux NOT IN ( ?, ? ) )",
+        stmt => " WHERE ( ( ( foo NOT LIKE ? ) OR ( foo NOT LIKE ? ) OR ( foo NOT LIKE ? ) ) AND ( ( fum LIKE ? ) OR ( fum LIKE ? ) ) AND nix BETWEEN ? AND ? AND nox NOT BETWEEN ? AND ? AND wix IN ( ?, ? ) AND wux NOT IN ( ?, ? ) )",
         bind => [7,8,9,'a','b',100,200,150,160,'zz','yy','30','40'],
     },
 




More information about the Bast-commits mailing list