• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SQLExprTableSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alibaba.druid.sql.ast.statement.SQLExprTableSource的典型用法代码示例。如果您正苦于以下问题:Java SQLExprTableSource类的具体用法?Java SQLExprTableSource怎么用?Java SQLExprTableSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SQLExprTableSource类属于com.alibaba.druid.sql.ast.statement包,在下文中一共展示了SQLExprTableSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public boolean visit(MySqlDeleteStatement x) {
    setAliasMap();

    setMode(x, Mode.Delete);

    accept(x.getFrom());
    accept(x.getUsing());
    x.getTableSource().accept(this);

    if (x.getTableSource() instanceof SQLExprTableSource) {
        SQLName tableName = (SQLName) ((SQLExprTableSource) x.getTableSource()).getExpr();
        String ident = tableName.toString();
        setCurrentTable(x, ident);

        TableStat stat = this.getTableStat(ident,ident);
        stat.incrementDeleteCount();
    }

    accept(x.getWhere());

    accept(x.getOrderBy());
    accept(x.getLimit());

    return false;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:26,代码来源:MycatSchemaStatVisitor.java


示例2: isInsertSeq

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
private static boolean isInsertSeq(ServerConnection c, String stmt, SchemaConfig schema) throws SQLException {
    SQLStatementParser parser = new MySqlStatementParser(stmt);
    MySqlInsertStatement statement = (MySqlInsertStatement) parser.parseStatement();
    String schemaName = schema == null ? null : schema.getName();
    SQLExprTableSource tableSource = statement.getTableSource();
    SchemaUtil.SchemaInfo schemaInfo = SchemaUtil.getSchemaInfo(c.getUser(), schemaName, tableSource);
    String tableName = schemaInfo.getTable();
    schema = schemaInfo.getSchemaConfig();
    TableConfig tableConfig = schema.getTables().get(tableName);
    if (tableConfig == null) {
        return false;
    } else if (tableConfig.isAutoIncrement()) {
        return true;
    }
    return false;
}
 
开发者ID:actiontech,项目名称:dble,代码行数:17,代码来源:ExplainHandler.java


示例3: visitorParse

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public SchemaConfig visitorParse(SchemaConfig schema, RouteResultset rrs, SQLStatement stmt,
                                 ServerSchemaStatVisitor visitor, ServerConnection sc) throws SQLException {
    SQLCreateIndexStatement createStmt = (SQLCreateIndexStatement) stmt;
    SQLTableSource tableSource = createStmt.getTable();
    if (tableSource instanceof SQLExprTableSource) {
        String schemaName = schema == null ? null : schema.getName();
        SchemaInfo schemaInfo = SchemaUtil.getSchemaInfo(sc.getUser(), schemaName, (SQLExprTableSource) tableSource);
        String statement = RouterUtil.removeSchema(rrs.getStatement(), schemaInfo.getSchema());
        rrs.setStatement(statement);
        if (RouterUtil.isNoSharding(schemaInfo.getSchemaConfig(), schemaInfo.getTable())) {
            RouterUtil.routeToSingleDDLNode(schemaInfo, rrs);
            return schemaInfo.getSchemaConfig();
        }
        RouterUtil.routeToDDLNode(schemaInfo, rrs);
        return schemaInfo.getSchemaConfig();
    } else {
        String msg = "The DDL is not supported, sql:" + stmt;
        throw new SQLNonTransientException(msg);
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:22,代码来源:DruidCreateIndexParser.java


示例4: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public boolean visit(MySqlDeleteStatement x) {
    setAliasMap();

    setMode(x, Mode.Delete);

    accept(x.getFrom());
    accept(x.getUsing());
    x.getTableSource().accept(this);

    if (x.getTableSource() instanceof SQLExprTableSource) {
        SQLName tableName = (SQLName) ((SQLExprTableSource) x.getTableSource()).getExpr();
        String ident = tableName.toString();
        setCurrentTable(x, ident);
        // 和父类只有这行不同
        TableStat stat = this.getTableStat(ident,ident);
        stat.incrementDeleteCount();
    }

    accept(x.getWhere());

    accept(x.getOrderBy());
    accept(x.getLimit());

    return false;
}
 
开发者ID:tongbanjie,项目名称:baymax,代码行数:27,代码来源:SqlVisitor.java


示例5: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public boolean visit(SQLExprTableSource x) {
	SQLName name = (SQLName) x.getExpr();
	if (logicalTable.equalsIgnoreCase(name.getSimpleName())) {
		print0(physicalTable);
	} else {
		x.getExpr().accept(this);
	}

	if (x.getAlias() != null) {
		print(' ');
		print0(x.getAlias());
	}

	for (int i = 0; i < x.getHintsSize(); ++i) {
		print(' ');
		x.getHints().get(i).accept(this);
	}

	return false;
}
 
开发者ID:dianping,项目名称:zebra,代码行数:22,代码来源:DefaultSQLRewrite.java


示例6: parseOneIdx

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
private Map parseOneIdx(String idx)
{
  Map map = new HashMap();
  OracleStatementParser parser = new OracleStatementParser(idx);
  OracleCreateIndexStatement statement = parser.parseCreateIndex(true);
  SQLExprTableSource tableSource = (SQLExprTableSource) statement.getTable();
  String tableName = ((SQLPropertyExpr) tableSource.getExpr()).getSimleName().toLowerCase();
  String idxType = statement.getType();
  List<SQLSelectOrderByItem> items = statement.getItems();
  List fields = new ArrayList();
  for (SQLSelectOrderByItem item : items)
  {
    SQLIdentifierExpr expr = (SQLIdentifierExpr) item.getExpr();
    fields.add(expr.getSimleName().toLowerCase());
  }
  if ("unique".equalsIgnoreCase(idxType))
    map.put(tableName, fields);
  return map;
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:20,代码来源:OracleDdlParser.java


示例7: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public boolean visit(SQLExprTableSource x) {
    processTableName(x.getExpr());
    if (x.getAlias() != null) {
        print(' ');
        print0(x.getAlias());
    }

    for (int i = 0; i < x.getHintsSize(); ++i) {
        print(' ');
        x.getHints().get(i).accept(this);
    }

    if (x.getPartitionSize() > 0) {
        print0(ucase ? " PARTITION (" : " partition (");
        printlnAndAccept(x.getPartitions(), ", ");
        print(')');
    }

    return false;
}
 
开发者ID:alibaba,项目名称:otter,代码行数:21,代码来源:DdlUtils.java


示例8: getDDLTableSource

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
private static SQLExprTableSource getDDLTableSource(SQLStatement statement) {
	SQLExprTableSource source = null;
	if (statement instanceof SQLAlterTableStatement) {
		source = ((SQLAlterTableStatement)statement).getTableSource();
		
	} else if (isCreate(statement)) {
		source = ((SQLCreateTableStatement)statement).getTableSource();
	}
	return source;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:11,代码来源:GlobalTableUtil.java


示例9: getDisTable

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
private SQLExprTableSource getDisTable(SQLTableSource tableSource,RouteResultsetNode node) throws SQLSyntaxErrorException{
	if(node.getSubTableName()==null){
		String msg = " sub table not exists for " + node.getName() + " on " + tableSource;
		LOGGER.error("DruidMycatRouteStrategyError " + msg);
		throw new SQLSyntaxErrorException(msg);
	}
	
	SQLIdentifierExpr sqlIdentifierExpr = new SQLIdentifierExpr();
	sqlIdentifierExpr.setParent(tableSource.getParent());
	sqlIdentifierExpr.setName(node.getSubTableName());
	SQLExprTableSource from2 = new SQLExprTableSource(sqlIdentifierExpr);
	return from2;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:14,代码来源:DruidMycatRouteStrategy.java


示例10: setLeft

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public void setLeft(String tableName) {
    SQLExprTableSource tableSource;
    if (tableName == null || tableName.length() == 0) {
        tableSource = null;
    } else {
        tableSource = new OracleSelectTableReference(new SQLIdentifierExpr(tableName));
    }
    this.setLeft(tableSource);
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:10,代码来源:OracleSelectJoin.java


示例11: setRight

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public void setRight(String tableName) {
    SQLExprTableSource tableSource;
    if (tableName == null || tableName.length() == 0) {
        tableSource = null;
    } else {
        tableSource = new OracleSelectTableReference(new SQLIdentifierExpr(tableName));
    }
    this.setRight(tableSource);
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:10,代码来源:OracleSelectJoin.java


示例12: setFrom

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public void setFrom(String tableName) {
    SQLExprTableSource from;
    if (tableName == null || tableName.length() == 0) {
        from = null;
    } else {
        from = new OracleSelectTableReference(new SQLIdentifierExpr(tableName));
    }
    this.setFrom(from);
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:10,代码来源:OracleSelectQueryBlock.java


示例13: parseTableSourceRest

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
protected SQLTableSource parseTableSourceRest(SQLTableSource tableSource) {
    if (lexer.token() == Token.AS && tableSource instanceof SQLExprTableSource) {
        lexer.nextToken();

        String alias = null;
        if (lexer.token() == Token.IDENTIFIER) {
            alias = lexer.stringVal();
            lexer.nextToken();
        }

        if (lexer.token() == Token.LPAREN) {
            SQLExprTableSource exprTableSource = (SQLExprTableSource) tableSource;

            PGFunctionTableSource functionTableSource = new PGFunctionTableSource(exprTableSource.getExpr());
            if (alias != null) {
                functionTableSource.setAlias(alias);
            }
            
            lexer.nextToken();
            parserParameters(functionTableSource.getParameters());
            accept(Token.RPAREN);

            return super.parseTableSourceRest(functionTableSource);
        }
        if (alias != null) {
            tableSource.setAlias(alias);
            return super.parseTableSourceRest(tableSource);
        }
    }

    return super.parseTableSourceRest(tableSource);
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:33,代码来源:PGSelectParser.java


示例14: parserOutput

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
protected SQLServerOutput parserOutput() {
    if (lexer.identifierEquals("OUTPUT")) {
        lexer.nextToken();
        SQLServerOutput output = new SQLServerOutput();

        final List<SQLSelectItem> selectList = output.getSelectList();
        for (;;) {
            final SQLSelectItem selectItem = parseSelectItem();
            selectList.add(selectItem);

            if (lexer.token() != Token.COMMA) {
                break;
            }

            lexer.nextToken();
        }

        if (lexer.token() == Token.INTO) {
            lexer.nextToken();
            output.setInto(new SQLExprTableSource(this.name()));
            if (lexer.token() == (Token.LPAREN)) {
                lexer.nextToken();
                this.exprList(output.getColumns(), output);
                accept(Token.RPAREN);
            }
        }
        return output;
    }
    return null;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:31,代码来源:SQLServerExprParser.java


示例15: addTable

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public void addTable(SQLExprTableSource table) {
    if (table == null) {
        return;
    }
    table.setParent(this);
    this.tables.add(table);
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:8,代码来源:MySqlFlushStatement.java


示例16: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
public static boolean visit(SQLEvalVisitor visitor, SQLQueryExpr x) {


        if (x.getSubQuery().getQuery() instanceof SQLSelectQueryBlock) {
            SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) x.getSubQuery().getQuery();

            boolean nullFrom = false;
            if (queryBlock.getFrom() == null) {
                nullFrom = true;
            } else if (queryBlock.getFrom() instanceof SQLExprTableSource) {
                SQLExpr expr = ((SQLExprTableSource) queryBlock.getFrom()).getExpr();
                if (expr instanceof SQLIdentifierExpr) {
                    if ("dual".equalsIgnoreCase(((SQLIdentifierExpr) expr).getName())) {
                        nullFrom = true;
                    }
                }
            }

            if (nullFrom) {
                List<Object> row = new ArrayList<Object>(queryBlock.getSelectList().size());
                for (int i = 0; i < queryBlock.getSelectList().size(); ++i) {
                    SQLSelectItem item = queryBlock.getSelectList().get(i);
                    item.getExpr().accept(visitor);
                    Object cell = item.getExpr().getAttribute(EVAL_VALUE);
                    row.add(cell);
                }
                List<List<Object>> rows = new ArrayList<List<Object>>(1);
                rows.add(row);

                Object result = rows;
                queryBlock.putAttribute(EVAL_VALUE, result);
                x.getSubQuery().putAttribute(EVAL_VALUE, result);
                x.putAttribute(EVAL_VALUE, result);

                return false;
            }
        }

        return false;
    }
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:41,代码来源:SQLEvalVisitorUtils.java


示例17: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public boolean visit(SQLExprTableSource astNode) {
    if (StringUtil.removeBackquote(astNode.toString()).equals(originalName)){
        if (isReplase){
            throw new BayMaxException("分区表名在一个Sql中只能出现一次:" + originalName + "," +newName);
        }else {
            node = (SQLIdentifierExpr) astNode.getExpr();
            node.setName(newName);
            isReplase = true;
        }
    }
    return true;
}
 
开发者ID:tongbanjie,项目名称:baymax,代码行数:14,代码来源:ReplaceTableNameVisitor.java


示例18: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public boolean visit(SQLExprTableSource x) {
	SQLName table = (SQLName) x.getExpr();
	result.getRouterContext().getTableSet().add(table.getSimpleName());

	return true;
}
 
开发者ID:dianping,项目名称:zebra,代码行数:8,代码来源:AbstractMySQLASTVisitor.java


示例19: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
private boolean visit(final SQLExprTableSource x, final Table table) {
	printToken(table.getName());
	if (table.getAlias().isPresent()) {
		print(' ');
		print(table.getAlias().get());
	}
	for (SQLHint each : x.getHints()) {
		print(' ');
		each.accept(this);
	}
	return false;
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:13,代码来源:AbstractPGSQLVisitor.java


示例20: visit

import com.alibaba.druid.sql.ast.statement.SQLExprTableSource; //导入依赖的package包/类
@Override
public boolean visit(final PGSelectQueryBlock x) {
	selectLayer++;
    if (x.getFrom() instanceof SQLExprTableSource) {
        SQLExprTableSource tableExpr = (SQLExprTableSource) x.getFrom();
        setCurrentTable(tableExpr.getExpr().toString(), Optional.fromNullable(tableExpr.getAlias()));
    }
    //处理distinct
    if(isEnableCollectMetadata()){
    	if(SQLSetQuantifier.DISTINCT==x.getDistionOption()){
    		parseResult.markDistinct();
    	}
    }
    return super.visit(x);
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:16,代码来源:PGSQLSelectVisitor.java



注:本文中的com.alibaba.druid.sql.ast.statement.SQLExprTableSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IRCConnection类代码示例发布时间:2022-05-22
下一篇:
Java GreenMailRule类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap