本文整理汇总了Java中com.alibaba.druid.sql.ast.statement.SQLTableSource类的典型用法代码示例。如果您正苦于以下问题:Java SQLTableSource类的具体用法?Java SQLTableSource怎么用?Java SQLTableSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLTableSource类属于com.alibaba.druid.sql.ast.statement包,在下文中一共展示了SQLTableSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parser
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public void parser(){
masterTable="";
SQLTableSource table=mysqlQuery.getFrom();
parserTable(table,tableFilter,false);
parserFields(mysqlQuery.getSelectList());
parserMasterTable();
parserWhere(mysqlQuery.getWhere(),"");
// getJoinField();
parserOrderBy(mysqlQuery.getOrderBy());
parserLimit();
// LOGGER.info("field "+fieldAliasMap);
// LOGGER.info("master "+masterTable);
// LOGGER.info("join Lkey "+getJoinLkey());
// LOGGER.info("join Rkey "+getJoinRkey());
LOGGER.info("SQL: "+this.stmt);
}
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:20,代码来源:JoinParser.java
示例2: parserTable
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
private void parserTable(SQLTableSource table,TableFilter tFilter,boolean isOutJoin){
if(table instanceof SQLJoinTableSource){
SQLJoinTableSource table1=(SQLJoinTableSource)table;
joinType=table1.getJoinType().toString();
if ((table1.getJoinType()==JoinType.COMMA)||(table1.getJoinType()==JoinType.JOIN)||(table1.getJoinType()==JoinType.INNER_JOIN)
||(table1.getJoinType()==JoinType.LEFT_OUTER_JOIN)) {
tFilter=setTableFilter(tFilter,getTableFilter(table1.getLeft(),isOutJoin));
if (tableFilter==null){
tableFilter=tFilter;
}
}
//parserTable(table1.getLeft()); //SQLExprTableSource
parserTable(table1.getRight(),tFilter,true);
SQLExpr expr=table1.getCondition();//SQLBinaryOpExpr
parserJoinKey(expr);
}
else {
tFilter=setTableFilter(tFilter,getTableFilter(table,isOutJoin));
LOGGER.info("table "+table.toString() +" Alias:"+table.getAlias()+" Hints:"+table.getHints());
}
}
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:23,代码来源:JoinParser.java
示例3: parseLateralView
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
protected SQLTableSource parseLateralView(SQLTableSource tableSource) {
accept(Token.VIEW);
if ("LATERAL".equalsIgnoreCase(tableSource.getAlias())) {
tableSource.setAlias(null);
}
OdpsLateralViewTableSource lateralViewTabSrc = new OdpsLateralViewTableSource();
lateralViewTabSrc.setTableSource(tableSource);
SQLMethodInvokeExpr udtf = (SQLMethodInvokeExpr) this.exprParser.expr();
lateralViewTabSrc.setMethod(udtf);
String alias = as();
lateralViewTabSrc.setAlias(alias);
accept(Token.AS);
this.exprParser.names(lateralViewTabSrc.getColumns());
return parseTableSourceRest(lateralViewTabSrc);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:21,代码来源:OdpsSelectParser.java
示例4: findTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLTableSource findTableSource(long alias_hash) {
long hash = this.aliasHashCode64();
if (hash != 0 && hash == alias_hash) {
return this;
}
for (SQLName column : columns) {
if (column.nameHashCode64() == alias_hash) {
return this;
}
}
if (tableSource != null) {
return tableSource.findTableSource(alias_hash);
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:19,代码来源:OdpsLateralViewTableSource.java
示例5: isFromJoinOrUnionTable
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public static boolean isFromJoinOrUnionTable(SQLExpr expr) {
SQLObject temp = expr;
AtomicInteger counter = new AtomicInteger(10);
while (temp != null &&
!(expr instanceof SQLSelectQueryBlock) &&
!(expr instanceof SQLJoinTableSource) && !(expr instanceof SQLUnionQuery) && counter.get() > 0) {
counter.decrementAndGet();
temp = temp.getParent();
if (temp instanceof SQLSelectQueryBlock) {
SQLTableSource from = ((SQLSelectQueryBlock) temp).getFrom();
if (from instanceof SQLJoinTableSource || from instanceof SQLUnionQuery) {
return true;
}
}
if (temp instanceof SQLJoinTableSource || temp instanceof SQLUnionQuery) {
return true;
}
}
return false;
}
开发者ID:mazhou,项目名称:es-sql,代码行数:21,代码来源:Util.java
示例6: isSupportSelect
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
private static boolean isSupportSelect(String stmt) {
SQLStatementParser parser = new MySqlStatementParser(stmt);
SQLStatement statement = parser.parseStatement();
if (!(statement instanceof SQLSelectStatement)) {
return false;
}
SQLSelectQuery sqlSelectQuery = ((SQLSelectStatement) statement).getSelect().getQuery();
if (!(sqlSelectQuery instanceof MySqlSelectQueryBlock)) {
return false;
}
MySqlSelectQueryBlock selectQueryBlock = (MySqlSelectQueryBlock) sqlSelectQuery;
SQLTableSource mysqlFrom = selectQueryBlock.getFrom();
if (mysqlFrom != null) {
return false;
}
for (SQLSelectItem item : selectQueryBlock.getSelectList()) {
SQLExpr selectItem = item.getExpr();
if (!isVariantRef(selectItem)) {
return false;
}
}
return true;
}
开发者ID:actiontech,项目名称:dble,代码行数:25,代码来源:SelectHandler.java
示例7: visitorParse
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的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
示例8: getTableFilter
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
private TableFilter getTableFilter(SQLTableSource table,boolean isOutJoin){
String key ;
String value = table.toString().trim();
if (table.getAlias()==null) {
key=value;
}
else {
key = table.getAlias().trim();
}
return new TableFilter(value,key,isOutJoin);
}
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:12,代码来源:JoinParser.java
示例9: getDisTable
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的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: parseTableSourceRest
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的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
示例11: parseTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLTableSource parseTableSource() {
if (lexer.token() == Token.VALUES) {
lexer.nextToken();
OdpsValuesTableSource tableSource = new OdpsValuesTableSource();
for (;;) {
accept(Token.LPAREN);
SQLListExpr listExpr = new SQLListExpr();
this.exprParser.exprList(listExpr.getItems(), listExpr);
accept(Token.RPAREN);
listExpr.setParent(tableSource);
tableSource.getValues().add(listExpr);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
String alias = this.tableAlias();
tableSource.setAlias(alias);
accept(Token.LPAREN);
this.exprParser.names(tableSource.getColumns(), tableSource);
accept(Token.RPAREN);
return tableSource;
}
return super.parseTableSource();
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:35,代码来源:OdpsSelectParser.java
示例12: parseTableSourceRest
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
protected SQLTableSource parseTableSourceRest(SQLTableSource tableSource) {
tableSource = super.parseTableSourceRest(tableSource);
if ("LATERAL".equalsIgnoreCase(tableSource.getAlias()) && lexer.token() == Token.VIEW) {
return parseLateralView(tableSource);
}
if (lexer.identifierEquals("LATERAL")) {
lexer.nextToken();
return parseLateralView(tableSource);
}
return tableSource;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:15,代码来源:OdpsSelectParser.java
示例13: findTableSourceWithColumn
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLTableSource findTableSourceWithColumn(long columnNameHash) {
for (SQLName column : columns) {
if (column.nameHashCode64() == columnNameHash) {
return this;
}
}
if (tableSource != null) {
return tableSource.findTableSourceWithColumn(columnNameHash);
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:13,代码来源:OdpsLateralViewTableSource.java
示例14: updateRecordLog
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
private void updateRecordLog(LogOperate operate,String sql,Object ...args){
MySqlStatementParser mySqlStatementParser = new MySqlStatementParser(sql);
SQLUpdateStatement sqlUpdateStatement = mySqlStatementParser.parseUpdateStatement();
SQLTableSource tableSource = sqlUpdateStatement.getTableSource();
Assert.notNull(tableSource,"不匹配的操作类型,日志记录失败!");
List<SQLUpdateSetItem> items = sqlUpdateStatement.getItems();
JSONObject log = new JSONObject();
for (int i = 0; i < items.size(); i++) {
SQLUpdateSetItem sqlUpdateSetItem = items.get(i);
log.put(sqlUpdateSetItem.getColumn().toString(),args[i]);
}
logHandler.handle(operate,sqlUpdateStatement.getTableName().getSimpleName(),sqlUpdateStatement.getTableName().getSimpleName(),log);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:16,代码来源:LogJdbcTemplate.java
示例15: getResolvedTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLTableSource getResolvedTableSource() {
return resolvedTableSource;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:4,代码来源:SQLAllColumnExpr.java
示例16: setResolvedTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public void setResolvedTableSource(SQLTableSource resolvedTableSource) {
this.resolvedTableSource = resolvedTableSource;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:4,代码来源:SQLAllColumnExpr.java
示例17: OracleSelectJoin
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public OracleSelectJoin(SQLTableSource left, JoinType joinType, SQLTableSource right, SQLExpr condition){
super (left, joinType, right, condition);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:4,代码来源:OracleSelectJoin.java
示例18: join
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLJoinTableSource join(SQLTableSource right, JoinType joinType, SQLExpr condition) {
SQLJoinTableSource joined = new OracleSelectJoin(this, joinType, right, condition);
return joined;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:5,代码来源:OracleSelectJoin.java
示例19: getTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public SQLTableSource getTableSource() {
return tableSource;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:4,代码来源:OdpsLateralViewTableSource.java
示例20: setTableSource
import com.alibaba.druid.sql.ast.statement.SQLTableSource; //导入依赖的package包/类
public void setTableSource(SQLTableSource tableSource) {
if (tableSource != null) {
tableSource.setParent(this);
}
this.tableSource = tableSource;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:7,代码来源:OdpsLateralViewTableSource.java
注:本文中的com.alibaba.druid.sql.ast.statement.SQLTableSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论