Java Doc for SqlXmlExecutor.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » sql » execute » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.sql.execute 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.sql.execute.SqlXmlExecutor

SqlXmlExecutor
public class SqlXmlExecutor (Code)
This class is really just an execution time "utility" that makes calls to methods on the XMLDataValue interface. Instances of this class are generated at execution time by the various Derby XML operators--one instance for each row in the target result set--and then the appropriate operator call is made on that instance (see, for example, the generateExpression() methods in UnaryOperatorNode and BinaryOperatorNode). When an instance of this class is instantiated, one of the arguments that can be provided is an id that is used to retrieve an already-constructed (from compilation time) instance of SqlXmlUtil from the current Activation. When it comes time to execute the operator, this class just makes the appropriate call on the received XMLDataValue object and passes in the SqlXmlUtil, from which the XMLDataValue can retrieve compile-time objects. The XMLDataValue can also make calls to various XML-specific utilities on the SqlXmlUtil object. Let's take an example. Assume the statement that the user wants to execute is: select id from xtable where XMLEXISTS('/simple' PASSING BY REF xcol) At compilation time we will compile the expression "/simple" and store the compiled version of the query into an instance of SqlXmlUtil. Then we will save that instance of SqlXmlUtil as an object in the statement activation, from which we will receive an id that can be used later to retrieve the object (i.e. to retrieve the SqlXmlUtil). Then, for *each* row in xtable, we'll generate the following: boolean result = (new SqlXmlExecutor(activation, compileTimeObjectId)). XMLExists("/simple", xcol); In other words, for each row we create a new instance of this class and call "XMLExists" on that instance. Then, as seen below, we retrieve the SqlXmlUtil from the activation and pass that into a call to "XMLExists" on the XML value itself (i.e. xcol). XMLDataValue.XMLExists() then uses the methods and objects (which include the compiled query expression for "/simple") defined on SqlXmlUtil to complete the operation. Okay, so why do we use this execution-time SqlXmlExecutor class instead of just generating a call to XMLDataValue.XMLExists() directly? The reason is that we only want to compile the XML query expression once per statement--and where possible we'd also like to only generate re-usable XML-specific objects once per statement, as well. If instead we generated a call to XMLDataValue.XMLExists() directly for each row, then we would have to either pass in the expression string and have XMLDataValue compile it, or we would have to compile the expression string and then pass the compiled object into XMLDataValue--in either case, we'd end up compiling the XML query expression (and creating the corresponding XML-specific objects) once for each row in the target result set. By using the "saveObject" functionality in Activation along with this SqlXmlExecutor class, we make it so that we only have to compile the XML query expression and create XML-specific objects once (at compile time), and then we can re-use those objects for every row in the target result set. Yes, we're still creating an instance of this class (SqlXmlExecutor) once per row, and yes we have to fetch the appropriate SqlXmlUtil object once per row, but this is still going to be cheaper than having to re-compile the query expression and re-create XML objects for every row. So in short, this class allows us to improve the execution-time performance of XML operators by allowing us to create XML- specific objects and compile XML query expressions once per statement, instead of once per row. One final note: the reason this class is in this package instead of the types package is that, in order to retrieve the compile-time objects, we have to use the "getSavedObject()" method on the Activation. But the Activation class is part of the SQL layer (org.apache.derby.iapi.sql.Activation) and we want to keep the types layer independent of the SQL layer because the types can be used during recovery before the SQL system has booted. So the next logical choices were the compile package (impl.sql.compile) or the execution package; of those, the execution package seems more appropriate since this class is only instantiated and used during execution, not during compilation.



Constructor Summary
public  SqlXmlExecutor(Activation activation, int utilId, boolean preserveWS)
     Constructor 1: Used for XMLPARSE op.
public  SqlXmlExecutor(int targetTypeId, int targetMaxWidth)
     Constructor 2: Used for XMLSERIALIZE op.
public  SqlXmlExecutor(Activation activation, int utilId)
     Constructor 3: Used for XMLEXISTS/XMLQUERY ops.

Method Summary
public  BooleanDataValueXMLExists(StringDataValue xExpr, XMLDataValue xmlContext)
     Make the call to perform an XMLEXISTS operation on the received XML data value.
Parameters:
  xExpr - Query expression to be evaluated
Parameters:
  xmlContext - Context node against which to evaluatethe expression.
public  XMLDataValueXMLParse(StringDataValue xmlText, XMLDataValue result)
     Make the call to perform an XMLPARSE operation on the received XML string and store the result in the received XMLDataValue (or if it's null, create a new one).
Parameters:
  xmlText - String to parse
Parameters:
  result - XMLDataValue in which to store the result The received XMLDataValue with its content set tocorrespond to the received xmlText, if the text constitutesa valid XML document.
public  XMLDataValueXMLQuery(StringDataValue xExpr, XMLDataValue xmlContext, XMLDataValue result)
     Make the call to perform an XMLQUERY operation on the received XML data value and store the result in the received result holder (or, if it's null, create a new one).
public  StringDataValueXMLSerialize(XMLDataValue xmlVal, StringDataValue result)
     Make the call to perform an XMLSERIALIZE operation on the received XML data value and store the result in the received StringDataValue (or if it's null, create a new one).
Parameters:
  xmlVal - XML value to serialize
Parameters:
  result - StringDataValue in which to store the result A serialized (to string) version of this XML object,in the form of a StringDataValue object.


Constructor Detail
SqlXmlExecutor
public SqlXmlExecutor(Activation activation, int utilId, boolean preserveWS)(Code)
Constructor 1: Used for XMLPARSE op.
Parameters:
  activation - Activation from which to retrieve saved objects
Parameters:
  utilId - Id by which we find saved objects in activation
Parameters:
  preserveWS - Whether or not to preserve whitespace



SqlXmlExecutor
public SqlXmlExecutor(int targetTypeId, int targetMaxWidth)(Code)
Constructor 2: Used for XMLSERIALIZE op.
Parameters:
  targetTypeId - The string type to which we want to serialize.
Parameters:
  targetMaxWidth - The max width of the target type.



SqlXmlExecutor
public SqlXmlExecutor(Activation activation, int utilId)(Code)
Constructor 3: Used for XMLEXISTS/XMLQUERY ops.
Parameters:
  activation - Activation from which to retrieve saved objects
Parameters:
  utilId - Id by which we find saved objects in activation




Method Detail
XMLExists
public BooleanDataValue XMLExists(StringDataValue xExpr, XMLDataValue xmlContext) throws StandardException(Code)
Make the call to perform an XMLEXISTS operation on the received XML data value.
Parameters:
  xExpr - Query expression to be evaluated
Parameters:
  xmlContext - Context node against which to evaluatethe expression. True if evaluation of the query expressionagainst xmlContext returns at least one item; unknown ifeither the xml value is NULL; false otherwise.



XMLParse
public XMLDataValue XMLParse(StringDataValue xmlText, XMLDataValue result) throws StandardException(Code)
Make the call to perform an XMLPARSE operation on the received XML string and store the result in the received XMLDataValue (or if it's null, create a new one).
Parameters:
  xmlText - String to parse
Parameters:
  result - XMLDataValue in which to store the result The received XMLDataValue with its content set tocorrespond to the received xmlText, if the text constitutesa valid XML document. If the received XMLDataValue isnull, then create a new one and set its content tocorrespond to the received xmlText.



XMLQuery
public XMLDataValue XMLQuery(StringDataValue xExpr, XMLDataValue xmlContext, XMLDataValue result) throws StandardException(Code)
Make the call to perform an XMLQUERY operation on the received XML data value and store the result in the received result holder (or, if it's null, create a new one).
Parameters:
  xExpr - Query expression to be evaluated
Parameters:
  xmlContext - Context node against which to evaluatethe expression.
Parameters:
  result - XMLDataValue in which to store the result The received XMLDataValue with its content set toresult of evaulating the query expression against xmlContext.If the received XMLDataValue is null, then create a new oneand set its content to correspond to the received xmlText.



XMLSerialize
public StringDataValue XMLSerialize(XMLDataValue xmlVal, StringDataValue result) throws StandardException(Code)
Make the call to perform an XMLSERIALIZE operation on the received XML data value and store the result in the received StringDataValue (or if it's null, create a new one).
Parameters:
  xmlVal - XML value to serialize
Parameters:
  result - StringDataValue in which to store the result A serialized (to string) version of this XML object,in the form of a StringDataValue object.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.