Beehive
  1. Beehive
  2. BEEHIVE-411

Data Grid : SQLSupport createWhereFrament and createWhereClause not consistent with createOrderBy

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: V1Beta
    • Fix Version/s: V1Beta
    • Component/s: NetUI
    • Labels:
      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>

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Nathan Jantz
            Reporter:
            Scott Symmank
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development