本文整理汇总了Java中com.alibaba.druid.sql.parser.Token类的典型用法代码示例。如果您正苦于以下问题:Java Token类的具体用法?Java Token怎么用?Java Token使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Token类属于com.alibaba.druid.sql.parser包,在下文中一共展示了Token类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: dotRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
protected SQLExpr dotRest(SQLExpr expr) {
boolean backet = false;
if (lexer.token() == Token.LBRACKET) {
lexer.nextToken();
backet = true;
}
expr = super.dotRest(expr);
if (backet) {
accept(Token.RBRACKET);
}
return expr;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:17,代码来源:SQLServerExprParser.java
示例2: partitionByRange
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
protected SQLPartitionByRange partitionByRange() {
acceptIdentifier("RANGE");
SQLPartitionByRange clause = new SQLPartitionByRange();
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
clause.setExpr(this.exprParser.expr());
accept(Token.RPAREN);
} else {
acceptIdentifier("COLUMNS");
accept(Token.LPAREN);
for (;;) {
clause.addColumn(this.exprParser.name());
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
accept(Token.RPAREN);
}
return clause;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:25,代码来源:MySqlCreateTableParser.java
示例3: parseLateralView
import com.alibaba.druid.sql.parser.Token; //导入依赖的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: primaryRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLExpr primaryRest(SQLExpr expr) {
if(lexer.token() == Token.COLON) {
lexer.nextToken();
expr = dotRest(expr);
return expr;
}
if (lexer.token() == Token.LBRACKET) {
SQLArrayExpr array = new SQLArrayExpr();
array.setExpr(expr);
lexer.nextToken();
this.exprList(array.getValues(), array);
accept(Token.RBRACKET);
return primaryRest(array);
}
return super.primaryRest(expr);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:19,代码来源:OdpsExprParser.java
示例5: parseStatementListDialect
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public boolean parseStatementListDialect(List<SQLStatement> statementList) {
if (lexer.token() == Token.VALUES) {
lexer.nextToken();
DB2ValuesStatement stmt = new DB2ValuesStatement();
stmt.setExpr(this.exprParser.expr());
statementList.add(stmt);
return true;
}
return false;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:12,代码来源:DB2StatementParser.java
示例6: parseInsertColumns
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
@Override
protected void parseInsertColumns(SQLInsertInto insert) {
if (lexer.token() == Token.RPAREN ) {
return;
}
for (;;) {
SQLName expr = this.exprParser.name();
expr.setParent(insert);
insert.getColumns().add(expr);
if (lexer.token() == Token.IDENTIFIER) {
String text = lexer.stringVal();
if (text.equalsIgnoreCase("TINYINT")
|| text.equalsIgnoreCase("BIGINT")
|| text.equalsIgnoreCase("INTEGER")
|| text.equalsIgnoreCase("DOUBLE")
|| text.equalsIgnoreCase("DATE")
|| text.equalsIgnoreCase("VARCHAR")) {
expr.getAttributes().put("dataType", text);
lexer.nextToken();
} else if (text.equalsIgnoreCase("CHAR")) {
String dataType = text;
lexer.nextToken();
accept(Token.LPAREN);
SQLExpr char_len = this.exprParser.primary();
accept(Token.RPAREN);
dataType += ("(" + char_len.toString() + ")");
expr.getAttributes().put("dataType", dataType);
}
}
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:41,代码来源:PhoenixStatementParser.java
示例7: parseDataType
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
@Override
public SQLDataType parseDataType() {
if (lexer.token() == Token.TYPE) {
lexer.nextToken();
}
return super.parseDataType();
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:8,代码来源:PGExprParser.java
示例8: parseInterval
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
@Override
protected SQLExpr parseInterval() {
accept(Token.INTERVAL);
PGIntervalExpr intervalExpr=new PGIntervalExpr();
if (lexer.token() != Token.LITERAL_CHARS) {
return new SQLIdentifierExpr("INTERVAL");
}
intervalExpr.setValue(new SQLCharExpr(lexer.stringVal()));
lexer.nextToken();
return intervalExpr;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:12,代码来源:PGExprParser.java
示例9: primary
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLExpr primary() {
if (lexer.token() == Token.LBRACKET) {
lexer.nextToken();
SQLExpr name = this.name();
accept(Token.RBRACKET);
return primaryRest(name);
}
return super.primary();
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:12,代码来源:SQLServerExprParser.java
示例10: primaryRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLExpr primaryRest(SQLExpr expr) {
if (lexer.token() == Token.DOTDOT) {
expr = nameRest((SQLName) expr);
}
return super.primaryRest(expr);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:8,代码来源:SQLServerExprParser.java
示例11: parseTop
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLServerTop parseTop() {
if (lexer.token() == Token.TOP) {
SQLServerTop top = new SQLServerTop();
lexer.nextToken();
boolean paren = false;
if (lexer.token() == Token.LPAREN) {
paren = true;
lexer.nextToken();
}
top.setExpr(primary());
if (paren) {
accept(Token.RPAREN);
}
if (lexer.token() == Token.PERCENT) {
lexer.nextToken();
top.setPercent(true);
}
return top;
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:28,代码来源:SQLServerExprParser.java
示例12: parserOutput
import com.alibaba.druid.sql.parser.Token; //导入依赖的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
示例13: parseColumnRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLColumnDefinition parseColumnRest(SQLColumnDefinition column) {
if (lexer.token() == Token.IDENTITY) {
lexer.nextToken();
SQLColumnDefinition.Identity identity = new SQLColumnDefinition.Identity();
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
SQLIntegerExpr seed = (SQLIntegerExpr) this.primary();
accept(Token.COMMA);
SQLIntegerExpr increment = (SQLIntegerExpr) this.primary();
accept(Token.RPAREN);
identity.setSeed((Integer) seed.getNumber());
identity.setIncrement((Integer) increment.getNumber());
}
if (lexer.token() == Token.NOT) {
lexer.nextToken();
if (lexer.token() == Token.NULL) {
lexer.nextToken();
column.setDefaultExpr(new SQLNullExpr());
} else {
accept(Token.FOR);
acceptIdentifier("REPLICATION ");
identity.setNotForReplication(true);
}
}
column.setIdentity(identity);
}
return super.parseColumnRest(column);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:36,代码来源:SQLServerExprParser.java
示例14: parseIndexHint
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
private void parseIndexHint(MySqlIndexHintImpl hint) {
if (lexer.token() == Token.INDEX) {
lexer.nextToken();
} else {
accept(Token.KEY);
}
if (lexer.token() == Token.FOR) {
lexer.nextToken();
if (lexer.token() == Token.JOIN) {
lexer.nextToken();
hint.setOption(MySqlIndexHint.Option.JOIN);
} else if (lexer.token() == Token.ORDER) {
lexer.nextToken();
accept(Token.BY);
hint.setOption(MySqlIndexHint.Option.ORDER_BY);
} else {
accept(Token.GROUP);
accept(Token.BY);
hint.setOption(MySqlIndexHint.Option.GROUP_BY);
}
}
accept(Token.LPAREN);
if (lexer.token() == Token.PRIMARY) {
lexer.nextToken();
hint.getIndexList().add(new SQLIdentifierExpr("PRIMARY"));
} else {
this.exprParser.names(hint.getIndexList());
}
accept(Token.RPAREN);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:34,代码来源:MySqlSelectIntoParser.java
示例15: parseTableOptionCharsetOrCollate
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
private boolean parseTableOptionCharsetOrCollate(MySqlCreateTableStatement stmt) {
if (lexer.identifierEquals("CHARACTER")) {
lexer.nextToken();
accept(Token.SET);
if (lexer.token() == Token.EQ) {
lexer.nextToken();
}
stmt.getTableOptions().put("CHARACTER SET", this.exprParser.expr());
return true;
}
if (lexer.identifierEquals("CHARSET")) {
lexer.nextToken();
if (lexer.token() == Token.EQ) {
lexer.nextToken();
}
stmt.getTableOptions().put("CHARSET", this.exprParser.expr());
return true;
}
if (lexer.identifierEquals("COLLATE")) {
lexer.nextToken();
if (lexer.token() == Token.EQ) {
lexer.nextToken();
}
stmt.getTableOptions().put("COLLATE", this.exprParser.expr());
return true;
}
return false;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:32,代码来源:MySqlCreateTableParser.java
示例16: parseTableSource
import com.alibaba.druid.sql.parser.Token; //导入依赖的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
示例17: parseTableSourceRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的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
示例18: unionRest
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
public SQLUnionQuery unionRest(SQLUnionQuery union) {
if (lexer.token() == Token.LIMIT) {
MySqlUnionQuery mysqlUnionQuery = (MySqlUnionQuery) union;
mysqlUnionQuery.setLimit(parseLimit());
}
return super.unionRest(union);
}
开发者ID:mazhou,项目名称:es-sql,代码行数:8,代码来源:ElasticSqlSelectParser.java
示例19: handle
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
@Override
public boolean handle(Token lastToken, String comment) {
if (lastToken == null && comment.contains("zebra")) {
hintComment = comment;
}
return false;
}
开发者ID:dianping,项目名称:zebra,代码行数:8,代码来源:SQLParser.java
示例20: parseHints
import com.alibaba.druid.sql.parser.Token; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void parseHints(List hints) {
while (lexer.token() == Token.HINT) {
hints.add(new SQLCommentHint(lexer.stringVal()));
lexer.nextToken();
}
}
开发者ID:selvakumarEsra,项目名称:es4sql,代码行数:9,代码来源:ElasticSqlExprParser.java
注:本文中的com.alibaba.druid.sql.parser.Token类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论