org.teiid.language.Update.getChanges()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(189)

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

Update.getChanges介绍

暂无

代码示例

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

public void visit(Update obj) {
  buffer.append(UPDATE)
     .append(Tokens.SPACE);
  appendSourceComment(obj);
  append(obj.getTable());
  buffer.append(Tokens.SPACE)
     .append(SET)
     .append(Tokens.SPACE);
  append(obj.getChanges()); 
  if (obj.getWhere() != null) {
    buffer.append(Tokens.SPACE)
       .append(WHERE)
       .append(Tokens.SPACE);
    append(obj.getWhere());
  }
}

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

@Override
public void visit(Update obj) {
  this.method = "PUT"; //$NON-NLS-1$
  this.entity = obj.getTable().getMetadataObject();
  visitNode(obj.getTable());
  
  // only pk are allowed, no other criteria not allowed
  obj.setWhere(buildEntityKey(obj.getWhere()));
  
  // this will build with entity keys
  this.uri = getEnitityURL();
  
  if (this.uri.indexOf('(') == -1) {
    this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17011, this.filter.toString())));
  }
  
  if (this.filter.length() > 0) {
    this.exceptions.add(new TranslatorException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID17009, this.filter.toString())));
  }
  
  final List<OProperty<?>> props = new ArrayList<OProperty<?>>();
  int elementCount = obj.getChanges().size();
  for (int i = 0; i < elementCount; i++) {
    Column column = obj.getChanges().get(i).getSymbol().getMetadataObject();
    OProperty<?> property = readProperty(column, obj.getChanges().get(i).getValue());
    props.add(property);
  }
  this.payload = props;
}

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

@Override
public void visit(Update obj) {
  this.operationType = OperationType.UPDATE;
  visitNode(obj.getTable());
  this.odataQuery.setCondition(obj.getWhere());
  
  try {
    // read the properties
    int elementCount = obj.getChanges().size();
    for (int i = 0; i < elementCount; i++) {
      Column column = obj.getChanges().get(i).getSymbol().getMetadataObject();            
      String type = ODataTypeManager.odataType(column)
          .getFullQualifiedName().getFullQualifiedNameAsString();
      Expression expr = obj.getChanges().get(i).getValue();
      Object value = resolveExpressionValue(expr);
      this.odataQuery.addUpdateProperty(column, type, value);
    }
  } catch (TranslatorException e) {
    this.exceptions.add(e);
  }            
}

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

private void handleUpdate() throws TranslatorException {
  Update update = (Update)command;
  List<SetClause> changes = update.getChanges();
  
  while (true) {
    Row row = nextRow();
    if (row == null) {
      break;
    }
    for (int i = 0; i < this.visitor.getProjectedColumns().size(); i++) {
      int index = this.visitor.getProjectedColumns().get(i);
      Object o = ((Literal)changes.get(i).getValue()).getValue();
      setValue(row, index-1, o);
    }
    modified = true;
    result++;
  }
}

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

public void visit(Update obj) {
  visitNode(obj.getTable());
  visitNodes(obj.getChanges());
  visitNode(obj.getWhere());
}

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

public void testGetChanges() throws Exception {
  List changes = example().getChanges();
  assertNotNull(changes);
  assertEquals(4, changes.size());
}

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

@Override
public void visit(Update obj) {
  if (obj.getParameterValues() != null) {
    this.exceptions.add(new TranslatorException(SimpleDBPlugin.Event.TEIID24006, SimpleDBPlugin.Util.gs(SimpleDBPlugin.Event.TEIID24006)));
  }
  
  this.table = obj.getTable().getMetadataObject();
  for(SetClause setClause : obj.getChanges()){
    visitNode(setClause);
  }
  if (obj.getWhere() != null) {
    this.criteria = SimpleDBSQLVisitor.getSQLString(obj.getWhere());
  }
}

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

for (SetClause set : update.getChanges()) {
  cols.add(set.getSymbol());
  vals.add(set.getValue());

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

@Override
  protected int processIds(String[] ids, IQueryProvidingVisitor visitor)
      throws TranslatorException {
    List<DataPayload> updateDataList = new ArrayList<DataPayload>();

    for (int i = 0; i < ids.length; i++) {
      DataPayload data = new DataPayload();

      for (SetClause clause : ((Update)command).getChanges()) {
        ColumnReference element = clause.getSymbol();
        Column column = element.getMetadataObject();
        String val = ((Literal) clause.getValue()).toString();
        data.addField(column.getSourceName(), Util.stripQutes(val));
      }

      data.setType(visitor.getTableName());
      data.setID(ids[i]);
      updateDataList.add(data);
    }

    return getConnection().update(updateDataList);
  }
}

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

private void executeUpdate()
    throws TranslatorException {
  List<SetClause> updateList = ((Update)command).getChanges();
  Condition criteria = ((Update)command).getWhere();

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

public void visit(Update obj) {
  worksheetTitle = obj.getTable().getName();
  changes = new ArrayList<UpdateSet>();
  String columnName;
  if (obj.getTable().getMetadataObject().getNameInSource() != null) {
    this.worksheetTitle = obj.getTable().getMetadataObject().getNameInSource();
  }
  for (SetClause s : obj.getChanges()) {
    if(s.getSymbol().getMetadataObject().getNameInSource()!=null){
      columnName=s.getSymbol().getMetadataObject().getNameInSource();
    }else{
      columnName=s.getSymbol().getMetadataObject().getName();
    }
    changes.add(new UpdateSet(columnName, getStringValue(s.getValue())));
  }
  translateWhere(obj.getWhere());
}

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

append(obj.getTable());
List<SetClause> changes = obj.getChanges();
try {
  IDRef pk = null;

相关文章