use of org.eclipse.persistence.internal.helper.DatabaseType in project eclipselink by eclipse-ee4j.
the class PLSQLStoredProcedureCall method buildNestedFunctions.
/**
* INTERNAL
* Generate portion of the Anonymous PL/SQL block with PL/SQL conversion routines as
* nested functions.
*/
protected void buildNestedFunctions(StringBuilder stream, List<PLSQLargument> arguments) {
List<String> nestedFunctions = new ArrayList<>();
Set<DatabaseType> processed = new HashSet<>();
for (PLSQLargument arg : arguments) {
DatabaseType type = arg.databaseType;
addNestedFunctionsForArgument(nestedFunctions, arg, type, processed);
}
if (!nestedFunctions.isEmpty()) {
for (String function : nestedFunctions) {
stream.append(function);
}
}
}
use of org.eclipse.persistence.internal.helper.DatabaseType in project eclipselink by eclipse-ee4j.
the class PLSQLStoredProcedureCall method addNamedOutputArgument.
/**
* PUBLIC: Add a named OUT argument to the stored procedure. The databaseType parameter
* classifies the parameter (JDBCType vs. OraclePLSQLType, simple vs. complex)
*/
public void addNamedOutputArgument(String procedureParameterName, DatabaseType databaseType) {
DatabaseType dt = databaseType.isComplexDatabaseType() ? ((ComplexDatabaseType) databaseType).clone() : databaseType;
arguments.add(new PLSQLargument(procedureParameterName, originalIndex++, OUT, dt));
}
use of org.eclipse.persistence.internal.helper.DatabaseType in project eclipselink by eclipse-ee4j.
the class PLSQLStoredProcedureCall method addNestedFunctionsForArgument.
/**
* INTERNAL
* Add the nested function string required for the type and its subtypes. The functions
* must be added in inverse order to resolve dependencies.
*/
protected void addNestedFunctionsForArgument(List<String> functions, PLSQLargument argument, DatabaseType databaseType, Set<DatabaseType> processed) {
if ((databaseType == null) || !databaseType.isComplexDatabaseType() || databaseType.isJDBCType() || argument.cursorOutput || processed.contains(databaseType)) {
return;
}
ComplexDatabaseType type = (ComplexDatabaseType) databaseType;
if (!type.hasCompatibleType()) {
return;
}
processed.add(type);
boolean isNestedTable = false;
if (type.isCollection()) {
isNestedTable = ((PLSQLCollection) type).isNestedTable();
DatabaseType nestedType = ((PLSQLCollection) type).getNestedType();
addNestedFunctionsForArgument(functions, argument, nestedType, processed);
} else if (type.isRecord()) {
for (PLSQLargument field : ((PLSQLrecord) type).getFields()) {
DatabaseType nestedType = field.databaseType;
addNestedFunctionsForArgument(functions, argument, nestedType, processed);
}
}
TypeInfo info = this.typesInfo.get(type.getTypeName());
// If the info was not found in publisher, then generate it.
if (info == null) {
info = generateNestedFunction(type, isNestedTable);
}
if (type.getTypeName().equals(type.getCompatibleType())) {
if (!functions.contains(info.pl2SqlConv)) {
functions.add(info.pl2SqlConv);
}
} else {
if (argument.direction == IN) {
if (!functions.contains(info.sql2PlConv)) {
functions.add(info.sql2PlConv);
}
} else if (argument.direction == INOUT) {
if (!functions.contains(info.sql2PlConv)) {
functions.add(info.sql2PlConv);
}
if (!functions.contains(info.pl2SqlConv)) {
functions.add(info.pl2SqlConv);
}
} else if (argument.direction == OUT) {
if (!functions.contains(info.pl2SqlConv)) {
functions.add(info.pl2SqlConv);
}
}
}
}
use of org.eclipse.persistence.internal.helper.DatabaseType in project eclipselink by eclipse-ee4j.
the class PLSQLStoredProcedureCall method addNamedOutputArgument.
/**
* PUBLIC: Add a named OUT argument to the stored procedure. The databaseType parameter
* classifies the parameter (JDBCType vs. OraclePLSQLType, simple vs. complex). The extra scale
* and precision parameters indicates that this parameter, when used in an Anonymous PL/SQL
* block, requires scale and precision specification
*/
public void addNamedOutputArgument(String procedureParameterName, DatabaseType databaseType, int precision, int scale) {
DatabaseType dt = databaseType.isComplexDatabaseType() ? ((ComplexDatabaseType) databaseType).clone() : databaseType;
arguments.add(new PLSQLargument(procedureParameterName, originalIndex++, OUT, dt, precision, scale));
}
use of org.eclipse.persistence.internal.helper.DatabaseType in project eclipselink by eclipse-ee4j.
the class PLSQLStoredProcedureCall method addNamedInOutputArgument.
/**
* PUBLIC: Add a named IN OUT argument to the stored procedure. The databaseType parameter
* classifies the parameter (JDBCType vs. OraclePLSQLType, simple vs. complex)
*/
public void addNamedInOutputArgument(String procedureParameterName, DatabaseType databaseType) {
DatabaseType dt = databaseType.isComplexDatabaseType() ? ((ComplexDatabaseType) databaseType).clone() : databaseType;
arguments.add(new PLSQLargument(procedureParameterName, originalIndex++, INOUT, dt));
}
Aggregations