|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.arsdigita.acs.Selection
Represents a generic multiple-row data source pulled in from the database. Provides a generic interface for getting properties and filling the datasource from either a ResultSet or a SqlStatement and a database handle.
Entity objects for doing logical operations on more specific database objects should extend Selection, adding additional accessors for derived properties as needed.
Field Summary | |
protected int |
ctr
|
protected Database |
db
|
protected ResultSet |
rs
The result set that we're managing |
protected ResultSetMetaData |
rsmd
|
Constructor Summary | |
Selection()
|
|
Selection(ResultSet rs)
Creates a new Selection, initialized from a ResultSet. |
|
Selection(SqlStatement sql,
Database db)
Utility constructor to initialize from a result set created from a SqlStatement and a database handle. |
Method Summary | |
boolean |
contains(String column)
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. |
protected Hashtable |
freeze()
Returns a mapping from column names to objects, to stash a current set of values for a row. |
String |
get(String key)
Generic get-property accessor. |
byte[] |
getBLOB(String key)
Returns the contents of a BLOB column in this Selection. |
String[] |
keys()
Returns a list of available keys (column names) in the Selection. |
boolean |
next()
Advances to the next row in the data source, if there is one. |
int |
rownum()
Returns the current row number in the datasource. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected ResultSet rs
protected ResultSetMetaData rsmd
protected Database db
protected int ctr
Constructor Detail |
public Selection()
public Selection(ResultSet rs) throws SQLException
public Selection(SqlStatement sql, Database db) throws SQLException
Method Detail |
public boolean contains(String column) throws DataSourceException
true
if this contains a column named
column
.contains
in interface DataSource
protected Hashtable freeze() throws SQLException, IOException
public String get(String key) throws DataSourceException
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!).get
in interface DataSource
InvalidKeyException
- if key is not found.public boolean next() throws DataSourceException
next
in interface DataSource
public String[] keys() throws DataSourceException
keys
in interface DataSource
public byte[] getBLOB(String key) throws DataSourceException
key
- The column name to retrievepublic void dumpBLOB(String key, OutputStream os) throws DataSourceException
key
- The column nameos
- The output streampublic int rownum() throws DataSourceException
rownum
in interface DataSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |