[Bast-commits] r9665 - in SQL-Abstract/1.x/branches/sqla-tree: lib/SQL/Abstract t

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Wed Sep 1 03:55:49 GMT 2010


Author: frew
Date: 2010-09-01 04:55:49 +0100 (Wed, 01 Sep 2010)
New Revision: 9665

Modified:
   SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm
   SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t
Log:
add format command

Modified: SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm
===================================================================
--- SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm	2010-08-31 04:13:04 UTC (rev 9664)
+++ SQL-Abstract/1.x/branches/sqla-tree/lib/SQL/Abstract/Tree.pm	2010-09-01 03:55:49 UTC (rev 9665)
@@ -182,10 +182,11 @@
     return join (" $tree->[0] ", map {unparse($_)} @{$tree->[1]});
   }
   else {
-    return sprintf "%s %s\n", $tree->[0], unparse ($tree->[1]);
+    return sprintf '%s %s', $tree->[0], unparse ($tree->[1]);
   }
 }
 
+sub format { unparse(parse(@_)) }
 
 1;
 

Modified: SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t
===================================================================
--- SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t	2010-08-31 04:13:04 UTC (rev 9664)
+++ SQL-Abstract/1.x/branches/sqla-tree/t/11unparse.t	2010-09-01 03:55:49 UTC (rev 9665)
@@ -8,7 +8,7 @@
    FROM foo WHERE foo.a =1 and foo.b LIKE 'station'";
 
    print "$sql\n";
-   print SQL::Abstract::Tree::unparse(SQL::Abstract::Tree::parse($sql)) . "\n";
+   print SQL::Abstract::Tree::format($sql) . "\n";
 }
 
 {
@@ -16,7 +16,7 @@
    FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'";
 
    print "$sql\n";
-   print SQL::Abstract::Tree::unparse(SQL::Abstract::Tree::parse($sql)) . "\n";
+   print SQL::Abstract::Tree::format($sql) . "\n";
 }
 
 # stuff we want:




More information about the Bast-commits mailing list