com.googlecode.jdbw.util
Class NullValue

java.lang.Object
  extended by com.googlecode.jdbw.util.NullValue
Direct Known Subclasses:
NullValue.Binary, NullValue.Decimal, NullValue.Double, NullValue.Integer, NullValue.String, NullValue.Timestamp

public class NullValue
extends Object

This class is a null value representation when dealing with SQL parameters. The reason why this is needed is that some database servers requires you to supply what 'type' of null (as in, is it a varchar null, an int null or something else) you are giving. Trying to assign null of a wrong type will give you an SQLException.

Since the Java null keyword has no type information, when you supply it to a JDBW class database method (for example, SQLWorker.query(...) or SQLExecutor.execute(...)) in the parameter list, type varchar will be associated with this null. If this is incompatible with your database server/table/column, you can instead of null pass in an instance of one of the subclasses of this class. There isn't a subclass for every conceivable datatype, but there should be one that is compatible with what you need.

Author:
Martin Berglund

Nested Class Summary
static class NullValue.Binary
          Represents a null binary value.
static class NullValue.Decimal
          Represents a null decimal value.
static class NullValue.Double
          Represents a null double value.
static class NullValue.Integer
          Represents a null integer value.
static class NullValue.String
          Represents a null varchar value.
static class NullValue.Timestamp
          Represents a null timestamp value.
 
Method Summary
static Object fromSqlType(int sqlType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromSqlType

public static Object fromSqlType(int sqlType)


Copyright © 2012. All Rights Reserved.