mikeh       01/06/26 15:05:16

  Modified:    proposals/eric/statement BaseSql.java
  Log:
  added getOrderBy(String fieldName) and "safe" getEquals() methods
  that deal with a null right parameter
  
  Revision  Changes    Path
  1.6       +52 -1     jakarta-turbine/proposals/eric/statement/BaseSql.java
  
  Index: BaseSql.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/proposals/eric/statement/BaseSql.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BaseSql.java      2001/06/26 16:14:22     1.5
  +++ BaseSql.java      2001/06/26 22:05:16     1.6
  @@ -290,6 +290,26 @@
       }
   
       /**
  +     * If right is not null, constructs an equals comparison 
  +     * othwerise, construts a isNull comparison
  +     *
  +     * @param left String the left side of the comparison
  +     * @param right String the right side of the comparison
  +     * @return (<em>left</em>=<em>right</em>)
  +     */
  +    public String getSafeEquals(String left, String right)
  +    {
  +        if (right != null)
  +        {
  +            return getEquals(left, right);
  +        }
  +        else
  +        {
  +            return getIsNull(left);
  +        }
  +    }
  +
  +    /**
        * Constructs a logical comparison using the not equals operator.
        *
        * @param left String the left side of the comparison
  @@ -304,6 +324,26 @@
       }
   
       /**
  +     * If right is not null, constructs a not equals comparison 
  +     * othwerise, construts a isNotNull comparison
  +     *
  +     * @param left String the left side of the comparison
  +     * @param right String the right side of the comparison
  +     * @return (<em>left</em>=<em>right</em>)
  +     */
  +    public String getSafeNotEquals(String left, String right)
  +    {
  +        if (right != null)
  +        {
  +            return getNotEquals(left, right);
  +        }
  +        else
  +        {
  +            return getIsNotNull(left);
  +        }
  +    }
  +
  +    /**
        * Constructs a logical comparison using the less than operator.
        *
        * @param left String the left side of the comparison
  @@ -669,11 +709,22 @@
        * Constructs an order by fragment.
        *
        * @param list List the list of items
  -     * @return ORDER BY <em>item1</em>, <em>item2</em>, ..., <em>itemN</em>
  +     * @return ORDER BY <em>item1</em>, ..., <em>itemN</em>
        */
       public String getOrderBy(List list)
       {
           return leftRightListConnector(ORDER_BY, EMPTY, list, COMMA);
  +    }
  +
  +    /**
  +     * Constructs an order by fragment.
  +     *
  +     * @param fieldName field name of the order by column 
  +     * @return ORDER BY <em>fieldName</em>
  +     */
  +    public String getOrderBy(String fieldName)
  +    {
  +        return leftMiddleRight(ORDER_BY, fieldName, EMPTY);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to