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 boolean
callback(ResultSet rs, ObjectGetter ignored)
Invoked for each result, provided that the previous invocation returnedtrue
.void
close()
Close the ToolResultSet, this is not required, but will free memory used to hold the data set.void
finish()
Invoked when all results have been processed.BigDecimal
getBigDecimal(int columnIndex)
Get the value of the specified column as a BigDecimal, columns start at 1.Long
getLong(int columnIndex)
Get the value of the specified column as a Long, columns start at 1.ToolResultSetMetaData
getMetaData()
Get the metadata for the query.String
getString(int columnIndex)
Get the value of the specified column as a String, columns start at 1.boolean
next()
Attempt to moves to the next row, and return true if that row exists.void
postExecute(ResultSet rs)
Process the result set before the initial ResultSet.next() is called.void
start()
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:APIResultSetPostExecuteCallback
Process 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:
postExecute
in interfaceAPIResultSetPostExecuteCallback
- Parameters:
rs
- the ResultSet row to process- Throws:
SQLException
- if an error occurs.
-
start
public void start()
Description copied from interface:APIResultSetCallback
Invoked 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:
start
in interfaceAPIResultSetCallback
-
callback
public boolean callback(ResultSet rs, ObjectGetter ignored) throws SQLException
Description copied from interface:APIResultSetCallback
Invoked for each result, provided that the previous invocation returnedtrue
.- Specified by:
callback
in 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:
true
if this method should be invoked for the next result,false
if subsequent results are to be discarded.- Throws:
SQLException
- Exception thrown when a database-related error occurs
-
finish
public void finish()
Description copied from interface:APIResultSetCallback
Invoked when all results have been processed. This is after all calls toAPIResultSetCallback.callback(ResultSet, ObjectGetter)
have been made.- Specified by:
finish
in interfaceAPIResultSetCallback
-
getMetaData
public ToolResultSetMetaData getMetaData()
Description copied from interface:ToolResultSet
Get the metadata for the query.- Specified by:
getMetaData
in interfaceToolResultSet
- Returns:
- the metadata.
-
next
public boolean next()
Description copied from interface:ToolResultSet
Attempt 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:
next
in 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:ToolResultSet
Get the value of the specified column as a Long, columns start at 1.- Specified by:
getLong
in 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:ToolResultSet
Get the value of the specified column as a BigDecimal, columns start at 1.- Specified by:
getBigDecimal
in 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:ToolResultSet
Get the value of the specified column as a String, columns start at 1.- Specified by:
getString
in 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:ToolResultSet
Close the ToolResultSet, this is not required, but will free memory used to hold the data set.- Specified by:
close
in interfaceToolResultSet
-
-