Data Grid : SQLSupport  createWhereFrament and createWhereClause not consistent 
with createOrderBy
--------------------------------------------------------------------------------------------------

         Key: BEEHIVE-411
         URL: http://issues.apache.org/jira/browse/BEEHIVE-411
     Project: Beehive
        Type: Bug
  Components: NetUI  
    Versions: V1Beta    
    Reporter: Scott Symmank
 Assigned to: Eddie O'Neil 
    Priority: Minor
     Fix For: V1Beta


 Data Grid : SQLSupport  createWhereFrament and createWhereClause not 
consistent with createOrderBy

The orderBy and where methods in SQLSupport are inconsistent:
in createOrderByFragment you get the 'ORDER BY', but 
in createWhereFragment you don't get the 'WHERE'

Test Case:
put the following in a pageflow with a datagrid.
import org.apache.beehive.netui.databinding.datagrid.runtime.sql.SQLSupport;
System.err.println(SQLSupport.getInstance().createOrderByFragment(sorts));
System.err.println(SQLSupport.getInstance().createOrderByClause(sorts));
System.err.println(SQLSupport.getInstance().createWhereFragment(filters));
System.err.println(SQLSupport.getInstance().createWhereClause(filters));

Expected Results:  

1. ORDER BY
2. does not have ORDER BY
3. WHERE
4. does not have WHERE

Actual Results: 

1. ORDER BY
2. does not have ORDER BY
3. does not have WHERE
4. WHERE

WORKAROUND:
call the other one.

<SQLSupport.java>
    public final String createOrderByFragment(List<Sort> sorts) {
        if(sorts == null || sorts.size() == 0)
            return EMPTY_STRING;

        StringBuilder sql = new StringBuilder();
        sql.append("ORDER BY ");
        internalCreateOrderByFragment(sql, sorts);
        return sql.toString();
    }

    public final String createOrderByClause(List<Sort> sorts) {
        if(sorts == null || sorts.size() == 0)
            return EMPTY_STRING;

        StringBuilder sql = new StringBuilder(64);
        internalCreateOrderByFragment(sql, sorts);
        return sql.toString();
    }

    public String createWhereClause(List<Filter> filters) {
        if(filters == null || filters.size() == 0)
            return EMPTY_STRING;

        StringBuilder sql = new StringBuilder();
        sql.append("WHERE ");
        internalCreateWhereFragment(sql, filters);
        return sql.toString();
    }

    public String createWhereFragment(List<Filter> filters) {
        if(filters == null || filters.size() == 0)
            return EMPTY_STRING;

        StringBuilder sql = new StringBuilder(64);
        internalCreateWhereFragment(sql, filters);
        return sql.toString();
    }
</SQLSupport.java>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to