Package com.redwood.scheduler.api.jdbc
Class InternalToolResultSet
- java.lang.Object
-
- com.redwood.scheduler.api.jdbc.InternalToolResultSet
-
- All Implemented Interfaces:
APIResultSetCallback,APIResultSetPostExecuteCallback,ToolResultSet
public class InternalToolResultSet extends Object implements APIResultSetCallback, APIResultSetPostExecuteCallback, ToolResultSet
REDWOOD INTERNAL USE ONLY, NOT FOR CUSTOMER USE. Internal tool result set for client JDBC driver.
-
-
Field Summary
-
Fields inherited from interface com.redwood.scheduler.api.model.APIResultSetCallback
NULL
-
-
Constructor Summary
Constructors Constructor Description InternalToolResultSet(SchedulerSession newSession)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancallback(ResultSet rs, ObjectGetter ignored)Invoked for each result, provided that the previous invocation returnedtrue.voidclose()Close the ToolResultSet, this is not required, but will free memory used to hold the data set.voidfinish()Invoked when all results have been processed.BigDecimalgetBigDecimal(int columnIndex)Get the value of the specified column as a BigDecimal, columns start at 1.LonggetLong(int columnIndex)Get the value of the specified column as a Long, columns start at 1.ToolResultSetMetaDatagetMetaData()Get the metadata for the query.StringgetString(int columnIndex)Get the value of the specified column as a String, columns start at 1.booleannext()Attempt to moves to the next row, and return true if that row exists.voidpostExecute(ResultSet rs)Process the result set before the initial ResultSet.next() is called.voidstart()Invoked before processing any results.
-
-
-
Constructor Detail
-
InternalToolResultSet
public InternalToolResultSet(SchedulerSession newSession)
-
-
Method Detail
-
postExecute
public void postExecute(ResultSet rs) throws SQLException
Description copied from interface:APIResultSetPostExecuteCallbackProcess the result set before the initial ResultSet.next() is called. This should be used to handle the cases where the result set is empty but result information is still required - e.g. displaying the headers for an empty result.- Specified by:
postExecutein interfaceAPIResultSetPostExecuteCallback- Parameters:
rs- the ResultSet row to process- Throws:
SQLException- if an error occurs.
-
start
public void start()
Description copied from interface:APIResultSetCallbackInvoked before processing any results.This is before any calls to
APIResultSetCallback.callback(ResultSet, ObjectGetter)are made.Note that this may be invoked more than once under some circumstances. (Such circumstances include when the query is restarted due to underlying database errors.)
- Specified by:
startin interfaceAPIResultSetCallback
-
callback
public boolean callback(ResultSet rs, ObjectGetter ignored) throws SQLException
Description copied from interface:APIResultSetCallbackInvoked for each result, provided that the previous invocation returnedtrue.- Specified by:
callbackin interfaceAPIResultSetCallback- Parameters:
rs- the result-set to processignored- an object-getter with can be used to convert the result-set into one (or more) objects.- Returns:
trueif this method should be invoked for the next result,falseif subsequent results are to be discarded.- Throws:
SQLException- Exception thrown when a database-related error occurs
-
finish
public void finish()
Description copied from interface:APIResultSetCallbackInvoked when all results have been processed. This is after all calls toAPIResultSetCallback.callback(ResultSet, ObjectGetter)have been made.- Specified by:
finishin interfaceAPIResultSetCallback
-
getMetaData
public ToolResultSetMetaData getMetaData()
Description copied from interface:ToolResultSetGet the metadata for the query.- Specified by:
getMetaDatain interfaceToolResultSet- Returns:
- the metadata.
-
next
public boolean next()
Description copied from interface:ToolResultSetAttempt to moves to the next row, and return true if that row exists. The ToolResultSet starts before the first row. The first call to the method makes the first row curent, the second call makes the second row current, and so on. Example usage:import com.redwood.scheduler.api.tool.*; public class Main { public static void main(String [] args) throws Exception { ToolConnection con = ToolConnectionFactory.createConnection(args[0], 60000); ToolResultSet rs = con.executeQuery("select JobDefinition.Name, JobDefinition.UniqueId from JobDefinition", null, null); while (rs.next()) { System.out.println(rs.getString(1) + " = " + rs.getString(2)); } } }- Specified by:
nextin interfaceToolResultSet- Returns:
- true if the new current row is valid, or false if there are no more rows.
-
getLong
public Long getLong(int columnIndex)
Description copied from interface:ToolResultSetGet the value of the specified column as a Long, columns start at 1.- Specified by:
getLongin interfaceToolResultSet- Parameters:
columnIndex- the column index, 1 based.- Returns:
- the value of the column, as a Long.
-
getBigDecimal
public BigDecimal getBigDecimal(int columnIndex)
Description copied from interface:ToolResultSetGet the value of the specified column as a BigDecimal, columns start at 1.- Specified by:
getBigDecimalin interfaceToolResultSet- Parameters:
columnIndex- the column index, 1 based.- Returns:
- the value of the column, as a BigDecimal.
-
getString
public String getString(int columnIndex)
Description copied from interface:ToolResultSetGet the value of the specified column as a String, columns start at 1.- Specified by:
getStringin interfaceToolResultSet- Parameters:
columnIndex- the column index, 1 based.- Returns:
- the value of the column, as a String.
-
close
public void close()
Description copied from interface:ToolResultSetClose the ToolResultSet, this is not required, but will free memory used to hold the data set.- Specified by:
closein interfaceToolResultSet
-
-