groovy.sql
public class DataSet extends Sql
Sql.AbstractQueryCommand, Sql.PreparedQueryCommand, Sql.QueryCommand| Constructor and Description |
|---|
DataSet(Sql sql,
java.lang.Class type) |
DataSet(Sql sql,
java.lang.String table) |
| Modifier and Type | Method and Description |
|---|---|
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
overridden 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() |
protected SqlOrderByVisitor |
getSqlOrderByVisitor() |
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) |
void |
withTransaction(Closure closure)
Performs the closure within a transaction using a cached connection.
|
ARRAY, asList, asList, asSql, BIGINT, BINARY, BIT, BLOB, BOOLEAN, cacheStatements, call, call, call, call, call, CHAR, CLOB, close, configure, createPreparedQueryCommand, createQueryCommand, DATALINK, dataSet, dataSet, DATE, DECIMAL, DISTINCT, DOUBLE, eachRow, eachRow, eachRow, eachRow, eachRow, eachRow, execute, execute, execute, executeInsert, executeInsert, executeInsert, executePreparedQuery, executeQuery, executeUpdate, executeUpdate, executeUpdate, expand, findWhereKeyword, firstRow, firstRow, firstRow, FLOAT, getConnection, getDataSource, getParameters, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, in, inout, INTEGER, isCacheStatements, JAVA_OBJECT, loadDriver, LONGVARBINARY, LONGVARCHAR, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, NULL, nullify, NUMERIC, OTHER, out, query, query, query, REAL, REF, resultSet, rows, rows, rows, rows, rows, rows, setCacheStatements, setInternalConnection, setObject, setParameters, setResultSetConcurrency, setResultSetHoldability, setResultSetType, SMALLINT, STRUCT, TIME, TIMESTAMP, TINYINT, VARBINARY, VARCHAR, withBatch, withStatementpublic DataSet(Sql sql, java.lang.Class type)
public DataSet(Sql sql, java.lang.String table)
protected java.sql.Connection createConnection()
throws java.sql.SQLException
SqlcreateConnection in class Sqljava.sql.SQLException - if a SQL error occursprotected void closeResources(java.sql.Connection connection,
java.sql.Statement statement,
java.sql.ResultSet results)
SqlcloseResources in class Sqlconnection - the connection to closestatement - the statement to closeresults - the results to closeprotected void closeResources(java.sql.Connection connection,
java.sql.Statement statement)
SqlcloseResources in class Sqlconnection - the connection to closestatement - the statement to closepublic void cacheConnection(Closure closure) throws java.sql.SQLException
SqlcacheConnection in class Sqlclosure - the given closurejava.sql.SQLException - if a database error occurspublic void withTransaction(Closure closure) throws java.sql.SQLException
SqlwithTransaction in class Sqlclosure - the given closurejava.sql.SQLException - if a database error occurspublic void commit()
throws java.sql.SQLException
Sqlpublic void rollback()
throws java.sql.SQLException
Sqlpublic void add(java.util.Map<java.lang.String,java.lang.Object> map)
throws java.sql.SQLException
java.sql.SQLExceptionpublic DataSet reverse()
public void each(Closure closure) throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getSql()
public java.util.List getParameters()
protected SqlWhereVisitor getSqlWhereVisitor()
protected SqlOrderByVisitor getSqlOrderByVisitor()
public java.util.List rows()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurspublic java.lang.Object firstRow()
throws java.sql.SQLException
java.sql.SQLException - if a database error occurs