本文整理汇总了Java中net.sf.jsqlparser.statement.update.Update.getExpressions方法的典型用法代码示例。如果您正苦于以下问题:Java Update.getExpressions方法的具体用法?Java Update.getExpressions怎么用?Java Update.getExpressions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jsqlparser.statement.update.Update
的用法示例。
在下文中一共展示了Update.getExpressions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUpdateMutation
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
private Mutation createUpdateMutation(Update update, boolean generateParameterMetaData) throws SQLException
{
if (update.getTables().isEmpty())
throw new CloudSpannerSQLException("No table found in update statement", Code.INVALID_ARGUMENT);
if (update.getTables().size() > 1)
throw new CloudSpannerSQLException("Update statements for multiple tables at once are not supported",
Code.INVALID_ARGUMENT);
String table = unquoteIdentifier(update.getTables().get(0).getFullyQualifiedName());
getParameterStore().setTable(table);
List<Expression> expressions = update.getExpressions();
WriteBuilder builder = Mutation.newUpdateBuilder(table);
int index = 0;
for (Column col : update.getColumns())
{
String columnName = unquoteIdentifier(col.getFullyQualifiedName());
expressions.get(index).accept(new ValueBinderExpressionVisitorAdapter<>(getParameterStore(),
builder.set(columnName), columnName));
index++;
}
visitUpdateWhereClause(update.getWhere(), builder, generateParameterMetaData);
return builder.build();
}
示例2: visit
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
public void visit(Update update) {
for (Table table : update.getTables()) {
tables.add(table.getName());
}
if (update.getExpressions() != null) {
for (Expression expression : update.getExpressions()) {
expression.accept(this);
}
}
if (update.getFromItem() != null) {
update.getFromItem().accept(this);
}
if (update.getJoins() != null) {
for (Join join : update.getJoins()) {
join.getRightItem().accept(this);
}
}
if (update.getWhere() != null) {
update.getWhere().accept(this);
}
}
示例3: visit
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
public void visit(Update update) {
for (Table table : update.getTables()) {
tables.add(table, table1 -> table.getName());
}
if (update.getExpressions() != null) {
for (Expression expression : update.getExpressions()) {
expression.accept(this);
}
}
if (update.getFromItem() != null) {
update.getFromItem().accept(this);
}
if (update.getJoins() != null) {
for (Join join : update.getJoins()) {
join.getRightItem().accept(this);
}
}
if (update.getWhere() != null) {
update.getWhere().accept(this);
}
}
示例4: visit
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
public void visit(Update update) {
if (update.getExpressions() != null) {
for (Expression expression : update.getExpressions()) {
expression.accept(this);
}
}
if (update.getFromItem() != null) {
update.getFromItem().accept(this);
}
if (update.getJoins() != null) {
for (Join join : update.getJoins()) {
join.getRightItem().accept(this);
}
}
if (update.getWhere() != null) {
update.getWhere().accept(this);
}
}
示例5: updateCase
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
private void updateCase(Update update){
List<Column> columns = update.getColumns();
System.out.println(columns);
List<Expression> expressions = update.getExpressions();
int index = 0;
for (Expression exp:expressions){
handleColumn(columns.get(index),exp,paramNames);
index++;
}
handleWhereCause(update.getWhere(), paramNames);
}
示例6: visit
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
public void visit(Update s) {
for (Table table : s.getTables()) {
visit(table);
}
if (s.getColumns() != null) {
s.getColumns().forEach(c -> {
c.accept(this);
});
}
if (s.getExpressions() != null) {
s.getExpressions().forEach(e -> e.accept(this));
}
if (s.getOrderByElements() != null) {
s.getOrderByElements().forEach(o -> {
o.accept(this);
});
}
if (s.getWhere() != null) {
s.getWhere().accept(this);
}
if (s.getReturningExpressionList() != null) {
s.getReturningExpressionList().forEach(o -> {
o.accept(this);
});
}
}
示例7: visit
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
@Override
public void visit(Update update)
{
for (Table table : update.getTables())
{
table.accept(this);
}
if (update.getExpressions() != null)
{
for (Expression expression : update.getExpressions())
{
expression.accept(this);
}
}
if (update.getFromItem() != null)
{
update.getFromItem().accept(this);
}
if (update.getJoins() != null)
{
for (Join join : update.getJoins())
{
join.getRightItem().accept(this);
}
}
if (update.getWhere() != null)
{
update.getWhere().accept(this);
}
}
示例8: buildUpdateStatement
import net.sf.jsqlparser.statement.update.Update; //导入方法依赖的package包/类
private ExecutionPlan buildUpdateStatement(String defaultTableSpace, Update s,
boolean returnValues) throws StatementExecutionException {
if (s.getTables().size() != 1) {
throw new StatementExecutionException("unsupported multi-table update " + s);
}
net.sf.jsqlparser.schema.Table fromTable = s.getTables().get(0);
String tableSpace = fromTable.getSchemaName();
String tableName = fromTable.getName();
if (tableSpace == null) {
tableSpace = defaultTableSpace;
}
TableSpaceManager tableSpaceManager = manager.getTableSpaceManager(tableSpace);
if (tableSpaceManager == null) {
throw new StatementExecutionException("no such tablespace " + tableSpace + " here at " + manager.getNodeId());
}
AbstractTableManager tableManager = tableSpaceManager.getTableManager(tableName);
if (tableManager == null) {
throw new StatementExecutionException("no such table " + tableName + " in tablespace " + tableSpace);
}
Table table = tableManager.getTable();
for (net.sf.jsqlparser.schema.Column c : s.getColumns()) {
Column column = table.getColumn(c.getColumnName());
if (column == null) {
throw new StatementExecutionException("no such column " + c.getColumnName() + " in table " + tableName + " in tablespace " + tableSpace);
}
if (table.isPrimaryKeyColumn(c.getColumnName())) {
throw new StatementExecutionException("updates of fields on the PK (" + Arrays.toString(table.primaryKey) + ") are not supported. Please perform a DELETE and than an INSERT");
}
}
List<CompiledSQLExpression> compiledSQLExpressions = new ArrayList<>();
for (Expression e : s.getExpressions()) {
compiledSQLExpressions.add(SQLExpressionCompiler.compileExpression(null, e));
}
RecordFunction function = new SQLRecordFunction(table, s.getColumns(), compiledSQLExpressions);
// Perform a scan and then update each row
SQLRecordPredicate where = s.getWhere() != null ? new SQLRecordPredicate(table, table.name, s.getWhere()) : null;
if (where != null) {
Expression expressionWhere = s.getWhere();
discoverIndexOperations(expressionWhere, table, table.name, where, tableSpaceManager);
}
DMLStatement st = new UpdateStatement(tableSpace, tableName, null, function, where)
.setReturnValues(returnValues);
return ExecutionPlan.simple(st);
}