本文整理汇总了Java中com.alibaba.druid.sql.ast.statement.SQLExprTableSource类的典型用法代码示例。如果您正苦于以下问题:Java SQLExprTableSource类的具体用法?Java SQLExprTableSource怎么用?Java SQLExprTableSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLExprTableSource类属于com.alibaba.druid.sql.ast.statement包,在下文中一共展示了SQLExprTableSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}