// is this a request for generatedKeys ?
//
if (_getGeneratedKeys) {
if (_callableStatement) {
throw new ControlException("getGeneratedKeys not supported for CallableStatements");
}
if (_genKeyColumnNames.length > 0) {
preparedStatement = connection.prepareStatement(sql, _genKeyColumnNames);
} else if (_genKeyColumnIndexes.length > 0) {
preparedStatement = connection.prepareStatement(sql, _genKeyColumnIndexes);
} else {
preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
}
} else {
if (_holdability == JdbcControl.HoldabilityType.DRIVER_DEFAULT) {
if (_scrollType == JdbcControl.ScrollType.DRIVER_DEFAULT) {
preparedStatement = (_callableStatement) ? connection.prepareCall(sql) : connection.prepareStatement(sql);
} else {
preparedStatement = (_callableStatement)
? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType())
: connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType());
}
} else {
preparedStatement = (_callableStatement)
? connection.prepareCall(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability())
: connection.prepareStatement(sql, _scrollType.getType(), _scrollType.getConcurrencyType(), _holdability.getHoldability());
}
}
//
// If the method argument is of type SQLParameter, treat this statement as a CallableStatement,
//
if (_callableStatement) {
for (SqlFragment sf : _children) {
if (sf.hasParamValue()) {
throw new ControlException("Cannot use parameter substution and SQLParameter array in the same method.");
}
}
JdbcControl.SQLParameter[] params = (JdbcControl.SQLParameter[]) arguments[0];
if (params == null) {
return preparedStatement;