|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.derby.iapi.types.DataType
org.apache.derby.iapi.types.XML
This type implements the XMLDataValue interface and thus is the type on which all XML related operations are executed. The first and simplest XML store implementation is a UTF-8 based one--all XML data is stored on disk as a UTF-8 string, just like the other Derby string types. In order to make it possible for smarter XML implementations to exist in the future, this class always writes an "XML implementation id" to disk before writing the rest of its data. When reading the data, the impl id is read first and serves as an indicator of how the rest of the data should be read. So long as there's only one implementation (UTF-8) the impl id can be ignored; but when smarter implementations are written, the impl id will be the key to figuring out how an XML value should be read, written, and processed.
| Nested Class Summary | |
private class |
XML.ExistsHandler
|
private class |
XML.XMLErrorHandler
|
| Field Summary | |
private static int |
BASE_MEMORY_USAGE
|
private static java.lang.String |
QUERY_MATCH_STRING
|
protected org.xml.sax.XMLReader |
saxReader
|
private org.apache.xalan.processor.TransformerFactoryImpl |
saxTFactory
|
protected static short |
UTF8_IMPL_ID
|
protected static java.lang.String |
XML_PARSER_CLASS
|
private SQLChar |
xmlStringValue
|
private static java.lang.String |
XPATH_PLACEHOLDER
|
private org.xml.sax.XMLReader |
xsltReader
|
private static java.lang.String |
xsltStylesheet
|
| 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 |
| Constructor Summary | |
|
XML()
Default constructor. |
private |
XML(SQLChar val)
Private constructor used for the getClone() method. |
| Method Summary | |
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. |
boolean |
exists(java.lang.String xExpr)
Helper method for XMLExists. |
DataValueDescriptor |
getClone()
Clone this DataValueDescriptor. |
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 |
boolean |
isNull()
Return whether the value is null or not. |
protected void |
loadSAXReader()
Load an XMLReader for SAX events that can be used for parsing XML data. |
void |
loadStream()
sets the stream state for the object. |
private void |
loadXSLTObjects()
Prepare for an XSLT query by loading the objects required for such a query. |
void |
parseAndLoadXML(java.lang.String text,
boolean preserveWS)
Method to parse an XML string and, if it's valid, store the _parsed_ version for subsequent use. |
void |
readExternal(java.io.ObjectInput in)
Read an XML value from an input stream. |
void |
readExternalFromArray(ArrayInputStream in)
Read the DataValueDescriptor from the stream. |
private java.lang.String |
replaceDoubleQuotes(java.lang.String queryText)
Takes a string (which is an XPath query specified by the user) and replaces any double quotes with single quotes. |
void |
restoreToNull()
Restore this object to its (SQL)null value. |
java.io.InputStream |
returnStream()
Return the stream state of the object. |
protected void |
setFrom(DataValueDescriptor theValue)
|
void |
setStream(java.io.InputStream newStream)
sets the 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. |
int |
typePrecedence()
Each built-in type in JSQL has a precedence. |
void |
writeExternal(java.io.ObjectOutput out)
Write an XML value. |
BooleanDataValue |
XMLExists(StringDataValue xExpr,
XMLDataValue xml)
The SQL/XML XMLExists operator. |
StringDataValue |
XMLSerialize(StringDataValue result,
int targetType,
int targetWidth)
The SQL/XML XMLSerialize operator. |
| Methods inherited from class org.apache.derby.iapi.types.DataType |
checkHostVariable, cloneObject, coalesce, compare, dataTypeConversion, equals, equals, flip, genericSetObject, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getNationalString, getObject, getShort, getStream, getTime, getTimestamp, greaterOrEquals, greaterThan, in, invalidFormat, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, outOfRange, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch, typeToBigDecimal |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
checkHostVariable, coalesce, compare, equals, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getObject, getShort, getStream, getTime, getTimestamp, greaterOrEquals, greaterThan, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, typeToBigDecimal |
| Field Detail |
protected static final short UTF8_IMPL_ID
protected static final java.lang.String XML_PARSER_CLASS
private static final int BASE_MEMORY_USAGE
private SQLChar xmlStringValue
protected org.xml.sax.XMLReader saxReader
private static final java.lang.String XPATH_PLACEHOLDER
private static final java.lang.String QUERY_MATCH_STRING
private static java.lang.String xsltStylesheet
private org.xml.sax.XMLReader xsltReader
private org.apache.xalan.processor.TransformerFactoryImpl saxTFactory
| Constructor Detail |
public XML()
private XML(SQLChar val)
val - A SQLChar instance to clone and use for
this XML value.| Method Detail |
public DataValueDescriptor getClone()
DataValueDescriptor
getClone in interface DataValueDescriptorDataValueDescriptor.getClone()public DataValueDescriptor getNewNull()
DataValueDescriptor
getNewNull in interface DataValueDescriptorDataValueDescriptor.getNewNull()public java.lang.String getTypeName()
DataValueDescriptor
getTypeName in interface DataValueDescriptorDataValueDescriptor.getTypeName()public int typePrecedence()
DataValueDescriptor
typePrecedence in interface DataValueDescriptortypePrecedence in class DataTypeDataValueDescriptor.typePrecedence()
public java.lang.String getString()
throws StandardException
DataValueDescriptor
getString in interface DataValueDescriptorStandardException - Thrown on errorDataValueDescriptor.getString()
public int getLength()
throws StandardException
DataValueDescriptor
getLength in interface DataValueDescriptorStandardException - On errorDataValueDescriptor.getLength()public int estimateMemoryUsage()
DataValueDescriptor
estimateMemoryUsage in interface DataValueDescriptorDataValueDescriptor.estimateMemoryUsage()
public void readExternalFromArray(ArrayInputStream in)
throws java.io.IOException
DataValueDescriptorInitialize the data value by reading it's values from the ArrayInputStream. This interface is provided as a way to achieve possible performance enhancement when reading an array can be optimized over reading from a generic stream from readExternal().
readExternalFromArray in interface DataValueDescriptorin - 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
setFrom in class DataTypeStandardExceptionDataValueDescriptor#setFrom
public final void setValueFromResultSet(java.sql.ResultSet resultSet,
int colNumber,
boolean isNullable)
throws java.sql.SQLException
DataValueDescriptor
setValueFromResultSet 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 int getTypeFormatId()
TypedFormat
getTypeFormatId in interface TypedFormatFrom the engine's perspective, all XML implementations share
the same format id.public boolean isNull()
Storable
isNull in interface StorableStorable#isNullpublic void restoreToNull()
Storable
restoreToNull 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.IOException
public 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()
StreamStorable
returnStream in interface StreamStorableStreamStorable.returnStream()public void setStream(java.io.InputStream newStream)
StreamStorable
setStream in interface StreamStorableStreamStorable.setStream(java.io.InputStream)
public void loadStream()
throws StandardException
StreamStorable
loadStream in interface StreamStorableStandardException - on errorStreamStorable.loadStream()
public void parseAndLoadXML(java.lang.String text,
boolean preserveWS)
throws StandardException
parseAndLoadXML in interface XMLDataValuetext - The string value to check.preserveWS - Whether or not to preserve
ignorable whitespace.
StandardException - Thrown on parse error.
public StringDataValue XMLSerialize(StringDataValue result,
int targetType,
int targetWidth)
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.
StandardException - Thrown on error
public BooleanDataValue XMLExists(StringDataValue xExpr,
XMLDataValue xml)
throws StandardException
XMLExists in interface XMLDataValuexExpr - The query expression, as a string.xml - The XML value being queried.
StandardException - Thrown on error
public boolean exists(java.lang.String xExpr)
throws StandardException
exists in interface XMLDataValuexExpr - The XPath expression.
StandardException
protected void loadSAXReader()
throws java.lang.Exception
java.lang.Exception
private void loadXSLTObjects()
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionprivate java.lang.String replaceDoubleQuotes(java.lang.String queryText)
queryText - Text in which we want to replace double
quotes.
|
Built on Tue 2006-10-10 19:23:47+0200, from revision exported | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||