本文整理汇总了Java中net.sf.jsqlparser.statement.update.Update.setColumns方法的典型用法代码示例。如果您正苦于以下问题:Java Update.setColumns方法的具体用法?Java Update.setColumns怎么用?Java Update.setColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jsqlparser.statement.update.Update
的用法示例。
在下文中一共展示了Update.setColumns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseConvertedQuery
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
protected Statement parseConvertedQuery(Update update) {
List<Column> allColumns = icdb.getFields(update.getTables().get(0).toString())
.stream().map(Column::new)
.collect(Collectors.toList());
update.setColumns(allColumns);
List<Expression> expressions = updateSelectResults
.map(record -> {
List<Expression> values = new ArrayList<>();
for (int i = 0; i < record.size() - 2; i++) {
final Object value = record.get(i);
if (value instanceof String) {
values.add(new StringValue("'" + value + "'"));
} else {
values.add(new HexValue(value.toString()));
}
}
// Add this serial to be revoked upon successful execution
final long serial = (long) record.get(Format.SERIAL_COLUMN);
serialsToBeRevoked.add(serial);
return values;
})
.stream()
.findFirst() // TODO: get all results
.orElseThrow(() -> new RuntimeException("Failed to parse query"));
convertExpressionList(expressions);
update.setExpressions(expressions);
return update;
}
示例2: Update
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
final public Update Update() throws ParseException {
Update update = new Update();
Table table = null;
Expression where = null;
Column tableColumn = null;
List expList = new ArrayList();
List columns = new ArrayList();
Expression value = null;
jj_consume_token(K_UPDATE);
table = TableWithAlias();
jj_consume_token(K_SET);
tableColumn = Column();
jj_consume_token(78);
value = SimpleExpression();
columns.add(tableColumn); expList.add(value);
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 79:
;
break;
default:
jj_la1[3] = jj_gen;
break label_1;
}
jj_consume_token(79);
tableColumn = Column();
jj_consume_token(78);
value = SimpleExpression();
columns.add(tableColumn); expList.add(value);
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case K_WHERE:
where = WhereClause();
update.setWhere(where);
break;
default:
jj_la1[4] = jj_gen;
;
}
update.setColumns(columns);
update.setExpressions(expList);
update.setTable(table);
{if (true) return update;}
throw new Error("Missing return statement in function");
}