[ic] A fix for Vend/SQL_Parser.pm
Mike Heins
mike at perusion.com
Wed Aug 10 10:38:36 EDT 2005
Quoting Lars Tode (lars.tode at bpanet.de):
> Dear Interchange Developer Team.
>
> I got a problem with the package Vend::SQL_Parser (version 2.10).
>
> The following SQL - Statement produces some error messages in the
> catalog error log :
>
> SQL : select DISTINCT( Gruppe ),Gruppenummer from products WHERE
> aktiv='1' and Sonderposten != 'S' ORDER BY Gruppe;
>
> Log message :
> > shop /cgi-bin/shop/display.html SQL query failed: Bad column name
> (from DISTINCT( Gruppe )): 'DISTINCT( Gruppe )' at
> /www/shop/icserver/lib/Vend/SQL_Parser.pm line 839.
> >
>
> It seems that the distinct check can not handle brackets at the moment
> (\s does not include brackets):
> $self->{distinct} = 1 if $raw =~ s/^distinct\s+//i;
>
> The problem could be solved with the modification followed:
>
> if ($raw =~ s/^distinct[\s(]+//i) {
> $self->{distinct} = 1;
> # delete last bracket if exists
> $raw =~ s/[\s\)]+$//i
> }
>
As long as it is understood we don't handle that idiom -- it would be no
different than select DISTINCT Gruppe,Gruppenummer -- I think we can
do this.
If you are passing this to a real SQL interpreter and using this
to find the table for that, you can use base=real_table to prevent
having to route it through our cheesy little SQL parser.
Thanks for the suggestion. It is in CVS.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
Software axiom: Lack of speed kills.
More information about the interchange-users
mailing list