my $sql_alias = (ref $s) eq 'HASH' ? $s->{-as} : undef;
push @sel, {
+ arg => $s,
sql => $sql_sel,
unquoted_sql => do {
local $self->{quote_char};
}
else {
push @{$sel->{inner}}, $node->{sql};
- push @{$sel->{outer}}, $self->_quote ($node->{as});
+ push @{$sel->{outer}}, $self->_quote (ref $node->{arg} ? $node->{as} : $node->{arg});
}
}
is_same_sql_bind (
$rs->as_query,
'(
- SELECT artistid, name, rank, charfield, parentid
+ SELECT me.artistid, me.name, me.rank, me.charfield, me.parentid
FROM (
SELECT me.artistid, me.name, me.rank, me.charfield, me.parentid
FROM artist me
'(
SELECT COUNT( * )
FROM (
- SELECT artistid
+ SELECT me.artistid
FROM (
SELECT me.artistid
FROM artist me
my $rs = $books_45_and_owners->search ({}, {order_by => $null_order });
is_same_sql_bind(
$rs->as_query,
- '(SELECT id, source, owner, price, owner__id, owner__name
+ '(SELECT me.id, me.source, me.owner, me.price, owner__id, owner__name
FROM (
SELECT me.id, me.source, me.owner, me.price, owner.id AS owner__id, owner.name AS owner__name
FROM books me
is_same_sql_bind(
$books_45_and_owners->search ({}, {order_by => $ord_set->{order_by}})->as_query,
- "(SELECT id, source, owner, price, owner__id, owner__name
+ "(SELECT me.id, me.source, me.owner, me.price, owner__id, owner__name
FROM (
- SELECT id, source, owner, price, owner__id, owner__name$o_sel
+ SELECT me.id, me.source, me.owner, me.price, owner__id, owner__name$o_sel
FROM (
SELECT me.id, me.source, me.owner, me.price, owner.id AS owner__id, owner.name AS owner__name$i_sel
FROM books me
$books_45_and_owners->search ({}, { group_by => 'title', order_by => 'title' })->as_query,
'(SELECT me.id, me.source, me.owner, me.price, owner.id, owner.name
FROM (
- SELECT id, source, owner, price, ORDER__BY__1 AS title
+ SELECT me.id, me.source, me.owner, me.price, ORDER__BY__1 AS title
FROM (
- SELECT id, source, owner, price, ORDER__BY__1
+ SELECT me.id, me.source, me.owner, me.price, ORDER__BY__1
FROM (
SELECT me.id, me.source, me.owner, me.price, title AS ORDER__BY__1
FROM books me
is_same_sql_bind(
$rs->as_query,
'(
- SELECT id, source, owner, title, price,
+ SELECT me.id, me.source, me.owner, me.title, me.price,
owner_name
FROM (
SELECT me.id, me.source, me.owner, me.title, me.price,
is_same_sql_bind(
$rs->as_query,
'(
- SELECT "id", "source", "owner", "title", "price",
+ SELECT "me"."id", "me"."source", "me"."owner", "me"."title", "me"."price",
"owner__name"
FROM (
SELECT "me"."id", "me"."source", "me"."owner", "me"."title", "me"."price",
is_same_sql_bind(
$rs_selectas_col->as_query,
'(
- SELECT id, source, owner, title, price,
+ SELECT me.id, me.source, me.owner, me.title, me.price,
owner__name
FROM (
- SELECT id, source, owner, title, price,
+ SELECT me.id, me.source, me.owner, me.title, me.price,
owner__name,
ROW_NUMBER() OVER( ) AS rno__row__index
FROM (
is_same_sql_bind(
$rs_selectas_rel->as_query,
'(
- SELECT [id], [source], [owner], [title], [price],
+ SELECT [me].[id], [me].[source], [me].[owner], [me].[title], [me].[price],
[owner_name]
FROM (
- SELECT [id], [source], [owner], [title], [price],
+ SELECT [me].[id], [me].[source], [me].[owner], [me].[title], [me].[price],
[owner_name],
ROW_NUMBER() OVER( ) AS [rno__row__index]
FROM (
is_same_sql_bind(
$rs_selectas_rel->as_query,
'(
- SELECT [id], [owner] FROM (
- SELECT [id], [owner], ROW_NUMBER() OVER( ) AS [rno__row__index] FROM (
+ SELECT [me].[id], [me].[owner] FROM (
+ SELECT [me].[id], [me].[owner], ROW_NUMBER() OVER( ) AS [rno__row__index] FROM (
SELECT [me].[id], [me].[owner]
FROM [books] [me]
WHERE ( ( (EXISTS (
is_same_sql_bind(
$rs_selectas_rel->as_query,
'(
- SELECT id, owner FROM (
+ SELECT me.id, me.owner FROM (
SELECT me.id, me.owner FROM books me WHERE ( ( (EXISTS (SELECT COUNT( * ) FROM owners owner WHERE ( books.owner = owner.id ))) AND source = ? ) )
) me
WHERE ROWNUM <= ?
is_same_sql_bind(
$rs->as_query,
'(SELECT TOP 2
- id, source, owner, price, owner__id, owner__name
+ me.id, me.source, me.owner, me.price, owner__id, owner__name
FROM (
SELECT TOP 5
me.id, me.source, me.owner, me.price, owner.id AS owner__id, owner.name AS owner__name
is_same_sql_bind(
$books_45_and_owners->search ({}, {order_by => $ord_set->{order_by}})->as_query,
- "(SELECT id, source, owner, price, owner__id, owner__name
+ "(SELECT me.id, me.source, me.owner, me.price, owner__id, owner__name
FROM (
SELECT TOP 2
- id, source, owner, price, owner__id, owner__name$o_sel
+ me.id, me.source, me.owner, me.price, owner__id, owner__name$o_sel
FROM (
SELECT TOP 5
me.id, me.source, me.owner, me.price, owner.id AS owner__id, owner.name AS owner__name$i_sel
$books_45_and_owners->search ({}, { group_by => 'title', order_by => 'title' })->as_query,
'(SELECT me.id, me.source, me.owner, me.price, owner.id, owner.name
FROM (
- SELECT id, source, owner, price, ORDER__BY__1 AS title
+ SELECT me.id, me.source, me.owner, me.price, ORDER__BY__1 AS title
FROM (
SELECT TOP 2
- id, source, owner, price, ORDER__BY__1
+ me.id, me.source, me.owner, me.price, ORDER__BY__1
FROM (
SELECT TOP 5
me.id, me.source, me.owner, me.price, title AS ORDER__BY__1