[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] A fix for Vend/SQL_Parser.pm


Quoting Lars Tode (suppressed):
> 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 <suppressed>

Software axiom: Lack of speed kills.
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.