|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.sqltools.result.ResultsViewAPI
The core API of SQL Results View.
To use ResultsViewAPI
to display message or result set on SQL Results View, follow the steps below:
OperationCommand
ResultsViewAPI
via ResultsViewAPI.getInstance()
ResultsViewAPI
to display result item, given the instance of
OperationCommand
Three types of result item can be displayed on SQL Results View:
Usage example:
OperationCommand cmd = new OperationCommand(OperationCommand.ACTION_EXECUTE, "select * from test_table", "SQL Editor", "ase_15", "pubs2"); ResultsViewAPI resultsView = ResultsViewAPI.getInstance(); resultsView.createNewInstance(cmd, null); resultsView.appendStatusMessage(cmd, "Start executing..."); ResultSet rs = .....;//execution logic to get result set from database resultsView.appendResultSet(cmd, rs); String xmlString = ....;//execution logic to get XML result string from database resultsView.appendXMLResultSet(cmd, xmlString); resultsView.appendStatusMessage(cmd, "Operation Succeeded"); resultsView.updateStatus(cmd, OperationCommand.STATUS_SUCCEEDED);
Notice that except that the user can display a JDBC result set on SQL Results View, he/she can also initiate an
instance of IResultSetObject
and then display it on SQL Results View. The following code is an usage
example:
OperationCommand cmd = new OperationCommand(OperationCommand.ACTION_EXECUTE, "select * from test_table", "SQL Editor", "ase_15", "pubs2"); ResultsViewAPI resultsView = ResultsViewAPI.getInstance(); resultsView.createNewInstance(cmd, null); resultsView.appendStatusMessage(cmd, "Start executing..."); IResultSetRow row1 = new ResultSetRow(new String[] { "1", "21", "Jack" }); IResultSetRow row2 = new ResultSetRow(new String[] { "2", "23", "Micheal" }); ArrayList rows = new ArrayList(); rows.add(row1); rows.add(row2); IResultSetObject rs = new ResultSetObject(rows, new String[] { "Id", "Age", "Name" }, new int[] { Types.CHAR, Types.CHAR, Types.CHAR }, new int[] { 8, 8, 21 }); resultsView.appendResultSet(cmd, rs); resultsView.appendStatusMessage(cmd, "Operation Succeeded"); resultsView.updateStatus(cmd, OperationCommand.STATUS_SUCCEEDED);
OperationCommand
,
ResultSetObject
,
Parameter
Method Summary | |
boolean |
appendPlainMessage(OperationCommand cmd,
java.lang.String message)
Appends a plain message to the result instance, when using multiple windows display mode, this kind of messages will be displayed on "Message" tab |
boolean |
appendResultSet(OperationCommand cmd,
IResultSetObject rs)
Appends an instance of IResultSetObject to SQL Results View. |
boolean |
appendResultSet(OperationCommand cmd,
java.sql.ResultSet rs)
Appends a JDBC result set to the result instance. |
boolean |
appendStatusMessage(OperationCommand cmd,
java.lang.String message)
Appends a status message to the result instance, when using multiple windows display mode, this kind of messages will be displayed on "Status" tab |
boolean |
appendThrowable(OperationCommand cmd,
java.lang.Throwable th)
Appends an exception to the result instance, this won't affect the UI. |
boolean |
appendUpdateCountMessage(OperationCommand cmd,
int count)
Appends an update count message to the result instance. |
boolean |
appendXMLResultSet(OperationCommand cmd,
java.lang.String xmlString)
Appends an XML result set to SQL Results View. |
int |
calculateStatus(OperationCommand command)
Calculates the status of the result instance based on its sub-results' status. |
boolean |
checkView()
Checks if the SQL Results View is active, if not, create it and bring it to the top. |
boolean |
createNewInstance(OperationCommand cmd,
java.lang.Runnable terminateHandler)
Creates a new result instance given the OperationCommand instance |
boolean |
createSubInstance(OperationCommand parentCmd,
OperationCommand cmd,
java.lang.Runnable terminateHandler)
Creates a sub result instance for the given parent result instance. |
int |
getCurrentStatus(OperationCommand cmd)
Returns the current status of the given operation command |
java.lang.Throwable[] |
getFailThrowables(OperationCommand cmd)
Returns the exceptions thrown when generating the result instance |
java.lang.Throwable[] |
getFailThrowables(OperationCommand cmd,
boolean includeSubThrowables)
Returns the exceptions thrown when generating the result instance |
static ResultsViewAPI |
getInstance()
Returns the instance of ResultsViewAPI |
OperationCommand |
getSubOperationCommand(OperationCommand parentCmd,
int subNum)
Returns the operation request of the sub-result |
boolean |
showParameters(OperationCommand cmd,
java.util.List params)
Shows the parameters on SQL Results View. |
boolean |
updateStatus(OperationCommand cmd,
int status)
Updates the status of the result instance. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static ResultsViewAPI getInstance()
ResultsViewAPI
ResultsViewAPI
public int getCurrentStatus(OperationCommand cmd)
cmd
- the operation command
null
or the corresponding result instance is not foundOperationCommand.STATUS_STARTED
,
OperationCommand.STATUS_RUNNING
,
OperationCommand.STATUS_SUCCEEDED
,
OperationCommand.STATUS_FAILED
,
OperationCommand.STATUS_TERMINATED
,
OperationCommand.STATUS_WARNING
,
OperationCommand.STATUS_CRITICAL_ERROR
public java.lang.Throwable[] getFailThrowables(OperationCommand cmd, boolean includeSubThrowables)
cmd
- the operation request, should not be nullincludeSubThrowables
- whether include all the sub results' throwables or not
public java.lang.Throwable[] getFailThrowables(OperationCommand cmd)
cmd
- the operation request, should not be null
public boolean appendThrowable(OperationCommand cmd, java.lang.Throwable th)
th
- the exception thrownpublic boolean appendPlainMessage(OperationCommand cmd, java.lang.String message)
cmd
- the operation request, should not be nullmessage
- the message string, should not be null
true
if operation succeeds; false
otherwisepublic boolean appendResultSet(OperationCommand cmd, IResultSetObject rs)
IResultSetObject
to SQL Results View.
cmd
- the operation request, should not be nullrs
- the instance of IResultSetObject
true
if operation succeeds; false
otherwisepublic boolean appendResultSet(OperationCommand cmd, java.sql.ResultSet rs)
cmd
- the operation request, should not be nullrs
- the JDBC result set, should not be null
true
if operation succeeds; false
otherwisepublic boolean appendStatusMessage(OperationCommand cmd, java.lang.String message)
cmd
- the operation request, should not be nullmessage
- the message string, should not be null
true
if operation succeeds; false
otherwisepublic boolean appendUpdateCountMessage(OperationCommand cmd, int count)
cmd
- the operation request, should not be nullcount
- the update count number, should greater than or equals to 0
true
if operation succeeds; false
otherwisepublic boolean appendXMLResultSet(OperationCommand cmd, java.lang.String xmlString)
cmd
- the operation request, should not be nullxmlString
- the xml string
true
if operation succeeds; false
otherwisepublic boolean checkView()
true
if operation succeeds; false
otherwisepublic boolean createNewInstance(OperationCommand cmd, java.lang.Runnable terminateHandler)
OperationCommand
instance
cmd
- the operation request, can not be nullterminateHandler
- handler used to teminate this item, can be null
true
if the creation succeeds; false
otherwisepublic boolean showParameters(OperationCommand cmd, java.util.List params)
cmd
- he operation request, should not be nullparams
- a list of Parameter
instances
true
if operation succeeds; false
otherwiseParameter
public boolean updateStatus(OperationCommand cmd, int status)
cmd
- the operation request, should not be nullstatus
- the new status (There are 7 statuses defined in OperationCommand
)
true
if operation succeeds; false
otherwiseOperationCommand.STATUS_STARTED
,
OperationCommand.STATUS_RUNNING
,
OperationCommand.STATUS_SUCCEEDED
,
OperationCommand.STATUS_FAILED
,
OperationCommand.STATUS_TERMINATED
,
OperationCommand.STATUS_WARNING
,
OperationCommand.STATUS_CRITICAL_ERROR
public boolean createSubInstance(OperationCommand parentCmd, OperationCommand cmd, java.lang.Runnable terminateHandler)
parentCmd
- the operation request instance of the parent result, can not be nullcmd
- the operation request instance, can not be nullterminateHandler
- the handler to terminate the new instance, can be null
true
if the creation succeeds; false
otherwisepublic OperationCommand getSubOperationCommand(OperationCommand parentCmd, int subNum)
parentCmd
- the parent operation request, can not be nullsubNum
- the number of the sub-instance, 0-based
public int calculateStatus(OperationCommand command)
command
- the operation command
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |