SQLCall call = (SQLCall)enumtr.nextElement();
statementVector.addElement(this.buildProcedureString(call));
}
definition.setStatements(statementVector);
DatabaseField databaseField;
AbstractRecord dataRow;
Hashtable fieldNames = new Hashtable();
List primaryKeyFields = fields;
for (int index = 0; index < primaryKeyFields.size(); index++) {
databaseField = (DatabaseField)primaryKeyFields.get(index);
fieldNames.put(databaseField.getName(), this.schemaManager.getColumnInfo(null, null, databaseField.getTableName(), databaseField.getName()).firstElement());
}
definition.setName(Helper.truncate(name, MAX_NAME_SIZE));
Enumeration fieldsEnum = fieldNames.keys();
String prefixArgToken;
if (getSession().getPlatform().isOracle()) {
prefixArgToken = getSession().getPlatform().getStoredProcedureParameterPrefix();
} else {
prefixArgToken = "";
}
while (fieldsEnum.hasMoreElements()) {
Number dataType;
dataRow = (AbstractRecord)fieldNames.get(fieldsEnum.nextElement());
dataType = (Number)dataRow.get("DATA_TYPE");
Class type = this.getFieldType(dataType);
String typeName = (String)dataRow.get("TYPE_NAME");
if ((type != null) || (typeName == null) || (typeName.length() == 0)) {
definition.addArgument(prefixArgToken + (String)dataRow.get("COLUMN_NAME"), type, ((Number)dataRow.get("COLUMN_SIZE")).intValue());
} else {
definition.addArgument(prefixArgToken + (String)dataRow.get("COLUMN_NAME"), typeName);
}
}
return definition;