Class Nil

java.lang.Object
com.groiss.store.Nil

public class Nil extends Object
This class can be used to shrink wrap potential null values together with an appropriate SQL type (c.f. Types.
Example:
 Date d1 = ClockUtil.nowDate(), d2 = null;
 Store.getInstance().executeStatement(
   "update t set d1=?, d2=? where oid = ?",
   Nil.wrap(d1, Types.TIMESTAMP), Nil.wrap(d2,Types.TIMESTAMP), oid); 
Can be used in value lists of inserts and in "set column = value" assignments of update statements. Note that usage for parameters in the where clause is not advisable since this will not yield the intended results because of the three valued logic in SQL (see NullExpression for this).
  • Method Details

    • getValue

      public Object getValue()
      Returns:
      the value
    • getSqltype

      public int getSqltype()
      Returns:
      the sqltype
    • wrap

      public static Nil wrap(Object value, int sqltype)
      Wrap up a value and an appropriate sqltype (from Types)
      Parameters:
      value - the value to be wrapped (can be null)
      sqltype - the type to use, if the value is null
      Returns:
      the wrapper