Skip Menu |

This queue is for tickets about the SQL-Abstract CPAN distribution.

Report information
The Basics
Id: 103219
Status: resolved
Priority: 0/
Queue: SQL-Abstract

People
Owner: Nobody in particular
Requestors: fabrizio.ge [...] tiscali.it
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.82



Subject: [PATCH] SQL::Abstract: ORDER BY clause with with placeholders and bind values
Date: Tue, 31 Mar 2015 10:07:25 +0200
To: <bug-SQL-Abstract [...] rt.cpan.org>
From: fabrizio.ge [...] tiscali.it
Hello, I'd like to generate some SQL like: WHERE age >= 25 ORDER BY dept_id = ? DESC, name ASC The intention is, for example, to have all records with dept_id=10 on top (so the boolean expression dept_id=10 has value 1), then the others. I could not do it with SQL::Abstract without patching it: the patch is attached. This is the code my $a = SQL::Abstract->new; my $id=10; my ($b,@bind)=$a->where({age => {">=", 25 }}, [ { -desc => ["dept_id=?" => ($id)] }, { -asc => 'name' } ]); print $b . "n" . qq(@bind) . "n" With the patch, @bind is (25, 10), the desired result. Without the patch it is (25). Using Perl v5.14.2 and SQL::Abstract 1.72, but the patch also applies to the latest Git. Could you please apply the patch? Or specify a different solution not involving patching the code? Regards, Fabrizio Connetti gratis il mondo con la nuova indoona: hai la chat, le chiamate, le video chiamate e persino le chiamate di gruppo. E chiami gratis anche i numeri fissi e mobili nel mondo! Scarica subito l’app Vai su https://www.indoona.com/

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #103219] [PATCH] SQL::Abstract: ORDER BY clause with with placeholders and bind values
Date: Tue, 31 Mar 2015 11:31:17 +0200
To: bug-SQL-Abstract [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
Hi! Thank you for the patch, even though there is a very similar work already pending in https://github.com/dbsrgits/sql-abstract/commits/where-order-bind There are a couple other issues preventing release at this time, I will do my best to get them sorted out in the next couple days. Please remind me about this if you don't see an SQL::Abstract before this Friday. Cheers
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #103219] [PATCH] SQL::Abstract: ORDER BY clause with with placeholders and bind values
Date: Tue, 31 Mar 2015 12:16:38 +0200
To: bug-SQL-Abstract [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
"fabrizio.ge@tiscali.it via RT" <bug-SQL-Abstract@rt.cpan.org> writes: Show quoted text
> Hello, > I'd like to generate some SQL like: > > WHERE age >= 25 > ORDER BY > dept_id = ? DESC, name ASC > > The intention is, for example, to have all > records with dept_id=10 on top (so the boolean expression dept_id=10 has > value 1), then the others.
[…] Show quoted text
> With the patch, @bind is (25, 10), > the desired result. > Without the patch it is (25). > > Using Perl v5.14.2 > and SQL::Abstract 1.72, but the patch also applies to the latest > Git. > > Could you please apply the patch? Or specify a different solution > not involving patching the code?
There is already a patch in git, but it's not in master yet: https://github.com/dbsrgits/sql-abstract/commit/where-order-bind This should be in the next release of SQL-Abstract. -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen
On 2015-03-31 11:16:54, ilmari@ilmari.org wrote: Show quoted text
> > There is already a patch in git, but it's not in master yet: > > https://github.com/dbsrgits/sql-abstract/commit/where-order-bind > > This should be in the next release of SQL-Abstract.
This was in 1.82, released 2017-03-20. - ilmari