本文整理汇总了Java中com.alibaba.druid.sql.ast.expr.SQLPropertyExpr类的典型用法代码示例。如果您正苦于以下问题:Java SQLPropertyExpr类的具体用法?Java SQLPropertyExpr怎么用?Java SQLPropertyExpr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLPropertyExpr类属于com.alibaba.druid.sql.ast.expr包,在下文中一共展示了SQLPropertyExpr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setSchema
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public void setSchema(String schema) {
if (expr instanceof SQLIdentifierExpr) {
if (schema == null) {
return;
}
String ident = ((SQLIdentifierExpr) expr).getName();
this.setExpr(new SQLPropertyExpr(schema, ident));
} else if (expr instanceof SQLPropertyExpr) {
SQLPropertyExpr propertyExpr = (SQLPropertyExpr) expr;
if (schema == null) {
setExpr(new SQLIdentifierExpr(propertyExpr.getName()));
} else {
propertyExpr.setOwner(schema);
}
}
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:18,代码来源:SQLExprTableSource.java
示例2: findTableSource
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public SQLTableSource findTableSource(long alias_hash) {
if (alias_hash == 0) {
return null;
}
if (aliasHashCode64() == alias_hash) {
return this;
}
if (expr instanceof SQLName) {
long exprNameHash = ((SQLName) expr).nameHashCode64();
if (exprNameHash == alias_hash) {
return this;
}
}
if (expr instanceof SQLPropertyExpr) {
long hash = ((SQLPropertyExpr) expr).hashCode64();
if (hash == alias_hash) {
return this;
}
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:26,代码来源:SQLExprTableSource.java
示例3: visit
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
/**
* 将表名替换成占位符.
*
* <p>
* 1. 如果二元表达式使用别名, 如: {@code FROM order o WHERE o.column_name = 't' },
* 则Column中的tableName为o.
* </p>
*
* <p>
* 2. 如果二元表达式使用表名, 如: {@code FROM order WHERE order.column_name = 't' },
* 则Column中的tableName为order.
* </p>
*
* @param x
* SQL属性表达式
* @return true表示继续遍历AST, false表示终止遍历AST
*/
@Override
// TODO SELECT [别名.xxx]的情况,目前都是替换成token,解析之后应该替换回去
public final boolean visit(final SQLPropertyExpr x) {
if (!(x.getParent() instanceof SQLBinaryOpExpr) && !(x.getParent() instanceof SQLSelectItem)) {
return super.visit(x);
}
if (!(x.getOwner() instanceof SQLIdentifierExpr)) {
return super.visit(x);
}
String tableOrAliasName = ((SQLIdentifierExpr) x.getOwner()).getLowerName();
if (isBinaryOperateWithAlias(x, tableOrAliasName)) {
return super.visit(x);
}
printToken(tableOrAliasName);
print(".");
print(x.getName());
return false;
}
开发者ID:balancebeam,项目名称:sherlock,代码行数:36,代码来源:AbstractPGSQLVisitor.java
示例4: visit
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
/**
* 将表名替换成占位符.
*
* <p>
* 1. 如果二元表达式使用别名, 如: {@code FROM order o WHERE o.column_name = 't' },
* 则Column中的tableName为o.
* </p>
*
* <p>
* 2. 如果二元表达式使用表名, 如: {@code FROM order WHERE order.column_name = 't' },
* 则Column中的tableName为order.
* </p>
*
* @param x
* SQL属性表达式
* @return true表示继续遍历AST, false表示终止遍历AST
*/
@Override
public final boolean visit(final SQLPropertyExpr x) {
if (!(x.getParent() instanceof SQLBinaryOpExpr) && !(x.getParent() instanceof SQLSelectItem)) {
return super.visit(x);
}
if (!(x.getOwner() instanceof SQLIdentifierExpr)) {
return super.visit(x);
}
String tableOrAliasName = ((SQLIdentifierExpr) x.getOwner()).getLowerName();
if (isBinaryOperateWithAlias(x, tableOrAliasName)) {
return super.visit(x);
}
printToken(tableOrAliasName);
print(".");
print(x.getName());
return false;
}
开发者ID:balancebeam,项目名称:sherlock,代码行数:35,代码来源:AbstractOracleVisitor.java
示例5: parseOneIdx
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的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
示例6: reverseAppendTo
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
private void reverseAppendTo(SQLSelectOrderByItem order, SQLServerOutputVisitor visitor, String tmpTableAlias, List<SQLSelectItem> items) {
SQLExpr expression=order.getExpr();
if(expression instanceof SQLPropertyExpr){
SQLPropertyExpr c=(SQLPropertyExpr)expression;
if(items!=null){
fixWithSelects(c,items);
}
if(c.getOwner()!=null){
c.setOwner(new SQLIdentifierExpr(tmpTableAlias));
}
}
expression.accept(visitor);
if(order.getType()==SQLOrderingSpecification.ASC || order.getType()==null){
try {
visitor.getAppender().append(" DESC");
} catch (IOException e) {
e.printStackTrace();
}
}
}
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:22,代码来源:SQL2000LimitHandler.java
示例7: parseValue
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
private Object parseValue(SQLExpr expr) throws SqlParseException {
if (expr instanceof SQLNumericLiteralExpr) {
Number number = ((SQLNumericLiteralExpr) expr).getNumber();
if(number instanceof BigDecimal){
return number.doubleValue();
}
if(number instanceof BigInteger){
return number.longValue();
}
return ((SQLNumericLiteralExpr) expr).getNumber();
} else if (expr instanceof SQLCharExpr) {
return ((SQLCharExpr) expr).getText();
} else if (expr instanceof SQLMethodInvokeExpr) {
return expr;
} else if (expr instanceof SQLNullExpr) {
return null;
} else if (expr instanceof SQLIdentifierExpr) {
return expr;
} else if (expr instanceof SQLPropertyExpr) {
return expr;
} else {
throw new SqlParseException(
String.format("Failed to parse SqlExpression of type %s. expression value: %s", expr.getClass(), expr)
);
}
}
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:27,代码来源:WhereParser.java
示例8: getSqlName
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
private String getSqlName(SQLExpr sqlName) {
if (sqlName == null) {
return null;
}
if (sqlName instanceof SQLPropertyExpr) {
SQLIdentifierExpr owner = (SQLIdentifierExpr) ((SQLPropertyExpr) sqlName).getOwner();
return DruidDdlParser.unescapeName(owner.getName()) + "."
+ DruidDdlParser.unescapeName(((SQLPropertyExpr) sqlName).getName());
} else if (sqlName instanceof SQLIdentifierExpr) {
return DruidDdlParser.unescapeName(((SQLIdentifierExpr) sqlName).getName());
} else if (sqlName instanceof SQLCharExpr) {
return ((SQLCharExpr) sqlName).getText();
} else {
return sqlName.toString();
}
}
开发者ID:alibaba,项目名称:canal,代码行数:18,代码来源:MemoryTableMeta.java
示例9: processName
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
private static void processName(DdlResult ddlResult, String schema, SQLExpr sqlName, boolean isOri) {
if (sqlName == null) {
return;
}
String table = null;
if (sqlName instanceof SQLPropertyExpr) {
SQLIdentifierExpr owner = (SQLIdentifierExpr) ((SQLPropertyExpr) sqlName).getOwner();
schema = unescapeName(owner.getName());
table = unescapeName(((SQLPropertyExpr) sqlName).getName());
} else if (sqlName instanceof SQLIdentifierExpr) {
table = unescapeName(((SQLIdentifierExpr) sqlName).getName());
}
if (isOri) {
ddlResult.setOriSchemaName(schema);
ddlResult.setOriTableName(table);
} else {
ddlResult.setSchemaName(schema);
ddlResult.setTableName(table);
}
}
开发者ID:alibaba,项目名称:canal,代码行数:23,代码来源:DruidDdlParser.java
示例10: getFieldName
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
private String getFieldName(SQLSelectItem item){
if (item.getExpr() instanceof SQLPropertyExpr) {
return item.getExpr().toString();//字段别名
}
else {
return item.toString();
}
}
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:9,代码来源:JoinParser.java
示例11: getTableName
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String getTableName() {
if (table instanceof SQLExprTableSource) {
SQLExpr expr = ((SQLExprTableSource) table).getExpr();
if (expr instanceof SQLIdentifierExpr) {
return ((SQLIdentifierExpr) expr).getName();
} else if (expr instanceof SQLPropertyExpr) {
return ((SQLPropertyExpr) expr).getName();
}
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:13,代码来源:SQLCreateIndexStatement.java
示例12: getSchema
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String getSchema() {
SQLName name = getName();
if (name == null) {
return null;
}
if (name instanceof SQLPropertyExpr) {
return ((SQLPropertyExpr) name).getOwnernName();
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:13,代码来源:SQLCreateTableStatement.java
示例13: apply
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public boolean apply(SQLCommentStatement x) {
SQLName on = x.getOn().getName();
SQLExpr comment = x.getComment();
if (comment == null) {
return false;
}
SQLCommentStatement.Type type = x.getType();
if (type == SQLCommentStatement.Type.TABLE) {
if (!SQLUtils.nameEquals(getName(), on)) {
return false;
}
setComment(comment.clone());
return true;
} else if (type == SQLCommentStatement.Type.COLUMN) {
SQLPropertyExpr propertyExpr = (SQLPropertyExpr) on;
if (!SQLUtils.nameEquals(getName(), (SQLName) propertyExpr.getOwner())) {
return false;
}
SQLColumnDefinition column
= this.findColumn(
propertyExpr.nameHashCode64());
if (column != null) {
column.setComment(comment.clone());
}
return true;
}
return false;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:35,代码来源:SQLCreateTableStatement.java
示例14: getTableName
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String getTableName() {
if (tableSource == null) {
return null;
}
SQLExpr expr = ((SQLExprTableSource) tableSource).getExpr();
if (expr instanceof SQLIdentifierExpr) {
return ((SQLIdentifierExpr) expr).getName();
} else if (expr instanceof SQLPropertyExpr) {
return ((SQLPropertyExpr) expr).getName();
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:14,代码来源:SQLAlterTableStatement.java
示例15: computeAlias
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String computeAlias() {
String alias = this.getAlias();
if (alias == null) {
if (expr instanceof SQLIdentifierExpr) {
alias = ((SQLIdentifierExpr) expr).getName();
} else if (expr instanceof SQLPropertyExpr) {
alias = ((SQLPropertyExpr) expr).getName();
}
}
return SQLUtils.normalize(alias);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:13,代码来源:SQLSelectItem.java
示例16: computeAlias
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String computeAlias() {
String alias = null;
if (name instanceof SQLIdentifierExpr) {
alias = ((SQLIdentifierExpr) name).getName();
} else if (name instanceof SQLPropertyExpr) {
alias = ((SQLPropertyExpr) name).getName();
}
return SQLUtils.normalize(alias);
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:12,代码来源:SQLColumnDefinition.java
示例17: columnMatch
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public boolean columnMatch(String column) {
if (this.column instanceof SQLIdentifierExpr) {
return ((SQLIdentifierExpr) this.column).nameEquals(column);
} else if (this.column instanceof SQLPropertyExpr) {
((SQLPropertyExpr) this.column).nameEquals(column);
}
return false;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:9,代码来源:SQLUpdateSetItem.java
示例18: getSchema
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public String getSchema() {
if (expr == null) {
return null;
}
if (expr instanceof SQLPropertyExpr) {
return ((SQLPropertyExpr) expr).getOwnernName();
}
return null;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:12,代码来源:SQLExprTableSource.java
示例19: SQLServerObjectReferenceExpr
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
public SQLServerObjectReferenceExpr(SQLExpr owner){
if (owner instanceof SQLIdentifierExpr) {
this.database = ((SQLIdentifierExpr) owner).getName();
} else if (owner instanceof SQLPropertyExpr) {
SQLPropertyExpr propExpr = (SQLPropertyExpr) owner;
this.server = ((SQLIdentifierExpr) propExpr.getOwner()).getName();
this.database = propExpr.getName();
} else {
throw new IllegalArgumentException(owner.toString());
}
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:13,代码来源:SQLServerObjectReferenceExpr.java
示例20: hashCode64
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; //导入依赖的package包/类
@Override
public long hashCode64() {
if (hashCode64 == 0) {
if (server == null) {
hashCode64 = new SQLPropertyExpr(
new SQLPropertyExpr(server, database)
, schema)
.hashCode64();
} else {
hashCode64 = new SQLPropertyExpr(database, schema)
.hashCode64();
}
}
return hashCode64;
}
开发者ID:zuonima,项目名称:sql-utils,代码行数:16,代码来源:SQLServerObjectReferenceExpr.java
注:本文中的com.alibaba.druid.sql.ast.expr.SQLPropertyExpr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论