db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject svn commit: r369194 - in /db/ojb/trunk/src/java/org/apache/ojb: broker/query/ odmg/oql/
Date Sun, 15 Jan 2006 09:34:50 GMT
Author: brj
Date: Sun Jan 15 01:34:39 2006
New Revision: 369194

URL: http://svn.apache.org/viewcvs?rev=369194&view=rev
Log:
improved OQL-support for InCriteria

Modified:
    db/ojb/trunk/src/java/org/apache/ojb/broker/query/BetweenCriteria.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/query/BindableCriterion.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/query/InCriteria.java
    db/ojb/trunk/src/java/org/apache/ojb/broker/query/SelectionCriteria.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexer.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLParser.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
    db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/oql-ojb.g

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/BetweenCriteria.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/broker/query/BetweenCriteria.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/BetweenCriteria.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/BetweenCriteria.java Sun Jan 15 01:34:39
2006
@@ -80,7 +80,14 @@
 		return (getValue() == null && getValue2() == null);
 	}
 
-	// PAW
+    /**
+     * @see org.apache.ojb.broker.query.BindableCriterion#isMultiBindable()
+     */
+    public boolean isMultiBindable()
+    {
+        return true;
+    }
+
 	/**
 	 * String representation
 	 */

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/BindableCriterion.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/broker/query/BindableCriterion.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/BindableCriterion.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/BindableCriterion.java Sun Jan 15 01:34:39
2006
@@ -34,6 +34,13 @@
      * Used by the ODMG OQLQuery.bind() operation
      */
     public void bind(Object newValue);
+    
+    /**
+     * Indicates whether the Criteria can be bound more than once. 
+     * (ie. BetweenCriteria with 2 Parameters)
+     * @return true if multi bindable
+     */
+    public boolean isMultiBindable();
 
 }
 

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/InCriteria.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/broker/query/InCriteria.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/InCriteria.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/InCriteria.java Sun Jan 15 01:34:39
2006
@@ -65,7 +65,7 @@
 	}
 	
 	private Object m_attribute;
-	private Collection m_values;
+	private List m_values;
 	private boolean m_translateAttribute;
 	private boolean m_preprocessed = false;
 
@@ -73,14 +73,14 @@
 	 * Constructor.
 	 * 
 	 * @param anAttribute the name of the attribute
-	 * @param values the Collection 
+	 * @param values the Collection, may contain nulls 
 	 * @param negative clause-indicator : true=NOT IN, false=IN
 	 * @param translate if false the attribute name is not translated into column name
 	 */
     InCriteria(Object anAttribute, Collection values, boolean negative, boolean translate)
     {
         m_attribute = anAttribute;
-        m_values = values;
+        setValues(values);
         m_translateAttribute = translate;
         setNegative(negative);
     }
@@ -105,15 +105,16 @@
         List result = new ArrayList();
         Collection inCollection = new ArrayList();
         int inLimit = aPb.getSqlInLimit();
+        List values = getValues();
        
-        if (m_values == null || m_values.isEmpty())
+        if (values == null || values.isEmpty())
         {
             // OQL creates empty Criteria for late binding
-            result.add(buildInCriterion(m_values));
+            result.add(buildInCriterion(values));
         }
         else
         {
-            Iterator iter = m_values.iterator();
+            Iterator iter = values.iterator();
 
             while (iter.hasNext())
             {
@@ -147,6 +148,30 @@
     }
 
     /**
+     * @return the values
+     */
+    private List getValues()
+    {
+        return m_values;
+    }
+
+    /**
+     * @param values the values to set
+     */
+    private void setValues(Collection values)
+    {
+        List newValues = null;
+        
+        if (values != null)
+        {
+            newValues = new ArrayList(values.size());
+            newValues.addAll(values);
+        }
+        
+        m_values = newValues;
+    }
+
+    /**
      * Preprocess the Criteria using a PersistenceBroker.
      * Build list of InCriterion based on SQL-IN-LIMIT.
      * 
@@ -168,28 +193,40 @@
     {
         if (newValue instanceof Collection)
         {
-            m_values = (Collection) newValue;
+            setValues((Collection) newValue);
         }
         else
         {
-            if (m_values != null)
-            {
-                m_values.add(newValue);
-            }
-            else
-            {
-                m_values = new ArrayList();
-                m_values.add(newValue);
-            }
-        }
+            bindSingleObject(newValue);
+        }    
     }
 
     /**
+     * Bind a single Object to the next null position.
+     * @param obj
+     */
+    private void bindSingleObject(Object obj)
+    {
+        int idx = getValues().indexOf(null);
+        
+        getValues().set(idx, obj);
+    }
+    
+    /**
      * @see org.apache.ojb.broker.query.BindableCriterion#isBound()
+     * @return true if the collection does not contain nulls
      */
     public boolean isBound()
     {
-        return (m_values != null);
+       return !getValues().contains(null);
+    }
+
+    /**
+     * @see org.apache.ojb.broker.query.BindableCriterion#isMultiBindable()
+     */
+    public boolean isMultiBindable()
+    {
+        return true;
     }
 
     /**
@@ -198,6 +235,7 @@
     public String toString()
     {
         String clause = isNegative() ? SelectionCriteria.NOT_IN : SelectionCriteria.IN;
-        return "InCriteria:" + m_attribute + clause + super.toString();
+        return "InCriteria:" + m_attribute + clause + getValues();
     }
+
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/SelectionCriteria.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/broker/query/SelectionCriteria.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/query/SelectionCriteria.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/SelectionCriteria.java Sun Jan 15 01:34:39
2006
@@ -129,6 +129,14 @@
 		return m_bound;
 	}
 
+    /**
+     * @see org.apache.ojb.broker.query.BindableCriterion#isMultiBindable()
+     */
+    public boolean isMultiBindable()
+    {
+        return false;
+    }
+
 	/**
 	 * Sets the bound.
 	 * @param bound The bound to set

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexer.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexer.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexer.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexer.java Sun Jan 15 01:34:39 2006
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.3: "oql-ojb.g" -> "OQLLexer.java"$
+// $ANTLR 2.7.5 (20050128): "oql-ojb.g" -> "OQLLexer.java"$
 
 
 /*
@@ -21,25 +21,35 @@
  */
 package org.apache.ojb.odmg.oql;
 
+import org.odmg.QueryInvalidException;
+import org.apache.ojb.broker.query.*;
+import org.apache.ojb.broker.metadata.*;
+import org.apache.ojb.broker.util.ClassHelper;
+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.ANTLRHashString;
+import antlr.CharScanner;
+import antlr.InputBuffer;
 import antlr.ByteBuffer;
 import antlr.CharBuffer;
-import antlr.CharStreamException;
-import antlr.CharStreamIOException;
-import antlr.InputBuffer;
-import antlr.LexerSharedInputState;
-import antlr.NoViableAltForCharException;
-import antlr.RecognitionException;
 import antlr.Token;
+import antlr.CommonToken;
+import antlr.RecognitionException;
+import antlr.NoViableAltForCharException;
+import antlr.MismatchedCharException;
 import antlr.TokenStream;
-import antlr.TokenStreamException;
-import antlr.TokenStreamIOException;
-import antlr.TokenStreamRecognitionException;
+import antlr.ANTLRHashString;
+import antlr.LexerSharedInputState;
 import antlr.collections.impl.BitSet;
+import antlr.SemanticException;
 
 public class OQLLexer extends antlr.CharScanner implements OQLLexerTokenTypes, TokenStream
  {

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.java Sun Jan 15 01:34:39
2006
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.3: "oql-ojb.g" -> "OQLParser.java"$
+// $ANTLR 2.7.5 (20050128): "oql-ojb.g" -> "OQLParser.java"$
 
 
 /*
@@ -21,67 +21,73 @@
  */
 package org.apache.ojb.odmg.oql;
 
+import org.odmg.QueryInvalidException;
+import org.apache.ojb.broker.query.*;
+import org.apache.ojb.broker.metadata.*;
+import org.apache.ojb.broker.util.ClassHelper;
+import java.util.*;
+
 public interface OQLLexerTokenTypes {
-    int EOF = 1;
-    int NULL_TREE_LOOKAHEAD = 3;
-    int TOK_RPAREN = 4;
-    int TOK_LPAREN = 5;
-    int TOK_COMMA = 6;
-    int TOK_SEMIC = 7;
-    int TOK_COLON = 8;
-    int TOK_DOT = 9;
-    int TOK_INDIRECT = 10;
-    int TOK_CONCAT = 11;
-    int TOK_EQ = 12;
-    int TOK_PLUS = 13;
-    int TOK_MINUS = 14;
-    int TOK_SLASH = 15;
-    int TOK_STAR = 16;
-    int TOK_LE = 17;
-    int TOK_GE = 18;
-    int TOK_NE = 19;
-    int TOK_NE2 = 20;
-    int TOK_LT = 21;
-    int TOK_GT = 22;
-    int TOK_LBRACK = 23;
-    int TOK_RBRACK = 24;
-    int TOK_DOLLAR = 25;
-    int NameFirstCharacter = 26;
-    int NameCharacter = 27;
-    int Identifier = 28;
-    int TOK_UNSIGNED_INTEGER = 29;
-    int TOK_APPROXIMATE_NUMERIC_LITERAL = 30;
-    int TOK_EXACT_NUMERIC_LITERAL = 31;
-    int CharLiteral = 32;
-    int StringLiteral = 33;
-    int WhiteSpace = 34;
-    int NewLine = 35;
-    int CommentLine = 36;
-    int MultiLineComment = 37;
-    int LITERAL_select = 38;
-    int LITERAL_distinct = 39;
-    int LITERAL_from = 40;
-    int LITERAL_where = 41;
-    int LITERAL_order = 42;
-    int LITERAL_by = 43;
-    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;
+	int EOF = 1;
+	int NULL_TREE_LOOKAHEAD = 3;
+	int TOK_RPAREN = 4;
+	int TOK_LPAREN = 5;
+	int TOK_COMMA = 6;
+	int TOK_SEMIC = 7;
+	int TOK_COLON = 8;
+	int TOK_DOT = 9;
+	int TOK_INDIRECT = 10;
+	int TOK_CONCAT = 11;
+	int TOK_EQ = 12;
+	int TOK_PLUS = 13;
+	int TOK_MINUS = 14;
+	int TOK_SLASH = 15;
+	int TOK_STAR = 16;
+	int TOK_LE = 17;
+	int TOK_GE = 18;
+	int TOK_NE = 19;
+	int TOK_NE2 = 20;
+	int TOK_LT = 21;
+	int TOK_GT = 22;
+	int TOK_LBRACK = 23;
+	int TOK_RBRACK = 24;
+	int TOK_DOLLAR = 25;
+	int NameFirstCharacter = 26;
+	int NameCharacter = 27;
+	int Identifier = 28;
+	int TOK_UNSIGNED_INTEGER = 29;
+	int TOK_APPROXIMATE_NUMERIC_LITERAL = 30;
+	int TOK_EXACT_NUMERIC_LITERAL = 31;
+	int CharLiteral = 32;
+	int StringLiteral = 33;
+	int WhiteSpace = 34;
+	int NewLine = 35;
+	int CommentLine = 36;
+	int MultiLineComment = 37;
+	int LITERAL_select = 38;
+	int LITERAL_distinct = 39;
+	int LITERAL_from = 40;
+	int LITERAL_where = 41;
+	int LITERAL_order = 42;
+	int LITERAL_by = 43;
+	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;
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLLexerTokenTypes.txt Sun Jan 15 01:34:39
2006
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.3: oql-ojb.g -> OQLLexerTokenTypes.txt$
+// $ANTLR 2.7.5 (20050128): oql-ojb.g -> OQLLexerTokenTypes.txt$
 OQLLexer    // output token vocab name
 TOK_RPAREN("right parenthesis")=4
 TOK_LPAREN("left parenthesis")=5

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLParser.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLParser.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLParser.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLParser.java Sun Jan 15 01:34:39 2006
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.3: "oql-ojb.g" -> "OQLParser.java"$
+// $ANTLR 2.7.5 (20050128): "oql-ojb.g" -> "OQLParser.java"$
 
 
 /*
@@ -21,27 +21,25 @@
  */
 package org.apache.ojb.odmg.oql;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Vector;
+import org.odmg.QueryInvalidException;
+import org.apache.ojb.broker.query.*;
+import org.apache.ojb.broker.metadata.*;
+import org.apache.ojb.broker.util.ClassHelper;
+import java.util.*;
 
-import antlr.NoViableAltException;
-import antlr.ParserSharedInputState;
-import antlr.RecognitionException;
-import antlr.Token;
 import antlr.TokenBuffer;
-import antlr.TokenStream;
 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 org.apache.ojb.broker.metadata.ClassDescriptor;
-import org.apache.ojb.broker.metadata.MetadataManager;
-import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
-import org.apache.ojb.broker.query.Criteria;
-import org.apache.ojb.broker.query.Query;
-import org.apache.ojb.broker.query.QueryByCriteria;
-import org.apache.ojb.broker.query.QueryFactory;
-import org.apache.ojb.broker.util.ClassHelper;
-import org.odmg.QueryInvalidException;
 
 public class OQLParser extends antlr.LLkParser       implements OQLLexerTokenTypes
  {
@@ -89,8 +87,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_0);
+			recover(ex,_tokenSet_0);
 		}
 		return query;
 	}
@@ -228,8 +225,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_4);
+			recover(ex,_tokenSet_4);
 		}
 		return query;
 	}
@@ -301,8 +297,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_5);
+			recover(ex,_tokenSet_5);
 		}
 		return projectionAttrs;
 	}
@@ -400,8 +395,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_7);
+			recover(ex,_tokenSet_7);
 		}
 	}
 	
@@ -415,8 +409,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -443,8 +436,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_2);
+			recover(ex,_tokenSet_2);
 		}
 	}
 	
@@ -471,8 +463,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_3);
+			recover(ex,_tokenSet_3);
 		}
 	}
 	
@@ -499,8 +490,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_4);
+			recover(ex,_tokenSet_4);
 		}
 	}
 	
@@ -550,8 +540,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 		return query;
 	}
@@ -581,8 +570,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -630,8 +618,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_11);
+			recover(ex,_tokenSet_11);
 		}
 	}
 	
@@ -650,8 +637,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_12);
+			recover(ex,_tokenSet_12);
 		}
 	}
 	
@@ -670,8 +656,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_13);
+			recover(ex,_tokenSet_13);
 		}
 	}
 	
@@ -700,8 +685,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -751,8 +735,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -866,8 +849,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -908,8 +890,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -949,8 +930,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -994,8 +974,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -1047,8 +1026,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -1099,8 +1077,7 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 	}
 	
@@ -1213,33 +1190,29 @@
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_18);
+			recover(ex,_tokenSet_18);
 		}
 		return value;
 	}
 	
 	public final Collection  argList() throws RecognitionException, TokenStreamException {
-		Collection coll = null;
+		Collection coll = new ArrayList();
 		
 		
 		try {      // for error handling
-			
-					Collection temp = new Vector();
-				    Object val;
-				
+			Object val;
 			match(TOK_LPAREN);
 			{
 			if ((_tokenSet_17.member(LA(1)))) {
 				val=literal();
-				if (val != null) {temp.add(val);}
+				coll.add(val);
 				{
 				_loop129:
 				do {
 					if ((LA(1)==TOK_COMMA)) {
 						match(TOK_COMMA);
 						val=literal();
-						if (val != null) {temp.add(val);}
+						coll.add(val);
 					}
 					else {
 						break _loop129;
@@ -1256,14 +1229,10 @@
 			
 			}
 			match(TOK_RPAREN);
-			
-					if (!temp.isEmpty()) {coll = temp;}
-					
 		}
 		catch (RecognitionException ex) {
 			reportError(ex);
-			consume();
-			consumeUntil(_tokenSet_8);
+			recover(ex,_tokenSet_8);
 		}
 		return coll;
 	}

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java Sun Jan 15 01:34:39 2006
@@ -25,7 +25,6 @@
 import org.apache.ojb.broker.ManageableCollection;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.accesslayer.OJBIterator;
-import org.apache.ojb.broker.query.BetweenCriteria;
 import org.apache.ojb.broker.query.BindableCriterion;
 import org.apache.ojb.broker.query.Criteria;
 import org.apache.ojb.broker.query.Query;
@@ -113,8 +112,8 @@
             BindableCriterion crit = (BindableCriterion) getBindIterator().next();
             crit.bind(parameter);
 
-            // BRJ: bind is called twice for between
-            if (crit instanceof BetweenCriteria && !crit.isBound())
+            // BRJ: some criteria can be bound more than once, ie. BetweenCiriteria, InCriteria
+            if (crit.isMultiBindable() && !crit.isBound())
             {
                 getBindIterator().previous();
             }

Modified: db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/oql-ojb.g
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/oql-ojb.g?rev=369194&r1=369193&r2=369194&view=diff
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/oql-ojb.g (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/odmg/oql/oql-ojb.g Sun Jan 15 01:34:39 2006
@@ -874,28 +874,21 @@
             { value = java.sql.Timestamp.valueOf(tokTs.getText()); }
     ;
 
-argList returns [Collection coll = null] :
-// return a collection of parameters or null if we only have $1,$2...
-	    {
-		Collection temp = new Vector();
-	    Object val;
-	    }
+argList returns [Collection coll = new ArrayList()] :
+// BRJ: return a collection of parameters, or a collection of nulls if we only have $1,$2...
+
+	    { Object val; }
 
         TOK_LPAREN
         (
             val = literal
 
-            // BRJ: do not add null objects
-            {if (val != null) {temp.add(val);} }
+            { coll.add(val); }
             (
                 TOK_COMMA
 	            val = literal
-	            {if (val != null) {temp.add(val);} }
+	            { coll.add(val); }
             )*
         )?
         TOK_RPAREN
-
-		{
-		if (!temp.isEmpty()) {coll = temp;}
-		}
     ;



---------------------------------------------------------------------
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