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, 09 Mar 2003 08:59:39 GMT
brj         2003/03/09 00:59:39

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlQueryStatement.java
  Log:
  use OUTER joins for OR-Criteria. fix by Bill Skrypnyk
  
  Revision  Changes    Path
  1.25      +9 -6      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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SqlQueryStatement.java	1 Mar 2003 20:19:56 -0000	1.24
  +++ SqlQueryStatement.java	9 Mar 2003 08:59:39 -0000	1.25
  @@ -1108,19 +1108,22 @@
               else
               {
                   SelectionCriteria c = (SelectionCriteria) o;
  +                // BRJ : Outer join for OR
  +                boolean useOuterJoin = (crit.getType() == Criteria.OR); 
  +                
                   if (c.getAttribute() != null)
                   {
  -                    buildJoinTreeForColumn(c.getAttribute(), crit.getAlias());
  +                    buildJoinTreeForColumn(c.getAttribute(), useOuterJoin, crit.getAlias());
                   }
                   if (c instanceof FieldCriteria)
                   {
                       FieldCriteria cc = (FieldCriteria) c;
  -                    buildJoinTreeForColumn((String) cc.getValue(), crit.getAlias());
  +                    buildJoinTreeForColumn((String) cc.getValue(), useOuterJoin, crit.getAlias());
                   }
                   else if (c instanceof ColumnCriteria)
                   {
                       ColumnCriteria cc = (ColumnCriteria) c;
  -                    buildJoinTreeForColumn((String) cc.getValue(), crit.getAlias());
  +                    buildJoinTreeForColumn((String) cc.getValue(), useOuterJoin, crit.getAlias());
                   }
               }
           } 
  @@ -1131,14 +1134,14 @@
        * functions and the last segment are removed
        * ie: avg(accounts.amount) -> accounts
        */
  -    private void buildJoinTreeForColumn(String aColName, String aUserAlias)
  +    private void buildJoinTreeForColumn(String aColName, boolean useOuterJoin, String aUserAlias)
       {
           String pathName = SqlHelper.cleanPath(aColName);
           int sepPos = pathName.lastIndexOf(".");
   
           if (sepPos >= 0)
           {
  -            getTableAlias(pathName.substring(0, sepPos), false, aUserAlias); 
  +            getTableAlias(pathName.substring(0, sepPos), useOuterJoin, aUserAlias); 
           }
   
       }
  
  
  

Mime
View raw message