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 SqlSelectStatement.java TableAliasHandler.java
Date Wed, 20 Oct 2004 19:17:43 GMT
brj         2004/10/20 12:17:43

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlSelectStatement.java TableAliasHandler.java
  Log:
  minor refactorings based on findbugs
  
  Revision  Changes    Path
  1.30      +16 -16    db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java
  
  Index: SqlSelectStatement.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- SqlSelectStatement.java	13 Oct 2004 20:06:17 -0000	1.29
  +++ SqlSelectStatement.java	20 Oct 2004 19:17:43 -0000	1.30
  @@ -85,20 +85,17 @@
           ArrayList columnList = new ArrayList();
           int i = 0;
   
  -        if (fieldDescriptors != null)
  +        FieldDescriptor field = null;
  +        for (int j = 0; j < fieldDescriptorLength; j++)
           {
  -            FieldDescriptor field = null;
  -            for (int j = 0; j < fieldDescriptorLength; j++)
  +            field = fieldDescriptors[j];
  +            if (i > 0)
               {
  -                field = fieldDescriptors[j];
  -                if (i > 0)
  -                {
  -                    buf.append(",");
  -                }
  -                appendColumn(getSearchTable().alias, field.getColumnName(), buf);
  -                columnList.add(field.getAttributeName());
  -                i++;
  +                buf.append(",");
               }
  +            appendColumn(getSearchTable().alias, field.getColumnName(), buf);
  +            columnList.add(field.getAttributeName());
  +            i++;
           }
           return columnList;
       }
  @@ -259,10 +256,13 @@
           // TODO: do not use the superclassfield anymore, just assume that the id is the
same in both tables - @see PBroker.storeToDb
           int superFieldRef = cld.getSuperClassFieldRef();
           FieldDescriptor refField = cld.getFieldDescriptorByIndex(superFieldRef);
  -        where.append(cldSuper.getFullTableName()).append(".").append(
  -                cldSuper.getAutoIncrementFields()[0].getColumnName());
  -        where.append(" = ");
  -        where.append(cld.getFullTableName()).append(".").append(refField.getColumnName());
  +        where.append(cldSuper.getFullTableName())
  +        	.append(".")
  +        	.append(cldSuper.getAutoIncrementFields()[0].getColumnName())
  +        	.append(" = ")
  +        	.append(cld.getFullTableName())
  +        	.append(".")
  +        	.append(refField.getColumnName());
   
       }
   
  
  
  
  1.4       +2 -11     db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/TableAliasHandler.java
  
  Index: TableAliasHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/TableAliasHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TableAliasHandler.java	13 Oct 2004 20:06:17 -0000	1.3
  +++ TableAliasHandler.java	20 Oct 2004 19:17:43 -0000	1.4
  @@ -733,14 +733,6 @@
       // ------------------- Inner classes ------------------------------
       //-----------------------------------------------------------------
   
  -    /**
  -     * This class is a helper to return TableAlias and PathInfo
  -     */
  -    static final class AttributeInfo
  -    {
  -        TableAlias tableAlias;
  -        PathInfo pathInfo;
  -    }
   
       /**
        * This class represents one table (possibly with alias) in the SQL query
  @@ -752,7 +744,6 @@
           String table;
           final String alias;
           List extents = new ArrayList();
  -        List hints = new ArrayList();
           List joins = new ArrayList();
   
           TableAlias(String aTable, String anAlias)
  @@ -948,7 +939,7 @@
       /**
        * This class represents join between two TableAliases
        */
  -    final class Join
  +    static final class Join
       {
           final TableAlias left;
           final String[] leftKeys;
  
  
  

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