com.ddtek.xquery3
Interface ExtPlanExplain


public interface ExtPlanExplain

This interface enables the DataDirect XQuery plan explain feature.
Here is an example to generate an execution plan.

   ...
   XQExpression exp = conn.createExpression();
   ExtPlanExplain explain = (ExtPlanExplain)exp;
   XQResultSequence seq = explain.explain("for $item in fn:doc('items.xml')/items/item");
   seq.writeSequence(new FileOutputStream("queryplan.xml"), null);
   seq.close();
   exp.close();
   ...
 


Field Summary
static String PLAN_EXPLAIN_AS_XHTML
          Generate a plan explain in XHTML format.
static String PLAN_EXPLAIN_AS_XML
          Generate a plan explain in XML format.
 
Method Summary
 XQResultSequence explain(InputStream query)
          Request a plan explain for the specified query.
 XQResultSequence explain(Reader query)
          Request a plan explain for the specified query.
 XQResultSequence explain(String query)
          Request a plan explain for the specified query.
 void setPlanFormat(String format)
          Set the returned plan format.
 void setResourceLocation(String resourceLocation)
          Set the folder where the generated plan will reference required resources, like images, JavaScript, HTML stylesheets.
 

Field Detail

PLAN_EXPLAIN_AS_XML

public static final String PLAN_EXPLAIN_AS_XML
Generate a plan explain in XML format.

See Also:
Constant Field Values

PLAN_EXPLAIN_AS_XHTML

public static final String PLAN_EXPLAIN_AS_XHTML
Generate a plan explain in XHTML format.

See Also:
Constant Field Values
Method Detail

explain

public XQResultSequence explain(String query)
                         throws XQException
Request a plan explain for the specified query.
The returned XQResultSequence contains the XML document representing the execution plan. It can be processed as any other result with the XQJ api.

Parameters:
query - the query for which the execution plan is requested
Returns:
an XQResultSequence containing an XML document representing the execution plan.
Throws:
XQException - the execution plan cannot be generated

explain

public XQResultSequence explain(Reader query)
                         throws XQException
Request a plan explain for the specified query.
This method is equivalent to explain(String), but the query is specified as a java.io.Reader.

Parameters:
query - the query for which the execution plan is requested
Returns:
an XQResultSequence containing an XML document representing the execution plan.
Throws:
XQException - the execution plan cannot be generated

explain

public XQResultSequence explain(InputStream query)
                         throws XQException
Request a plan explain for the specified query.
This method is equivalent to explain(String), but the query is specified as a java.io.InputStream.

Parameters:
query - the query for which the execution plan is requested
Returns:
an XQResultSequence containing an XML document representing the execution plan.
Throws:
XQException - the execution plan cannot be generated

setResourceLocation

public void setResourceLocation(String resourceLocation)
                         throws XQException
Set the folder where the generated plan will reference required resources, like images, JavaScript, HTML stylesheets. The default is http://www.xquery.com/planExplain

Parameters:
resourceLocation - a directory reachable by a web browser containing resource files used by the generated plan description
Throws:
XQException - a null value has been specified

setPlanFormat

public void setPlanFormat(String format)
                   throws XQException
Set the returned plan format. Either PLAN_EXPLAIN_AS_XML or PLAN_EXPLAIN_AS_XHTML. The default is PLAN_EXPLAIN_AS_XHTML.

Parameters:
format - the format in which the exeution plan should be generated. Must be PLAN_EXPLAIN_AS_XML or PLAN_EXPLAIN_AS_XHTML
Throws:
XQException - a null value has been specified