public class QueryStatementFactory extends Object implements ConfigurableStatementFactory
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 otherwiseConstructor and Description |
---|
QueryStatementFactory() |
Modifier and Type | Method and Description |
---|---|
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
|
void |
setQueryTimeout(int queryTimeout)
Indicates the minimum amount of time in seconds before the JDBC driver
attempts to cancel a running statement.
|
public Statement create(DbConnection connection, QueryTemplate queryTemplate) throws SQLException
StatementFactory
create
in interface StatementFactory
connection
- connection uses to create the statementqueryTemplate
- query template that will be execute on the statementSQLException
- if a database access error occurs or this method is called on a closed connectionpublic Statement create(DbConnection connection, QueryTemplate queryTemplate, AutoGeneratedKeyStrategy autoGeneratedKeyStrategy) throws SQLException
StatementFactory
create
in interface StatementFactory
connection
- connection uses to create the statementqueryTemplate
- query template that will be execute on the statementautoGeneratedKeyStrategy
- strategy to process auto generated keysSQLException
- if a database access error occurs or this method is called on a closed connectionpublic void setMaxRows(int max)
ConfigurableStatementFactory
setMaxRows
in interface ConfigurableStatementFactory
max
- the new max rows limit; zero means there is no limitpublic void setFetchSize(int size)
ConfigurableStatementFactory
setFetchSize
in interface ConfigurableStatementFactory
size
- the number of rows to fetchpublic void setQueryTimeout(int queryTimeout)
ConfigurableStatementFactory
setQueryTimeout
in interface ConfigurableStatementFactory
queryTimeout
- number of seconds to wait. Non negative. Zero means no timeout.Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.