com.arsdigita.acs
Class SingleSelection

java.lang.Object
  |
  +--com.arsdigita.acs.Selection
        |
        +--com.arsdigita.acs.SingleSelection
All Implemented Interfaces:
DataSource
Direct Known Subclasses:
ChatRoom

public class SingleSelection
extends Selection

Represents a single generic object pulled in from the database.


Field Summary
(package private)  Hashtable props
           
 
Fields inherited from class com.arsdigita.acs.Selection
ctr, db, rs, rsmd
 
Constructor Summary
SingleSelection(ResultSet rs)
          Generates a single-row selection from the current row in the result set.
SingleSelection(Selection s)
          Creates a single-row selection from the currently active row in s.
 
Method Summary
 boolean contains(String key)
          Returns true if this contains a column named column.
 void dumpBLOB(String key, OutputStream os)
          Dumps the contents of a BLOB column to an OutputStream.
 String get(String key)
          Generic get-property accessor.
 byte[] getBLOB(String key, OutputStream os)
          Returns the contents of a BLOB column in a byte array.
 String[] keys()
          Returns a list of available keys (column names) in the Selection.
 boolean next()
          Since we are represening a single database row, we never want to (and can't) increment the data source.
 int rownum()
          Returns the current row number in the datasource.
 
Methods inherited from class com.arsdigita.acs.Selection
freeze, getBLOB
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

Hashtable props
Constructor Detail

SingleSelection

public SingleSelection(ResultSet rs)
                throws SQLException,
                       IOException
Generates a single-row selection from the current row in the result set. Requires that next() has been called at least once on rs.

SingleSelection

public SingleSelection(Selection s)
                throws SQLException,
                       IOException
Creates a single-row selection from the currently active row in s. The returned SingleSelection is "frozen" with the currently-active values in s.
Method Detail

get

public String get(String key)
           throws DataSourceException
Description copied from class: Selection
Generic get-property accessor. Returns the value of the column named by key; if it's a CLOB column, still returns the text from the CLOB. If it's a DATE column, returns an ANSI date string (yyyy-mm-dd). Returns an empty string if the column is null (a perhaps unnecessary evil to prevent the string "null" from popping up in JSP pages--probably should get rid of this with more consistent use of ad:sub tag!).
Overrides:
get in class Selection
Following copied from class: com.arsdigita.acs.Selection
Throws:
InvalidKeyException - if key is not found.

contains

public boolean contains(String key)
                 throws DataSourceException
Description copied from class: Selection
Returns true if this contains a column named column.
Overrides:
contains in class Selection

keys

public String[] keys()
Description copied from class: Selection
Returns a list of available keys (column names) in the Selection.
Overrides:
keys in class Selection

next

public boolean next()
Since we are represening a single database row, we never want to (and can't) increment the data source. Always returns false.
Overrides:
next in class Selection
Returns:
Always false

rownum

public int rownum()
Description copied from class: Selection
Returns the current row number in the datasource.
Overrides:
rownum in class Selection

getBLOB

public byte[] getBLOB(String key,
                      OutputStream os)
               throws DataSourceException
Returns the contents of a BLOB column in a byte array.

dumpBLOB

public void dumpBLOB(String key,
                     OutputStream os)
              throws DataSourceException
Dumps the contents of a BLOB column to an OutputStream.
Overrides:
dumpBLOB in class Selection
Parameters:
key - The column name
os - The output stream