org.oddjob.sql
Class SQLResultsSheet

java.lang.Object
  extended by org.oddjob.beanbus.AbstractDestination<F>
      extended by org.oddjob.beanbus.AbstractFilter<Object,Object>
          extended by org.oddjob.sql.SQLResultsSheet
All Implemented Interfaces:
Iterable<Object>, Collection<Object>, ArooaSessionAware, BusFilter<Object,Object>, Outbound<Object>

public class SQLResultsSheet
extends AbstractFilter<Object,Object>
implements ArooaSessionAware

Description

Writes SQL results to an output stream.

Example

A result sheet for multiple statements.
<oddjob>
  <job>
    <sql>
      <connection>
        <connection driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:mem:test" username="sa" password=""/>
      </connection>
      <input>
        <buffer>
create table FRUIT(
  TYPE varchar(16),
  VARIETY varchar(16),
  COLOUR varchar(32),
  SIZE double);
insert into FRUIT values ('Apple', 'Cox', 'Red and Green', 7.6);
insert into FRUIT values ('Orange', 'Jaffa', 'Orange', 9.245);

select * from FRUIT;

shutdown;
        </buffer>
      </input>
      <results>
        <sql-results-sheet/>
      </results>
    </sql>
  </job>
</oddjob>
This writes the following to the console:
 [0 rows affected, 16 ms.]
 
 [1 rows affected, 0 ms.]
 
 [1 rows affected, 0 ms.]
 
 TYPE    VARIETY  COLOUR         SIZE
 ------  -------  -------------  -----
 Apple   Cox      Red and Green  7.6
 Orange  Jaffa    Orange         9.245
 
 [2 rows, 212 ms.]
 
 [0 rows affected, 0 ms.]
 
 
Author:
rob

Constructor Summary
SQLResultsSheet()
           
 
Method Summary
protected  Object filter(Object from)
           
 OutputStream getOutput()
           
 boolean isDataOnly()
           
 void setArooaSession(ArooaSession session)
           
 void setBusConductor(BusConductor busConductor)
           
 void setDataOnly(boolean dataOnly)
           
 void setOutput(OutputStream output)
           
 void writeBeans(List<Object> beans)
           
 
Methods inherited from class org.oddjob.beanbus.AbstractFilter
add, getName, getTo, setName, setTo, toString
 
Methods inherited from class org.oddjob.beanbus.AbstractDestination
addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

SQLResultsSheet

public SQLResultsSheet()
Method Detail

setArooaSession

public void setArooaSession(ArooaSession session)
Specified by:
setArooaSession in interface ArooaSessionAware

filter

protected Object filter(Object from)
Specified by:
filter in class AbstractFilter<Object,Object>

writeBeans

public void writeBeans(List<Object> beans)

getOutput

public OutputStream getOutput()

setOutput

public void setOutput(OutputStream output)

isDataOnly

public boolean isDataOnly()

setDataOnly

public void setDataOnly(boolean dataOnly)

setBusConductor

@Inject
public void setBusConductor(BusConductor busConductor)