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/broker/query Criteria.java
Date Fri, 13 Feb 2004 17:02:48 GMT
brj         2004/02/13 09:02:48

  Modified:    src/java/org/apache/ojb/broker/query Criteria.java
  Log:
  support criteria containing no selection-criteria
  
  Revision  Changes    Path
  1.38      +15 -14    db-ojb/src/java/org/apache/ojb/broker/query/Criteria.java
  
  Index: Criteria.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/Criteria.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Criteria.java	13 Jan 2004 21:21:49 -0000	1.37
  +++ Criteria.java	13 Feb 2004 17:02:48 -0000	1.38
  @@ -716,11 +716,8 @@
   		else
   		{
   			setEmbraced(false);
  -			setType(NONE); // root object
  -            addCriteria(pc.getCriteria());
  -
  -			orderby.addAll(pc._getOrderby());
  -			groupby.addAll(pc._getGroupby());
  +            pc.setType(OR);
  +            addCriteria(pc);
   		}
   	}
   
  @@ -860,7 +857,7 @@
   	 */
   	public void addAndCriteria(Criteria pc)
   	{
  -		// by combining a second criteria by 'AND' the existing criteria needs to be enclosed
  +        // by combining a second criteria by 'AND' the existing criteria needs to be enclosed
   		// in parenthesis
   		if (!m_criteria.isEmpty())
   		{
  @@ -872,13 +869,10 @@
   		else
   		{
   			setEmbraced(false);
  -			setType(NONE); // root object
  -            addCriteria(pc.getCriteria());
  -
  -			orderby.addAll(pc._getOrderby());
  -			groupby.addAll(pc._getGroupby());
  +            pc.setType(AND);
  +            addCriteria(pc);
   		}
  -	}
  +   	}
   
   	/**
   	 * Adds an exists(sub query)
  @@ -1091,7 +1085,14 @@
   	
   	public String toString()
   	{
  -	    return m_criteria.toString();
  +        if (isNegative())
  +        {
  +            return "-" + m_criteria.toString();
  +        }
  +        else
  +        {
  +            return m_criteria.toString();
  +        }
   	}
   
       /**
  
  
  

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