[ic] A fix for Vend/SQL_Parser.pm

Lars Tode lars.tode at bpanet.de
Wed Aug 10 09:44:13 EDT 2005

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



More information about the interchange-users mailing list