org.teiid.metadata.Procedure.getParameters()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.teiid.metadata.Procedure.getParameters()方法的一些代码示例,展示了Procedure.getParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Procedure.getParameters()方法的具体详情如下:
包路径:org.teiid.metadata.Procedure
类名称:Procedure
方法名:getParameters

Procedure.getParameters介绍

暂无

代码示例

代码示例来源:origin: teiid/teiid

public ProcedureParameter getReturnParameter() {
  for (ProcedureParameter param : this.metadataObject.getParameters()) {
    if (param.getType() == Type.ReturnValue) {
      return param;
    }
  }
  return null;
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

@Override
protected Collection<? extends BaseColumn> getChildren(final Procedure parent, CommandContext cc) {
  Collection<ProcedureParameter> params = parent.getParameters();
  if (parent.getResultSet() == null) {
    return params;
  }
  //TODO: don't incur the gc cost of the temp list
  Collection<Column> rsColumns = parent.getResultSet().getColumns();
  ArrayList<BaseColumn> result = new ArrayList<BaseColumn>(params.size() + rsColumns.size());
  result.addAll(params);
  result.addAll(rsColumns);
  return result;
}

代码示例来源:origin: teiid/teiid

@Override
protected Collection<? extends BaseColumn> getChildren(final Procedure parent, CommandContext cc) {
  Collection<ProcedureParameter> params = parent.getParameters();
  if (parent.getResultSet() == null) {
    return params;
  }
  //TODO: don't incur the gc cost of the temp list
  Collection<Column> rsColumns = parent.getResultSet().getColumns();
  ArrayList<BaseColumn> result = new ArrayList<BaseColumn>(params.size() + rsColumns.size());
  result.addAll(params);
  result.addAll(rsColumns);
  return result;
}

代码示例来源:origin: org.teiid/teiid-engine

@Override
protected Collection<? extends BaseColumn> getChildren(final Procedure parent, CommandContext cc) {
  Collection<ProcedureParameter> params = parent.getParameters();
  if (parent.getResultSet() == null) {
    return params;
  }
  //TODO: don't incur the gc cost of the temp list
  Collection<Column> rsColumns = parent.getResultSet().getColumns();
  ArrayList<BaseColumn> result = new ArrayList<BaseColumn>(params.size() + rsColumns.size());
  result.addAll(params);
  result.addAll(rsColumns);
  return result;
}

代码示例来源:origin: org.teiid/teiid-olingo

private ProcedureParameter getReturnParameter() {
  for (ProcedureParameter parameter: this.procedure.getParameters()) {
    if (parameter.getType().equals(ProcedureParameter.Type.ReturnValue)) {
      return parameter;
    }
  }
  return null;
}

代码示例来源:origin: org.teiid.connectors/translator-odata4

private ProcedureParameter getReturnParameter() {
  for (ProcedureParameter pp : this.command.getMetadataObject().getParameters()) {
    if (pp.getType() == ProcedureParameter.Type.ReturnValue) {
      return pp;
    }
  }
  return null;
}

代码示例来源:origin: org.teiid.connectors/translator-swagger

private ProcedureParameter getReturnParameter() {
  for (ProcedureParameter pp : this.command.getMetadataObject().getParameters()) {
    if (pp.getType() == ProcedureParameter.Type.ReturnValue) {
      return pp;
    }
  }
  return null;
}

代码示例来源:origin: org.teiid/teiid-olingo

private Class<?> resolveParameterType(String procedureName, String parameterName) {
  for (ProcedureParameter pp : this.procedure.getParameters()) {
    if (pp.getName().equalsIgnoreCase(parameterName)) {
      return DataTypeManager.getDataTypeClass(pp.getRuntimeType());
    }
  }
  return null;
}

代码示例来源:origin: org.teiid/teiid-olingo

private static boolean doesProcedureReturn(Procedure proc) {        
  for (ProcedureParameter pp : proc.getParameters()) {
    if (pp.getType().equals(ProcedureParameter.Type.ReturnValue)) {
      return true;
    }
  }
  return (proc.getResultSet() != null);
}

代码示例来源:origin: org.teiid/teiid-olingo

private static boolean isInputParameterLob(Procedure proc) {        
  for (ProcedureParameter pp : proc.getParameters()) {
    if (!pp.getType().equals(ProcedureParameter.Type.ReturnValue)
        && DataTypeManager.isLOB(pp.getRuntimeType())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: teiid/teiid

AbstractMetadataRecord getColumn(String paramName, Procedure proc, boolean parameter) throws MetadataException {
  if (proc.getResultSet() != null) {
    Column result = proc.getResultSet().getColumnByName(paramName);
    if (result != null) {
      return result;
    }
  }
  if (parameter) {
    List<ProcedureParameter> params = proc.getParameters();
    for (ProcedureParameter param:params) {
      if (param.getName().equalsIgnoreCase(paramName)) {
        return param;
      }
    }
  }
  throw new MetadataException(QueryPlugin.Util.getString("SQLParser.alter_procedure_param_doesnot_exist", paramName, proc.getName())); //$NON-NLS-1$
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

AbstractMetadataRecord getColumn(String paramName, Procedure proc, boolean parameter) throws MetadataException {
  if (proc.getResultSet() != null) {
    Column result = proc.getResultSet().getColumnByName(paramName);
    if (result != null) {
      return result;
    }
  }
  if (parameter) {
    List<ProcedureParameter> params = proc.getParameters();
    for (ProcedureParameter param:params) {
      if (param.getName().equalsIgnoreCase(paramName)) {
        return param;
      }
    }
  }
  throw new MetadataException(QueryPlugin.Util.getString("SQLParser.alter_procedure_param_doesnot_exist", paramName, proc.getName())); //$NON-NLS-1$
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterProcedureColumnType() throws Exception {
  String ddl = "CREATE FOREIGN PROCEDURE myProc(OUT p1 boolean, p2 varchar, INOUT p3 decimal) " +
      "RETURNS (r1 varchar, r2 decimal)" +
      "OPTIONS(RANDOM 'any', UUID 'uuid', NAMEINSOURCE 'nis', ANNOTATION 'desc', UPDATECOUNT '2');" +
      "ALTER FOREIGN PROCEDURE myProc ALTER PARAMETER p2 TYPE integer;";
  
  Schema s = helpParse(ddl, "model").getSchema();
  Procedure proc = s.getProcedure("myProc");
  assertNotNull(proc);

  assertEquals("p2", proc.getParameters().get(1).getName());
  assertEquals("integer", proc.getParameters().get(1).getRuntimeType());
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

private void assignOids(Schema schema, TreeMap<String, RecordHolder> map) {
  addOid(schema, map);
  for (Table table : schema.getTables().values()) {
    addOid(table, map);
    addOids(table.getColumns(), map);
    addOids(table.getAllKeys(), map);
  }
  for (Procedure proc : schema.getProcedures().values()) {
    addOid(proc, map);
    addOids(proc.getParameters(), map);
    if (proc.getResultSet() != null) {
      addOids(proc.getResultSet().getColumns(), map);
    }
  }
  for (FunctionMethod func : schema.getFunctions().values()) {
    addOid(func, map);
    addOids(func.getInputParameters(), map);
    addOid(func.getOutputParameter(), map);
  }
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterProcedureColumnRename() throws Exception {
  String ddl = "CREATE FOREIGN PROCEDURE myProc(OUT p1 boolean, p2 varchar, INOUT p3 decimal) " +
      "RETURNS (r1 varchar, r2 decimal)" +
      "OPTIONS(RANDOM 'any', UUID 'uuid', NAMEINSOURCE 'nis', ANNOTATION 'desc', UPDATECOUNT '2');" +
      "ALTER FOREIGN PROCEDURE myProc RENAME PARAMETER p2 TO p2renamed;";
  
  Schema s = helpParse(ddl, "model").getSchema();
  Procedure proc = s.getProcedure("myProc");
  assertNotNull(proc);

  assertEquals("p2renamed", proc.getParameters().get(1).getName());
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterProcedureOptions() throws Exception {
  String ddl = "CREATE FOREIGN PROCEDURE myProc(OUT p1 boolean, p2 varchar, INOUT p3 decimal) " +
      "RETURNS (r1 varchar, r2 decimal)" +
      "OPTIONS(RANDOM 'any', UUID 'uuid', NAMEINSOURCE 'nis', ANNOTATION 'desc', UPDATECOUNT '2');" +
      "ALTER FOREIGN PROCEDURE myProc OPTIONS(SET NAMEINSOURCE 'x');" +
      "ALTER FOREIGN PROCEDURE myProc ALTER PARAMETER p2 OPTIONS (ADD x 'y');" +
      "ALTER FOREIGN PROCEDURE myProc OPTIONS(DROP UPDATECOUNT);";
  
  Schema s = helpParse(ddl, "model").getSchema();
  Procedure proc = s.getProcedure("myProc");
  assertNotNull(proc);

  assertEquals("x", proc.getNameInSource());
  assertEquals("p2", proc.getParameters().get(1).getName());
  assertEquals("y", proc.getParameters().get(1).getProperty("x", false));
  assertEquals(1, proc.getUpdateCount());
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

public void procedureCreated(Procedure procedure) {
  if (!assertInEditMode(Mode.SCHEMA)) {
    return;
  }
  assertGrant(Grant.Permission.Privilege.CREATE, Database.ResourceType.PROCEDURE, procedure);
  
  Schema s = getCurrentSchema();
  setUUID(s.getUUID(), procedure);
  for (ProcedureParameter param : procedure.getParameters()) {
    setUUID(s.getUUID(), param);
  }
  if (procedure.getResultSet() != null) {
    setUUID(s.getUUID(), procedure.getResultSet());
  }
  
  s.addProcedure(procedure);
}

代码示例来源:origin: org.teiid/teiid-engine

public void procedureCreated(Procedure procedure) {
  if (!assertInEditMode(Mode.SCHEMA)) {
    return;
  }
  assertGrant(Grant.Permission.Privilege.CREATE, Database.ResourceType.PROCEDURE, procedure);
  
  Schema s = getCurrentSchema();
  setUUID(s.getUUID(), procedure);
  for (ProcedureParameter param : procedure.getParameters()) {
    setUUID(s.getUUID(), param);
  }
  if (procedure.getResultSet() != null) {
    setUUID(s.getUUID(), procedure.getResultSet());
  }
  
  s.addProcedure(procedure);
}

代码示例来源:origin: teiid/teiid

public void procedureCreated(Procedure procedure) {
  if (!assertInEditMode(Mode.SCHEMA)) {
    return;
  }
  assertGrant(Grant.Permission.Privilege.CREATE, Database.ResourceType.PROCEDURE, procedure);
  
  Schema s = getCurrentSchema();
  setUUID(s.getUUID(), procedure);
  for (ProcedureParameter param : procedure.getParameters()) {
    setUUID(s.getUUID(), param);
  }
  if (procedure.getResultSet() != null) {
    setUUID(s.getUUID(), procedure.getResultSet());
  }
  
  s.addProcedure(procedure);
}

代码示例来源:origin: teiid/teiid

@Test 
public void testCreateProcedure() throws Exception {
  String ddl = "CREATE DATABASE FOO;"
      + "USE DATABASE FOO;"
      + "CREATE FOREIGN DATA WRAPPER postgresql;"
      + "CREATE SERVER pgsql TYPE 'custom' FOREIGN DATA WRAPPER postgresql OPTIONS (\"jndi-name\" 'jndiname');"  
      + "CREATE  SCHEMA test SERVER pgsql;"
      + "SET SCHEMA test;"
      + "CREATE FOREIGN PROCEDURE procG1(P1 integer) RETURNS (e1 integer, e2 varchar)";
  
  Database db = helpParse(ddl);
  Schema s = db.getSchema("test");
  Procedure p = s.getProcedure("procG1");
  assertNotNull(p);  
  assertEquals(1, p.getParameters().size());
  assertNotNull(p.getParameterByName("P1"));
  assertEquals(2, p.getResultSet().getColumns().size());
  assertEquals("e1", p.getResultSet().getColumns().get(0).getName());
}

相关文章