groovy.sql
Class DataSet

java.lang.Object
  extended by groovy.sql.Sql
      extended by groovy.sql.DataSet

public class DataSet
extends Sql

Represents an extent of objects

Version:
$Revision: 6778 $
Author:
Chris Stevenson, Paul King, James Strachan

Field Summary
private  java.util.List params
           
private  DataSet parent
           
private  java.lang.String sql
           
private  java.lang.String table
           
private  SqlWhereVisitor visitor
           
private  Closure where
           
 
Fields inherited from class groovy.sql.Sql
ARRAY, BIGINT, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATALINK, DATE, DECIMAL, DISTINCT, DOUBLE, FLOAT, INTEGER, JAVA_OBJECT, log, LONGVARBINARY, LONGVARCHAR, NULL, NUMERIC, OTHER, REAL, REF, SMALLINT, STRUCT, TIME, TIMESTAMP, TINYINT, updateCount, VARBINARY, VARCHAR
 
Constructor Summary
DataSet(DataSet parent, Closure where)
           
DataSet(Sql sql, java.lang.Class type)
           
DataSet(Sql sql, java.lang.String table)
           
 
Method Summary
 void add(java.util.Map values)
           
 DataSet createView(Closure criteria)
           
 void each(Closure closure)
           
 DataSet findAll(Closure where)
           
 java.lang.Object firstRow()
          Returns the first row from a DataSet's underlying table
 java.util.List getParameters()
           
 java.lang.String getSql()
           
protected  SqlWhereVisitor getSqlVisitor()
           
 java.util.List rows()
          Returns a List of all of the rows from the table a DataSet represents
 
Methods inherited from class groovy.sql.Sql
ARRAY, asSql, BIGINT, BINARY, BIT, BLOB, BOOLEAN, call, call, call, call, call, CHAR, CLOB, close, closeResources, closeResources, commit, configure, createConnection, DATALINK, dataSet, dataSet, DATE, DECIMAL, DISTINCT, DOUBLE, eachRow, eachRow, eachRow, eachRow, execute, execute, execute, executeInsert, executeInsert, executeInsert, executeUpdate, executeUpdate, executeUpdate, expand, findWhereKeyword, firstRow, firstRow, firstRow, FLOAT, getConnection, getDataSource, getParameters, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, in, inout, INTEGER, JAVA_OBJECT, loadDriver, LONGVARBINARY, LONGVARCHAR, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, NULL, nullify, NUMERIC, OTHER, out, query, query, query, queryEach, queryEach, queryEach, REAL, REF, resultSet, rollback, rows, rows, rows, rows, setObject, setParameters, setResultSetConcurrency, setResultSetHoldability, setResultSetType, SMALLINT, STRUCT, TIME, TIMESTAMP, TINYINT, VARBINARY, VARCHAR, withStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

where

private Closure where

parent

private DataSet parent

table

private java.lang.String table

visitor

private SqlWhereVisitor visitor

sql

private java.lang.String sql

params

private java.util.List params
Constructor Detail

DataSet

public DataSet(Sql sql,
               java.lang.Class type)

DataSet

public DataSet(Sql sql,
               java.lang.String table)

DataSet

public DataSet(DataSet parent,
               Closure where)
Method Detail

add

public void add(java.util.Map values)
         throws java.sql.SQLException
Throws:
java.sql.SQLException

findAll

public DataSet findAll(Closure where)

each

public void each(Closure closure)
          throws java.sql.SQLException
Throws:
java.sql.SQLException

getSql

public java.lang.String getSql()

getParameters

public java.util.List getParameters()

getSqlVisitor

protected SqlWhereVisitor getSqlVisitor()

createView

public DataSet createView(Closure criteria)

rows

public java.util.List rows()
                    throws java.sql.SQLException
Returns a List of all of the rows from the table a DataSet represents

Returns:
Returns a list of GroovyRowResult objects from the dataset
Throws:
java.sql.SQLException - if a database error occurs

firstRow

public java.lang.Object firstRow()
                          throws java.sql.SQLException
Returns the first row from a DataSet's underlying table

Returns:
Returns the first GroovyRowResult object from the dataset
Throws:
java.sql.SQLException - if a database error occurs


Copyright © ${year} The Codehaus. All Rights Reserved.