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 SqlGeneratorDefaultImpl.java SqlQueryStatement.java SqlSelectStatement.java SqlDeleteByQuery.java
Date Sat, 14 Feb 2004 19:36:53 GMT
brj         2004/02/14 11:36:53

  Modified:    src/java/org/apache/ojb/broker/accesslayer/sql
                        SqlGeneratorDefaultImpl.java SqlQueryStatement.java
                        SqlSelectStatement.java SqlDeleteByQuery.java
  Log:
  handle columns internally
  
  Revision  Changes    Path
  1.21      +3 -16     db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
  
  Index: SqlGeneratorDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SqlGeneratorDefaultImpl.java	16 Nov 2003 17:43:57 -0000	1.20
  +++ SqlGeneratorDefaultImpl.java	14 Feb 2004 19:36:53 -0000	1.21
  @@ -69,7 +69,6 @@
   import org.apache.ojb.broker.query.InCriteria;
   import org.apache.ojb.broker.query.NullCriteria;
   import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.query.ReportQuery;
   import org.apache.ojb.broker.query.SelectionCriteria;
   import org.apache.ojb.broker.query.SqlCriteria;
   import org.apache.ojb.broker.util.logging.Logger;
  @@ -187,13 +186,7 @@
           String result = (String) m_sqlCacheMap.get(key);
           if (result == null)
           {
  -            String[] columns = null;
  -            SqlStatement sql;
  -            if (query instanceof ReportQuery)
  -            {
  -                columns = ((ReportQuery) query).getColumns();
  -            }
  -            sql = new SqlSelectStatement(m_platform, cld, columns, query, logger);
  +            SqlStatement sql = new SqlSelectStatement(m_platform, cld, query, logger);
               result = sql.getStatement();
               if (logger.isDebugEnabled())
               {
  @@ -325,13 +318,7 @@
           String result = (String) m_sqlCacheMap.get(key);
           if (result == null)
           {
  -            String[] columns = null;
  -            SqlStatement sql;
  -            if (query instanceof ReportQuery)
  -            {
  -                columns = ((ReportQuery) query).getColumns();
  -            }
  -            sql = new SqlSelectStatement(m_platform, cld, columns, query, logger);
  +            SqlStatement sql = new SqlSelectStatement(m_platform, cld, query, logger);
               result = sql.getStatement();
               if (logger.isDebugEnabled())
               {
  
  
  
  1.63      +5 -22     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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- SqlQueryStatement.java	13 Feb 2004 17:01:22 -0000	1.62
  +++ SqlQueryStatement.java	14 Feb 2004 19:36:53 -0000	1.63
  @@ -89,8 +89,6 @@
       private TableAlias m_search;
       /** the query */
       private QueryByCriteria m_query;
  -    /** the columns to select (null means all) */
  -    private String[] m_columns;
       /** the mapping of paths to TableAliases */
       private HashMap m_pathToAlias = new HashMap();
       /** maps trees of joins to criteria */
  @@ -106,20 +104,19 @@
       /**
        * Constructor for SqlCriteriaStatement.
        */
  -    public SqlQueryStatement(Platform pf, ClassDescriptor cld, String[] columns, Query
query, Logger logger)
  +    public SqlQueryStatement(Platform pf, ClassDescriptor cld, Query query, Logger logger)
       {
  -        this (null, pf, cld, columns, query, logger);
  +        this (null, pf, cld, query, logger);
       }
   
       /**
        * Constructor for SqlCriteriaStatement.
        */
  -    public SqlQueryStatement(SqlQueryStatement parent, Platform pf, ClassDescriptor cld,
String[] columns, Query query, Logger logger)
  +    public SqlQueryStatement(SqlQueryStatement parent, Platform pf, ClassDescriptor cld,
Query query, Logger logger)
       {
           m_logger = logger != null ? logger : LoggerFactory.getLogger(SqlQueryStatement.class);
           m_parentStatement = parent;
           m_query = (QueryByCriteria) query;
  -        m_columns = columns;
           m_platform = pf;
           m_searchCld = cld;
   
  @@ -909,12 +906,7 @@
           }
           else
           {
  -            String[] columns = null;
  -            if (subQuery instanceof ReportQuery)
  -            {
  -                columns = ((ReportQuery) subQuery).getColumns();
  -            }
  -            sql = new SqlSelectStatement(this ,m_platform, cld, columns, subQuery, m_logger).getStatement();
  +            sql = new SqlSelectStatement(this ,m_platform, cld, subQuery, m_logger).getStatement();
           }
   
           return sql;
  @@ -1670,15 +1662,6 @@
       protected HashMap getJoinTreeToCriteria()
       {
           return m_joinTreeToCriteria;
  -    }
  -
  -    /**
  -     * Gets the columns.
  -     * @return Returns a String[]
  -     */
  -    protected String[] getColumns()
  -    {
  -        return m_columns;
       }
   
       /**
  
  
  
  1.17      +12 -9     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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SqlSelectStatement.java	12 Dec 2003 18:36:17 -0000	1.16
  +++ SqlSelectStatement.java	14 Feb 2004 19:36:53 -0000	1.17
  @@ -63,6 +63,7 @@
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.ReportQuery;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.platforms.Platform;
   
  @@ -80,13 +81,12 @@
        * 
        * @param pf
        * @param cld
  -     * @param columns
        * @param query
        * @param logger
        */
  -	public SqlSelectStatement(Platform pf, ClassDescriptor cld, String[] columns, Query query,
Logger logger)
  +	public SqlSelectStatement(Platform pf, ClassDescriptor cld, Query query, Logger logger)
   	{
  -		super(pf, cld, columns, query, logger);
  +		super(pf, cld, query, logger);
   	}
   
       /**
  @@ -95,13 +95,12 @@
        * @param parent
        * @param pf
        * @param cld
  -     * @param columns
        * @param query
        * @param logger
        */
  -    public SqlSelectStatement(SqlQueryStatement parent, Platform pf, ClassDescriptor cld,
String[] columns, Query query, Logger logger)
  +    public SqlSelectStatement(SqlQueryStatement parent, Platform pf, ClassDescriptor cld,
Query query, Logger logger)
       {
  -        super(parent, pf, cld, columns, query, logger);
  +        super(parent, pf, cld, query, logger);
       }
   
       /**
  @@ -177,11 +176,15 @@
           Query query = getQuery();
           boolean first = true;
           List orderByFields = null;
  -        /** the column numbers used in ORDER BY clause  */
           int[] orderByColumnNumbers = null;
  -        String[] columns = getColumns();
  +        String[] columns = null;
           Iterator it = getJoinTreeToCriteria().entrySet().iterator();
   
  +        if (query instanceof ReportQuery)
  +        {
  +            columns = ((ReportQuery)query).getColumns();
  +        }
  +        
           while (it.hasNext())
           {
               Map.Entry entry = (Map.Entry) it.next();
  
  
  
  1.12      +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlDeleteByQuery.java
  
  Index: SqlDeleteByQuery.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlDeleteByQuery.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SqlDeleteByQuery.java	2 Aug 2003 08:27:22 -0000	1.11
  +++ SqlDeleteByQuery.java	14 Feb 2004 19:36:53 -0000	1.12
  @@ -77,7 +77,7 @@
   	 */
   	public SqlDeleteByQuery(Platform pf, ClassDescriptor cld, Query query, Logger logger)
   	{
  -		super(pf, cld, null, query, logger);
  +		super(pf, cld, query, logger);
   	}
   
   	/**
  
  
  

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