Author: shawkins
Date: 2009-10-05 11:26:10 -0400 (Mon, 05 Oct 2009)
New Revision: 1522
Modified:
trunk/adminshell/src/main/resources/scripts/jdbc.bsh
trunk/client/src/main/java/com/metamatrix/jdbc/api/TextOutputVisitor.java
trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
Log:
TEIID-845 adding documentation and the ability to show a text plan
Modified: trunk/adminshell/src/main/resources/scripts/jdbc.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/jdbc.bsh 2009-10-05 14:44:52 UTC (rev
1521)
+++ trunk/adminshell/src/main/resources/scripts/jdbc.bsh 2009-10-05 15:26:10 UTC (rev
1522)
@@ -12,6 +12,7 @@
import java.sql.*;
import com.metamatrix.script.io.*;
import com.metamatrix.jdbc.api.*;
+import com.metamatrix.jdbc.*;
protected Connection getConnection() {
if (currentContext().internalConnection != void &&
currentContext().internalConnection != null) {
@@ -258,10 +259,18 @@
printResults(currentContext().internalResultSet, fileName);
}
-void showPlan() {
+void showPlan(boolean xml) {
+ if (currentContext().internalStatement == void || currentContext().internalStatement
== null) {
+ print("Statement is null - execute then issue showPlan");
+ return;
+ }
PlanNode queryPlan =
((MMResultSet)currentContext().internalStatement).getPlanDescription();
if (queryPlan != null) {
- print(XMLOutputVisitor.convertToXML(queryPlan));
+ if (xml != null && xml) {
+ print(XMLOutputVisitor.convertToXML(queryPlan));
+ } else {
+ print(TextOutputVisitor.convertToText(queryPlan));
+ }
} else {
print("No plan provided - add OPTION SHOWPLAN");
}
Modified: trunk/client/src/main/java/com/metamatrix/jdbc/api/TextOutputVisitor.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/jdbc/api/TextOutputVisitor.java 2009-10-05
14:44:52 UTC (rev 1521)
+++ trunk/client/src/main/java/com/metamatrix/jdbc/api/TextOutputVisitor.java 2009-10-05
15:26:10 UTC (rev 1522)
@@ -161,5 +161,11 @@
protected void visitContainerProperty(PlanNode node, String propertyName, Collection
propertyValue) {
}
+
+ public static String convertToText(PlanNode node, int initialTabs) {
+ TextOutputVisitor visitor = new TextOutputVisitor(new DefaultDisplayHelper(),
initialTabs);
+ visitor.visit(node);
+ return visitor.getText();
+ }
}
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml
===================================================================
---
trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml 2009-10-05
14:44:52 UTC (rev 1521)
+++
trunk/documentation/admin-guide/src/main/docbook/en-US/content/appendix-c.xml 2009-10-05
15:26:10 UTC (rev 1522)
@@ -38,15 +38,22 @@
/**
* Prints the previously executed ResultSet to system out, in the form required by the
assert call. Usally in
* the interactive more the resultset is automatically read, so this applies only in the
script mode.
- * @param comparemode - true - print in the format that can be used in the regression
tests
- * - false - print to console
+ * @param comparePrint - true - print in the format that can be used in the regression
tests
+ * - false - print to console
*/
-printResults(boolean true);
+printResults(boolean comparePrint);
/**
* Walks the ResultSet, but does not print any results. Good for performance testing.
Usally in
* the interactive more the resultset is automatically read, so this applies only in the
script mode.
*/
-walkResults()
+walkResults();
+
+/**
+ * Shows the plan associated with the last executed statement.
+ * @param xml - true - show in xml form
+ * - false - show in text form
+ */
+showPlan(boolean xml);
]]></programlisting>
</appendix>
\ No newline at end of file
Show replies by date