本文整理汇总了Java中com.alibaba.druid.sql.SQLUtils.normalize方法的典型用法代码示例。如果您正苦于以下问题:Java SQLUtils.normalize方法的具体用法?Java SQLUtils.normalize怎么用?Java SQLUtils.normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.druid.sql.SQLUtils
的用法示例。
在下文中一共展示了SQLUtils.normalize方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isReferenced
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean isReferenced(String tableName) {
if (tableName == null) {
return false;
}
tableName = SQLUtils.normalize(tableName);
for (SQLTableElement element : this.tableElementList) {
if (element instanceof SQLForeignKeyConstraint) {
SQLForeignKeyConstraint fk = (SQLForeignKeyConstraint) element;
String refTableName = fk.getReferencedTableName().getSimpleName();
if (SQLUtils.nameEquals(tableName, refTableName)) {
return true;
}
}
}
return false;
}
示例2: computeName
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public String computeName() {
if (tableSource == null) {
return null;
}
SQLExpr expr = tableSource.getExpr();
if (expr instanceof SQLName) {
String name = ((SQLName) expr).getSimpleName();
return SQLUtils.normalize(name);
}
return null;
}
示例3: computeAlias
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的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);
}
示例4: computeAlias
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的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);
}
示例5: simplify
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public void simplify() {
enable = null;
validate = null;
rely = null;
if (this.name instanceof SQLIdentifierExpr) {
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) this.name;
String columnName = identExpr.getName();
String normalized = SQLUtils.normalize(columnName, dbType);
if (normalized != columnName) {
this.setName(normalized);
}
}
}
示例6: simplify
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public void simplify() {
if (this.name instanceof SQLIdentifierExpr) {
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) this.name;
String columnName = identExpr.getName();
String normalized = SQLUtils.normalize(columnName, dbType);
if (columnName != normalized) {
this.setName(normalized);
}
}
}
示例7: computeAlias
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public String computeAlias() {
String alias = this.getAlias();
if (alias == null) {
if (expr instanceof SQLName) {
alias =((SQLName) expr).getSimpleName();
}
}
return SQLUtils.normalize(alias);
}
示例8: simplify
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public void simplify() {
super.simplify();
for (SQLSelectOrderByItem item : columns) {
SQLExpr column = item.getExpr();
if (column instanceof SQLIdentifierExpr) {
SQLIdentifierExpr identExpr = (SQLIdentifierExpr) column;
String columnName = identExpr.getName();
String normalized = SQLUtils.normalize(columnName, dbType);
if (normalized != columnName) {
item.setExpr(new SQLIdentifierExpr(columnName));
}
}
}
}
示例9: simplify
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public SQLIdentifierExpr simplify() {
String normalized = SQLUtils.normalize(name);
if (normalized != name) {
return new SQLIdentifierExpr(normalized, hashCode64);
}
return this;
}
示例10: normalizedName
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public String normalizedName() {
String ownerName;
if (owner instanceof SQLIdentifierExpr) {
ownerName = ((SQLIdentifierExpr) owner).normalizedName();
} else if (owner instanceof SQLPropertyExpr) {
ownerName = ((SQLPropertyExpr) owner).normalizedName();
} else {
ownerName = owner.toString();
}
return ownerName + '.' + SQLUtils.normalize(name);
}
示例11: simplify
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public SQLPropertyExpr simplify() {
String normalizedName = SQLUtils.normalize(name);
SQLExpr normalizedOwner = this.owner;
if (normalizedOwner instanceof SQLIdentifierExpr) {
normalizedOwner = ((SQLIdentifierExpr) normalizedOwner).simplify();
}
if (normalizedName != name || normalizedOwner != owner) {
return new SQLPropertyExpr(normalizedOwner, normalizedName, hashCode64);
}
return this;
}
示例12: addTableMapping
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public void addTableMapping(String srcTable, String destTable) {
if (tableMapping == null) {
tableMapping = new HashMap<String, String>();
}
if (srcTable.indexOf('.') >= 0) {
SQLExpr expr = SQLUtils.toSQLExpr(srcTable, dbType);
if (expr instanceof SQLPropertyExpr) {
srcTable = ((SQLPropertyExpr) expr).simplify().toString();
}
} else {
srcTable = SQLUtils.normalize(srcTable);
}
tableMapping.put(srcTable, destTable);
}
示例13: normalizedName
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public String normalizedName() {
return SQLUtils.normalize(name);
}
示例14: resolve
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public static List<SQLStatement> resolve(SQLCreateViewStatement stmt) {
List<SQLStatement> targetList = new ArrayList<SQLStatement>();
targetList.add(stmt);
String viewName = SQLUtils.normalize(stmt.getName().getSimpleName());
FromSubqueryResolver visitor = new FromSubqueryResolver(targetList, viewName);
SQLWithSubqueryClause withSubqueryClause = stmt.getSubQuery().getWithSubQuery();
if (withSubqueryClause != null) {
stmt.getSubQuery().setWithSubQuery(null);
for (SQLWithSubqueryClause.Entry entry : withSubqueryClause.getEntries()) {
String entryName = entry.getAlias();
SQLCreateViewStatement entryStmt = new SQLCreateViewStatement();
entryStmt.setOrReplace(true);
entryStmt.setDbType(stmt.getDbType());
String entryViewName = visitor.generateSubViewName();
entryStmt.setName(entryViewName);
entryStmt.setSubQuery(entry.getSubQuery());
visitor.targetList.add(0, entryStmt);
visitor.mappings.put(entryName, entryViewName);
entryStmt.accept(visitor);
}
}
stmt.accept(visitor);
String dbType = stmt.getDbType();
for (int i = 0; i < targetList.size() - 1; ++i) {
SQLCreateViewStatement targetStmt = (SQLCreateViewStatement) targetList.get(i);
targetStmt.setOrReplace(true);
targetStmt.setDbType(dbType);
targetStmt.setAfterSemi(true);
}
return targetList;
}