Class DataValueFactoryImpl
- java.lang.Object
-
- org.apache.derby.iapi.types.DataValueFactoryImpl
-
- All Implemented Interfaces:
ModuleControl
,DataValueFactory
public final class DataValueFactoryImpl extends java.lang.Object implements DataValueFactory, ModuleControl
Core implementation of DataValueFactory.- See Also:
DataValueFactory
-
-
Field Summary
Fields Modifier and Type Field Description private java.text.RuleBasedCollator
collatorForCharacterTypes
private java.util.Locale
databaseLocale
private LocaleFinder
localeFinder
-
Constructor Summary
Constructors Constructor Description DataValueFactoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
boot(boolean create, java.util.Properties properties)
Boot this module with the given properties.BitDataValue
getBitDataValue(byte[] value)
Get a SQL bit with the given value.BitDataValue
getBitDataValue(byte[] value, BitDataValue previous)
BitDataValue
getBlobDataValue(byte[] value, BitDataValue previous)
Get a SQL Blob with the given value.BitDataValue
getBlobDataValue(java.sql.Blob value, BitDataValue previous)
Get a SQL Blob with the given value.java.text.RuleBasedCollator
getCharacterCollator(int collationType)
Return the RuleBasedCollator depending on the collation type.StringDataValue
getCharDataValue(java.lang.String value)
Get a new SQLChar object to represent a SQL CHAR (UCS_BASIC) with the given value.StringDataValue
getCharDataValue(java.lang.String value, StringDataValue previous)
Get a SQLChar object to represent a SQL CHAR (UCS_BASIC with the given value.StringDataValue
getCharDataValue(java.lang.String value, StringDataValue previous, int collationType)
Return a StringDataValue to represent a SQL CHAR with the given collation re-using previous if not null.StringDataValue
getClobDataValue(java.lang.String value, StringDataValue previous)
Get a SQLClob object to represent a SQL CLOB (UCS_BASIC) with the given value.StringDataValue
getClobDataValue(java.lang.String value, StringDataValue previous, int collationType)
Return a StringDataValue to represent a SQL CLOB with the given collation re-using previous if not null.StringDataValue
getClobDataValue(java.sql.Clob value, StringDataValue previous)
Get a SQLClob object to represent a SQL CLOB (UCS_BASIC) with the given value.StringDataValue
getClobDataValue(java.sql.Clob value, StringDataValue previous, int collationType)
Get a StringDataValue to represent a SQL CLOB with the passed in collationType.(package private) static Context
getContext(java.lang.String contextID)
Privileged lookup of a Context.BooleanDataValue
getDataValue(boolean value, BooleanDataValue previous)
Get a SQL boolean with the given value.NumberDataValue
getDataValue(byte value, NumberDataValue previous)
Get a SQL TINYINT with the given value.NumberDataValue
getDataValue(char value, NumberDataValue previous)
Get a SQL int with a char value.NumberDataValue
getDataValue(double value, NumberDataValue previous)
Get a SQL double precision with the given value.NumberDataValue
getDataValue(float value, NumberDataValue previous)
Get a SQL real with the given value.NumberDataValue
getDataValue(int value, NumberDataValue previous)
Get a SQL int with the given value.NumberDataValue
getDataValue(long value, NumberDataValue previous)
Get a SQL bigint with the given value.NumberDataValue
getDataValue(short value, NumberDataValue previous)
Get a SQL SMALLINT with the given value.BooleanDataValue
getDataValue(java.lang.Boolean value, BooleanDataValue previous)
Get a SQL boolean with the given value.NumberDataValue
getDataValue(java.lang.Byte value, NumberDataValue previous)
Get a SQL TINYINT with the given value.NumberDataValue
getDataValue(java.lang.Double value, NumberDataValue previous)
Get a SQL double precision with the given value.NumberDataValue
getDataValue(java.lang.Float value, NumberDataValue previous)
Get a SQL real with the given value.NumberDataValue
getDataValue(java.lang.Integer value, NumberDataValue previous)
Get a SQL int with the given value.NumberDataValue
getDataValue(java.lang.Long value, NumberDataValue previous)
Get a SQL bigint with the given value.UserDataValue
getDataValue(java.lang.Object value, UserDataValue previous)
Get a User-defined data value with the given value and type name.NumberDataValue
getDataValue(java.lang.Short value, NumberDataValue previous)
Get a SQL smallint with the given value.DateTimeDataValue
getDataValue(java.sql.Date value, DateTimeDataValue previous)
Get a SQL date with the given value.DateTimeDataValue
getDataValue(java.sql.Time value, DateTimeDataValue previous)
Get a SQL time with the given value.DateTimeDataValue
getDataValue(java.sql.Timestamp value, DateTimeDataValue previous)
Get a SQL timestamp with the given value.RefDataValue
getDataValue(RowLocation value, RefDataValue previous)
Get a RefDataValue with the given value.DateTimeDataValue
getDate(DataValueDescriptor operand)
Implement the date SQL function: construct a SQL date from a string, number, or timestamp.DateTimeDataValue
getDateValue(java.lang.String dateStr, boolean isJdbcEscape)
NumberDataValue
getDecimalDataValue(java.lang.Number value, NumberDataValue previous)
Get a SQL DECIMAL with the given value.private LocaleFinder
getLocaleFinder()
BitDataValue
getLongVarbitDataValue(byte[] value, BitDataValue previous)
Get a SQL Long Bit Varying with the given value.StringDataValue
getLongvarcharDataValue(java.lang.String value)
Get a SQL long varchar with the given value.StringDataValue
getLongvarcharDataValue(java.lang.String value, StringDataValue previous)
Get a SQLLongvarchar object to represent a SQL LONG VARCHAR (UCS_BASIC) with the given value.StringDataValue
getLongvarcharDataValue(java.lang.String value, StringDataValue previous, int collationType)
Return a StringDataValue to represent a SQL LONG VARCHAR with the given collation re-using previous if not null.private static ModuleFactory
getMonitor()
Privileged Monitor lookup.DataValueDescriptor
getNull(int formatId, int collationType)
Return an object based on the format id and collation type.BitDataValue
getNullBit(BitDataValue dataValue)
Get a SQL Bit with a SQL null value.BitDataValue
getNullBlob(BitDataValue dataValue)
Get a SQL Blob with a SQL null value.BooleanDataValue
getNullBoolean(BooleanDataValue dataValue)
Get a SQL boolean with a SQL null value.NumberDataValue
getNullByte(NumberDataValue dataValue)
Get a SQL tinyint with a SQL null value.StringDataValue
getNullChar(StringDataValue dataValue)
Get a SQL CHAR (UCS_BASIC) with a SQL null value.StringDataValue
getNullChar(StringDataValue previous, int collationType)
Get a SQL CHAR set to NULL with collation set to collationType.StringDataValue
getNullClob(StringDataValue dataValue)
Get a SQL CLOB (UCS_BASIC) with a SQL null value.StringDataValue
getNullClob(StringDataValue previous, int collationType)
Get a SQL CLOB set to NULL with collation set to collationType.DateTimeDataValue
getNullDate(DateTimeDataValue dataValue)
Get a SQL date with a SQL null value.NumberDataValue
getNullDecimal(NumberDataValue dataValue)
Get a SQL Decimal/Numeric with a SQL null value.NumberDataValue
getNullDouble(NumberDataValue dataValue)
Get a SQL double with a SQL null value.static DataValueDescriptor
getNullDVDWithUCS_BASICcollation(int formatId)
This method will return a DVD based on the formatId.NumberDataValue
getNullFloat(NumberDataValue dataValue)
Get a SQL float with a SQL null value.NumberDataValue
getNullInteger(NumberDataValue dataValue)
Get a SQL int with a SQL null value.NumberDataValue
getNullLong(NumberDataValue dataValue)
Get a SQL bigint with a SQL null value.BitDataValue
getNullLongVarbit(BitDataValue dataValue)
Get a SQL Long Bit Varying with a SQL null value.StringDataValue
getNullLongvarchar(StringDataValue dataValue)
Get a SQL LONG VARCHAR (UCS_BASIC) with a SQL null value.StringDataValue
getNullLongvarchar(StringDataValue previous, int collationType)
Get a SQL LONG VARCHAR set to NULL with collation set to collationType.UserDataValue
getNullObject(UserDataValue dataValue)
Get a User-defined data value with a SQL null value.RefDataValue
getNullRef(RefDataValue dataValue)
Get a RefDataValue with a SQL null value.NumberDataValue
getNullShort(NumberDataValue dataValue)
Get a SQL smallint with a SQL null value.DateTimeDataValue
getNullTime(DateTimeDataValue dataValue)
Get a SQL time with a SQL null value.DateTimeDataValue
getNullTimestamp(DateTimeDataValue dataValue)
Get a SQL timestamp with a SQL null value.BitDataValue
getNullVarbit(BitDataValue dataValue)
Get a SQL Bit Varying with a SQL null value.StringDataValue
getNullVarchar(StringDataValue dataValue)
Get a SQL VARCHAR (UCS_BASIC) with a SQL null value.StringDataValue
getNullVarchar(StringDataValue previous, int collationType)
Get a SQL VARCHAR set to NULL with collation set to collationType.XMLDataValue
getNullXML(XMLDataValue dataValue)
getNullXML: Get an XML with a SQL null value.DateTimeDataValue
getTimestamp(DataValueDescriptor operand)
Implement the timestamp SQL function: construct a SQL timestamp from a string, or timestamp.DateTimeDataValue
getTimestamp(DataValueDescriptor date, DataValueDescriptor time)
Construct a SQL timestamp from a date and time.DateTimeDataValue
getTimestampValue(java.lang.String timestampStr, boolean isJdbcEscape)
DateTimeDataValue
getTimeValue(java.lang.String timeStr, boolean isJdbcEscape)
BitDataValue
getVarbitDataValue(byte[] value, BitDataValue previous)
Get a SQL bit with the given value.StringDataValue
getVarcharDataValue(java.lang.String value)
Get a SQL varchar with the given value.StringDataValue
getVarcharDataValue(java.lang.String value, StringDataValue previous)
Get a SQLVarhar object to represent a SQL VARCHAR (UCS_BASIC) with the given value.StringDataValue
getVarcharDataValue(java.lang.String value, StringDataValue previous, int collationType)
Return a StringDataValue to represent a SQL VARCHAR with the given collation re-using previous if not null.XMLDataValue
getXMLDataValue(XMLDataValue previous)
getXMLDataValue: Get a null XML value.void
stop()
Stop the module.private java.text.RuleBasedCollator
verifyCollatorSupport(int strength)
Verify that JVM has support for the Collator for the database's locale.
-
-
-
Field Detail
-
localeFinder
private LocaleFinder localeFinder
-
databaseLocale
private java.util.Locale databaseLocale
-
collatorForCharacterTypes
private java.text.RuleBasedCollator collatorForCharacterTypes
-
-
Method Detail
-
boot
public void boot(boolean create, java.util.Properties properties) throws StandardException
Description copied from interface:ModuleControl
Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned.An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.
When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by Derby code, and thus must not be modified by Derby code.When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.
Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.
- Specified by:
boot
in interfaceModuleControl
- Throws:
StandardException
- Module cannot be started.- See Also:
Monitor
,ModuleFactory
-
stop
public void stop()
Description copied from interface:ModuleControl
Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.- Specified by:
stop
in interfaceModuleControl
- See Also:
Monitor
,ModuleFactory
-
getDataValue
public NumberDataValue getDataValue(int value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL int with the given value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- See Also:
DataValueFactory.getDataValue(java.lang.Integer, org.apache.derby.iapi.types.NumberDataValue)
-
getDataValue
public NumberDataValue getDataValue(java.lang.Integer value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL int with the given value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(char value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL int with a char value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(short value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL SMALLINT with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(java.lang.Short value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL smallint with the given value. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(byte value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL TINYINT with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(java.lang.Byte value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL TINYINT with the given value. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(long value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL bigint with the given value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(java.lang.Long value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL bigint with the given value. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(float value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL real with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getDataValue
public NumberDataValue getDataValue(java.lang.Float value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL real with the given value. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public NumberDataValue getDataValue(double value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL double precision with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getDataValue
public NumberDataValue getDataValue(java.lang.Double value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL double precision with the given value. A null argument means a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getDecimalDataValue
public final NumberDataValue getDecimalDataValue(java.lang.Number value, NumberDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL DECIMAL with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getDecimalDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getDataValue
public BooleanDataValue getDataValue(boolean value, BooleanDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL boolean with the given value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public BooleanDataValue getDataValue(java.lang.Boolean value, BooleanDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL boolean with the given value. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getBitDataValue
public BitDataValue getBitDataValue(byte[] value) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL bit with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getBitDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getBitDataValue
public BitDataValue getBitDataValue(byte[] value, BitDataValue previous) throws StandardException
- Specified by:
getBitDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getVarbitDataValue
public BitDataValue getVarbitDataValue(byte[] value, BitDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL bit with the given value. Uses the previous value, if non-null, as the data holder to return.- Specified by:
getVarbitDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getLongVarbitDataValue
public BitDataValue getLongVarbitDataValue(byte[] value, BitDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Long Bit Varying with the given value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getLongVarbitDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getBlobDataValue
public BitDataValue getBlobDataValue(byte[] value, BitDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Blob with the given value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getBlobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getBlobDataValue
public BitDataValue getBlobDataValue(java.sql.Blob value, BitDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Blob with the given value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getBlobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getCharDataValue
public StringDataValue getCharDataValue(java.lang.String value)
Description copied from interface:DataValueFactory
Get a new SQLChar object to represent a SQL CHAR (UCS_BASIC) with the given value. A null argument means get a SQL NULL value.- Specified by:
getCharDataValue
in interfaceDataValueFactory
-
getCharDataValue
public StringDataValue getCharDataValue(java.lang.String value, StringDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQLChar object to represent a SQL CHAR (UCS_BASIC with the given value. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new SQLChar will be created and set to the value.- Specified by:
getCharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getCharDataValue
public StringDataValue getCharDataValue(java.lang.String value, StringDataValue previous, int collationType) throws StandardException
Return a StringDataValue to represent a SQL CHAR with the given collation re-using previous if not null.- Specified by:
getCharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getVarcharDataValue
public StringDataValue getVarcharDataValue(java.lang.String value)
Description copied from interface:DataValueFactory
Get a SQL varchar with the given value. A null argument means get a SQL null value.- Specified by:
getVarcharDataValue
in interfaceDataValueFactory
-
getVarcharDataValue
public StringDataValue getVarcharDataValue(java.lang.String value, StringDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQLVarhar object to represent a SQL VARCHAR (UCS_BASIC) with the given value. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new SQLVarchar will be created and set to the value.- Specified by:
getVarcharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getVarcharDataValue
public StringDataValue getVarcharDataValue(java.lang.String value, StringDataValue previous, int collationType) throws StandardException
Return a StringDataValue to represent a SQL VARCHAR with the given collation re-using previous if not null.- Specified by:
getVarcharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getLongvarcharDataValue
public StringDataValue getLongvarcharDataValue(java.lang.String value)
Description copied from interface:DataValueFactory
Get a SQL long varchar with the given value. A null argument means get a SQL null value.- Specified by:
getLongvarcharDataValue
in interfaceDataValueFactory
-
getLongvarcharDataValue
public StringDataValue getLongvarcharDataValue(java.lang.String value, StringDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQLLongvarchar object to represent a SQL LONG VARCHAR (UCS_BASIC) with the given value. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new SQLLongvarchar will be created and set to the value.- Specified by:
getLongvarcharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getLongvarcharDataValue
public StringDataValue getLongvarcharDataValue(java.lang.String value, StringDataValue previous, int collationType) throws StandardException
Return a StringDataValue to represent a SQL LONG VARCHAR with the given collation re-using previous if not null.- Specified by:
getLongvarcharDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getClobDataValue
public StringDataValue getClobDataValue(java.lang.String value, StringDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQLClob object to represent a SQL CLOB (UCS_BASIC) with the given value. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new SQLLongvarchar will be created and set to the value.- Specified by:
getClobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getClobDataValue
public StringDataValue getClobDataValue(java.sql.Clob value, StringDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQLClob object to represent a SQL CLOB (UCS_BASIC) with the given value. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new SQLLongvarchar will be created and set to the value.- Specified by:
getClobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getClobDataValue
public StringDataValue getClobDataValue(java.sql.Clob value, StringDataValue previous, int collationType) throws StandardException
Description copied from interface:DataValueFactory
Get a StringDataValue to represent a SQL CLOB with the passed in collationType. A null argument means get a SQL NULL value. If previous is not null (Java reference) then it will be set to the value passed in and returned, otherwise a new StringDataValue will be created and set to the value. If collationType is equal to StringDataValue.COLLATION_TYPE_UCS_BASIC then the call is the equivalent of the overload without collationType.- Specified by:
getClobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getClobDataValue
public StringDataValue getClobDataValue(java.lang.String value, StringDataValue previous, int collationType) throws StandardException
Return a StringDataValue to represent a SQL CLOB with the given collation re-using previous if not null.- Specified by:
getClobDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public DateTimeDataValue getDataValue(java.sql.Date value, DateTimeDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL date with the given value. A null argument means get a SQL null value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public DateTimeDataValue getDataValue(java.sql.Time value, DateTimeDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL time with the given value. A null argument means get a SQL null value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDataValue
public DateTimeDataValue getDataValue(java.sql.Timestamp value, DateTimeDataValue previous) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL timestamp with the given value. A null argument means get a SQL null value. The second arg re-uses the previous value, if non-null, as the data holder to return.- Specified by:
getDataValue
in interfaceDataValueFactory
- Throws:
StandardException
-
getDate
public DateTimeDataValue getDate(DataValueDescriptor operand) throws StandardException
Implement the date SQL function: construct a SQL date from a string, number, or timestamp.- Specified by:
getDate
in interfaceDataValueFactory
- Parameters:
operand
- Must be a date, a number, or a string convertible to a date.- Returns:
- the corresponding date value
- Throws:
StandardException
- standard error policy
-
getTimestamp
public DateTimeDataValue getTimestamp(DataValueDescriptor operand) throws StandardException
Implement the timestamp SQL function: construct a SQL timestamp from a string, or timestamp.- Specified by:
getTimestamp
in interfaceDataValueFactory
- Parameters:
operand
- Must be a timestamp or a string convertible to a timestamp.- Throws:
StandardException
- standard error policy
-
getTimestamp
public DateTimeDataValue getTimestamp(DataValueDescriptor date, DataValueDescriptor time) throws StandardException
Description copied from interface:DataValueFactory
Construct a SQL timestamp from a date and time.- Specified by:
getTimestamp
in interfaceDataValueFactory
- Parameters:
date
- Must be convertible to a date.time
- Must be convertible to a time.- Throws:
StandardException
-
getDataValue
public UserDataValue getDataValue(java.lang.Object value, UserDataValue previous)
Description copied from interface:DataValueFactory
Get a User-defined data value with the given value and type name. A null argument means get a SQL null value. The second arg uses the previous value (if non-null) hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
-
getDataValue
public RefDataValue getDataValue(RowLocation value, RefDataValue previous)
Description copied from interface:DataValueFactory
Get a RefDataValue with the given value. A null argument means get a SQL null value. Uses the previous value (if non-null) to hold the return value.- Specified by:
getDataValue
in interfaceDataValueFactory
-
getNullInteger
public NumberDataValue getNullInteger(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL int with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullInteger
in interfaceDataValueFactory
-
getNullShort
public NumberDataValue getNullShort(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL smallint with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullShort
in interfaceDataValueFactory
-
getNullLong
public NumberDataValue getNullLong(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL bigint with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullLong
in interfaceDataValueFactory
-
getNullByte
public NumberDataValue getNullByte(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL tinyint with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullByte
in interfaceDataValueFactory
-
getNullFloat
public NumberDataValue getNullFloat(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL float with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullFloat
in interfaceDataValueFactory
-
getNullDouble
public NumberDataValue getNullDouble(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL double with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullDouble
in interfaceDataValueFactory
-
getNullDecimal
public final NumberDataValue getNullDecimal(NumberDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL Decimal/Numeric with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullDecimal
in interfaceDataValueFactory
-
getNullBoolean
public BooleanDataValue getNullBoolean(BooleanDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL boolean with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullBoolean
in interfaceDataValueFactory
-
getNullBit
public BitDataValue getNullBit(BitDataValue dataValue) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Bit with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullBit
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getNullVarbit
public BitDataValue getNullVarbit(BitDataValue dataValue) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Bit Varying with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullVarbit
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getNullLongVarbit
public BitDataValue getNullLongVarbit(BitDataValue dataValue) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Long Bit Varying with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullLongVarbit
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getNullBlob
public BitDataValue getNullBlob(BitDataValue dataValue) throws StandardException
Description copied from interface:DataValueFactory
Get a SQL Blob with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullBlob
in interfaceDataValueFactory
- Throws:
StandardException
- Thrown on error
-
getNullChar
public StringDataValue getNullChar(StringDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL CHAR (UCS_BASIC) with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullChar
in interfaceDataValueFactory
-
getNullChar
public StringDataValue getNullChar(StringDataValue previous, int collationType) throws StandardException
Get a SQL CHAR set to NULL with collation set to collationType. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullChar
in interfaceDataValueFactory
- Throws:
StandardException
-
getNullVarchar
public StringDataValue getNullVarchar(StringDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL VARCHAR (UCS_BASIC) with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullVarchar
in interfaceDataValueFactory
-
getNullVarchar
public StringDataValue getNullVarchar(StringDataValue previous, int collationType) throws StandardException
Get a SQL VARCHAR set to NULL with collation set to collationType. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullVarchar
in interfaceDataValueFactory
- Throws:
StandardException
-
getNullLongvarchar
public StringDataValue getNullLongvarchar(StringDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL LONG VARCHAR (UCS_BASIC) with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullLongvarchar
in interfaceDataValueFactory
-
getNullLongvarchar
public StringDataValue getNullLongvarchar(StringDataValue previous, int collationType) throws StandardException
Get a SQL LONG VARCHAR set to NULL with collation set to collationType. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullLongvarchar
in interfaceDataValueFactory
- Throws:
StandardException
-
getNullClob
public StringDataValue getNullClob(StringDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL CLOB (UCS_BASIC) with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullClob
in interfaceDataValueFactory
-
getNullClob
public StringDataValue getNullClob(StringDataValue previous, int collationType) throws StandardException
Get a SQL CLOB set to NULL with collation set to collationType. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullClob
in interfaceDataValueFactory
- Throws:
StandardException
-
getNullObject
public UserDataValue getNullObject(UserDataValue dataValue)
Description copied from interface:DataValueFactory
Get a User-defined data value with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullObject
in interfaceDataValueFactory
-
getNullRef
public RefDataValue getNullRef(RefDataValue dataValue)
Description copied from interface:DataValueFactory
Get a RefDataValue with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullRef
in interfaceDataValueFactory
-
getNullDate
public DateTimeDataValue getNullDate(DateTimeDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL date with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullDate
in interfaceDataValueFactory
-
getNullTime
public DateTimeDataValue getNullTime(DateTimeDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL time with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullTime
in interfaceDataValueFactory
-
getNullTimestamp
public DateTimeDataValue getNullTimestamp(DateTimeDataValue dataValue)
Description copied from interface:DataValueFactory
Get a SQL timestamp with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullTimestamp
in interfaceDataValueFactory
-
getDateValue
public DateTimeDataValue getDateValue(java.lang.String dateStr, boolean isJdbcEscape) throws StandardException
- Specified by:
getDateValue
in interfaceDataValueFactory
- Parameters:
dateStr
- A date in one of the DB2 standard date formats or the local format.isJdbcEscape
- If true then the timestamp must be in the JDBC timestamp escape format, otherwise it must be in the DB2 timestamp format.- Returns:
- A DateTimeDataValue
- Throws:
StandardException
- if the syntax is invalid or the date is out of range.
-
getTimeValue
public DateTimeDataValue getTimeValue(java.lang.String timeStr, boolean isJdbcEscape) throws StandardException
- Specified by:
getTimeValue
in interfaceDataValueFactory
- Parameters:
timeStr
- A date in one of the DB2 standard time formats or the local format.isJdbcEscape
- If true then the timestamp must be in the JDBC time escape format, otherwise it must be in the DB2 time format.- Returns:
- A DateTimeDataValue
- Throws:
StandardException
- if the syntax is invalid or the time is out of range.
-
getTimestampValue
public DateTimeDataValue getTimestampValue(java.lang.String timestampStr, boolean isJdbcEscape) throws StandardException
- Specified by:
getTimestampValue
in interfaceDataValueFactory
- Parameters:
timestampStr
- A time in string format.isJdbcEscape
- If true then the time must be in the JDBC time escape format, otherwise it must be in the DB2 time format.- Returns:
- An internal timestamp
- Throws:
StandardException
- if the syntax is invalid or the timestamp is out of range.
-
getXMLDataValue
public XMLDataValue getXMLDataValue(XMLDataValue previous) throws StandardException
getXMLDataValue: Get a null XML value. If a non-null XMLDataValue is received then re-use that instance, otherwise create a new one.- Specified by:
getXMLDataValue
in interfaceDataValueFactory
- Parameters:
previous
- An XMLDataValue instance to re-use.- Returns:
- An XMLDataValue instance corresponding to a NULL value. If an XMLDataValue was received, the returned XMLDataValue is the same instance as the one received, but the actual data has been set to a SQL null value.
- Throws:
StandardException
- Thrown on error
-
getNullXML
public XMLDataValue getNullXML(XMLDataValue dataValue)
getNullXML: Get an XML with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.- Specified by:
getNullXML
in interfaceDataValueFactory
- Parameters:
dataValue
- An XMLDataValue instance to re-use.- Returns:
- An XMLDataValue instance corresponding to a NULL value. If an XMLDataValue was received, the returned XMLDataValue is the same instance as the one received, but the actual data has been set to null.
-
getCharacterCollator
public java.text.RuleBasedCollator getCharacterCollator(int collationType) throws StandardException
Description copied from interface:DataValueFactory
Return the RuleBasedCollator depending on the collation type. If the collation type is UCS_BASIC, then this method will return null. If the collation type is TERRITORY_BASED then the return value will be the Collator derived from the database's locale. If this is the first time Collator is being requested for a database with collation type of TERRITORY_BASED, then we will check to make sure that JVM supports the Collator for the database's locale. If not, we will throw an exception This method will be used when Store code is trying to create a DVD template row using the format ids and the collation types. First a DVD will be constructed just using format id. Then if the DVD is of type StringDataValue, then it will call this method to get the Collator object. If the Collator object returned from this method is null then we will continue to use the default DVDs for the character types, ie the DVDs which just use the JVM's default collation. (This is why, we want this method to return null if we are dealing with UCS_BASIC.) If the Collator object returned is not null, then we will construct collation sensitive DVD for the character types. So, the return value of this method determines if we are going to create a character DVD with default collation or with custom collation.- Specified by:
getCharacterCollator
in interfaceDataValueFactory
- Parameters:
collationType
- This will be UCS_BASIC or TERRITORY_BASED- Returns:
- Collator null if the collation type is UCS_BASIC. Collator based on territory if the collation type is TERRITORY_BASED
- Throws:
StandardException
- See Also:
DataValueFactory.getCharacterCollator(int)
-
verifyCollatorSupport
private java.text.RuleBasedCollator verifyCollatorSupport(int strength) throws StandardException
Verify that JVM has support for the Collator for the database's locale.- Parameters:
strength
- Collator strength or -1 for locale default.- Returns:
- Collator for database's locale
- Throws:
StandardException
- if JVM does not have support for Collator
-
getNull
public DataValueDescriptor getNull(int formatId, int collationType) throws StandardException
Description copied from interface:DataValueFactory
Return an object based on the format id and collation type. For format ids which do not correspond to character types, a format id is sufficient to get the right DVD. But for character types, Derby uses same format id for collation sensitive character types and for character types that use the default JVM collation. To get the correct DVD for character types, we need to know the collation type. Using collation type, we will determine if we need to construct collation sensitive DVD and associate the correct RuleBasedCollator with such DVDs.- Specified by:
getNull
in interfaceDataValueFactory
- Parameters:
formatId
- Format id for the DVDcollationType
- this is meaningful only for character types.- Returns:
- DataValueDescriptor which will be constructed using the passed parameters
- Throws:
StandardException
- See Also:
DataValueFactory.getNull(int, int)
-
getNullDVDWithUCS_BASICcollation
public static DataValueDescriptor getNullDVDWithUCS_BASICcollation(int formatId)
This method will return a DVD based on the formatId. It doesn't take into account the collation that should be associated with collation sensitive DVDs, which are all the character type DVDs. Such DVDs returned from this method have default UCS_BASIC collation associated with them. If collation associated should be territory based, then that needs to be handled by the caller of this method. An example of such code in the caller can be seen in DataValueFactory.getNull method.- Parameters:
formatId
- Return a DVD based on the format id- Returns:
- DataValueDescriptor with default collation of UCS_BASIC
-
getLocaleFinder
private LocaleFinder getLocaleFinder()
-
getContext
static Context getContext(java.lang.String contextID)
Privileged lookup of a Context. Package protected so that user code can't call this entry point.
-
getMonitor
private static ModuleFactory getMonitor()
Privileged Monitor lookup. Must be private so that user code can't call this entry point.
-
-