The default implementation for the StatementFactory. The configuration
interface for this component is
SqlFactoryConfiguration.
The Component configuration consists of
Statement Set
Default Configuration values
Sample configuration for the component
<!-- Component Configuration for a SQLStatementFactory -->
<Configuration ConfigurationInterface=
"org.sape.carbon.services.sql.SqlFactoryConfiguration">
<FunctionalInterface>
org.sape.carbon.services.sql.StatementFactory
</FunctionalInterface>
<FunctionalImplementationClass>
org.sape.carbon.services.sql.DefaultStatementFactoryImpl
</FunctionalImplementationClass>
<ConnectionFactory>
ref:///sql/connection/test/StandaloneConnectionFactory
</ConnectionFactory>
<!-- Default Values for Statement Properties -->
<ResultSetType>TYPE_SCROLL_SENSITIVE</ResultSetType>
<ResultSetConcurrency>CONCUR_UPDATABLE</ResultSetConcurrency>
<MaxRows>5</MaxRows>
<!-- Statement Definitions -->
<Statement>
<!-- Statement Query Name -->
<QueryName>selectAccounts</QueryName>
<Query>SELECT * FROM accounts</Query>
<!-- Overriding Parameters -->
<MaxRows>10</MaxRows>
</Statement>
<Statement>
<QueryName>Second</QueryName>
<Query>SELECT * from TEST</Query>
</Statement>
</Configuration>
buildCallableStatement(StatementConfiguration statementConfig, Connection connection) Builds a callable statement for the given configuration
with the connection given.
Parameters: statementConfig - configuration to build the statement from Parameters: connection - a connection to execute with.
buildPreparedStatement(StatementConfiguration statementConfig, Connection connection) Builds a prepared statement for the given configuration
with the connection given.
Parameters: statementConfig - configuration to build the statement from Parameters: connection - a connection to execute with.
createCallableStatement(String queryName, Connection connection) Creates a callable statement for the given query name
with the connection given.
Parameters: queryName - query to create a CallableStatement for. Parameters: connection - a connection to execute with.
createCallableStatement(String queryName) Creates a callable statement for the given query name using
the default connection in the factories configuration.
When using this interface to create a statement it is
important to remember to get back and close the connection
that is created.
createPreparedStatement(String queryName, Connection connection) Creates a prepared statement for the given query name
with the connection given.
Parameters: queryName - query to create a CallableStatement for. Parameters: connection - a connection to execute with.
createPreparedStatement(String queryName) Creates a prepared statement for the given query name using
the default connection in the factories configuration.
When using this interface to create a statement it is
important to remember to get back and close the connection
that is created.
Builds a callable statement for the given configuration
with the connection given.
Parameters: statementConfig - configuration to build the statement from Parameters: connection - a connection to execute with. a CallableStatement constructed for the queryName given throws: SQLException - indicates an errorcreating the CallableStatement
Builds a debug message containg the configuration status of the supplied
configured statement.
Parameters: statementConfig - statement configuration to build debugmessage for a debug message describing the statement config
Builds a prepared statement for the given configuration
with the connection given.
Parameters: statementConfig - configuration to build the statement from Parameters: connection - a connection to execute with. a PreparedStatement constructed for the queryName given throws: SQLException - indicates an errorcreating the CallableStatement
Configure the component. This is preceded and followed by the suspend and
resume operations if they are available on the component.
Parameters: configuration - A SqlFactoryConfiguration
Configure the statement based on the configuration specified in the
sqlStatement or using the default values.
Parameters: statement - A PreparedStatement or aCallableStatement> Parameters: sqlStatement - The configuration information for the statement. Statement A configured statement throws: SQLException - indicates an error configuring the statement
Creates a callable statement for the given query name
with the connection given.
Parameters: queryName - query to create a CallableStatement for. Parameters: connection - a connection to execute with. a CallableStatement constructed for the queryName given throws: StatementFactoryException - indicates an errorcreating the CallableStatement
Creates a callable statement for the given query name using
the default connection in the factories configuration.
When using this interface to create a statement it is
important to remember to get back and close the connection
that is created. This should be done with:
statement.getConnection().close() Parameters: queryName - query to create a CallableStatement for. a CallableStatement constructed for the queryName given throws: StatementFactoryException - indicates an errorcreating the CallableStatement
Creates a prepared statement for the given query name
with the connection given.
Parameters: queryName - query to create a CallableStatement for. Parameters: connection - a connection to execute with. a PreparedStatement constructed for the queryName given throws: StatementFactoryException - indicates an errorcreating the CallableStatement
Creates a prepared statement for the given query name using
the default connection in the factories configuration.
When using this interface to create a statement it is
important to remember to get back and close the connection
that is created. This should be done with:
statement.getConnection().close() Parameters: queryName - query to create a CallableStatement for. a PreparedStatement constructed for the queryName given throws: StatementFactoryException - indicates an errorcreating the CallableStatement
Looks up a statement configuration based on the name of
the configuration.
Parameters: queryName - name of the query to lookup Parameters: sourceClass - class to use when throwing an exception a StatementConfiguration for the given queryName throws: StatementNotConfiguredException - indicates the queryName had noconfigured statement associated with it.