my @final;
while (@select) {
my $e = shift @select;
- my $res = push @final, +{ expr => $e->{expr} };
+ push @final, my $res = { expr => $e->{expr} };
if (ref($select[0]) eq 'LIES::AS') {
- $res->{name} = identifier(shift @select);
+ $res->{name} = identifier(${shift @select});
}
}
# will need rewriting to fix it - commit bits available if you do it first
[ "SELECT foo , ?", binding(1) ],
"Identifier and literal";
+
+expr_sql_is { SELECT { $_->foo => AS("foom"), 1 } }
+ [ "SELECT foo AS foom , ?", binding(1) ],
+ "AS with parens";
+
+expr_sql_is { SELECT { $_->foo => AS "foom", 1 } }
+ [ "SELECT foo AS foom , ?", binding(1) ],
+ "AS without parens";