db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/odmg/oql OQLLexerTokenTypes.java oql-ojb.g OQLLexerTokenTypes.txt OQLLexer.java OQLParser.java
Date Mon, 13 Oct 2003 16:46:31 GMT
brj         2003/10/13 09:46:31

  Modified:    src/java/org/apache/ojb/odmg/oql OQLLexerTokenTypes.java
                        oql-ojb.g OQLLexerTokenTypes.txt OQLLexer.java
                        OQLParser.java
  Log:
  added support for group by
  
  Revision  Changes    Path
  1.8       +25 -19    db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java
  
  Index: OQLLexerTokenTypes.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- OQLLexerTokenTypes.java	4 Aug 2003 06:06:25 -0000	1.7
  +++ OQLLexerTokenTypes.java	13 Oct 2003 16:46:29 -0000	1.8
  @@ -20,6 +20,11 @@
    */
   package org.apache.ojb.odmg.oql;
   
  +import org.apache.ojb.broker.query.*;
  +import org.apache.ojb.broker.metadata.*;
  +import org.apache.ojb.broker.*;
  +import java.util.*;
  +
   public interface OQLLexerTokenTypes {
   	int EOF = 1;
   	int NULL_TREE_LOOKAHEAD = 3;
  @@ -63,23 +68,24 @@
   	int LITERAL_where = 41;
   	int LITERAL_order = 42;
   	int LITERAL_by = 43;
  -	int LITERAL_prefetch = 44;
  -	int LITERAL_exists = 45;
  -	int LITERAL_in = 46;
  -	int LITERAL_asc = 47;
  -	int LITERAL_desc = 48;
  -	int LITERAL_or = 49;
  -	int LITERAL_and = 50;
  -	int LITERAL_nil = 51;
  -	int LITERAL_not = 52;
  -	int LITERAL_list = 53;
  -	int LITERAL_between = 54;
  -	int LITERAL_is_undefined = 55;
  -	int LITERAL_is_defined = 56;
  -	int LITERAL_like = 57;
  -	int LITERAL_true = 58;
  -	int LITERAL_false = 59;
  -	int LITERAL_date = 60;
  -	int LITERAL_time = 61;
  -	int LITERAL_timestamp = 62;
  +	int LITERAL_group = 44;
  +	int LITERAL_prefetch = 45;
  +	int LITERAL_exists = 46;
  +	int LITERAL_in = 47;
  +	int LITERAL_asc = 48;
  +	int LITERAL_desc = 49;
  +	int LITERAL_or = 50;
  +	int LITERAL_and = 51;
  +	int LITERAL_nil = 52;
  +	int LITERAL_not = 53;
  +	int LITERAL_list = 54;
  +	int LITERAL_between = 55;
  +	int LITERAL_is_undefined = 56;
  +	int LITERAL_is_defined = 57;
  +	int LITERAL_like = 58;
  +	int LITERAL_true = 59;
  +	int LITERAL_false = 60;
  +	int LITERAL_date = 61;
  +	int LITERAL_time = 62;
  +	int LITERAL_timestamp = 63;
   }
  
  
  
  1.21      +21 -3     db-ojb/src/java/org/apache/ojb/odmg/oql/oql-ojb.g
  
  Index: oql-ojb.g
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/oql-ojb.g,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- oql-ojb.g	4 Aug 2003 06:24:31 -0000	1.20
  +++ oql-ojb.g	13 Oct 2003 16:46:29 -0000	1.21
  @@ -394,8 +394,9 @@
                   }
               }
           }
  -        ( "order" "by" orderClause[query] )?
   
  +        ( "order" "by" orderClause[query] )?
  +        ( "group" "by" groupClause[query] )?
           ( "prefetch" prefetchClause[query] )?
   
       ;
  @@ -428,7 +429,7 @@
           {
               try {
                   clazz = Class.forName(id.getText(), true,
  -Thread.currentThread().getContextClassLoader());
  +				Thread.currentThread().getContextClassLoader());
               } catch (Exception e) {
               }
           }
  @@ -512,6 +513,23 @@
           }
       ;
   
  +groupClause[QueryByCriteria query] :
  +
  +        groupCriterion[query]
  +        (
  +            TOK_COMMA groupCriterion[query]
  +        )*
  +    ;
  +
  +groupCriterion[QueryByCriteria query] :
  +
  +	    id:Identifier
  +        {
  +            query.addGroupBy(id.getText());
  +        }
  +    ;
  +
  +
   // start prefetch
   
   prefetchClause[QueryByCriteria query] :
  @@ -808,4 +826,4 @@
   		{
   		if (!temp.isEmpty()) {coll = temp;}
   		}
  -    ;
  +    ;
  \ No newline at end of file
  
  
  
  1.3       +20 -19    db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt
  
  Index: OQLLexerTokenTypes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OQLLexerTokenTypes.txt	24 Jun 2003 21:43:06 -0000	1.2
  +++ OQLLexerTokenTypes.txt	13 Oct 2003 16:46:29 -0000	1.3
  @@ -40,22 +40,23 @@
   LITERAL_where="where"=41
   LITERAL_order="order"=42
   LITERAL_by="by"=43
  -LITERAL_prefetch="prefetch"=44
  -LITERAL_exists="exists"=45
  -LITERAL_in="in"=46
  -LITERAL_asc="asc"=47
  -LITERAL_desc="desc"=48
  -LITERAL_or="or"=49
  -LITERAL_and="and"=50
  -LITERAL_nil="nil"=51
  -LITERAL_not="not"=52
  -LITERAL_list="list"=53
  -LITERAL_between="between"=54
  -LITERAL_is_undefined="is_undefined"=55
  -LITERAL_is_defined="is_defined"=56
  -LITERAL_like="like"=57
  -LITERAL_true="true"=58
  -LITERAL_false="false"=59
  -LITERAL_date="date"=60
  -LITERAL_time="time"=61
  -LITERAL_timestamp="timestamp"=62
  +LITERAL_group="group"=44
  +LITERAL_prefetch="prefetch"=45
  +LITERAL_exists="exists"=46
  +LITERAL_in="in"=47
  +LITERAL_asc="asc"=48
  +LITERAL_desc="desc"=49
  +LITERAL_or="or"=50
  +LITERAL_and="and"=51
  +LITERAL_nil="nil"=52
  +LITERAL_not="not"=53
  +LITERAL_list="list"=54
  +LITERAL_between="between"=55
  +LITERAL_is_undefined="is_undefined"=56
  +LITERAL_is_defined="is_defined"=57
  +LITERAL_like="like"=58
  +LITERAL_true="true"=59
  +LITERAL_false="false"=60
  +LITERAL_date="date"=61
  +LITERAL_time="time"=62
  +LITERAL_timestamp="timestamp"=63
  
  
  
  1.12      +30 -19    db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexer.java
  
  Index: OQLLexer.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLLexer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- OQLLexer.java	4 Aug 2003 06:06:25 -0000	1.11
  +++ OQLLexer.java	13 Oct 2003 16:46:29 -0000	1.12
  @@ -20,24 +20,34 @@
    */
   package org.apache.ojb.odmg.oql;
   
  +import org.apache.ojb.broker.query.*;
  +import org.apache.ojb.broker.metadata.*;
  +import org.apache.ojb.broker.*;
  +import java.util.*;
  +
   import java.io.InputStream;
   import antlr.TokenStreamException;
   import antlr.TokenStreamIOException;
   import antlr.TokenStreamRecognitionException;
   import antlr.CharStreamException;
   import antlr.CharStreamIOException;
  +import antlr.ANTLRException;
   import java.io.Reader;
   import java.util.Hashtable;
  +import antlr.CharScanner;
   import antlr.InputBuffer;
   import antlr.ByteBuffer;
   import antlr.CharBuffer;
   import antlr.Token;
  +import antlr.CommonToken;
   import antlr.RecognitionException;
   import antlr.NoViableAltForCharException;
  +import antlr.MismatchedCharException;
   import antlr.TokenStream;
   import antlr.ANTLRHashString;
   import antlr.LexerSharedInputState;
   import antlr.collections.impl.BitSet;
  +import antlr.SemanticException;
   
   public class OQLLexer extends antlr.CharScanner implements OQLLexerTokenTypes, TokenStream
    {
  @@ -53,31 +63,32 @@
   public OQLLexer(LexerSharedInputState state) {
   	super(state);
   	literals = new Hashtable();
  -	literals.put(new ANTLRHashString("nil", this), new Integer(51));
  -	literals.put(new ANTLRHashString("between", this), new Integer(54));
  -	literals.put(new ANTLRHashString("date", this), new Integer(60));
  +	literals.put(new ANTLRHashString("nil", this), new Integer(52));
  +	literals.put(new ANTLRHashString("group", this), new Integer(44));
  +	literals.put(new ANTLRHashString("between", this), new Integer(55));
  +	literals.put(new ANTLRHashString("date", this), new Integer(61));
   	literals.put(new ANTLRHashString("select", this), new Integer(38));
  -	literals.put(new ANTLRHashString("timestamp", this), new Integer(62));
  -	literals.put(new ANTLRHashString("like", this), new Integer(57));
  -	literals.put(new ANTLRHashString("is_undefined", this), new Integer(55));
  -	literals.put(new ANTLRHashString("asc", this), new Integer(47));
  -	literals.put(new ANTLRHashString("or", this), new Integer(49));
  -	literals.put(new ANTLRHashString("in", this), new Integer(46));
  -	literals.put(new ANTLRHashString("list", this), new Integer(53));
  +	literals.put(new ANTLRHashString("timestamp", this), new Integer(63));
  +	literals.put(new ANTLRHashString("like", this), new Integer(58));
  +	literals.put(new ANTLRHashString("is_undefined", this), new Integer(56));
  +	literals.put(new ANTLRHashString("asc", this), new Integer(48));
  +	literals.put(new ANTLRHashString("or", this), new Integer(50));
  +	literals.put(new ANTLRHashString("in", this), new Integer(47));
  +	literals.put(new ANTLRHashString("list", this), new Integer(54));
   	literals.put(new ANTLRHashString("from", this), new Integer(40));
  -	literals.put(new ANTLRHashString("desc", this), new Integer(48));
  -	literals.put(new ANTLRHashString("true", this), new Integer(58));
  +	literals.put(new ANTLRHashString("desc", this), new Integer(49));
  +	literals.put(new ANTLRHashString("true", this), new Integer(59));
   	literals.put(new ANTLRHashString("by", this), new Integer(43));
  -	literals.put(new ANTLRHashString("not", this), new Integer(52));
  -	literals.put(new ANTLRHashString("and", this), new Integer(50));
  +	literals.put(new ANTLRHashString("not", this), new Integer(53));
  +	literals.put(new ANTLRHashString("and", this), new Integer(51));
   	literals.put(new ANTLRHashString("distinct", this), new Integer(39));
  -	literals.put(new ANTLRHashString("prefetch", this), new Integer(44));
  -	literals.put(new ANTLRHashString("false", this), new Integer(59));
  -	literals.put(new ANTLRHashString("time", this), new Integer(61));
  +	literals.put(new ANTLRHashString("prefetch", this), new Integer(45));
  +	literals.put(new ANTLRHashString("false", this), new Integer(60));
  +	literals.put(new ANTLRHashString("time", this), new Integer(62));
   	literals.put(new ANTLRHashString("order", this), new Integer(42));
   	literals.put(new ANTLRHashString("where", this), new Integer(41));
  -	literals.put(new ANTLRHashString("exists", this), new Integer(45));
  -	literals.put(new ANTLRHashString("is_defined", this), new Integer(56));
  +	literals.put(new ANTLRHashString("exists", this), new Integer(46));
  +	literals.put(new ANTLRHashString("is_defined", this), new Integer(57));
   caseSensitiveLiterals = true;
   setCaseSensitive(true);
   }
  
  
  
  1.19      +279 -204  db-ojb/src/java/org/apache/ojb/odmg/oql/OQLParser.java
  
  Index: OQLParser.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/OQLParser.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- OQLParser.java	10 Aug 2003 09:53:13 -0000	1.18
  +++ OQLParser.java	13 Oct 2003 16:46:29 -0000	1.19
  @@ -22,16 +22,25 @@
   
   import org.apache.ojb.broker.query.*;
   import org.apache.ojb.broker.metadata.*;
  +import org.apache.ojb.broker.*;
   import java.util.*;
   
   import antlr.TokenBuffer;
   import antlr.TokenStreamException;
  +import antlr.TokenStreamIOException;
  +import antlr.ANTLRException;
  +import antlr.LLkParser;
   import antlr.Token;
   import antlr.TokenStream;
   import antlr.RecognitionException;
   import antlr.NoViableAltException;
  +import antlr.MismatchedTokenException;
  +import antlr.SemanticException;
   import antlr.ParserSharedInputState;
   import antlr.collections.impl.BitSet;
  +import antlr.collections.AST;
  +import antlr.ASTPair;
  +import antlr.collections.impl.ASTArray;
   
   public class OQLParser extends antlr.LLkParser
          implements OQLLexerTokenTypes
  @@ -62,8 +71,8 @@
   
   	public final Query  buildQuery() throws RecognitionException, TokenStreamException {
   		Query query = null;
  -
  -
  +		
  +		
   		try {      // for error handling
   			query=selectQuery();
   			{
  @@ -75,7 +84,7 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   		}
   		catch (RecognitionException ex) {
  @@ -85,32 +94,32 @@
   		}
   		return query;
   	}
  -
  +	
   	public final QueryByCriteria  selectQuery() throws RecognitionException, TokenStreamException
{
   		QueryByCriteria query = null;
  -
  -
  +		
  +		
   		try {      // for error handling
  -
  +			
   			Class clazz = null;
   			Criteria criteria = new Criteria();
   			String[] projectionAttrs;
   			boolean distinct = false;
  -
  +			
   			match(LITERAL_select);
   			{
   			if ((LA(1)==LITERAL_distinct)) {
   				match(LITERAL_distinct);
  -
  +				
   				distinct = true;
  -
  +				
   			}
   			else if ((LA(1)==TOK_STAR||LA(1)==Identifier)) {
   			}
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			projectionAttrs=projectionAttributes();
   			match(LITERAL_from);
  @@ -125,9 +134,9 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
  -
  +			
   			if (clazz != null)
   			{
   			if (projectionAttrs[0].indexOf('.') < 0)
  @@ -136,15 +145,15 @@
   			}
   			else
   			{
  -            ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(clazz);
  +			ClassDescriptor cld = MetadataManager.getInstance().getRepository().getDescriptorFor(clazz);
   			for (int i = 0; i < projectionAttrs.length; i++)
   			{
   			projectionAttrs[i] = projectionAttrs[i].substring(projectionAttrs[i].indexOf('.') +
1);
   			}
  -
  +			
   			ArrayList descs = cld.getAttributeDescriptorsForPath(projectionAttrs[0]);
   			int pathLen = descs.size();
  -
  +			
   			if ((pathLen > 0) && (descs.get(pathLen - 1) instanceof ObjectReferenceDescriptor))
   			{
   			ObjectReferenceDescriptor ord =
  @@ -159,7 +168,7 @@
   			}
   			}
   			}
  -
  +			
   			{
   			if ((LA(1)==LITERAL_order)) {
   				match(LITERAL_order);
  @@ -171,7 +180,20 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
  +			}
  +			{
  +			if ((LA(1)==LITERAL_group)) {
  +				match(LITERAL_group);
  +				match(LITERAL_by);
  +				groupClause(query);
  +			}
  +			else if ((_tokenSet_3.member(LA(1)))) {
  +			}
  +			else {
  +				throw new NoViableAltException(LT(1), getFilename());
  +			}
  +			
   			}
   			{
   			if ((LA(1)==LITERAL_prefetch)) {
  @@ -183,59 +205,59 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_3);
  +			consumeUntil(_tokenSet_4);
   		}
   		return query;
   	}
  -
  +	
   	public final String[]  projectionAttributes() throws RecognitionException, TokenStreamException
{
   		String[] projectionAttrs = null;
  -
  +		
   		Token  id = null;
   		Token  id1 = null;
  -
  +		
   		try {      // for error handling
  -
  +			
   			String first = null;
   			ArrayList list = null;
  -
  +			
   			{
   			if ((LA(1)==Identifier)) {
   				id = LT(1);
   				match(Identifier);
   				{
  -
  +				
   				first = id.getText();
  -
  +				
   				}
   				{
  -				_loop79:
  +				_loop80:
   				do {
   					if ((LA(1)==TOK_COMMA)) {
   						match(TOK_COMMA);
   						id1 = LT(1);
   						match(Identifier);
   						{
  -
  +						
   						if (list == null)
   						{
   						list = new ArrayList();
   						list.add(first);
   						}
   						list.add(id1.getText());
  -
  +						
   						}
   					}
   					else {
  -						break _loop79;
  +						break _loop80;
   					}
  -
  +					
   				} while (true);
   				}
   			}
  @@ -245,9 +267,9 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
  -
  +			
   			if (list == null)
   			{
   			projectionAttrs = new String[] {first};
  @@ -256,74 +278,74 @@
   			{
   			projectionAttrs = (String[]) list.toArray(new String[list.size()]);
   			}
  -
  -
  +			
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_4);
  +			consumeUntil(_tokenSet_5);
   		}
   		return projectionAttrs;
   	}
  -
  +	
   	public final Class  fromClause() throws RecognitionException, TokenStreamException {
   		Class clazz = null;
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
   			id = LT(1);
   			match(Identifier);
  -
  +			
   			try {
   			clazz = Class.forName(id.getText(), true,
  -			Thread.currentThread().getContextClassLoader());
  +							Thread.currentThread().getContextClassLoader());
   			} catch (Exception e) {
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_5);
  +			consumeUntil(_tokenSet_6);
   		}
   		return clazz;
   	}
  -
  +	
   	public final void whereClause(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			orExpr(criteria);
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void orderClause(
   		QueryByCriteria query
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			sortCriterion(query);
   			{
  -			_loop82:
  +			_loop83:
   			do {
   				if ((LA(1)==TOK_COMMA)) {
   					match(TOK_COMMA);
   					sortCriterion(query);
   				}
   				else {
  -					break _loop82;
  +					break _loop83;
   				}
  -
  +				
   			} while (true);
   			}
   		}
  @@ -333,44 +355,72 @@
   			consumeUntil(_tokenSet_2);
   		}
   	}
  -
  +	
  +	public final void groupClause(
  +		QueryByCriteria query
  +	) throws RecognitionException, TokenStreamException {
  +		
  +		
  +		try {      // for error handling
  +			groupCriterion(query);
  +			{
  +			_loop89:
  +			do {
  +				if ((LA(1)==TOK_COMMA)) {
  +					match(TOK_COMMA);
  +					groupCriterion(query);
  +				}
  +				else {
  +					break _loop89;
  +				}
  +				
  +			} while (true);
  +			}
  +		}
  +		catch (RecognitionException ex) {
  +			reportError(ex);
  +			consume();
  +			consumeUntil(_tokenSet_3);
  +		}
  +	}
  +	
   	public final void prefetchClause(
   		QueryByCriteria query
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			prefetchCriterion(query);
   			{
  -			_loop88:
  +			_loop93:
   			do {
   				if ((LA(1)==TOK_COMMA)) {
   					match(TOK_COMMA);
   					prefetchCriterion(query);
   				}
   				else {
  -					break _loop88;
  +					break _loop93;
   				}
  -
  +				
   			} while (true);
   			}
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_3);
  +			consumeUntil(_tokenSet_4);
   		}
   	}
  -
  +	
   	public final Query  existsQuery() throws RecognitionException, TokenStreamException {
   		Query query = null;
  -
  -
  +		
  +		
   		try {      // for error handling
  -
  +			
   			Class clazz = null;
   			Criteria criteria = new Criteria();
  -
  +			
   			match(LITERAL_exists);
   			projectionAttributes();
   			match(LITERAL_in);
  @@ -380,63 +430,63 @@
   				match(TOK_COLON);
   				whereClause(criteria);
   			}
  -			else if ((_tokenSet_6.member(LA(1)))) {
  +			else if ((_tokenSet_7.member(LA(1)))) {
   			}
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
  -
  +			
   			if (clazz != null) {
   			query = QueryFactory.newQuery(clazz, criteria);
   			}
  -
  +					
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   		return query;
   	}
  -
  +	
   	public final void orExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			andExpr(criteria);
   			{
  -			_loop92:
  +			_loop97:
   			do {
  -				if ((LA(1)==LITERAL_or) && (_tokenSet_7.member(LA(2))) && (_tokenSet_8.member(LA(3))))
{
  +				if ((LA(1)==LITERAL_or) && (_tokenSet_8.member(LA(2))) && (_tokenSet_9.member(LA(3))))
{
   					match(LITERAL_or);
   					Criteria orCriteria = new Criteria();
   					andExpr(orCriteria);
   					criteria.addOrCriteria(orCriteria);
   				}
   				else {
  -					break _loop92;
  +					break _loop97;
   				}
  -
  +				
   			} while (true);
   			}
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void sortCriterion(
   		QueryByCriteria query
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
   			boolean descending = false;
   			id = LT(1);
  @@ -455,86 +505,106 @@
   				else {
   					throw new NoViableAltException(LT(1), getFilename());
   				}
  -
  +				
   				}
   			}
  -			else if ((_tokenSet_9.member(LA(1)))) {
  +			else if ((_tokenSet_10.member(LA(1)))) {
   			}
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
  -
  +			
   			if (descending) {
   			query.addOrderByDescending(id.getText());
   			} else {
   			query.addOrderByAscending(id.getText());
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_9);
  +			consumeUntil(_tokenSet_10);
   		}
   	}
  -
  +	
  +	public final void groupCriterion(
  +		QueryByCriteria query
  +	) throws RecognitionException, TokenStreamException {
  +		
  +		Token  id = null;
  +		
  +		try {      // for error handling
  +			id = LT(1);
  +			match(Identifier);
  +			
  +			query.addGroupBy(id.getText());
  +			
  +		}
  +		catch (RecognitionException ex) {
  +			reportError(ex);
  +			consume();
  +			consumeUntil(_tokenSet_11);
  +		}
  +	}
  +	
   	public final void prefetchCriterion(
   		QueryByCriteria query
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
   			id = LT(1);
   			match(Identifier);
  -
  +			
   			query.addPrefetchedRelationship(id.getText());
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_10);
  +			consumeUntil(_tokenSet_12);
   		}
   	}
  -
  +	
   	public final void andExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			quantifierExpr(criteria);
   			{
  -			_loop95:
  +			_loop100:
   			do {
  -				if ((LA(1)==LITERAL_and) && (_tokenSet_7.member(LA(2))) && (_tokenSet_8.member(LA(3))))
{
  +				if ((LA(1)==LITERAL_and) && (_tokenSet_8.member(LA(2))) && (_tokenSet_9.member(LA(3))))
{
   					match(LITERAL_and);
   					Criteria andCriteria = new Criteria();
   					quantifierExpr(andCriteria);
   					criteria.addAndCriteria(andCriteria);
   				}
   				else {
  -					break _loop95;
  +					break _loop100;
   				}
  -
  +				
   			} while (true);
   			}
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void quantifierExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
   			switch ( LA(1)) {
   			case TOK_LPAREN:
  @@ -557,13 +627,13 @@
   				break;
   			}
   			default:
  -				if ((LA(1)==Identifier) && (_tokenSet_11.member(LA(2)))) {
  +				if ((LA(1)==Identifier) && (_tokenSet_13.member(LA(2)))) {
   					equalityExpr(criteria);
   				}
  -				else if ((LA(1)==Identifier) && (LA(2)==LITERAL_not||LA(2)==LITERAL_like) &&
(_tokenSet_12.member(LA(3)))) {
  +				else if ((LA(1)==Identifier) && (LA(2)==LITERAL_not||LA(2)==LITERAL_like) &&
(_tokenSet_14.member(LA(3)))) {
   					likeExpr(criteria);
   				}
  -				else if ((LA(1)==Identifier) && (LA(2)==LITERAL_not||LA(2)==LITERAL_between)
&& (_tokenSet_13.member(LA(3)))) {
  +				else if ((LA(1)==Identifier) && (LA(2)==LITERAL_not||LA(2)==LITERAL_between)
&& (_tokenSet_15.member(LA(3)))) {
   					betweenExpr(criteria);
   				}
   				else if ((LA(1)==Identifier) && (LA(2)==LITERAL_in||LA(2)==LITERAL_not) &&
(LA(3)==TOK_LPAREN||LA(3)==LITERAL_in||LA(3)==LITERAL_list)) {
  @@ -577,20 +647,20 @@
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void equalityExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
  -
  +			
   				Object value = null;
  -
  +			
   			id = LT(1);
   			match(Identifier);
   			{
  @@ -604,14 +674,14 @@
   					match(LITERAL_nil);
   					criteria.addIsNull(id.getText());
   				}
  -				else if ((_tokenSet_14.member(LA(1)))) {
  +				else if ((_tokenSet_16.member(LA(1)))) {
   					value=literal();
   					criteria.addEqualTo(id.getText(), value);
   				}
   				else {
   					throw new NoViableAltException(LT(1), getFilename());
   				}
  -
  +				
   				}
   				break;
   			}
  @@ -623,14 +693,14 @@
   					match(LITERAL_nil);
   					criteria.addNotNull(id.getText());
   				}
  -				else if ((_tokenSet_14.member(LA(1)))) {
  +				else if ((_tokenSet_16.member(LA(1)))) {
   					value=literal();
   					criteria.addNotEqualTo(id.getText(), value);
   				}
   				else {
   					throw new NoViableAltException(LT(1), getFilename());
   				}
  -
  +				
   				}
   				break;
   			}
  @@ -642,14 +712,14 @@
   					match(LITERAL_nil);
   					criteria.addNotNull(id.getText());
   				}
  -				else if ((_tokenSet_14.member(LA(1)))) {
  +				else if ((_tokenSet_16.member(LA(1)))) {
   					value=literal();
   					criteria.addNotEqualTo(id.getText(), value);
   				}
   				else {
   					throw new NoViableAltException(LT(1), getFilename());
   				}
  -
  +				
   				}
   				break;
   			}
  @@ -692,21 +762,21 @@
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void likeExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
  -
  +			
   			boolean negative = false;
   			Object value = null;
  -
  +			
   			id = LT(1);
   			match(Identifier);
   			{
  @@ -719,31 +789,31 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			match(LITERAL_like);
   			value=literal();
  -
  +			
   			if (negative) {
   			criteria.addNotLike(id.getText(), value);
   			} else {
   			criteria.addLike(id.getText(), value);
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void undefinedExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
   			boolean negative = false;
   			{
  @@ -758,39 +828,39 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			match(TOK_LPAREN);
   			id = LT(1);
   			match(Identifier);
   			match(TOK_RPAREN);
  -
  +			
   			if (negative) {
   			criteria.addNotNull(id.getText());
   			} else {
   			criteria.addIsNull(id.getText());
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void betweenExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
  -
  +			
   			boolean negative = false;
   			Object lower = null;
   			Object upper = null;
  -
  +			
   			id = LT(1);
   			match(Identifier);
   			{
  @@ -803,38 +873,38 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			match(LITERAL_between);
   			lower=literal();
   			match(LITERAL_and);
   			upper=literal();
  -
  +			
   			if (negative) {
   			criteria.addNotBetween(id.getText(), lower, upper);
   			} else {
   			criteria.addBetween(id.getText(), lower, upper);
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void inExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  +		
   		Token  id = null;
  -
  +		
   		try {      // for error handling
  -
  +			
   				 boolean negative = false;
   				 Collection coll;
  -
  +			
   			id = LT(1);
   			match(Identifier);
   			{
  @@ -847,7 +917,7 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			match(LITERAL_in);
   			{
  @@ -859,34 +929,34 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			coll=argList();
  -
  +			
   			if (negative) {
   			criteria.addNotIn(id.getText(), coll);
   			} else {
   			criteria.addIn(id.getText(), coll);
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final void existsExpr(
   		Criteria criteria
   	) throws RecognitionException, TokenStreamException {
  -
  -
  +		
  +		
   		try {      // for error handling
  -
  +			
   			Query subQuery = null;
   			boolean negative = false;
  -
  +			
   			{
   			if ((LA(1)==LITERAL_not)) {
   				match(LITERAL_not);
  @@ -897,7 +967,7 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			{
   			if ((LA(1)==LITERAL_exists) && (LA(2)==TOK_LPAREN)) {
  @@ -912,26 +982,26 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
  -
  +			
   			if (negative) {
   			criteria.addNotExists(subQuery);
   			} else {
   			criteria.addExists(subQuery);
   			}
  -
  +			
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   	}
  -
  +	
   	public final Object  literal() throws RecognitionException, TokenStreamException {
   		Object value = null;
  -
  +		
   		Token  tokInt = null;
   		Token  tokADbl = null;
   		Token  tokEDbl = null;
  @@ -940,7 +1010,7 @@
   		Token  tokDate = null;
   		Token  tokTime = null;
   		Token  tokTs = null;
  -
  +		
   		try {      // for error handling
   			switch ( LA(1)) {
   			case TOK_DOLLAR:
  @@ -966,7 +1036,7 @@
   			{
   				tokInt = LT(1);
   				match(TOK_UNSIGNED_INTEGER);
  -
  +				
   					try
   					{
   						value = Integer.valueOf(tokInt.getText());
  @@ -975,7 +1045,7 @@
   					{
   						value = Long.valueOf(tokInt.getText());
   					}
  -
  +				
   				break;
   			}
   			case TOK_APPROXIMATE_NUMERIC_LITERAL:
  @@ -1039,27 +1109,27 @@
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_15);
  +			consumeUntil(_tokenSet_17);
   		}
   		return value;
   	}
  -
  +	
   	public final Collection  argList() throws RecognitionException, TokenStreamException {
   		Collection coll = null;
  -
  -
  +		
  +		
   		try {      // for error handling
  -
  +			
   					Collection temp = new Vector();
   				    Object val;
  -
  +				
   			match(TOK_LPAREN);
   			{
  -			if ((_tokenSet_14.member(LA(1)))) {
  +			if ((_tokenSet_16.member(LA(1)))) {
   				val=literal();
   				if (val != null) {temp.add(val);}
   				{
  -				_loop119:
  +				_loop124:
   				do {
   					if ((LA(1)==TOK_COMMA)) {
   						match(TOK_COMMA);
  @@ -1067,9 +1137,9 @@
   						if (val != null) {temp.add(val);}
   					}
   					else {
  -						break _loop119;
  +						break _loop124;
   					}
  -
  +					
   				} while (true);
   				}
   			}
  @@ -1078,22 +1148,22 @@
   			else {
   				throw new NoViableAltException(LT(1), getFilename());
   			}
  -
  +			
   			}
   			match(TOK_RPAREN);
  -
  +			
   					if (!temp.isEmpty()) {coll = temp;}
  -
  +					
   		}
   		catch (RecognitionException ex) {
   			reportError(ex);
   			consume();
  -			consumeUntil(_tokenSet_6);
  +			consumeUntil(_tokenSet_7);
   		}
   		return coll;
   	}
  -
  -
  +	
  +	
   	public static final String[] _tokenNames = {
   		"<0>",
   		"EOF",
  @@ -1139,6 +1209,7 @@
   		"\"where\"",
   		"\"order\"",
   		"\"by\"",
  +		"\"group\"",
   		"\"prefetch\"",
   		"\"exists\"",
   		"\"in\"",
  @@ -1159,38 +1230,42 @@
   		"\"time\"",
   		"\"timestamp\""
   	};
  -
  +	
   	private static final long _tokenSet_0_data_[] = { 2L, 0L };
   	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
  -	private static final long _tokenSet_1_data_[] = { 21990232555666L, 0L };
  +	private static final long _tokenSet_1_data_[] = { 57174604644498L, 0L };
   	public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
  -	private static final long _tokenSet_2_data_[] = { 17592186044562L, 0L };
  +	private static final long _tokenSet_2_data_[] = { 52776558133394L, 0L };
   	public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
  -	private static final long _tokenSet_3_data_[] = { 146L, 0L };
  +	private static final long _tokenSet_3_data_[] = { 35184372088978L, 0L };
   	public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
  -	private static final long _tokenSet_4_data_[] = { 71468255805440L, 0L };
  +	private static final long _tokenSet_4_data_[] = { 146L, 0L };
   	public static final BitSet _tokenSet_4 = new BitSet(_tokenSet_4_data_);
  -	private static final long _tokenSet_5_data_[] = { 1713039116075410L, 0L };
  +	private static final long _tokenSet_5_data_[] = { 141836999983104L, 0L };
   	public static final BitSet _tokenSet_5 = new BitSet(_tokenSet_5_data_);
  -	private static final long _tokenSet_6_data_[] = { 1710840092819602L, 0L };
  +	private static final long _tokenSet_6_data_[] = { 3437073348428178L, 0L };
   	public static final BitSet _tokenSet_6 = new BitSet(_tokenSet_6_data_);
  -	private static final long _tokenSet_7_data_[] = { 112625175324786720L, 0L };
  +	private static final long _tokenSet_7_data_[] = { 3434874325172370L, 0L };
   	public static final BitSet _tokenSet_7 = new BitSet(_tokenSet_7_data_);
  -	private static final long _tokenSet_8_data_[] = { 274825130662629408L, 0L };
  +	private static final long _tokenSet_8_data_[] = { 225250350381137952L, 0L };
   	public static final BitSet _tokenSet_8 = new BitSet(_tokenSet_8_data_);
  -	private static final long _tokenSet_9_data_[] = { 17592186044626L, 0L };
  +	private static final long _tokenSet_9_data_[] = { 549650261048496160L, 0L };
   	public static final BitSet _tokenSet_9 = new BitSet(_tokenSet_9_data_);
  -	private static final long _tokenSet_10_data_[] = { 210L, 0L };
  +	private static final long _tokenSet_10_data_[] = { 52776558133458L, 0L };
   	public static final BitSet _tokenSet_10 = new BitSet(_tokenSet_10_data_);
  -	private static final long _tokenSet_11_data_[] = { 8261632L, 0L };
  +	private static final long _tokenSet_11_data_[] = { 35184372089042L, 0L };
   	public static final BitSet _tokenSet_11 = new BitSet(_tokenSet_11_data_);
  -	private static final long _tokenSet_12_data_[] = { 9079256865455472640L, 0L };
  +	private static final long _tokenSet_12_data_[] = { 210L, 0L };
   	public static final BitSet _tokenSet_12 = new BitSet(_tokenSet_12_data_);
  -	private static final long _tokenSet_13_data_[] = { 8953156075889098752L, 0L };
  +	private static final long _tokenSet_13_data_[] = { 8261632L, 0L };
   	public static final BitSet _tokenSet_13 = new BitSet(_tokenSet_13_data_);
  -	private static final long _tokenSet_14_data_[] = { 8935141677379616768L, 0L };
  +	private static final long _tokenSet_14_data_[] = { -288230359475159040L, 0L };
   	public static final BitSet _tokenSet_14 = new BitSet(_tokenSet_14_data_);
  -	private static final long _tokenSet_15_data_[] = { 1710840092819666L, 0L };
  +	private static final long _tokenSet_15_data_[] = { -540431938607906816L, 0L };
   	public static final BitSet _tokenSet_15 = new BitSet(_tokenSet_15_data_);
  -
  +	private static final long _tokenSet_16_data_[] = { -576460735626870784L, 0L };
  +	public static final BitSet _tokenSet_16 = new BitSet(_tokenSet_16_data_);
  +	private static final long _tokenSet_17_data_[] = { 3434874325172434L, 0L };
  +	public static final BitSet _tokenSet_17 = new BitSet(_tokenSet_17_data_);
  +	
   	}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message