[interchange-cvs] interchange - heins modified lib/Vend/SQL_Parser.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Aug 10 10:38:31 EDT 2005


User:      heins
Date:      2005-08-10 14:38:30 GMT
Modified:  lib/Vend SQL_Parser.pm
Log:
* Refine handling of DISTINCT to allow parens -- patch by Lars Tode
  <lars.tode at bpanet.de>.

Revision  Changes    Path
2.11      +7 -3      interchange/lib/Vend/SQL_Parser.pm


rev 2.11, prev_rev 2.10
Index: SQL_Parser.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/SQL_Parser.pm,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -r2.10 -r2.11
--- SQL_Parser.pm	30 Apr 2005 15:09:58 -0000	2.10
+++ SQL_Parser.pm	10 Aug 2005 14:38:30 -0000	2.11
@@ -1,6 +1,6 @@
 # Vend::SQL_Parser - Interchange SQL parser class
 #
-# $Id: SQL_Parser.pm,v 2.10 2005/04/30 15:09:58 mheins Exp $
+# $Id: SQL_Parser.pm,v 2.11 2005/08/10 14:38:30 mheins Exp $
 #
 # Copyright (C) 2003-2004 Interchange Development Group
 #
@@ -38,7 +38,7 @@
 use Text::ParseWords;
 use vars qw($VERSION);
 no warnings qw(uninitialized numeric);
-$VERSION = substr(q$Revision: 2.10 $, 10);
+$VERSION = substr(q$Revision: 2.11 $, 10);
 
 sub new {
 	my $class = shift;
@@ -814,7 +814,11 @@
 		}
 	}
 	elsif($raw =~ /\s/) {
-		$self->{distinct} = 1 if $raw =~ s/^distinct\s+//i;
+		if ($raw =~ s/^distinct[\s(]+//i) {
+		      $self->{distinct} = 1;
+		      # delete last bracket if exists
+		      $raw =~ s/[\s\)]+$//i;
+		}
 		my $title;
 		$title = $1 if $raw =~ s/\s+as\s+(.*)//;
 		if($title) {








More information about the interchange-cvs mailing list