Uploaded image for project: 'Beehive'
  1. Beehive
  2. BEEHIVE-411

Data Grid : SQLSupport createWhereFrament and createWhereClause not consistent with createOrderBy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • V1Beta
    • V1Beta
    • NetUI
    • None

    Description

      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>

      Attachments

        Activity

          People

            njantz Nathan Jantz
            ssymmank Scott Symmank
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: