当前位置: 首页>>代码示例>>Java>>正文


Java Insert.getItemsList方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.statement.insert.Insert.getItemsList方法的典型用法代码示例。如果您正苦于以下问题:Java Insert.getItemsList方法的具体用法?Java Insert.getItemsList怎么用?Java Insert.getItemsList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.statement.insert.Insert的用法示例。


在下文中一共展示了Insert.getItemsList方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert insert) {
    this.getStack().push(new FrameContext());
    ShardRouteConfig routeConfig = shardRouter.getRouteConfig(insert.getTable().getSchemaName(),
                                                              insert.getTable().getName());
    if (routeConfig != null) {
        TableWrapper table = new TableWrapper(insert.getTable(), routeConfig);
        addRoutedTableIntoContext(table, routeConfig, false);
        List<Column> columns = insert.getColumns();
        if (columns != null) {
            ExpressionList expressionList = (ExpressionList) insert.getItemsList();
            List<Expression> valueList = expressionList.getExpressions();
            for (int i = 0; i < columns.size(); i++) {
                Column column = columns.get(i);
                TableWrapper tab = getTableFromContext(column);
                if (tab != null) {
                    Expression expression = valueList.get(i);
                    routeTable(tab, column, expression);
                }
            }
        }
    }
    super.visit(insert);
    afterVisitBaseStatement();
}
 
开发者ID:hellojavaer,项目名称:ddal,代码行数:26,代码来源:JSQLParserAdapter.java

示例2: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert s) {
    visit(s.getTable());
    if (s.getColumns() != null) {
        s.getColumns().forEach(c -> {
            c.accept(this);
        });
    }
    if (s.getItemsList() != null) {
        s.getItemsList().accept(this);
    }
    if (s.getSelect() != null) {
        s.getSelect().accept(this);
    }
    if (s.getReturningExpressionList() != null) {
        s.getReturningExpressionList().forEach(o -> {
            o.accept(this);
        });
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:21,代码来源:JdbcQueryRewriter.java

示例3: processInsert

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
/**
 * <p>
 * insert 语句处理
 * </p>
 */
@Override
public void processInsert(Insert insert) {
    if (this.tenantHandler.doTableFilter(insert.getTable().getName())) {
        // 过滤退出执行
        return;
    }
    insert.getColumns().add(new Column(this.tenantHandler.getTenantIdColumn()));
    if (insert.getSelect() != null) {
        processPlainSelect((PlainSelect) insert.getSelect().getSelectBody(), true);
    } else if (insert.getItemsList() != null) {
        ((ExpressionList) insert.getItemsList()).getExpressions().add(tenantHandler.getTenantId());
    } else {
        throw new MybatisPlusException("Failed to process multiple-table update, please exclude the tableName or statementId");
    }
}
 
开发者ID:baomidou,项目名称:mybatis-plus,代码行数:21,代码来源:TenantSqlParser.java

示例4: parseConvertedQuery

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
protected Statement parseConvertedQuery(Insert insert) {
    // Get expression list from query
    ItemsList itemsList = insert.getItemsList();

    if (itemsList instanceof MultiExpressionList) {
        ((MultiExpressionList) itemsList).getExprList().stream()
                .map(ExpressionList::getExpressions)
                .forEach(this::convertExpressionList);
    } else {
        List<Expression> expressions = ((ExpressionList) itemsList).getExpressions();
        convertExpressionList(expressions);
    }

    return insert;
}
 
开发者ID:Hyperparticle,项目名称:integrity-coded-database,代码行数:17,代码来源:OCFQuery.java

示例5: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert insert) {
    tables.add(insert.getTable().getName());
    if (insert.getItemsList() != null) {
        insert.getItemsList().accept(this);
    }
    if (insert.getSelect() != null) {
        visit(insert.getSelect());
    }
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:11,代码来源:TablesNamesFinder.java

示例6: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert insert) {
    tables.add(insert.getTable(), table -> table.getName());
    if (insert.getItemsList() != null) {
        insert.getItemsList().accept(this);
    }
    if (insert.getSelect() != null) {
        visit(insert.getSelect());
    }
}
 
开发者ID:justice-code,项目名称:QiuQiu,代码行数:11,代码来源:ReplaceTablesNamesFinder.java

示例7: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert insert) {
    if (insert.getItemsList() != null) {
        insert.getItemsList().accept(this);
    }
    if (insert.getSelect() != null) {
        visit(insert.getSelect());
    }
}
 
开发者ID:hellojavaer,项目名称:ddal,代码行数:10,代码来源:JSQLBaseVisitor.java

示例8: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public void visit(Insert insert)
{
    insert.getTable().accept(this);
    
    if (insert.getItemsList() != null)
    {
        insert.getItemsList().accept(this);
    }
    if (insert.getSelect() != null)
    {
        visit(insert.getSelect());
    }
}
 
开发者ID:sogou-biztech,项目名称:compass,代码行数:15,代码来源:TableRenameVisitor.java

示例9: createInsertMutation

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
private Mutation createInsertMutation(Insert insert, boolean generateParameterMetaData) throws SQLException
{
	ItemsList items = insert.getItemsList();
	if (generateParameterMetaData && items == null && insert.getSelect() != null)
	{
		// Just initialize the parameter meta data of the select statement
		createSelectBuilder(insert.getSelect(), insert.getSelect().toString());
		return null;
	}
	if (!(items instanceof ExpressionList))
	{
		throw new CloudSpannerSQLException("Insert statement must specify a list of values", Code.INVALID_ARGUMENT);
	}
	if (insert.getColumns() == null || insert.getColumns().isEmpty())
	{
		throw new CloudSpannerSQLException("Insert statement must specify a list of column names",
				Code.INVALID_ARGUMENT);
	}
	List<Expression> expressions = ((ExpressionList) items).getExpressions();
	String table = unquoteIdentifier(insert.getTable().getFullyQualifiedName());
	getParameterStore().setTable(table);
	WriteBuilder builder;
	if (insert.isUseDuplicate())
	{
		/**
		 * Do an insert-or-update. BUT: Cloud Spanner does not support
		 * supplying different values for the insert and update statements,
		 * meaning that only the values specified in the INSERT part of the
		 * statement will be considered. Anything specified in the 'ON
		 * DUPLICATE KEY UPDATE ...' statement will be ignored.
		 */
		if (this.forceUpdate)
			builder = Mutation.newUpdateBuilder(table);
		else
			builder = Mutation.newInsertOrUpdateBuilder(table);
	}
	else
	{
		/**
		 * Just do an insert and throw an error if a row with the specified
		 * key alread exists.
		 */
		builder = Mutation.newInsertBuilder(table);
	}
	int index = 0;
	for (Column col : insert.getColumns())
	{
		String columnName = unquoteIdentifier(col.getFullyQualifiedName());
		expressions.get(index).accept(new ValueBinderExpressionVisitorAdapter<>(getParameterStore(),
				builder.set(columnName), columnName));
		index++;
	}
	return builder.build();
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:55,代码来源:CloudSpannerPreparedStatement.java

示例10: visit

import net.sf.jsqlparser.statement.insert.Insert; //导入方法依赖的package包/类
@Override
public synchronized void visit(Insert ins) {
   controlEventMap.put(sql, ControlEvent.INSERT);
   targetMap.put(sql, ins.getTable().getName());
   findPrimaryKeyColumn();

   List<SqlParameter> paramList = new ArrayList<SqlParameter>();
   parameterMap.put(sql, paramList);
   List<SqlParameter> updList = new ArrayList<SqlParameter>();
   insUpdColumnsMap.put(sql, updList);

   ItemsList il = ins.getItemsList();
   if (il instanceof ExpressionList) {
      ExpressionList el = (ExpressionList) il;

      if (ins.getColumns() != null
            && ins.getColumns().size() != el.getExpressions().size()) {
         String err = "Failed to parse INSERT statement "
               + sql
               + ": number of columns is not equal to number of values in VALUES clause";
         log.error(err);
         throw new CibetJdbcException(err);
      }

      int sequence = 0;
      for (int i = 0; i < el.getExpressions().size(); i++) {
         Expression exp = (Expression) el.getExpressions().get(i);
         SqlExpressionParser expParser = new SqlExpressionParser();
         exp.accept(expParser);
         Object value = expParser.getValue();
         String columnName = ins.getColumns() == null ? "?" + (i + 1)
               : ((Column) ins.getColumns().get(i)).getColumnName();

         SqlParameter sqlParam = new SqlParameter(columnName, value);
         if ("?".equals(value)) {
            sequence++;
            sqlParam.setSequence(sequence);
         }
         if (sqlParam.getColumn().equalsIgnoreCase(primaryKeyColumn)) {
            primaryKeys.put(sql, sqlParam);
         }
         paramList.add(sqlParam);
         updList.add(sqlParam);
      }

      refineColumnNames();

      if (primaryKeys.get(sql) == null) {
         emptyPrimaryKey(SqlParameterType.INSERT_PARAMETER);
      }

   } else {
      log.warn("Subselects not supported in statement " + sql);
      controlEventMap.put(sql, null);
   }
}
 
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:57,代码来源:SqlParser.java


注:本文中的net.sf.jsqlparser.statement.insert.Insert.getItemsList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。