org.mule.module.db.internal.domain.autogeneratedkey
Class ColumnNameAutoGeneratedKeyStrategy

java.lang.Object
  extended by org.mule.module.db.internal.domain.autogeneratedkey.ColumnNameAutoGeneratedKeyStrategy
All Implemented Interfaces:
AutoGeneratedKeyStrategy

public class ColumnNameAutoGeneratedKeyStrategy
extends Object
implements AutoGeneratedKeyStrategy


Constructor Summary
ColumnNameAutoGeneratedKeyStrategy(String[] columnNames)
           
 
Method Summary
 boolean execute(Statement statement, QueryTemplate queryTemplate)
          Executes a query that can return multiple results
 int executeUpdate(Statement statement, QueryTemplate queryTemplate)
          Executes an update query
 PreparedStatement prepareStatement(DbConnection connection, QueryTemplate queryTemplate)
          Prepares a statement in order to return auto generated keys
 boolean returnsAutoGeneratedKeys()
          Indicates if there are auto generated keys to return
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnNameAutoGeneratedKeyStrategy

public ColumnNameAutoGeneratedKeyStrategy(String[] columnNames)
Method Detail

returnsAutoGeneratedKeys

public boolean returnsAutoGeneratedKeys()
Description copied from interface: AutoGeneratedKeyStrategy
Indicates if there are auto generated keys to return

Specified by:
returnsAutoGeneratedKeys in interface AutoGeneratedKeyStrategy
Returns:
true if there are auto generated keys, false otherwise

prepareStatement

public PreparedStatement prepareStatement(DbConnection connection,
                                          QueryTemplate queryTemplate)
                                   throws SQLException
Description copied from interface: AutoGeneratedKeyStrategy
Prepares a statement in order to return auto generated keys

Specified by:
prepareStatement in interface AutoGeneratedKeyStrategy
Parameters:
connection - connection uses to prepare the statement
queryTemplate - query template to be prepared
Returns:
a statement prepared to return auto generated keys
Throws:
SQLException - if there is any error preparing the query

execute

public boolean execute(Statement statement,
                       QueryTemplate queryTemplate)
                throws SQLException
Description copied from interface: AutoGeneratedKeyStrategy
Executes a query that can return multiple results

Specified by:
execute in interface AutoGeneratedKeyStrategy
Parameters:
statement - statement to be executed
queryTemplate - query to execute
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Throws:
SQLException - if there is any database error or this method is called on a closed Statement

executeUpdate

public int executeUpdate(Statement statement,
                         QueryTemplate queryTemplate)
                  throws SQLException
Description copied from interface: AutoGeneratedKeyStrategy
Executes an update query

Specified by:
executeUpdate in interface AutoGeneratedKeyStrategy
Parameters:
statement - statement to be executed
queryTemplate - query to execute
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Throws:
SQLException - if there is any database error or this method is called on a closed Statement


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