Subject: | Tangram %% filter bug |
Date: | Mon, 03 Sep 2007 14:51:14 +0100 |
To: | bug-Tangram [...] rt.cpan.org |
From: | Peter Black <ptb [...] state51.co.uk> |
Tangram::Relational::PolySelectTemplate::instantiate
( Tangram::Relational::Engine::instantiate in previous versions of
tangram ) causes an extra % to be introduced in filters by substituting
single %'s with double %%. I believe this is incorrect behaviour in
MySQL.
e.g.
my $filter = ($remote->{title} eq ('101% / Threpton'));
used in a tangram select generates a MySQL query of:
SELECT
t2.id
# ...
FROM
state51__Base t2,
state51__ReportAsset t3
WHERE
t2.id = t3.id AND
(t3.title = '101%% / Threpton');
rather than the expected:
SELECT
t2.id
# ...
FROM
state51__Base t2,
state51__ReportAsset t3
WHERE
t2.id = t3.id AND
(t3.title = '101% / Threpton');
Removing the %% substitution from PolySelectTemplate.pm generates the
correct sql query.
diff PolySelectTemplate.pm PolySelectTemplate.pm.fix
32d31
< $xwhere[0] =~ s[%][%%]g;
Does this suggested fix appear sensible, or should this be a MySQL only
fix? Thanks!
Peter Black