Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.49_04



Subject: -between generates bad SQL
use strict; use warnings; use SQL::Abstract; use JSON qw/to_json/; say(to_json [SQL::Abstract->new()->where( { a => { -between => [1,2] }, c => 'b', } )] ); makes [" WHERE ( a BETWEEN ? AND ? AND c = ? )",1,2,"b"] but, I needs [" WHERE ( ( a BETWEEN ? AND ? ) AND c = ? )",1,2,"b"] follow is a patch --- lib/SQL/Abstract.pm.org 2008-10-15 19:21:25.000000000 +0900 +++ lib/SQL/Abstract.pm 2008-10-15 19:40:51.000000000 +0900 @@ -692,8 +692,8 @@ $self->_debug("HASH($f => $x) uses special operator: [ $u ]"); if ($u =~ /between/i) { # SQL sucks - push @sqlf, join ' ', $self->_convert($label), $u, $self->_convert('?'), - $self->_sqlcase('and'), $self->_convert('?'); + push @sqlf, join ' ', '(', $self->_convert($label), $u, $self->_convert('?'), + $self->_sqlcase('and'), $self->_convert('?'), ')'; } else { push @sqlf, join ' ', $self->_convert($label), $u, '(', join(', ', map { $self->_convert('?') } @$x),
Subject: Re: [rt.cpan.org #40083] -between generates bad SQL
Date: Wed, 12 Nov 2008 21:06:10 +0000
To: Tokuhiro Matsuno via RT <bug-SQL-Abstract [...] rt.cpan.org>
From: Matt S Trout <mst [...] shadowcat.co.uk>
On Wed, Oct 15, 2008 at 10:49:18PM -0400, Tokuhiro Matsuno via RT wrote: Show quoted text
> Wed Oct 15 22:49:16 2008: Request 40083 was acted upon. > Transaction: Ticket created by TOKUHIROM > Queue: SQL-Abstract > Subject: -between generates bad SQL > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: tokuhirom+cpan@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=40083 > > > > use strict; > use warnings; > use SQL::Abstract; > use JSON qw/to_json/; > say(to_json [SQL::Abstract->new()->where( > { > a => { -between => [1,2] }, > c => 'b', > } > )] ); > > makes > > [" WHERE ( a BETWEEN ? AND ? AND c = ? )",1,2,"b"] > > but, I needs > > [" WHERE ( ( a BETWEEN ? AND ? ) AND c = ? )",1,2,"b"] > > follow is a patch
Please patch against http://dev.catalyst.perl.org/repos/bast/SQL-Abstract/1.x/branches/1.50_RC also, please include a test that fails without your patch and passes with. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
From: norbi [...] nix.hu
On Wed Nov 12 16:06:33 2008, mst@shadowcat.co.uk wrote: Show quoted text
I tried to reproduce the bug on the above branch, but it seems that it is already fixed there. norbi