Package org.apache.derby.iapi.types
Interface StringDataValue
-
- All Superinterfaces:
ConcatableDataValue
,DataValueDescriptor
,java.io.Externalizable
,Formatable
,Orderable
,java.io.Serializable
,Storable
,TypedFormat
,VariableSizeDataValue
- All Known Implementing Classes:
CollatorSQLChar
,CollatorSQLClob
,CollatorSQLLongvarchar
,CollatorSQLVarchar
,SQLChar
,SQLClob
,SQLLongvarchar
,SQLVarchar
public interface StringDataValue extends ConcatableDataValue
-
-
Field Summary
Fields Modifier and Type Field Description static int
BOTH
static int
COLLATION_DERIVATION_EXPLICIT
static int
COLLATION_DERIVATION_IMPLICIT
static int
COLLATION_DERIVATION_NONE
For a character string type, the collation derivation should always be "explicit"(not possible in Derby 10.3), "implicit" or "none".static int
COLLATION_TYPE_TERRITORY_BASED
static int
COLLATION_TYPE_TERRITORY_BASED_IDENTICAL
static int
COLLATION_TYPE_TERRITORY_BASED_PRIMARY
static int
COLLATION_TYPE_TERRITORY_BASED_SECONDARY
static int
COLLATION_TYPE_TERRITORY_BASED_TERTIARY
static int
COLLATION_TYPE_UCS_BASIC
In Derby 10.3, it is possible to have database with one of the following two configurations 1)all the character columns will have a collation type of UCS_BASIC.static int
LEADING
static int
TRAILING
-
Fields inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
UNKNOWN_LOGICAL_LENGTH
-
Fields inherited from interface org.apache.derby.iapi.types.Orderable
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN
-
Fields inherited from interface org.apache.derby.iapi.types.VariableSizeDataValue
IGNORE_PRECISION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringDataValue
ansiTrim(int trimType, StringDataValue trimChar, StringDataValue result)
The SQL Ansi trim function.StringDataValue
concatenate(StringDataValue leftOperand, StringDataValue rightOperand, StringDataValue result)
The SQL concatenation '||' operator.char[]
getCharArray()
Get a char array.StreamHeaderGenerator
getStreamHeaderGenerator()
Returns the stream header generator for the string data value.CharacterStreamDescriptor
getStreamWithDescriptor()
Returns a descriptor for the input stream for this data value.StringDataValue
getValue(java.text.RuleBasedCollator collatorForComparison)
Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses).BooleanDataValue
like(DataValueDescriptor pattern)
The SQL like() function with out escape clause.BooleanDataValue
like(DataValueDescriptor pattern, DataValueDescriptor escape)
The SQL like() function WITH escape clause.NumberDataValue
locate(StringDataValue searchFrom, NumberDataValue start, NumberDataValue result)
Position in searchFrom of the first occurrence of this.value.StringDataValue
lower(StringDataValue result)
Convert the string to lower case.void
setStreamHeaderFormat(java.lang.Boolean usePreTenFiveHdrFormat)
Tells the data value descriptor which CLOB stream header format to use.void
setValue(java.sql.Clob value)
Stuff a StringDataValue with a Clob.StringDataValue
upper(StringDataValue result)
Convert the string to upper case.-
Methods inherited from interface org.apache.derby.iapi.types.ConcatableDataValue
charLength, substring
-
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
checkHostVariable, cloneHolder, cloneValue, coalesce, compare, compare, compare, compare, equals, estimateMemoryUsage, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLength, getLong, getNewNull, getObject, getShort, getStream, getString, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, readExternalFromArray, recycle, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, typePrecedence, typeToBigDecimal
-
Methods inherited from interface org.apache.derby.iapi.services.io.Storable
isNull, restoreToNull
-
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat
getTypeFormatId
-
Methods inherited from interface org.apache.derby.iapi.types.VariableSizeDataValue
setWidth
-
-
-
-
Field Detail
-
BOTH
static final int BOTH
- See Also:
- Constant Field Values
-
TRAILING
static final int TRAILING
- See Also:
- Constant Field Values
-
LEADING
static final int LEADING
- See Also:
- Constant Field Values
-
COLLATION_DERIVATION_NONE
static final int COLLATION_DERIVATION_NONE
For a character string type, the collation derivation should always be "explicit"(not possible in Derby 10.3), "implicit" or "none". We will start by setting it to "implicit" in TypeDescriptorImpl. At runtime, only character string types which are results of aggregate methods dealing with operands with different collation types should have a collation derivation of "none". All the other character string types should have their collation derivation set to "implicit".- See Also:
- Constant Field Values
-
COLLATION_DERIVATION_IMPLICIT
static final int COLLATION_DERIVATION_IMPLICIT
- See Also:
COLLATION_DERIVATION_NONE
, Constant Field Values
-
COLLATION_DERIVATION_EXPLICIT
static final int COLLATION_DERIVATION_EXPLICIT
- See Also:
COLLATION_DERIVATION_NONE
, Constant Field Values
-
COLLATION_TYPE_UCS_BASIC
static final int COLLATION_TYPE_UCS_BASIC
In Derby 10.3, it is possible to have database with one of the following two configurations 1)all the character columns will have a collation type of UCS_BASIC. This is same as what we do in Derby 10.2 release. 2)all the character string columns belonging to system tables will have collation type of UCS_BASIC but all the character string columns belonging to user tables will have collation type of TERRITORY_BASED. Data types will start with collation type defaulting to UCS_BASIC in TypeDescriptorImpl. This collation type of course makes sense for character string types only. It will be ignored for the rest of the types. If a character's collation type should be TERRITORY_BASED, then DTD.setCollationType can be called to change the default of UCS_BASIC. The collation types TERRITORY_BASED:PRIMARY through TERRITORY_BASED:IDENTICAL are variants of the TERRITORY_BASED type, with explicit collation strength.- See Also:
- Constant Field Values
-
COLLATION_TYPE_TERRITORY_BASED
static final int COLLATION_TYPE_TERRITORY_BASED
- See Also:
COLLATION_TYPE_UCS_BASIC
, Constant Field Values
-
COLLATION_TYPE_TERRITORY_BASED_PRIMARY
static final int COLLATION_TYPE_TERRITORY_BASED_PRIMARY
- See Also:
- Constant Field Values
-
COLLATION_TYPE_TERRITORY_BASED_SECONDARY
static final int COLLATION_TYPE_TERRITORY_BASED_SECONDARY
- See Also:
- Constant Field Values
-
COLLATION_TYPE_TERRITORY_BASED_TERTIARY
static final int COLLATION_TYPE_TERRITORY_BASED_TERTIARY
- See Also:
- Constant Field Values
-
COLLATION_TYPE_TERRITORY_BASED_IDENTICAL
static final int COLLATION_TYPE_TERRITORY_BASED_IDENTICAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
concatenate
StringDataValue concatenate(StringDataValue leftOperand, StringDataValue rightOperand, StringDataValue result) throws StandardException
The SQL concatenation '||' operator.- Parameters:
leftOperand
- String on the left hand side of '||'rightOperand
- String on the right hand side of '||'result
- The result of a previous call to this method, null if not called yet.- Returns:
- A ConcatableDataValue containing the result of the '||'
- Throws:
StandardException
- Thrown on error
-
like
BooleanDataValue like(DataValueDescriptor pattern) throws StandardException
The SQL like() function with out escape clause.- Parameters:
pattern
- the pattern to use- Returns:
- A BooleanDataValue containing the result of the like
- Throws:
StandardException
- Thrown on error
-
like
BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape) throws StandardException
The SQL like() function WITH escape clause.- Parameters:
pattern
- the pattern to useescape
- the escape character- Returns:
- A BooleanDataValue containing the result of the like
- Throws:
StandardException
- Thrown on error
-
ansiTrim
StringDataValue ansiTrim(int trimType, StringDataValue trimChar, StringDataValue result) throws StandardException
The SQL Ansi trim function.- Parameters:
trimType
- type of trim. Possible values areLEADING
,TRAILING
orBOTH
.trimChar
- The character to trim from thisresult
- The result of a previous call to this method, null if not called yet.- Returns:
- A StringDataValue containing the result of the trim().
- Throws:
StandardException
-
upper
StringDataValue upper(StringDataValue result) throws StandardException
Convert the string to upper case.- Parameters:
result
- The result (reusable - allocate if null).- Returns:
- The string converted to upper case.
- Throws:
StandardException
- Thrown on error
-
lower
StringDataValue lower(StringDataValue result) throws StandardException
Convert the string to lower case.- Parameters:
result
- The result (reusable - allocate if null).- Returns:
- The string converted to lower case.
- Throws:
StandardException
- Thrown on error
-
locate
NumberDataValue locate(StringDataValue searchFrom, NumberDataValue start, NumberDataValue result) throws StandardException
Position in searchFrom of the first occurrence of this.value. The search begins from position start. 0 is returned if searchFrom does not contain this.value. Position 1 is the first character in searchFrom.- Parameters:
searchFrom
- - The string to search fromstart
- - The position to search from in string searchFromresult
- - The object to return- Returns:
- The position in searchFrom the fist occurrence of this.value. 0 is returned if searchFrom does not contain this.value.
- Throws:
StandardException
- Thrown on error
-
getCharArray
char[] getCharArray() throws StandardException
Get a char array. Typically, this is a simple getter that is cheaper than getString() because we always need to create a char array when doing I/O. Use this instead of getString() where reasonable.WARNING: may return a character array that has spare characters at the end. MUST be used in conjunction with getLength() to be safe.
- Throws:
StandardException
- Thrown on error
-
getValue
StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses). Whether this method returns the base class or the subclass depends on the value of the RuleBasedCollator. If RuleBasedCollator is null, then the object returned would be baseclass otherwise it would be subcalss.
-
getStreamHeaderGenerator
StreamHeaderGenerator getStreamHeaderGenerator()
Returns the stream header generator for the string data value.The generator writes the correct header into the destination buffer or stream and also keeps track of whether appending an end-of-stream marker is required or not.
Note that the generator may fail to generate a header if there is no context at the time the header is asked for, and the mode hasn't been set explicitly.
- See Also:
setStreamHeaderFormat(java.lang.Boolean)
-
setStreamHeaderFormat
void setStreamHeaderFormat(java.lang.Boolean usePreTenFiveHdrFormat)
Tells the data value descriptor which CLOB stream header format to use.- Parameters:
usePreTenFiveHdrFormat
-true
if the database accessed is prior to version 10.5,false
if the version is 10.5 or newer, andnull
if unknown at this time
-
getStreamWithDescriptor
CharacterStreamDescriptor getStreamWithDescriptor() throws StandardException
Returns a descriptor for the input stream for this data value.The descriptor contains information about header data, current positions, length, whether the stream should be buffered or not, and if the stream is capable of repositioning itself.
- Returns:
- A descriptor for the stream, which includes a reference to the stream itself.
- Throws:
StandardException
- if obtaining the descriptor fails, or if the value isn't represented as a stream.
-
setValue
void setValue(java.sql.Clob value) throws StandardException
Stuff a StringDataValue with a Clob.- Specified by:
setValue
in interfaceDataValueDescriptor
- Parameters:
value
- The Clob value to set this DataValueDescriptor to- Throws:
StandardException
-
-