Skip Menu |

This queue is for tickets about the Tangram CPAN distribution.

Report information
The Basics
Id: 22525
Status: resolved
Priority: 0/
Queue: Tangram

People
Owner: Nobody in particular
Requestors: nomad [...] null.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.10
Fixed in: (no value)



Subject: Tangram fails to quote SQL "IN" items
Using the &in method as part of a criteria: my @objs = $st->select($remote, ($criteria) & (($remote->{lang}->in(@langs)) | ($remote->{src} == 1)) ); Produces the following SQL fragment: WHERE (t2.node = 6 AND (t2.lang IN (en, de, fr) OR t2.src = 1)) Which fails (on MySQL at least) with the following error: DBD::mysql::st execute failed: Unknown column 'en' in 'where clause' at /usr/share/perl5/Tangram/Cursor.pm line 185. because the items to match against are not quoted. I think Tangram (Expr?) needs to check the type of the column and quote the element if it is a string type.
I've had a quick go at fixing this - please test... if you could produce a test script that would be even better :-) Sam. On Mon Oct 23 18:58:28 2006, MLAWREN wrote: Show quoted text
> Using the &in method as part of a criteria: > > my @objs = $st->select($remote, ($criteria) & > (($remote->{lang}->in(@langs)) | ($remote->{src} == 1)) > ); > > Produces the following SQL fragment: > > WHERE > (t2.node = 6 AND (t2.lang IN (en, de, fr) OR t2.src = 1)) > > Which fails (on MySQL at least) with the following error: > > DBD::mysql::st execute failed: Unknown column 'en' in 'where clause' > at /usr/share/perl5/Tangram/Cursor.pm line 185. > > because the items to match against are not quoted. I think Tangram > (Expr?) needs to check the type of the column and quote the element if > it is a string type.
On Thu Oct 26 02:15:33 2006, SAMV wrote: Show quoted text
> I've had a quick go at fixing this - please test... if you could produce > a test script that would be even better :-) >
The actual change is at http://www.utsl.gen.nz/gitweb/?p=Tangram;a=commitdiff;h=f06f33;hp=b93070
Subject: Re: [rt.cpan.org #22525] Tangram fails to quote SQL "IN" items
Date: Sat, 28 Oct 2006 00:06:18 +0200 (CEST)
To: via RT <bug-Tangram [...] rt.cpan.org>
From: Mark Lawrence <nomad [...] null.net>
On Thu, 26 Oct 2006, via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=22525 > > > I've had a quick go at fixing this - please test... if you could produce > a test script that would be even better :-)
I would be happy to generate a test script, but to be honest I'm not sure where. The various directories in "t/" don't seem to jump out at me as the obvious place to put it. If you give me a file name I'll write the test! Mark. -- Mark Lawrence