[Bast-commits] r8935 - in SQL-Abstract/1.x/branches/arbitrary_op_nesting: . lib/SQL lib/SQL/Abstract t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun Mar 7 22:42:04 GMT 2010


Author: ribasushi
Date: 2010-03-07 22:42:04 +0000 (Sun, 07 Mar 2010)
New Revision: 8935

Modified:
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/Changes
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/Makefile.PL
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract/Test.pm
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/04modifiers.t
   SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/05in_between.t
Log:
 r8568 at Thesaurus (orig r8555):  ribasushi | 2010-02-05 17:31:39 +0100
 Release 1.61
 r8836 at Thesaurus (orig r8823):  rabbit | 2010-02-27 00:25:14 +0100
 Lose a couple of oddball dependencies (while moronizing the tests a bit)
 r8837 at Thesaurus (orig r8824):  rabbit | 2010-02-27 00:34:45 +0100
 Slightly change the license wording (to satisfy the M::I license guesser) while keeping the former verbosity
 r8902 at Thesaurus (orig r8889):  semifor | 2010-03-05 17:53:59 +0100
 fixed open outer parens in a multi-line literal
 
 r8947 at Thesaurus (orig r8934):  rabbit | 2010-03-07 22:51:20 +0100
 Factor out insert returning generator



Property changes on: SQL-Abstract/1.x/branches/arbitrary_op_nesting
___________________________________________________________________
Modified: svk:merge
   - b9bda2dc-4395-4011-945f-8c81d782bde1:/branches/matthewt:18
b9bda2dc-4395-4011-945f-8c81d782bde1:/trunk:23
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/and_or:6008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/bool_operator:7524
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/special_op_handling:6158
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/test_refactor:8533
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/trunk:8538
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/SQL-Abstract:3093
   + b9bda2dc-4395-4011-945f-8c81d782bde1:/branches/matthewt:18
b9bda2dc-4395-4011-945f-8c81d782bde1:/trunk:23
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/and_or:6008
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/bool_operator:7524
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/special_op_handling:6158
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/branches/test_refactor:8533
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/SQL-Abstract/1.x/trunk:8934
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/SQL-Abstract:3093

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/Changes
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/Changes	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/Changes	2010-03-07 22:42:04 UTC (rev 8935)
@@ -1,5 +1,9 @@
 Revision history for SQL::Abstract
 
+    - fixed open outer parens for a multi-line literal
+
+revision 1.61  2010-02-05 16:28 (UTC)
+----------------------------
     - Allow INSERT to take additional attributes
     - Support for INSERT ... RETURNING
     - Another iteration of SQL::Abstract::Test fixes and improvements

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/Makefile.PL
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/Makefile.PL	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/Makefile.PL	2010-03-07 22:42:04 UTC (rev 8935)
@@ -10,15 +10,14 @@
 
 all_from 'lib/SQL/Abstract.pm';
 
-requires "List::Util"   => 0;
-requires "Scalar::Util" => 0;
+requires 'List::Util'   => 0;
+requires 'Scalar::Util' => 0;
+requires 'Storable'     => 0;
 
 test_requires "Test::Builder"   => 0;
-test_requires "Test::Deep"      => 0;
 test_requires "Test::More"      => 0;
 test_requires "Test::Exception" => 0;
 test_requires "Test::Warn"      => 0;
-test_requires "Clone"           => 0.31;
 
 tests_recursive 't';
 

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract/Test.pm
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract/Test.pm	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract/Test.pm	2010-03-07 22:42:04 UTC (rev 8935)
@@ -6,7 +6,6 @@
 use Data::Dumper;
 use Carp;
 use Test::Builder;
-use Test::Deep qw(eq_deeply);
 
 our @EXPORT_OK = qw/&is_same_sql_bind &is_same_sql &is_same_bind
                     &eq_sql_bind &eq_sql &eq_bind 
@@ -177,7 +176,10 @@
 sub eq_bind {
   my ($bind_ref1, $bind_ref2) = @_;
 
-  return eq_deeply($bind_ref1, $bind_ref2);
+  local $Data::Dumper::Useqq = 1;
+  local $Data::Dumper::Sortkeys = 1;
+
+  return Dumper($bind_ref1) eq Dumper($bind_ref2);
 }
 
 sub eq_sql {

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/lib/SQL/Abstract.pm	2010-03-07 22:42:04 UTC (rev 8935)
@@ -15,7 +15,7 @@
 # GLOBALS
 #======================================================================
 
-our $VERSION  = '1.60';
+our $VERSION  = '1.61';
 
 # This would confuse some packagers
 #$VERSION      = eval $VERSION; # numify for warning-free dev releases
@@ -118,18 +118,24 @@
   my ($sql, @bind) = $self->$method($data);
   $sql = join " ", $self->_sqlcase('insert into'), $table, $sql;
 
-  if (my $fields = $options->{returning}) {
-    my $f = $self->_SWITCH_refkind($fields, {
-      ARRAYREF     => sub {join ', ', map { $self->_quote($_) } @$fields;},
-      SCALAR       => sub {$self->_quote($fields)},
-      SCALARREF    => sub {$$fields},
-    });
-    $sql .= join " ", $self->_sqlcase(' returning'), $f;
+  if (my $ret = $options->{returning}) {
+    $sql .= $self->_insert_returning ($ret);
   }
 
   return wantarray ? ($sql, @bind) : $sql;
 }
 
+sub _insert_returning {
+  my ($self, $fields) = @_;
+
+  my $f = $self->_SWITCH_refkind($fields, {
+    ARRAYREF     => sub {join ', ', map { $self->_quote($_) } @$fields;},
+    SCALAR       => sub {$self->_quote($fields)},
+    SCALARREF    => sub {$$fields},
+  });
+  return join (' ', $self->_sqlcase(' returning'), $f);
+}
+
 sub _insert_HASHREF { # explicit list of fields and then values
   my ($self, $data) = @_;
 
@@ -928,7 +934,7 @@
 # adding them back in the corresponding method
 sub _open_outer_paren {
   my ($self, $sql) = @_;
-  $sql = $1 while $sql =~ /^ \s* \( (.*) \) \s* $/x;
+  $sql = $1 while $sql =~ /^ \s* \( (.*) \) \s* $/xs;
   return $sql;
 }
 
@@ -2685,9 +2691,9 @@
 
 =head1 LICENSE
 
-This module is free software; you may copy this under the terms of
-the GNU General Public License, or the Artistic License, copies of
-which should have accompanied your Perl kit.
+This module is free software; you may copy this under the same
+terms as perl itself (either the GNU General Public License or
+the Artistic License)
 
 =cut
 

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/04modifiers.t
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/04modifiers.t	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/04modifiers.t	2010-03-07 22:42:04 UTC (rev 8935)
@@ -7,8 +7,8 @@
 use SQL::Abstract::Test import => ['is_same_sql_bind'];
 
 use Data::Dumper;
+use Storable qw/dclone/;
 use SQL::Abstract;
-use Clone;
 
 =begin
 Test -and -or and -nest modifiers, assuming the following:
@@ -384,7 +384,7 @@
     local $SIG{__WARN__} = sub { push @w, @_ };
 
     my $sql = SQL::Abstract->new ($case->{args} || {});
-    my $where_copy = Clone::clone ($case->{where});
+    my $where_copy = dclone($case->{where});
 
     lives_ok (sub { 
       my ($stmt, @bind) = $sql->where($case->{where});

Modified: SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/05in_between.t
===================================================================
--- SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/05in_between.t	2010-03-07 21:51:20 UTC (rev 8934)
+++ SQL-Abstract/1.x/branches/arbitrary_op_nesting/t/05in_between.t	2010-03-07 22:42:04 UTC (rev 8935)
@@ -115,6 +115,16 @@
   {
     parenthesis_significant => 1,
     where => {
+      status => { -in => \"(SELECT status_codes\nFROM states)" },
+    },
+    # failed to open outer parens on a multi-line query in 1.61 (semifor)
+    stmt => " WHERE ( status IN ( SELECT status_codes FROM states )) ",
+    bind => [],
+    test => '-in multi-line subquery test',
+  },
+  {
+    parenthesis_significant => 1,
+    where => {
       customer => { -in => \[
         'SELECT cust_id FROM cust WHERE balance > ?',
         2000,




More information about the Bast-commits mailing list