|
|||||||||||
| 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 |
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. |
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 |
int |
getCurrentStatus(OperationCommand cmd)
Returns the current status of the given operation command |
static ResultsViewAPI |
getInstance()
Returns the instance of ResultsViewAPI |
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
ResultsViewAPIpublic 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 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 otherwise
public 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 otherwise
public 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 otherwise
public 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 otherwise
public 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 otherwise
public 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 otherwise
public 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 otherwise
public 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
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||