|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgroovy.sql.Sql
groovy.sql.DataSet
public class DataSet
Represents an extent of objects
| Field Summary | |
|---|---|
private Sql |
delegate
|
private java.util.List |
params
|
private DataSet |
parent
|
private boolean |
reversed
|
private Closure |
sort
|
private SqlOrderByVisitor |
sortVisitor
|
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, VARBINARY, VARCHAR |
| Constructor Summary | |
|---|---|
private |
DataSet(DataSet parent)
|
private |
DataSet(DataSet parent,
Closure where)
|
private |
DataSet(DataSet parent,
Closure where,
Closure sort)
|
|
DataSet(Sql sql,
java.lang.Class type)
|
|
DataSet(Sql sql,
java.lang.String table)
|
| Method Summary | |
|---|---|
void |
add(java.util.Map<java.lang.String,java.lang.Object> map)
|
void |
cacheConnection(Closure closure)
Caches the connection used while the closure is active. |
protected void |
closeResources(java.sql.Connection connection,
java.sql.Statement statement)
An extension point allowing the behavior of resource closing to be overriden in derived classes. |
protected void |
closeResources(java.sql.Connection connection,
java.sql.Statement statement,
java.sql.ResultSet results)
An extension point allowing derived classes to change the behavior of resource closing. |
void |
commit()
If this SQL object was created with a Connection then this method commits the connection. |
protected java.sql.Connection |
createConnection()
An extension point allowing derived classes to change the behavior of connection creation. |
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()
|
private java.lang.String |
getSqlOrderBy()
|
protected SqlOrderByVisitor |
getSqlOrderByVisitor()
|
private java.lang.String |
getSqlWhere()
|
protected SqlWhereVisitor |
getSqlWhereVisitor()
|
DataSet |
reverse()
|
void |
rollback()
If this SQL object was created with a Connection then this method rolls back the connection. |
java.util.List |
rows()
Returns a List of all of the rows from the table a DataSet represents |
DataSet |
sort(Closure sort)
|
private void |
visit(Closure closure,
CodeVisitorSupport visitor)
|
void |
withTransaction(Closure closure)
Performs the closure within a transaction using a cached connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Closure where
private Closure sort
private boolean reversed
private DataSet parent
private java.lang.String table
private SqlWhereVisitor visitor
private SqlOrderByVisitor sortVisitor
private java.lang.String sql
private java.util.List params
private Sql delegate
| Constructor Detail |
|---|
public DataSet(Sql sql,
java.lang.Class type)
public DataSet(Sql sql,
java.lang.String table)
private DataSet(DataSet parent,
Closure where)
private DataSet(DataSet parent,
Closure where,
Closure sort)
private DataSet(DataSet parent)
| Method Detail |
|---|
protected java.sql.Connection createConnection()
throws java.sql.SQLException
Sql
createConnection in class Sqljava.sql.SQLException - if a SQL error occurs
protected void closeResources(java.sql.Connection connection,
java.sql.Statement statement,
java.sql.ResultSet results)
Sql
closeResources in class Sqlconnection - the connection to closestatement - the statement to closeresults - the results to close
protected void closeResources(java.sql.Connection connection,
java.sql.Statement statement)
Sql
closeResources in class Sqlconnection - the connection to closestatement - the statement to close
public void cacheConnection(Closure closure)
throws java.sql.SQLException
Sql
cacheConnection in class Sqlclosure - the given closure
java.sql.SQLException - if a database error occurs
public void withTransaction(Closure closure)
throws java.sql.SQLException
Sql
withTransaction in class Sqlclosure - the given closure
java.sql.SQLException - if a database error occurs
public void commit()
throws java.sql.SQLException
Sql
commit in class Sqljava.sql.SQLException - if a database access error occurs
public void rollback()
throws java.sql.SQLException
Sql
rollback in class Sqljava.sql.SQLException - if a database access error occurs
public void add(java.util.Map<java.lang.String,java.lang.Object> map)
throws java.sql.SQLException
java.sql.SQLExceptionpublic DataSet findAll(Closure where)
public DataSet sort(Closure sort)
public DataSet reverse()
public void each(Closure closure)
throws java.sql.SQLException
java.sql.SQLExceptionprivate java.lang.String getSqlWhere()
private java.lang.String getSqlOrderBy()
public java.lang.String getSql()
public java.util.List getParameters()
protected SqlWhereVisitor getSqlWhereVisitor()
protected SqlOrderByVisitor getSqlOrderByVisitor()
private void visit(Closure closure,
CodeVisitorSupport visitor)
public DataSet createView(Closure criteria)
public java.util.List rows()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurs
public java.lang.Object firstRow()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||