[Bast-commits] r4587 - SQL-Abstract/1.x/branches/cleanup
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Wed Jul 16 20:36:25 BST 2008
Author: matthewt
Date: 2008-07-16 20:36:25 +0100 (Wed, 16 Jul 2008)
New Revision: 4587
Modified:
SQL-Abstract/1.x/branches/cleanup/e.pl
Log:
aliasify
Modified: SQL-Abstract/1.x/branches/cleanup/e.pl
===================================================================
--- SQL-Abstract/1.x/branches/cleanup/e.pl 2008-07-16 18:56:05 UTC (rev 4586)
+++ SQL-Abstract/1.x/branches/cleanup/e.pl 2008-07-16 19:36:25 UTC (rev 4587)
@@ -60,6 +60,10 @@
map { _une($_) } $_[0]->();
}
+sub _aliasify {
+ map { ref($_) eq 'ARRAY' ? [ -alias, $_->[1], $_->[0] ] : $_ } @_
+}
+
sub expr (&) { _run_e(@_) }
sub _do {
my ($name, $code, @in) = @_;
@@ -67,11 +71,16 @@
}
sub _dolist {
my ($name, $code, @in) = @_;
- _do($name, sub { [ -list, map { _une($_) } $code->() ] }, @in);
+ _do($name,
+ sub { [ -list,
+ map { _une($_) }
+ _aliasify $code->()
+ ] },
+ @in);
}
sub ORDER_BY (&;@) { _do(-order_by, @_) }
sub SELECT (&;@) { _dolist('-select', @_); }
-sub JOIN (&;@) { _do('-join', @_) }
+sub JOIN (&;@) { _do('-join', _aliasify @_) }
sub WHERE (&;@) { _do(-where, @_) }
sub GROUP_BY (&;@) { _dolist(-group_by, @_); }
sub sum { E->new([ -sum, _une(shift) ]); }
More information about the Bast-commits
mailing list