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/sql SqlQueryStatement.java
Date Sun, 25 May 2003 12:05:57 GMT
brj         2003/05/25 05:05:57

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlQueryStatement.java
  Log:
  surround criteria with braces if it has extents
  
  Revision  Changes    Path
  1.40      +29 -11    db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
  
  Index: SqlQueryStatement.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- SqlQueryStatement.java	23 May 2003 16:52:30 -0000	1.39
  +++ SqlQueryStatement.java	25 May 2003 12:05:57 -0000	1.40
  @@ -149,7 +149,7 @@
              
           if (sp == -1)
           {
  -            // BRJ ignore alias for simple attributes 
  +            // BRJ : ignore alias for simple attributes ??
               tableAlias = getRoot();
   /*
               if (aUserAlias == null)
  @@ -652,18 +652,36 @@
           AttributeInfo attrInfo = getAttributeInfo(c.getAttribute(), false, c.getAlias());
           TableAlias alias = attrInfo.tableAlias;
           
  -        appendCriteria(alias, attrInfo.pathInfo, c, buf);
  -
           if (alias != null)
           {
  -            c.setNumberOfExtentsToBind(alias.extents.size());
  -            Iterator iter = alias.iterateExtents();
  -            while (iter.hasNext())
  -            {
  -                TableAlias tableAlias = (TableAlias) iter.next();
  -                buf.append(" OR ");
  -                appendCriteria(tableAlias, attrInfo.pathInfo, c, buf);
  +            boolean hasExtents = alias.hasExtents();
  +            
  +            if (hasExtents)
  +            {
  +                // BRJ : surround with braces if alias has extents
  +                buf.append("(");
  +                appendCriteria(alias, attrInfo.pathInfo, c, buf);
  +            
  +                c.setNumberOfExtentsToBind(alias.extents.size());
  +                Iterator iter = alias.iterateExtents();
  +                while (iter.hasNext())
  +                {
  +                    TableAlias tableAlias = (TableAlias) iter.next();
  +                    buf.append(" OR ");
  +                    appendCriteria(tableAlias, attrInfo.pathInfo, c, buf);
  +                }
  +                buf.append(")");
               }
  +            else
  +            {
  +                // no extents
  +                appendCriteria(alias, attrInfo.pathInfo, c, buf);
  +            }           
  +        }
  +        else
  +        {
  +            // alias null
  +            appendCriteria(alias, attrInfo.pathInfo, c, buf);
           }
   
       }
  
  
  

Mime
View raw message