Hi,
Sorry, I had to check the SQL::Abstract version first... 1.72 has been
used...
with 1.73 everything works perfectly ( as expected ) although the example
with -ident below doesn't work ( and it's correct ).
just test cases to confirm:
$join = $sqla->join(qw/ left requestor=submitter right/);
is_same_sql_bind(
$join->{sql}, $join->{bind},
"left INNER JOIN right ON left.requestor = right.submitter", [],
);
ok
$join = $sqla->join('left', {operator => '<=>', condition =>
{'left.requestor' => {-ident => 'right.submitter'}}}, 'right');
is_same_sql_bind(
$join->{sql}, $join->{bind},
"left INNER JOIN right ON left.requestor = right.submitter", [],
);
ok
$join = $sqla->join('left', {operator => '<=>', condition =>
{'left.requestor' => {'=' => {-ident => 'right.submitter'}}}}, 'right');
is_same_sql_bind(
$join->{sql}, $join->{bind},
"left INNER JOIN right ON left.requestor = right.submitter", [],
);
ok
$join = $sqla->join('left', {'left.requestor' => {-ident =>
'right.submitter'}}, 'right');
is_same_sql_bind(
$join->{sql}, $join->{bind},
"left INNER JOIN right ON left.requestor = right.submitter", [],
);
failed
- Thanks
On Wed, Nov 21, 2012 at 10:37 AM, laurent.dami@free.fr via RT <
bug-SQL-Abstract-More@rt.cpan.org> wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=81305 >
>
> Le 20.11.2012 21:49, to.code.perl via RT a écrit :
> > Tue Nov 20 15:49:07 2012: Request 81305 was acted upon.
> > Transaction: Ticket created by to.code.perl@gmail.com
> > Queue: SQL-Abstract-More
> > Subject: (No subject given)
> > Broken in: (no value)
> > Severity: (no value)
> > Owner: Nobody
> > Requestors: to.code.perl@gmail.com
> > Status: new
> > Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=81305 >
> >
> >
> > Hello,
> >
> > SQL::Abstract::More is an extension of SQL::Abstract and it would be
> great
> > if it takes into account some deprecated usage, e.g.:
> >
> >
>
https://metacpan.org/module/SQL::Abstract#Deprecated-usage-of-Literal-SQL
> >
> > my %where = ( requestor => \'= submitter' )
> >
> > $stmt = "WHERE requestor = submitter"
> >
> > This used to be the only way to compare columns. Use the superior
> "-ident"
> > method for all new code. For example an identifier declared in such a way
> > will be properly quoted if "quote_char" is properly set, while the legacy
> > form will remain as supplied.
> >
> >
> >
> > same \'= usage is suggested in
> >
https://metacpan.org/module/SQL::Abstract::More#Join-specifications (
> > "operator and condition" part ) but it doesn't support "-ident" method
> >
> >
> Hi,
>
> OK, thanks for the suggestion. I changed the internal translation, see
>
https://github.com/damil/SQL-Abstract-More .
>
> However, this stuff is only used internally, while translating user
> input into plain SQL::Abstract syntax, so it will not change anything
> for end users.
> User input is usually based on plain strings, i.e.
>
> $sqla->join(qw/ left requestor=submitter right/)
>
> or it was already possible to use the -ident syntax, as in
>
> $sqla->join('left', {'left.requestor' => {-ident =>
> 'right.submitter'}}, 'right')
>
> so apart from being an internal cleanup, I don't really see the point of
> this ticket. Did you have any special use case in mind ?
>
> Best regards, Laurent Dami
>
>