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/accesslayer StatementManager.java
Date Fri, 16 May 2003 19:26:29 GMT
brj         2003/05/16 12:26:29

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        StatementManager.java
  Log:
  fixed problem with binding subQueries
  
  Revision  Changes    Path
  1.34      +11 -7     db-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
  
  Index: StatementManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StatementManager.java	2 May 2003 18:13:28 -0000	1.33
  +++ StatementManager.java	16 May 2003 19:26:28 -0000	1.34
  @@ -246,11 +246,9 @@
   		if (value instanceof Query)
   		{
   			Query subQuery = (Query) value;
  -			if (subQuery.getCriteria() != null && !subQuery.getCriteria().isEmpty())
  -			{
  -				return bindStatement(stmt, subQuery.getCriteria(), cld.getRepository().getDescriptorFor(subQuery.getSearchClass()),
index);
  -			}
  -			return index;
  +            
  +            // BRJ: simply bind the whole subQuery
  +            return bindStatement(stmt,subQuery,cld.getRepository().getDescriptorFor(subQuery.getSearchClass()),
index);
   		}
   
   		// if query has criteria, bind them
  @@ -344,6 +342,7 @@
   	{
   		FieldDescriptor fld = cld.getFieldDescriptorForPath(crit.getAttribute());
   		index = bindStatementValue(stmt, index, crit.getValue(), cld, fld);
  +
   		return bindStatementValue(stmt, index, crit.getValue2(), cld, fld);
   	}
   
  @@ -552,9 +551,14 @@
   		{
   			Object val = values[i];
   			if (val != null)
  +            {         
   				m_platform.setObjectForStatement(stmt, index, val, SqlHelper.getSqlTypeRwNonPk(cld,
i));
  -			else
  +            }
  +            else
  +            {
   				m_platform.setNullForStatement(stmt, index, SqlHelper.getSqlTypeRwNonPk(cld, i));
  +            }
  +            
   			index++;
   		}
   		// parameters for WHERE-clause pk
  
  
  

Mime
View raw message