Package com.groiss.store
Class Nil
java.lang.Object
com.groiss.store.Nil
This class can be used to shrink wrap potential null values together with an
appropriate SQL type (c.f.
Example:
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 Summary
-
Method Details
-
getValue
- Returns:
- the value
-
getSqltype
public int getSqltype()- Returns:
- the sqltype
-
wrap
Wrap up a value and an appropriate sqltype (fromTypes
)- Parameters:
value
- the value to be wrapped (can be null)sqltype
- the type to use, if the value is null- Returns:
- the wrapper
-