use of org.teiid.metadata.ProcedureParameter in project teiid by teiid.
the class MultiSourceMetadataRepository method loadMetadata.
@Override
public void loadMetadata(MetadataFactory factory, ExecutionFactory<Object, Object> executionFactory, Object connectionFactory) throws TranslatorException {
Schema s = factory.getSchema();
for (Table t : s.getTables().values()) {
if (!t.isPhysical()) {
continue;
}
Column c = t.getColumnByName(multiSourceColumnName);
if (c == null) {
c = factory.addColumn(multiSourceColumnName, DataTypeManager.DefaultDataTypes.STRING, t);
MultiSourceMetadataWrapper.setMultiSourceElementMetadata(c);
}
}
outer: for (Procedure p : s.getProcedures().values()) {
if (p.isVirtual()) {
continue;
}
for (ProcedureParameter pp : p.getParameters()) {
if (multiSourceColumnName.equalsIgnoreCase(pp.getName())) {
continue outer;
}
}
ProcedureParameter pp = factory.addProcedureParameter(multiSourceColumnName, DataTypeManager.DefaultDataTypes.STRING, Type.In, p);
pp.setNullType(NullType.Nullable);
}
}
use of org.teiid.metadata.ProcedureParameter in project teiid by teiid.
the class TestMetadataObject method helpTestProcedureID.
public void helpTestProcedureID(String procName, String shortName, int inputParamCount, String[] paramNames, String rsParamName, TranslationUtility transUtil) throws Exception {
Procedure procID = getProcedureID(procName, inputParamCount, transUtil);
assertEquals(procName, procID.getFullName());
assertEquals(shortName, procID.getName());
// Check children
List<ProcedureParameter> children = procID.getParameters();
int i = 0;
for (ProcedureParameter childID : children) {
assertEquals(procID, childID.getParent());
// $NON-NLS-1$
assertTrue(childID.getFullName() + " " + procID.getFullName(), childID.getFullName().startsWith(procID.getFullName()));
assertEquals(paramNames[i++], childID.getName());
}
if (rsParamName != null) {
assertEquals(rsParamName, procID.getResultSet().getName());
} else {
assertNull(procID.getResultSet());
}
}
use of org.teiid.metadata.ProcedureParameter in project teiid by teiid.
the class TestParams method checkParameter.
private void checkParameter(Argument param, String name, String fullName, Direction direction, String nameInSource, String defaultValue, NullType nullability, Class<?> javaType, int length, int precision, int scale) throws Exception {
ProcedureParameter p = param.getMetadataObject();
assertEquals(name, p.getName());
assertEquals(fullName, p.getFullName());
assertEquals(direction, param.getDirection());
assertEquals(nameInSource, p.getNameInSource());
assertEquals(defaultValue, p.getDefaultValue());
assertEquals(nullability, p.getNullType());
assertEquals(javaType, p.getJavaType());
assertEquals(javaType, param.getType());
assertEquals(length, p.getLength());
assertEquals(precision, p.getPrecision());
assertEquals(scale, p.getScale());
assertEquals(null, param.getArgumentValue().getValue());
}
Aggregations