## groovy.sql
Class Sql

Represents an extent of objects

author:
  Chris Stevenson

author:
  James Strachan

version:
  $Revision: 10922 $

Field Summary
`OutParameter` | `ARRAY`
`OutParameter` | `BIGINT`
`OutParameter` | `BINARY`
`OutParameter` | `BIT`
`OutParameter` | `BLOB`
`OutParameter` | `BOOLEAN`
`OutParameter` | `CHAR`
`OutParameter` | `CLOB`
`OutParameter` | `DATALINK`
`OutParameter` | `DATE`
`OutParameter` | `DECIMAL`
`OutParameter` | `DISTINCT`
`OutParameter` | `DOUBLE`
`OutParameter` | `FLOAT`
`OutParameter` | `INTEGER`
`OutParameter` | `JAVA_OBJECT`
`OutParameter` | `LONGVARBINARY`
`OutParameter` | `LONGVARCHAR`
`OutParameter` | `NULL`
`OutParameter` | `NUMERIC`
`OutParameter` | `OTHER`
`OutParameter` | `REAL`
`OutParameter` | `REF`
`OutParameter` | `SMALLINT`
`OutParameter` | `STRUCT`
`OutParameter` | `TIME`
`OutParameter` | `TIMESTAMP`
`OutParameter` | `TINYINT`
`OutParameter` | `VARBINARY`
`OutParameter` | `VARCHAR`
`Closure` | `configureStatement`
`DataSource` | `dataSource`
`Logger` | `log`
`int` | `resultSetConcurrency`
`int` | `resultSetHoldability`
`int` | `resultSetType`
`int` | `updateCount`
`Connection` | `useConnection`
`boolean` | `warned`

Constructor Summary
`Sql(DataSource dataSource)` Constructs an SQL instance using the given DataSource.
`Sql(Connection connection)`
`Sql(Sql parent)`

Method Summary
`static InParameter` | `ARRAY(Object value)`
`static InParameter` | `BIGINT(Object value)`
`static InParameter` | `BINARY(Object value)`
`static InParameter` | `BIT(Object value)`
`static InParameter` | `BLOB(Object value)`
`static InParameter` | `BOOLEAN(Object value)`
`static InParameter` | `CHAR(Object value)`
`static InParameter` | `CLOB(Object value)`
`static InParameter` | `DATALINK(Object value)`
`static InParameter` | `DATE(Object value)`
`static InParameter` | `DECIMAL(Object value)`
`static InParameter` | `DISTINCT(Object value)`
`static InParameter` | `DOUBLE(Object value)`
`static InParameter` | `FLOAT(Object value)`
`static InParameter` | `INTEGER(Object value)`
`static InParameter` | `JAVA_OBJECT(Object value)`
`static InParameter` | `LONGVARBINARY(Object value)`
`static InParameter` | `LONGVARCHAR(Object value)`
`static InParameter` | `NULL(Object value)`
`static InParameter` | `NUMERIC(Object value)`
`static InParameter` | `OTHER(Object value)`
`static InParameter` | `REAL(Object value)`
`static InParameter` | `REF(Object value)`
`static InParameter` | `SMALLINT(Object value)`
`static InParameter` | `STRUCT(Object value)`
`static InParameter` | `TIME(Object value)`
`static InParameter` | `TIMESTAMP(Object value)`
`static InParameter` | `TINYINT(Object value)`
`static InParameter` | `VARBINARY(Object value)`
`static InParameter` | `VARCHAR(Object value)`
`String` | `asSql(GString gstring, List values)`
`int` | `call(String sql)` Performs a stored procedure call.
`int` | `call(String sql, List params)` Performs a stored procedure call with the given parameters.
`void` | `call(String sql, List params, Closure closure)` Performs a stored procedure call with the given parameters.
`int` | `call(GString gstring)` Performs a stored procedure call with the given parameters.
`void` | `call(GString gstring, Closure closure)` Performs a stored procedure call with the given parameters, calling the closure once with all result objects.
`void` | `close()` If this SQL object was created with a Connection then this method closes the connection.
`void` | `closeResources(Connection connection, Statement statement, ResultSet results)`
`void` | `closeResources(Connection connection, Statement statement)`
`void` | `commit()`
`void` | `configure(Statement statement)` Provides a hook to be able to configure JDBC statements, such as to configure
`Statement` | `createConnection(Connection connection)`
`Connection` | `createConnection()`
`DataSet` | `dataSet(String table)`
`DataSet` | `dataSet(Class type)`
`void` | `eachRow(String sql, Closure closure)` Performs the given SQL query calling the closure with each row of the result set.
`void` | `eachRow(String sql, Closure metaClosure, Closure rowClosure)` Performs the given SQL query calling closures for metadata and each row
`void` | `eachRow(String sql, List params, Closure closure)` Performs the given SQL query calling the closure with the result set.
`void` | `eachRow(GString gstring, Closure closure)` Performs the given SQL query calling the closure with the result set.
`boolean` | `execute(String sql)` Executes the given piece of SQL.
`boolean` | `execute(String sql, List params)` Executes the given piece of SQL with parameters.
`boolean` | `execute(GString gstring)` Executes the given SQL with embedded expressions inside.
`List` | `executeInsert(String sql)`
`List` | `executeInsert(String sql, List params)`
`List` | `executeInsert(GString gstring)` Executes the given SQL with embedded expressions inside, and returns the values of any auto-generated colums, such as an autoincrement ID field.
`int` | `executeUpdate(String sql)` Executes the given SQL update.
`int` | `executeUpdate(String sql, List params)` Executes the given SQL update with parameters.
`int` | `executeUpdate(GString gstring)` Executes the given SQL update with embedded expressions inside.
`static ExpandedVariable` | `expand(Object object)` Creates a variable to be expanded in the Sql string rather than representing an sql parameter.
`int` | `findWhereKeyword(String sql)` Find the first 'where' keyword in the sql.
`Object` | `firstRow(String sql)` Performs the given SQL query and return the first row of the result set.
`Object` | `firstRow(GString gstring)` Performs the given SQL query and return the first row of the result set.
`Object` | `firstRow(String sql, List params)` Performs the given SQL query with the list of params and return the first row of the result set.
`Connection` | `getConnection()` If this instance was created with a single Connection then the connection is returned.
`DataSource` | `getDataSource()`
`List` | `getParameters(GString gstring)`
`int` | `getResultSetConcurrency()` Gets the resultSetConcurrency for statements created using the connection.
`int` | `getResultSetHoldability()` Gets the resultSetHoldability for statements created using the connection.
`int` | `getResultSetType()` Gets the resultSetType for statements created using the connection.
`int` | `getUpdateCount()`
`static InParameter` | `in(int type, Object value)` Create a new InParameter
`static InOutParameter` | `inout(InParameter in)` Create an inout parameter using this in parameter.
`static void` | `loadDriver(String driverClassName)` Attempts to load the JDBC driver on the thread, current or system class loaders
`static Sql` | `newInstance(String url)` let's only warn of using deprecated methods once
`static Sql` | `newInstance(String url, Properties properties)` Creates a new Sql instance given a JDBC connection URL and some properties.
`static Sql` | `newInstance(String url, Properties properties, String driverClassName)` Creates a new Sql instance given a JDBC connection URL, some properties and a driver class name.
`static Sql` | `newInstance(String url, String user, String password)` Creates a new Sql instance given a JDBC connection URL, a username and a password.
`static Sql` | `newInstance(String url, String user, String password, String driverClassName)` Creates a new Sql instance given a JDBC connection URL, a username, a password and a driver class name.
`static Sql` | `newInstance(String url, String driverClassName)` Creates a new Sql instance given a JDBC connection URL and a driver class name.
`String` | `nullify(String sql)` replace ?'"?
`static OutParameter` | `out(int type)` Create a new OutParameter
`void` | `query(String sql, Closure closure)` Performs the given SQL query calling the closure with the result set.
`void` | `query(String sql, List params, Closure closure)` Performs the given SQL query with parameters calling the closure with the result set.
`void` | `query(GString gstring, Closure closure)` Performs the given SQL query calling the closure with the result set.
`void` | `queryEach(String sql, Closure closure)`
`void` | `queryEach(String sql, List params, Closure closure)`
`void` | `queryEach(GString gstring, Closure closure)`
`static ResultSetOutParameter` | `resultSet(int type)` Create a new ResultSetOutParameter
`void` | `rollback()`
`List` | `rows(String sql)` Performs the given SQL query and return the rows of the result set.
`List` | `rows(GString gstring)` Performs the given SQL query and return the rows of the result set.
`List` | `rows(String sql, Closure metaClosure)` Performs the given SQL query and return the rows of the result set.
`List` | `rows(String sql, List params)` Performs the given SQL query with the list of params and return the rows of the result set.
`void` | `setObject(PreparedStatement statement, int i, Object value)` Strategy method allowing derived classes to handle types differently such as for CLOBs etc.
`void` | `setParameters(List params, PreparedStatement statement)` Appends the parameters to the given statement.
`void` | `setResultSetConcurrency(int resultSetConcurrency)` Sets the resultSetConcurrency for statements created using the connection.
`void` | `setResultSetHoldability(int resultSetHoldability)` Sets the resultSetHoldability for statements created using the connection.
`void` | `setResultSetType(int resultSetType)` Sets the resultSetType for statements created using the connection.
`void` | `warnDeprecated()`
`void` | `withStatement(Closure configureStatement)` Allows a closure to be passed in to configure the JDBC statements before they are executed to do things like set the query size etc.

Constructor Detail

### Sql

    public Sql(DataSource dataSource)

  Constructs an SQL instance using the given DataSource. Each operation will use a Connection from the DataSource pool and close it when the operation is completed putting it back into the pool.
  param:
    dataSource the DataSource to use

### Sql

    public Sql(Connection connection)

### Sql

    public Sql(Sql parent)

Method Detail

### ARRAY

    public static InParameter ARRAY(Object value)

### BIGINT

    public static InParameter BIGINT(Object value)

### BINARY

    public static InParameter BINARY(Object value)

### BIT

    public static InParameter BIT(Object value)

### BLOB

    public static InParameter BLOB(Object value)

### BOOLEAN

    public static InParameter BOOLEAN(Object value)

### CHAR

    public static InParameter CHAR(Object value)

### CLOB

    public static InParameter CLOB(Object value)

### DATALINK

    public static InParameter DATALINK(Object value)

### DATE

    public static InParameter DATE(Object value)

### DECIMAL

    public static InParameter DECIMAL(Object value)

### DISTINCT

    public static InParameter DISTINCT(Object value)

### DOUBLE

    public static InParameter DOUBLE(Object value)

### FLOAT

    public static InParameter FLOAT(Object value)

### INTEGER

    public static InParameter INTEGER(Object value)

### JAVA_OBJECT

    public static InParameter JAVA_OBJECT(Object value)

### LONGVARBINARY

    public static InParameter LONGVARBINARY(Object value)

### LONGVARCHAR

    public static InParameter LONGVARCHAR(Object value)

### NULL

    public static InParameter NULL(Object value)

### NUMERIC

    public static InParameter NUMERIC(Object value)

### OTHER

    public static InParameter OTHER(Object value)

### REAL

    public static InParameter REAL(Object value)

### REF

    public static InParameter REF(Object value)

### SMALLINT

    public static InParameter SMALLINT(Object value)

### STRUCT

    public static InParameter STRUCT(Object value)

### TIME

    public static InParameter TIME(Object value)

### TIMESTAMP

    public static InParameter TIMESTAMP(Object value)

### TINYINT

    public static InParameter TINYINT(Object value)

### VARBINARY

    public static InParameter VARBINARY(Object value)

### VARCHAR

    public static InParameter VARCHAR(Object value)

### asSql

    String asSql(GString gstring, List values)

  param:
    gstring a GString containing the SQL query with embedded params
  param:
    values the values to embed
  return:
    the SQL version of the given query using ? instead of any
  parameter

### call

    public int call(String sql)

  Performs a stored procedure call.
  param:
    sql the SQL statement
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### call

    public int call(String sql, List params)

  Performs a stored procedure call with the given parameters.
  param:
    sql the SQL statement
  param:
    params a list of parameters
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### call

    public void call(String sql, List params, Closure closure)

  Performs a stored procedure call with the given parameters. The closure is called once with all the out parameters.
  param:
    sql the sql statement
  param:
    params a list of parameters
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### call

    public int call(GString gstring)

  Performs a stored procedure call with the given parameters.
  param:
    gstring a GString containing the SQL query with embedded params
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### call

    public void call(GString gstring, Closure closure)

  Performs a stored procedure call with the given parameters, calling the closure once with all result objects.
  param:
    gstring a GString containing the SQL query with embedded params
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### close

    public void close()

  If this SQL object was created with a Connection then this method closes the connection. If this SQL object was created from a DataSource then this method does nothing.
  throws:
    SQLException if a database access error occurs

### closeResources

    void closeResources(Connection connection, Statement statement, ResultSet results)

### closeResources

    void closeResources(Connection connection, Statement statement)

### commit

    public void commit()

### configure

    void configure(Statement statement)

  Provides a hook to be able to configure JDBC statements, such as to configure
  param:
    statement the statement to configure

### createConnection

    Statement createConnection(Connection connection)

### createConnection

    Connection createConnection()

### dataSet

    public DataSet dataSet(String table)

### dataSet

    public DataSet dataSet(Class type)

### eachRow

    public void eachRow(String sql, Closure closure)

  Performs the given SQL query calling the closure with each row of the result set.
  param:
    sql the sql statement
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### eachRow

    public void eachRow(String sql, Closure metaClosure, Closure rowClosure)

  Performs the given SQL query calling closures for metadata and each row
  param:
    sql the sql statement
  param:
    metaClosure called for meta data (only once after sql execution)
  param:
    rowClosure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### eachRow

    public void eachRow(String sql, List params, Closure closure)

  Performs the given SQL query calling the closure with the result set.
  param:
    sql the sql statement
  param:
    params a list of parameters
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### eachRow

    public void eachRow(GString gstring, Closure closure)

  Performs the given SQL query calling the closure with the result set.
  param:
    gstring a GString containing the SQL query with embedded params
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### execute

    public boolean execute(String sql)

  Executes the given piece of SQL.
  param:
    sql the SQL statement
  return:
    `true` if the first result is a `ResultSet`
  object; `false` if it is an update count or there are no results
  throws:
    SQLException if a database access error occurs

### execute

    public boolean execute(String sql, List params)

  Executes the given piece of SQL with parameters.
  param:
    sql the SQL statement
  param:
    params a list of parameters
  return:
    `true` if the first result is a `ResultSet`
  object; `false` if it is an update count or there are no results
  throws:
    SQLException if a database access error occurs

### execute

    public boolean execute(GString gstring)

  Executes the given SQL with embedded expressions inside.
  param:
    gstring a GString containing the SQL query with embedded params
  return:
    `true` if the first result is a `ResultSet`
  object; `false` if it is an update count or there are no results
  throws:
    SQLException if a database access error occurs

### executeInsert

    public List executeInsert(String sql)

### executeInsert

    public List executeInsert(String sql, List params)

### executeInsert

    public List executeInsert(GString gstring)

  Executes the given SQL with embedded expressions inside, and returns the values of any auto-generated colums, such as an autoincrement ID field. These values can be accessed using array notation. For example, to return the second auto-generated column value of the third row, use `keys[3][1]`. The method is designed to be used with SQL INSERT statements, but is not limited to them.

  The standard use for this method is when a table has an autoincrement ID column and you want to know what the ID is for a newly inserted row. In this example, we insert a single row into a table in which the first column contains the autoincrement ID:

           def sql = Sql.newInstance("jdbc:mysql://localhost:3306/groovy",
                                     "user",
                                     "password",
                                     "com.mysql.jdbc.Driver")

           def keys = sql.insert("insert into test_table (INT_DATA, STRING_DATA) "
                                 + "VALUES (1, 'Key Largo')")

           def id = keys[0][0]

           // 'id' now contains the value of the new row's ID column.
           // It can be used to update an object representation's
           // id attribute for example.
           ...

  param:
    gstring a GString containing the SQL query with embedded params
  return:
    A list of column values representing each row's
  auto-generated keys
  throws:
    SQLException if a database access error occurs

### executeUpdate

    public int executeUpdate(String sql)

  Executes the given SQL update.
  param:
    sql the SQL statement
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### executeUpdate

    public int executeUpdate(String sql, List params)

  Executes the given SQL update with parameters.
  param:
    sql the SQL statement
  param:
    params a list of parameters
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### executeUpdate

    public int executeUpdate(GString gstring)

  Executes the given SQL update with embedded expressions inside.
  param:
    gstring a GString containing the SQL query with embedded params
  return:
    the number of rows updated or 0 for SQL statements that return nothing
  throws:
    SQLException if a database access error occurs

### expand

    public static ExpandedVariable expand(Object object)

  Creates a variable to be expanded in the Sql string rather than representing an sql parameter.
  param:
    object the object of interest
  return:
    the expanded variable

### findWhereKeyword

    int findWhereKeyword(String sql)

  Find the first 'where' keyword in the sql.
  param:
    sql the SQL statement
  return:
    the index of the found keyword or -1 if not found

### firstRow

    public Object firstRow(String sql)

  Performs the given SQL query and return the first row of the result set.
  param:
    sql the SQL statement
  return:
    a GroovyRowResult object
  throws:
    SQLException if a database access error occurs

### firstRow

    public Object firstRow(GString gstring)

  Performs the given SQL query and return the first row of the result set.
  param:
    gstring a GString containing the SQL query with embedded params
  return:
    a GroovyRowResult object
  throws:
    SQLException if a database access error occurs

### firstRow

    public Object firstRow(String sql, List params)

  Performs the given SQL query with the list of params and return the first row of the result set.
  param:
    sql the SQL statement
  param:
    params a list of parameters
  return:
    a GroovyRowResult object
  throws:
    SQLException if a database access error occurs

### getConnection

    public Connection getConnection()

  If this instance was created with a single Connection then the connection is returned. Otherwise if this instance was created with a DataSource then this method returns null
  return:
    the connection wired into this object, or null if this object
  uses a DataSource

### getDataSource

    public DataSource getDataSource()

### getParameters

    List getParameters(GString gstring)

  param:
    gstring a GString containing the SQL query with embedded params
  return:
    extracts the parameters from the expression as a List

### getResultSetConcurrency

    public int getResultSetConcurrency()

  Gets the resultSetConcurrency for statements created using the connection.
  return:
    the current resultSetConcurrency value

### getResultSetHoldability

    public int getResultSetHoldability()

  Gets the resultSetHoldability for statements created using the connection.
  return:
    the current resultSetHoldability value or -1 if not set

### getResultSetType

    public int getResultSetType()

  Gets the resultSetType for statements created using the connection.
  return:
    the current resultSetType value

### getUpdateCount

    public int getUpdateCount()

  return:
    Returns the updateCount.

### in

    public static InParameter in(int type, Object value)

  Create a new InParameter
  param:
    type the JDBC data type
  param:
    value the object value
  return:
    an InParameter

### inout

    public static InOutParameter inout(InParameter in)

  Create an inout parameter using this in parameter.
  param:
    in the InParameter of interest
  return:
    the resulting InOutParameter

### loadDriver

    public static void loadDriver(String driverClassName)

  Attempts to load the JDBC driver on the thread, current or system class loaders
  param:
    driverClassName the fully qualified class name of the driver class
  throws:
    ClassNotFoundException if the class cannot be found or loaded

### newInstance

    public static Sql newInstance(String url)

  let's only warn of using deprecated methods once

### newInstance

    public static Sql newInstance(String url, Properties properties)

  Creates a new Sql instance given a JDBC connection URL and some properties.
  param:
    url a database url of the form
  `jdbc:subprotocol:subname`
  param:
    properties a list of arbitrary string tag/value pairs
  as connection arguments; normally at least a "user" and "password" property should be included
  return:
    a new Sql instance with a connection
  throws:
    SQLException if a database access error occurs

### newInstance

    public static Sql newInstance(String url, Properties properties, String driverClassName)

  Creates a new Sql instance given a JDBC connection URL, some properties and a driver class name.
  param:
    url a database url of the form
  `jdbc:subprotocol:subname`
  param:
    properties a list of arbitrary string tag/value pairs
  as connection arguments; normally at least a "user" and "password" property should be included
  param:
    driverClassName the fully qualified class name of the driver class
  return:
    a new Sql instance with a connection
  throws:
    SQLException if a database access error occurs
  throws:
    ClassNotFoundException if the class cannot be found or loaded

### newInstance

    public static Sql newInstance(String url, String user, String password)

  Creates a new Sql instance given a JDBC connection URL, a username and a password.
  param:
    url a database url of the form
  `jdbc:subprotocol:subname`
  param:
    user the database user on whose behalf the connection
  is being made
  param:
    password the user's password
  return:
    a new Sql instance with a connection
  throws:
    SQLException if a database access error occurs

### newInstance

    public static Sql newInstance(String url, String user, String password, String driverClassName)

  Creates a new Sql instance given a JDBC connection URL, a username, a password and a driver class name.
  param:
    url a database url of the form
  `jdbc:subprotocol:subname`
  param:
    user the database user on whose behalf the connection
  is being made
  param:
    password the user's password
  param:
    driverClassName the fully qualified class name of the driver class
  return:
    a new Sql instance with a connection
  throws:
    SQLException if a database access error occurs
  throws:
    ClassNotFoundException if the class cannot be found or loaded

### newInstance

    public static Sql newInstance(String url, String driverClassName)

  Creates a new Sql instance given a JDBC connection URL and a driver class name.
  param:
    url a database url of the form
  `jdbc:subprotocol:subname`
  param:
    driverClassName the fully qualified class name of the driver class
  return:
    a new Sql instance with a connection
  throws:
    SQLException if a database access error occurs
  throws:
    ClassNotFoundException if the class cannot be found or loaded

### nullify

    String nullify(String sql)

  replace ?'"? references with NULLish
  param:
    sql the SQL statement
  return:
    the modified SQL String

### out

    public static OutParameter out(int type)

  Create a new OutParameter
  param:
    type the JDBC data type.
  return:
    an OutParameter

### query

    public void query(String sql, Closure closure)

  Performs the given SQL query calling the closure with the result set.
  param:
    sql the sql statement
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### query

    public void query(String sql, List params, Closure closure)

  Performs the given SQL query with parameters calling the closure with the result set.
  param:
    sql the sql statement
  param:
    params a list of parameters
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### query

    public void query(GString gstring, Closure closure)

  Performs the given SQL query calling the closure with the result set.
  param:
    gstring a GString containing the SQL query with embedded params
  param:
    closure called for each row with a GroovyResultSet
  throws:
    SQLException if a database access error occurs

### queryEach

    public void queryEach(String sql, Closure closure)

  deprecated:
    please use eachRow instead

### queryEach

    public void queryEach(String sql, List params, Closure closure)

  deprecated:
    please use eachRow instead

### queryEach

    public void queryEach(GString gstring, Closure closure)

  deprecated:
    please use eachRow instead

### resultSet

    public static ResultSetOutParameter resultSet(int type)

  Create a new ResultSetOutParameter
  param:
    type the JDBC data type.
  return:
    a ResultSetOutParameter

### rollback

    public void rollback()

### rows

    public List rows(String sql)

  Performs the given SQL query and return the rows of the result set.
  param:
    sql the SQL statement
  return:
    a list of GroovyRowResult objects
  throws:
    SQLException if a database access error occurs

### rows

    public List rows(GString gstring)

  Performs the given SQL query and return the rows of the result set.
  param:
    gstring a GString containing the SQL query with embedded params
  return:
    a list of GroovyRowResult objects
  throws:
    SQLException if a database access error occurs

### rows

    public List rows(String sql, Closure metaClosure)

  Performs the given SQL query and return the rows of the result set.
  param:
    sql the SQL statement
  param:
    metaClosure called with meta data of the ResultSet
  return:
    a list of GroovyRowResult objects
  throws:
    SQLException if a database access error occurs

### rows

    public List rows(String sql, List params)

  Performs the given SQL query with the list of params and return the rows of the result set.
  param:
    sql the SQL statement
  param:
    params a list of parameters
  return:
    a list of GroovyRowResult objects
  throws:
    SQLException if a database access error occurs

### setObject

    void setObject(PreparedStatement statement, int i, Object value)

  Strategy method allowing derived classes to handle types differently such as for CLOBs etc.
  throws:
    SQLException if a database access error occurs

### setParameters

    void setParameters(List params, PreparedStatement statement)

  Appends the parameters to the given statement.
  throws:
    SQLException if a database access error occurs

### setResultSetConcurrency

    public void setResultSetConcurrency(int resultSetConcurrency)

  Sets the resultSetConcurrency for statements created using the connection. May cause SQLFeatureNotSupportedException exceptions to occur if the underlying database doesn't support the requested concurrency value.
  param:
    resultSetConcurrency one of the following `ResultSet`
  constants: `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`

### setResultSetHoldability

    public void setResultSetHoldability(int resultSetHoldability)

  Sets the resultSetHoldability for statements created using the connection. May cause SQLFeatureNotSupportedException exceptions to occur if the underlying database doesn't support the requested holdability value.
  param:
    resultSetHoldability one of the following `ResultSet`
  constants: `ResultSet.HOLD_CURSORS_OVER_COMMIT` or `ResultSet.CLOSE_CURSORS_AT_COMMIT`

### setResultSetType

    public void setResultSetType(int resultSetType)

  Sets the resultSetType for statements created using the connection. May cause SQLFeatureNotSupportedException exceptions to occur if the underlying database doesn't support the requested type value.
  param:
    resultSetType one of the following `ResultSet`
  constants: `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE`, or `ResultSet.TYPE_SCROLL_SENSITIVE`

### warnDeprecated

    void warnDeprecated()

### withStatement

    public void withStatement(Closure configureStatement)

  Allows a closure to be passed in to configure the JDBC statements before they are executed to do things like set the query size etc.
  param:
    configureStatement the closure