db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/query Criteria.java
Date Wed, 08 Jan 2003 19:51:15 GMT
brj         2003/01/08 11:51:14

  Modified:    src/java/org/apache/ojb/broker/query Criteria.java
  Log:
  removed warning when wildcard found
  
  Revision  Changes    Path
  1.20      +2 -57     jakarta-ojb/src/java/org/apache/ojb/broker/query/Criteria.java
  
  Index: Criteria.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/query/Criteria.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Criteria.java	29 Dec 2002 08:52:28 -0000	1.19
  +++ Criteria.java	8 Jan 2003 19:51:13 -0000	1.20
  @@ -65,7 +65,6 @@
   import org.apache.ojb.broker.metadata.FieldHelper;
   import org.apache.ojb.broker.singlevm.PersistenceBrokerConfiguration;
   import org.apache.ojb.broker.util.configuration.ConfigurationException;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
    * Persistent Criteria can be used to retrieve sets of objects based on their attributes
  @@ -230,41 +229,13 @@
   	/**
   	 * Adds and equals (=) criteria,
   	 * customer_id = 10034
  -	 * <P>
  -	 * Where Value is a string simple pattern matching can be used, the
  -	 * character * is a wildcard, e.g.
  -	 * customer_name = Ander*
  -	 * <P>
  -	 * Would match the customers: Anderson and Anderton.  The character ? matches a single
  -	 * occurence of a character.
  -	 *
  -	 * The '\' character is used as an escape character and allow searching for strings
  -	 * containing * or ?.  So in order to search for Ander* - use Ander\*.
   	 *
   	 * @param  attribute   The field name to be used
   	 * @param  value       An object representing the value of the field
   	 */
   	public void addEqualTo(String attribute, Object value)
   	{
  -		if (value instanceof String)
  -		{
  -			// substitute our special character for SQL versions
  -			String pattern = generateSQLSearchPattern((String) value);
  -			if ((pattern.indexOf('%') == -1) && (pattern.indexOf('_') == -1))
  -			{
  -				criteria.addElement(new EqualToCriteria(attribute, pattern, false));
  -			}
  -			else
  -			{
  -				// 
  -				LoggerFactory.getDefaultLogger().warn("use addLike() for wildcards !");
  -				criteria.addElement(new LikeCriteria(attribute, pattern, false));
  -			}
  -		}
  -		else
  -		{
  -			criteria.addElement(new EqualToCriteria(attribute, value, false));
  -		}
  +		criteria.addElement(new EqualToCriteria(attribute, value, false));
   	}
   
   	/**
  @@ -479,39 +450,13 @@
   	/**
   	 * Adds NotEqualTo (<>) criteria,
   	 * customer_id <> 10034
  -	 * <P>
  -	 * Where Value is a string simple pattern matching can be used, the
  -	 * character * is a wildcard, e.g.
  -	 * customer_name = Ander*
  -	 * <P>
  -	 * Would match the customers: Anderson and Anderton.  The character ? matches a single
  -	 * occurence of a character.
  -	 *
  -	 * The '\' character is used as an escape character and allow searching for strings
  -	 * containing * or ?.  So in order to search for Ander* - use Ander\*.
   	 *
   	 * @param  attribute   The field name to be used
   	 * @param  value       An object representing the value of the field
   	 */
   	public void addNotEqualTo(String attribute, Object value)
   	{
  -		if (value instanceof String)
  -		{
  -			// substitute our special character for SQL versions
  -			String pattern = generateSQLSearchPattern((String) value);
  -			if ((pattern.indexOf('%') == -1) && (pattern.indexOf('_') == -1))
  -			{
  -				criteria.addElement(new EqualToCriteria(attribute, pattern, true));
  -			}
  -			else
  -			{
  -				criteria.addElement(new LikeCriteria(attribute, pattern, true));
  -			}
  -		}
  -		else
  -		{
  -			criteria.addElement(new EqualToCriteria(attribute, value, true));
  -		}
  +		criteria.addElement(new EqualToCriteria(attribute, value, true));
   	}
   
   	/**
  
  
  

Mime
View raw message