com.googlecode.jpattern.orm.query
Class SqlExecutor

java.lang.Object
  extended by com.googlecode.jpattern.orm.query.SqlExecutor
All Implemented Interfaces:
ISqlExecutor

public class SqlExecutor
extends Object
implements ISqlExecutor

Author:
Francesco Cina 09/lug/2011

Constructor Summary
SqlExecutor(ISessionSqlPerformer session)
           
 
Method Summary
 ISqlBatchUpdate batchUpdate(List<String> sqls)
          Issue multiple SQL updates on a single JDBC Statement using batching.
 ISqlBatchUpdate batchUpdate(String sql, IPreparedStatementCreator psc)
          Issue multiple SQL updates on a single JDBC Statement using batching.
 ISqlBatchUpdate batchUpdate(String sql, List<Object[]> args)
          Issue multiple SQL updates on a single JDBC Statement using batching.
 ISqlExecute execute(String sql)
          Issue a single SQL execute, typically a DDL statement.
 ISqlQuery query(String sql, Object... args)
          Perform a single SQL select operation.
 ISqlUpdate update(String sql, IGeneratedKeyReader generatedKeyReader, Object... args)
          Issue an update statement using a PreparedStatementCreator to provide SQL and any required parameters.
 ISqlUpdate update(String sql, Object... args)
          Perform a single SQL update operation (such as an insert, update or delete statement).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlExecutor

public SqlExecutor(ISessionSqlPerformer session)
Method Detail

query

public ISqlQuery query(String sql,
                       Object... args)
Description copied from interface: ISqlExecutor
Perform a single SQL select operation.

Specified by:
query in interface ISqlExecutor
Parameters:
sql - static SQL to execute
args - arguments to bind to the query
Returns:

execute

public ISqlExecute execute(String sql)
                    throws OrmException
Description copied from interface: ISqlExecutor
Issue a single SQL execute, typically a DDL statement.

Specified by:
execute in interface ISqlExecutor
Parameters:
sql - static SQL to execute
Throws:
OrmException

update

public ISqlUpdate update(String sql,
                         Object... args)
                  throws OrmException
Description copied from interface: ISqlExecutor
Perform a single SQL update operation (such as an insert, update or delete statement).

Specified by:
update in interface ISqlExecutor
Parameters:
sql - static SQL to execute
args - arguments to bind to the query
Returns:
Throws:
OrmException

update

public ISqlUpdate update(String sql,
                         IGeneratedKeyReader generatedKeyReader,
                         Object... args)
                  throws OrmException
Description copied from interface: ISqlExecutor
Issue an update statement using a PreparedStatementCreator to provide SQL and any required parameters. Generated keys can be read using the IGeneratedKeyReader.

Specified by:
update in interface ISqlExecutor
generatedKeyReader - IGeneratedKeyReader to read the generated key
Returns:
Throws:
OrmException

batchUpdate

public ISqlBatchUpdate batchUpdate(List<String> sqls)
                            throws OrmException
Description copied from interface: ISqlExecutor
Issue multiple SQL updates on a single JDBC Statement using batching.

Specified by:
batchUpdate in interface ISqlExecutor
Returns:
Throws:
OrmException

batchUpdate

public ISqlBatchUpdate batchUpdate(String sql,
                                   List<Object[]> args)
                            throws OrmException
Description copied from interface: ISqlExecutor
Issue multiple SQL updates on a single JDBC Statement using batching. The same query is executed for every Object array present in the args list which is the list of arguments to bind to the query.

Specified by:
batchUpdate in interface ISqlExecutor
Parameters:
sql - defining a List of SQL statements that will be executed.
args - defining a List of Object arrays to bind to the query.
Returns:
Throws:
OrmException

batchUpdate

public ISqlBatchUpdate batchUpdate(String sql,
                                   IPreparedStatementCreator psc)
                            throws OrmException
Description copied from interface: ISqlExecutor
Issue multiple SQL updates on a single JDBC Statement using batching. The values on the generated PreparedStatement are set using an IPreparedStatementCreator.

Specified by:
batchUpdate in interface ISqlExecutor
Parameters:
sql - defining a List of SQL statements that will be executed.
psc - the creator to bind values on the PreparedStatement
Returns:
Throws:
OrmException


Copyright © 2011. All Rights Reserved.