com.groiss.store
Class Nil

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

public class Nil
extends java.lang.Object

This class can be used to shrink wrap potential null values together with an appropriate SQL type (c.f. Types.
Example:

 Date d1 = new Date(), d2 = null;
 ServiceLocator.getStore().executeStatement(
   "update t set d1=?, d2=? where oid = ?",
   new Object[]{Nil.wrap(d1, Types.TIMESTAMP), Nil.wrap(d2,Types.TIMESTAMP), oid}); 
Can be used in value lists of inserts and 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.


Method Summary
 int getSqltype()
           
 java.lang.Object getValue()
           
static Nil wrap(java.lang.Object value, int sqltype)
          Wrap up a value and an appropriate sqltype (from Types)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getValue

public java.lang.Object getValue()
Returns:
the value

getSqltype

public int getSqltype()
Returns:
the sqltype

wrap

public static Nil wrap(java.lang.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


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.