java.io.Externalizable, java.io.Serializable, java.lang.Comparable, Formatable, Storable, StreamStorable, TypedFormat, DataValueDescriptor, Orderable, XMLDataValuepublic class XML extends DataType implements XMLDataValue, StreamStorable
| Modifier and Type | Field | Description |
|---|---|---|
private static int |
BASE_MEMORY_USAGE |
|
private boolean |
containsTopLevelAttr |
|
private SqlXmlUtil |
tmpUtil |
|
protected static short |
UTF8_IMPL_ID |
|
static int |
XML_DOC_ANY |
|
static int |
XML_SEQUENCE |
|
private static java.lang.String |
xmlReqCheck |
|
private SQLChar |
xmlStringValue |
|
static short |
XQ_EMPTY_ON_EMPTY |
|
static short |
XQ_NULL_ON_EMPTY |
|
static short |
XQ_PASS_BY_REF |
|
static short |
XQ_PASS_BY_VALUE |
|
static short |
XQ_RETURN_CONTENT |
|
static short |
XQ_RETURN_SEQUENCE |
|
private int |
xType |
UNKNOWN_LOGICAL_LENGTHORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN| Modifier | Constructor | Description |
|---|---|---|
|
XML() |
Default constructor.
|
private |
XML(SQLChar val,
int xmlType,
boolean seqWithAttr,
boolean materialize) |
Private constructor used for the
cloneValue method. |
| Modifier and Type | Method | Description |
|---|---|---|
private static boolean |
checkJAXPRequirement() |
Check if we have a JAXP implementation installed.
|
static void |
checkXMLRequirements() |
See if the required JAXP and Xalan classes are in the
user's classpath.
|
private static boolean |
checkXPathRequirement() |
Check if XPath is supported on this platform.
|
DataValueDescriptor |
cloneValue(boolean forceMaterialization) |
Clone this DataValueDescriptor.
|
int |
compare(DataValueDescriptor other) |
Compare two XML DataValueDescriptors.
|
int |
estimateMemoryUsage() |
Estimate the memory usage in bytes of the data value and the overhead of the class.
|
int |
getLength() |
Gets the length of the data value.
|
DataValueDescriptor |
getNewNull() |
Get a new null value of the same type as this data value.
|
java.lang.String |
getString() |
Gets the value in the data value descriptor as a String.
|
int |
getTypeFormatId() |
Get a universally unique identifier for the type of
this object.
|
java.lang.String |
getTypeName() |
Get the SQL name of the datatype
|
int |
getXType() |
Retrieve this XML value's qualified type.
|
boolean |
hasTopLevelAttr() |
Return whether or not this XML value represents a sequence
that has one or more top-level attribute nodes.
|
boolean |
isNull() |
Return whether the value is null or not.
|
void |
loadStream() |
Set the value by reading the stream and
converting it to an object form.
|
void |
markAsHavingTopLevelAttr() |
Take note of the fact this XML value represents an XML
sequence that has one or more top-level attribute nodes.
|
void |
normalize(DataTypeDescriptor desiredType,
DataValueDescriptor source) |
Normalization method - this method will always be called when
storing an XML value into an XML column, for example, when
inserting/updating.
|
void |
readExternal(java.io.ObjectInput in) |
Read an XML value from an input stream.
|
void |
readExternalFromArray(ArrayInputStream in) |
Read the DataValueDescriptor from the stream.
|
void |
restoreToNull() |
Restore this object to its (SQL)null value.
|
java.io.InputStream |
returnStream() |
Return the on-disk stream state of the object.
|
protected void |
setFrom(DataValueDescriptor theValue) |
Set the value of this DataValueDescriptor based on the value
of the specified DataValueDescriptor.
|
void |
setStream(java.io.InputStream newStream) |
sets the on-disk stream state for the object.
|
void |
setValueFromResultSet(java.sql.ResultSet resultSet,
int colNumber,
boolean isNullable) |
Set the value based on the value for the specified DataValueDescriptor
from the specified ResultSet.
|
void |
setXType(int xtype) |
Set this XML value's qualified type.
|
int |
typePrecedence() |
Each built-in type in JSQL has a precedence.
|
void |
writeExternal(java.io.ObjectOutput out) |
Write an XML value.
|
BooleanDataValue |
XMLExists(SqlXmlUtil sqlxUtil) |
The SQL/XML XMLExists operator.
|
XMLDataValue |
XMLParse(StringDataValue stringValue,
boolean preserveWS,
SqlXmlUtil sqlxUtil) |
Method to parse an XML string and, if it's valid,
store the _serialized_ version locally and then return
this XMLDataValue.
|
XMLDataValue |
XMLQuery(SqlXmlUtil sqlxUtil,
XMLDataValue result) |
Evaluate the XML query expression contained within the received
util object against this XML value and store the results into
the received XMLDataValue "result" param (assuming "result" is
non-null; else create a new XMLDataValue).
|
StringDataValue |
XMLSerialize(StringDataValue result,
int targetType,
int targetWidth,
int targetCollationType) |
The SQL/XML XMLSerialize operator.
|
checkHostVariable, cloneHolder, coalesce, compare, compare, compare, compareTo, dataTypeConversion, equals, equals, flip, genericSetObject, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getObject, getShort, getStream, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, invalidFormat, isNotNull, isNullOp, lessOrEquals, lessThan, notEquals, outOfRange, recycle, setBigDecimal, setInto, setInto, setObject, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch, typeToBigDecimalcheckHostVariable, cloneHolder, coalesce, compare, compare, compare, equals, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getObject, getShort, getStream, getTime, getTimestamp, getTraceString, greaterOrEquals, greaterThan, hasStream, in, isNotNull, isNullOp, lessOrEquals, lessThan, notEquals, 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, setValue, typeToBigDecimalprotected static final short UTF8_IMPL_ID
private static final int BASE_MEMORY_USAGE
public static final short XQ_PASS_BY_REF
public static final short XQ_PASS_BY_VALUE
public static final short XQ_RETURN_SEQUENCE
public static final short XQ_RETURN_CONTENT
public static final short XQ_EMPTY_ON_EMPTY
public static final short XQ_NULL_ON_EMPTY
public static final int XML_DOC_ANY
public static final int XML_SEQUENCE
private int xType
private SQLChar xmlStringValue
private static java.lang.String xmlReqCheck
private boolean containsTopLevelAttr
private SqlXmlUtil tmpUtil
public XML()
private XML(SQLChar val, int xmlType, boolean seqWithAttr, boolean materialize)
cloneValue method.
Returns a new instance of XML whose fields are clones
of the values received.val - A SQLChar instance to clone and use for
this XML value.xmlType - Qualified XML type for "val"seqWithAttr - Whether or not "val" corresponds to
sequence with one or more top-level attribute nodes.materialize - whether or not to force materialization of the
underlying source datapublic DataValueDescriptor cloneValue(boolean forceMaterialization)
DataValueDescriptor
Even though the objects can be modified independently regardless of the
value of forceMaterialization, both the clone and the
original may be dependent on the store state if
forceMaterialization is set to false. An example is if
you need to access the value you just read using cloneValue
after the current transaction has ended, or after the source result set
has been closed.
cloneValue in interface DataValueDescriptorforceMaterialization - any streams representing the data value will
be materialized if true, the data value will be kept as a
stream if possible if falseDataValueDescriptor with the same initial
value as this.DataValueDescriptor.cloneValue(boolean)public DataValueDescriptor getNewNull()
DataValueDescriptorgetNewNull in interface DataValueDescriptorDataValueDescriptor.getNewNull()public java.lang.String getTypeName()
DataValueDescriptorgetTypeName in interface DataValueDescriptorDataValueDescriptor.getTypeName()public int typePrecedence()
DataTypetypePrecedence in interface DataValueDescriptortypePrecedence in class DataTypeDataValueDescriptor.typePrecedence()public java.lang.String getString()
throws StandardException
DataValueDescriptorgetString in interface DataValueDescriptorStandardException - Thrown on errorDataValueDescriptor.getString()public int getLength()
throws StandardException
DataValueDescriptorgetLength in interface DataValueDescriptorStandardException - On errorDataValueDescriptor.getLength()public int estimateMemoryUsage()
DataValueDescriptorestimateMemoryUsage in interface DataValueDescriptorDataValueDescriptor.estimateMemoryUsage()public void readExternalFromArray(ArrayInputStream in) throws java.io.IOException
DataTypereadExternal(), which accesses the ArrayInputStream
as a generic stream. If sub-classes can implement it more efficiently
by accessing the array, they should override this method.readExternalFromArray in interface DataValueDescriptorreadExternalFromArray in class DataTypein - The array stream positioned at the beginning of the
byte stream to read from.java.io.IOException - Usual error is if you try to read
past limit on the stream.DataValueDescriptor.readExternalFromArray(org.apache.derby.iapi.services.io.ArrayInputStream)protected void setFrom(DataValueDescriptor theValue) throws StandardException
DataTypesetFrom in class DataTypetheValue - The DataValueDescriptor that holds the value to
which we want to set this DataValueDescriptor's value.StandardExceptionDataType.setFrom(org.apache.derby.iapi.types.DataValueDescriptor)public final void setValueFromResultSet(java.sql.ResultSet resultSet,
int colNumber,
boolean isNullable)
throws java.sql.SQLException
DataValueDescriptorsetValueFromResultSet in interface DataValueDescriptorresultSet - The specified ResultSet.colNumber - The 1-based column # into the resultSet.isNullable - Whether or not the column is nullable
(No need to call wasNull() if not)java.sql.SQLException - Error accessing the result setDataValueDescriptor.setValueFromResultSet(java.sql.ResultSet, int, boolean)public int compare(DataValueDescriptor other) throws StandardException
compare in interface DataValueDescriptorother - The Orderable to compare this one to.StandardException - Thrown on errorDataValueDescriptor.compare(org.apache.derby.iapi.types.DataValueDescriptor)public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException
normalize in interface DataValueDescriptornormalize in class DataTypedesiredType - The type to normalize the source column tosource - The value to normalizeStandardException - Thrown if source is not
XML_DOC_ANY.public int getTypeFormatId()
TypedFormatgetTypeFormatId in interface TypedFormatFrom the engine's perspective, all XML implementations share
the same format id.public boolean isNull()
StorableisNull in interface StorableStorable.isNull()public void restoreToNull()
StorablerestoreToNull in interface StorableStorable.restoreToNull()public void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal in interface java.io.Externalizablein - The stream from which we're reading.java.io.IOExceptionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizableout - The stream to which we're writing.java.io.IOExceptionpublic java.io.InputStream returnStream()
StreamStorablereturnStream in interface StreamStorableStreamStorable.returnStream()public void setStream(java.io.InputStream newStream)
StreamStorablesetStream in interface StreamStorableStreamStorable.setStream(java.io.InputStream)public void loadStream()
throws StandardException
StreamStorableloadStream in interface StreamStorableStandardException - on errorStreamStorable.loadStream()public XMLDataValue XMLParse(StringDataValue stringValue, boolean preserveWS, SqlXmlUtil sqlxUtil) throws StandardException
XMLParse in interface XMLDataValuestringValue - The string value to check.preserveWS - Whether or not to preserve
ignorable whitespace.sqlxUtil - Contains SQL/XML objects and util
methods that facilitate execution of XML-related
operationsStandardException - Thrown on error.public StringDataValue XMLSerialize(StringDataValue result, int targetType, int targetWidth, int targetCollationType) throws StandardException
XMLSerialize in interface XMLDataValueresult - The result of a previous call to this method,
null if not called yet.targetType - The string type to which we want to serialize.targetWidth - The width of the target type.targetCollationType - The collation type of the target type.StandardException - Thrown on errorpublic BooleanDataValue XMLExists(SqlXmlUtil sqlxUtil) throws StandardException
XMLExists in interface XMLDataValuesqlxUtil - Contains SQL/XML objects and util
methods that facilitate execution of XML-related
operationsStandardException - Thrown on errorpublic XMLDataValue XMLQuery(SqlXmlUtil sqlxUtil, XMLDataValue result) throws StandardException
XMLQuery in interface XMLDataValuesqlxUtil - Contains SQL/XML objects and util methods that
facilitate execution of XML-related operationsresult - The result of a previous call to this method; null
if not called yet.StandardException - thrown on errorpublic void setXType(int xtype)
setXType in interface XMLDataValuepublic int getXType()
getXType in interface XMLDataValuepublic void markAsHavingTopLevelAttr()
markAsHavingTopLevelAttr in interface XMLDataValuepublic boolean hasTopLevelAttr()
hasTopLevelAttr in interface XMLDataValuepublic static void checkXMLRequirements()
throws StandardException
StandardException - thrown if the required
classes cannot be located in the classpath.private static boolean checkJAXPRequirement()
true if JAXP is installed, or false otherwiseprivate static boolean checkXPathRequirement()
true if XPath is supported, or false otherwiseApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.