Top Fields Methods
org.apache.derby.iapi.types

public Interface StringDataValue

extends ConcatableDataValue
Known Direct Implementers
org.apache.derby.iapi.types.SQLChar
Imports
java.sql.Clob, org.apache.derby.shared.common.error.StandardException, java.text.RuleBasedCollator, org.apache.derby.iapi.jdbc.CharacterStreamDescriptor

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public 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".

public static final int
public static final int
public static final int
public static final int
public static final int
public 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.

public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public StringDataValue

Returns:

A StringDataValue containing the result of the trim().
ansiTrim
(int
type of trim. Possible values are LEADING, TRAILING or BOTH.
trimType
,
StringDataValue
The character to trim from this
trimChar
,
StringDataValue
The result of a previous call to this method, null if not called yet.
result
)

The SQL Ansi trim function.

public StringDataValue

Returns:

A ConcatableDataValue containing the result of the '||'
concatenate
(StringDataValue
String on the left hand side of '||'
leftOperand
,
StringDataValue
String on the right hand side of '||'
rightOperand
,
StringDataValue
The result of a previous call to this method, null if not called yet.
result
)

The SQL concatenation '||' operator.

public char[]
getCharArray()

Get a char array.

public StreamHeaderGenerator
getStreamHeaderGenerator()

Returns the stream header generator for the string data value.

public CharacterStreamDescriptor

Returns:

A descriptor for the stream, which includes a reference to the stream itself.
getStreamWithDescriptor
()

Returns a descriptor for the input stream for this data value.

public StringDataValue
getValue(RuleBasedCollator collatorForComparison)

Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses).

public BooleanDataValue

Returns:

A BooleanDataValue containing the result of the like
like
(DataValueDescriptor
the pattern to use
pattern
)

The SQL like() function with out escape clause.

public BooleanDataValue

Returns:

A BooleanDataValue containing the result of the like
like
(DataValueDescriptor
the pattern to use
pattern
,
DataValueDescriptor
the escape character
escape
)

The SQL like() function WITH escape clause.

public NumberDataValue

Returns:

The position in searchFrom the fist occurrence of this.value. 0 is returned if searchFrom does not contain this.value.
locate
(StringDataValue
- The string to search from
searchFrom
,
NumberDataValue
- The position to search from in string searchFrom
start
,
NumberDataValue
- The object to return
result
)

Position in searchFrom of the first occurrence of this.value.

public StringDataValue

Returns:

The string converted to lower case.
lower
(StringDataValue
The result (reusable - allocate if null).
result
)

Convert the string to lower case.

public void
setStreamHeaderFormat(Boolean
true if the database accessed is prior to version 10.5, false if the version is 10.5 or newer, and null if unknown at this time
usePreTenFiveHdrFormat
)

Tells the data value descriptor which CLOB stream header format to use.

public void
setValue(Clob
The Clob value to set this DataValueDescriptor to
value
)

Redeclares org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Stuff a StringDataValue with a Clob.

public StringDataValue

Returns:

The string converted to upper case.
upper
(StringDataValue
The result (reusable - allocate if null).
result
)

Convert the string to upper case.

Inherited from org.apache.derby.iapi.types.ConcatableDataValue:
charLengthsubstring

Field Detail

BOTHback to summary
public static final int BOTH
COLLATION_DERIVATION_EXPLICITback to summary
public static final int COLLATION_DERIVATION_EXPLICIT
See Also
StringDataValue#COLLATION_DERIVATION_NONE
COLLATION_DERIVATION_IMPLICITback to summary
public static final int COLLATION_DERIVATION_IMPLICIT
See Also
StringDataValue#COLLATION_DERIVATION_NONE
COLLATION_DERIVATION_NONEback to summary
public 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".

COLLATION_TYPE_TERRITORY_BASEDback to summary
public static final int COLLATION_TYPE_TERRITORY_BASED
See Also
StringDataValue#COLLATION_TYPE_UCS_BASIC
COLLATION_TYPE_TERRITORY_BASED_IDENTICALback to summary
public static final int COLLATION_TYPE_TERRITORY_BASED_IDENTICAL
COLLATION_TYPE_TERRITORY_BASED_PRIMARYback to summary
public static final int COLLATION_TYPE_TERRITORY_BASED_PRIMARY
COLLATION_TYPE_TERRITORY_BASED_SECONDARYback to summary
public static final int COLLATION_TYPE_TERRITORY_BASED_SECONDARY
COLLATION_TYPE_TERRITORY_BASED_TERTIARYback to summary
public static final int COLLATION_TYPE_TERRITORY_BASED_TERTIARY
COLLATION_TYPE_UCS_BASICback to summary
public 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.

LEADINGback to summary
public static final int LEADING
TRAILINGback to summary
public static final int TRAILING

Method Detail

ansiTrimback to summary
public StringDataValue ansiTrim(int trimType, StringDataValue trimChar, StringDataValue result) throws StandardException

The SQL Ansi trim function.

Parameters
trimType:int

type of trim. Possible values are LEADING, TRAILING or BOTH.

trimChar:StringDataValue

The character to trim from this

result:StringDataValue

The result of a previous call to this method, null if not called yet.

Returns:StringDataValue

A StringDataValue containing the result of the trim().

concatenateback to summary
public StringDataValue concatenate(StringDataValue leftOperand, StringDataValue rightOperand, StringDataValue result) throws StandardException

The SQL concatenation '||' operator.

Parameters
leftOperand:StringDataValue

String on the left hand side of '||'

rightOperand:StringDataValue

String on the right hand side of '||'

result:StringDataValue

The result of a previous call to this method, null if not called yet.

Returns:StringDataValue

A ConcatableDataValue containing the result of the '||'

Exceptions
StandardException:
Thrown on error
getCharArrayback to summary
public 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.

Exceptions
StandardException:
Thrown on error
getStreamHeaderGeneratorback to summary
public 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
getStreamWithDescriptorback to summary
public 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:CharacterStreamDescriptor

A descriptor for the stream, which includes a reference to the stream itself.

Exceptions
StandardException:
if obtaining the descriptor fails, or if the value isn't represented as a stream.
getValueback to summary
public StringDataValue getValue(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.

likeback to summary
public BooleanDataValue like(DataValueDescriptor pattern) throws StandardException

The SQL like() function with out escape clause.

Parameters
pattern:DataValueDescriptor

the pattern to use

Returns:BooleanDataValue

A BooleanDataValue containing the result of the like

Exceptions
StandardException:
Thrown on error
likeback to summary
public BooleanDataValue like(DataValueDescriptor pattern, DataValueDescriptor escape) throws StandardException

The SQL like() function WITH escape clause.

Parameters
pattern:DataValueDescriptor

the pattern to use

escape:DataValueDescriptor

the escape character

Returns:BooleanDataValue

A BooleanDataValue containing the result of the like

Exceptions
StandardException:
Thrown on error
locateback to summary
public 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:StringDataValue

- The string to search from

start:NumberDataValue

- The position to search from in string searchFrom

result:NumberDataValue

- The object to return

Returns:NumberDataValue

The position in searchFrom the fist occurrence of this.value. 0 is returned if searchFrom does not contain this.value.

Exceptions
StandardException:
Thrown on error
lowerback to summary
public StringDataValue lower(StringDataValue result) throws StandardException

Convert the string to lower case.

Parameters
result:StringDataValue

The result (reusable - allocate if null).

Returns:StringDataValue

The string converted to lower case.

Exceptions
StandardException:
Thrown on error
setStreamHeaderFormatback to summary
public void setStreamHeaderFormat(Boolean usePreTenFiveHdrFormat)

Tells the data value descriptor which CLOB stream header format to use.

Parameters
usePreTenFiveHdrFormat:Boolean

true if the database accessed is prior to version 10.5, false if the version is 10.5 or newer, and null if unknown at this time

setValueback to summary
public void setValue(Clob value) throws StandardException

Redeclares org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Stuff a StringDataValue with a Clob.

Parameters
value:Clob

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setValue.

The Clob value to set this DataValueDescriptor to

upperback to summary
public StringDataValue upper(StringDataValue result) throws StandardException

Convert the string to upper case.

Parameters
result:StringDataValue

The result (reusable - allocate if null).

Returns:StringDataValue

The string converted to upper case.

Exceptions
StandardException:
Thrown on error