Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Fields inherited from class | Fields |
---|---|
class Sql |
ALL_RESULT_SETS, ARRAY, BIGINT, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATALINK, DATE, DECIMAL, DISTINCT, DOUBLE, FIRST_RESULT_SET, FLOAT, INTEGER, JAVA_OBJECT, LOG, LONGVARBINARY, LONGVARCHAR, NO_RESULT_SETS, NULL, NUMERIC, OTHER, REAL, REF, SMALLINT, STRUCT, TIME, TIMESTAMP, TINYINT, VARBINARY, VARCHAR |
Type | Name and description |
---|---|
void |
add(Map<String, Object> map) Adds the provided map of key-value pairs as a new row in the table represented by this DataSet. |
void |
cacheConnection(Closure closure) |
void |
close() |
protected void |
closeResources(Connection connection, Statement statement, ResultSet results) |
protected void |
closeResources(Connection connection, Statement statement) |
void |
commit() |
protected Connection |
createConnection() |
DataSet |
createView(Closure criteria) |
void |
each(Closure closure) Calls the provided closure for each of the rows of the table represented by this DataSet. |
void |
each(int offset, int maxRows, Closure closure) Calls the provided closure for a "page" of rows from the table represented by this DataSet. |
DataSet |
findAll(Closure where) Return a lazy-implemented filtered view of this DataSet. |
Object |
firstRow() Returns the first row from a DataSet's underlying table |
List<Object> |
getParameters() |
String |
getSql() |
protected SqlOrderByVisitor |
getSqlOrderByVisitor() |
protected SqlWhereVisitor |
getSqlWhereVisitor() |
DataSet |
reverse() Return a lazy-implemented reverse-ordered view of this DataSet. |
void |
rollback() |
List |
rows() Returns a List of all of the rows from the table a DataSet represents. |
List |
rows(int offset, int maxRows) Returns a "page" of the rows from the table a DataSet represents. |
DataSet |
sort(Closure sort) Return a lazy-implemented re-ordered view of this DataSet. |
int[] |
withBatch(Closure closure) Performs the closure (containing batch operations) within a batch. |
int[] |
withBatch(int batchSize, Closure closure) Performs the closure (containing batch operations) within a batch. |
void |
withTransaction(Closure closure) |
Adds the provided map of key-value pairs as a new row in the table represented by this DataSet.
map
- the key (column-name), value pairs to add as a new rowCalls the provided closure for each of the rows of the table represented by this DataSet.
closure
- called for each row with a GroovyResultSetCalls the provided closure for a "page" of rows from the table represented by this DataSet. A page is defined as starting at a 1-based offset, and containing a maximum number of rows.
offset
- the 1-based offset for the first row to be processedmaxRows
- the maximum number of rows to be processedclosure
- called for each row with a GroovyResultSetReturn a lazy-implemented filtered view of this DataSet.
where
- the filtering ClosureReturns the first row from a DataSet's underlying table
Return a lazy-implemented reverse-ordered view of this DataSet.
Returns a List of all of the rows from the table a DataSet represents.
Returns a "page" of the rows from the table a DataSet represents. A page is defined as starting at a 1-based offset, and containing a maximum number of rows.
offset
- the 1-based offset for the first row to be processedmaxRows
- the maximum number of rows to be processedReturn a lazy-implemented re-ordered view of this DataSet.
sort
- the ordering ClosurePerforms the closure (containing batch operations) within a batch. Uses a batch size of zero, i.e. no automatic partitioning of batches.
Statement
, or the
driver does not support batch statements. Throws BatchUpdateException
(a subclass of SQLException
) if one of the commands sent to the
database fails to execute properly or attempts to return a result set.closure
- the closure containing batch and optionally other statementsPerforms the closure (containing batch operations) within a batch. For example:
dataSet.withBatch(3) { add(anint: 1, astring: "Groovy") add(anint: 2, astring: "rocks") add(anint: 3, astring: "the") add(anint: 4, astring: "casbah") }
SQLException
)
if one of the commands sent to the database fails to execute properly.batchSize
- partition the batch into batchSize pieces, i.e. after batchSize
addBatch()
invocations, call executeBatch()
automatically;
0 means manual calls to executeBatch are requiredclosure
- the closure containing batch and optionally other statementsCopyright © 2003-2015 The Apache Software Foundation. All rights reserved.