org.mule.module.db.internal.domain.statement
Class QueryStatementFactory

java.lang.Object
  extended by org.mule.module.db.internal.domain.statement.QueryStatementFactory
All Implemented Interfaces:
ConfigurableStatementFactory, StatementFactory

public class QueryStatementFactory
extends Object
implements ConfigurableStatementFactory

Creates Statement based on the type and parameters of a given query: _CallableStatement for stored p rocedure queries _PreparedStatement for queries with input parameters _Standard Statement otherwise


Constructor Summary
QueryStatementFactory()
           
 
Method Summary
 Statement create(DbConnection connection, QueryTemplate queryTemplate)
          Creates a JDBC statement
 Statement create(DbConnection connection, QueryTemplate queryTemplate, AutoGeneratedKeyStrategy autoGeneratedKeyStrategy)
          Creates a JDBC statement with auto generated keys processing
 void setFetchSize(int size)
          Indicates how many rows should fetched from the database any time more rows are requested on any resultSet returned by a statement created by this factory
 void setMaxRows(int max)
          Sets the maximum numbers of rows that will be returned by any resultSet returned by a statement created by this factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryStatementFactory

public QueryStatementFactory()
Method Detail

create

public Statement create(DbConnection connection,
                        QueryTemplate queryTemplate)
                 throws SQLException
Description copied from interface: StatementFactory
Creates a JDBC statement

Specified by:
create in interface StatementFactory
Parameters:
connection - connection uses to create the statement
queryTemplate - query template that will be execute on the statement
Returns:
a statement appropriate to execute a query with the given template
Throws:
SQLException - if a database access error occurs or this method is called on a closed connection

create

public Statement create(DbConnection connection,
                        QueryTemplate queryTemplate,
                        AutoGeneratedKeyStrategy autoGeneratedKeyStrategy)
                 throws SQLException
Description copied from interface: StatementFactory
Creates a JDBC statement with auto generated keys processing

Specified by:
create in interface StatementFactory
Parameters:
connection - connection uses to create the statement
queryTemplate - query template that will be execute on the statement
autoGeneratedKeyStrategy - strategy to process auto generated keys
Returns:
a statement appropriate to execute a query with the given template
Throws:
SQLException - if a database access error occurs or this method is called on a closed connection

setMaxRows

public void setMaxRows(int max)
Description copied from interface: ConfigurableStatementFactory
Sets the maximum numbers of rows that will be returned by any resultSet returned by a statement created by this factory

Specified by:
setMaxRows in interface ConfigurableStatementFactory
Parameters:
max - the new max rows limit; zero means there is no limit

setFetchSize

public void setFetchSize(int size)
Description copied from interface: ConfigurableStatementFactory
Indicates how many rows should fetched from the database any time more rows are requested on any resultSet returned by a statement created by this factory

Specified by:
setFetchSize in interface ConfigurableStatementFactory
Parameters:
size - the number of rows to fetch


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.