本文整理汇总了Java中com.alibaba.druid.sql.SQLUtils.nameEquals方法的典型用法代码示例。如果您正苦于以下问题:Java SQLUtils.nameEquals方法的具体用法?Java SQLUtils.nameEquals怎么用?Java SQLUtils.nameEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.druid.sql.SQLUtils
的用法示例。
在下文中一共展示了SQLUtils.nameEquals方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isUNI
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
/**
* only for show columns
*/
public boolean isUNI(String columnName) {
for (SQLTableElement element : this.tableElementList) {
if (element instanceof MySqlUnique) {
MySqlUnique unique = (MySqlUnique) element;
if (unique.getColumns().size() == 0) {
continue;
}
SQLExpr column = unique.getColumns().get(0).getExpr();
if (column instanceof SQLIdentifierExpr
&& SQLUtils.nameEquals(columnName, ((SQLIdentifierExpr) column).getName())) {
return unique.columns.size() == 1;
} else if (column instanceof SQLMethodInvokeExpr
&& SQLUtils.nameEquals(((SQLMethodInvokeExpr) column).getMethodName(), columnName)) {
return true;
}
}
}
return false;
}
示例2: 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;
}
示例3: apply
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean apply(SQLDropIndexStatement x) {
long indexNameHashCode64 = x.getIndexName().nameHashCode64();
for (int i = tableElementList.size() - 1; i >= 0; i--) {
SQLTableElement e = tableElementList.get(i);
if (e instanceof SQLUniqueConstraint) {
SQLUniqueConstraint unique = (SQLUniqueConstraint) e;
if (unique.getName().nameHashCode64() == indexNameHashCode64) {
tableElementList.remove(i);
return true;
}
} else if (e instanceof MySqlTableIndex) {
MySqlTableIndex tableIndex = (MySqlTableIndex) e;
if (SQLUtils.nameEquals(tableIndex.getName(), x.getIndexName())) {
tableElementList.remove(i);
return true;
}
}
}
return false;
}
示例4: applyDropColumn
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean applyDropColumn(SQLName columnName) {
for (int i = columns.size() - 1; i >= 0; i--) {
SQLExpr expr = columns.get(i).getExpr();
if (expr instanceof SQLName
&& SQLUtils.nameEquals((SQLName) expr, columnName)) {
columns.remove(i);
return true;
}
if (expr instanceof SQLMethodInvokeExpr
&& SQLUtils.nameEquals(((SQLMethodInvokeExpr) expr).getMethodName(), columnName.getSimpleName())) {
columns.remove(i);
return true;
}
}
return false;
}
示例5: columnIndexOf
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
protected int columnIndexOf(SQLName column) {
if (column == null) {
return -1;
}
String columnName = column.getSimpleName();
for (int i = tableElementList.size() - 1; i >= 0; --i) {
SQLTableElement e = tableElementList.get(i);
if (e instanceof SQLColumnDefinition) {
if (SQLUtils.nameEquals(columnName, ((SQLColumnDefinition) e).getName().getSimpleName())) {
return i;
}
}
}
return -1;
}
示例6: applyDropColumn
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean applyDropColumn(SQLName columnName) {
for (int i = columns.size() - 1; i >= 0; i--) {
SQLExpr expr = columns.get(i).getExpr();
if (expr instanceof SQLName
&& SQLUtils.nameEquals((SQLName) expr, columnName)) {
columns.remove(i);
return true;
}
if (expr instanceof SQLMethodInvokeExpr
&& SQLUtils.nameEquals(((SQLMethodInvokeExpr) expr).getMethodName(), columnName.getSimpleName())) {
columns.remove(i);
return true;
}
}
return false;
}
示例7: computeDataType
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public SQLDataType computeDataType() {
if (SQLUtils.nameEquals("to_date", name)
|| SQLUtils.nameEquals("add_months", name)) {
return SQLDateExpr.DEFAULT_DATA_TYPE;
}
if (parameters.size() == 1) {
if (SQLUtils.nameEquals("trunc", name)) {
return parameters.get(0).computeDataType();
}
} else if (parameters.size() == 2) {
SQLExpr param0 = parameters.get(0);
SQLExpr param1 = parameters.get(1);
if (SQLUtils.nameEquals("nvl", name) || SQLUtils.nameEquals("ifnull", name)) {
SQLDataType dataType = param0.computeDataType();
if (dataType != null) {
return dataType;
}
return param1.computeDataType();
}
}
return null;
}
示例8: containsAlias
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean containsAlias(String alias) {
if (SQLUtils.nameEquals(this.alias, alias)) {
return true;
}
if (left != null && left.containsAlias(alias)) {
return true;
}
if (right != null && right.containsAlias(alias)) {
return true;
}
return false;
}
示例9: containsAlias
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean containsAlias(String alias) {
if (SQLUtils.nameEquals(this.alias, alias)) {
return true;
}
return false;
}
示例10: containsColumn
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean containsColumn(String column) {
for (SQLSelectOrderByItem item : columns) {
SQLExpr expr = item.getExpr();
if (expr instanceof SQLIdentifierExpr) {
if (SQLUtils.nameEquals(((SQLIdentifierExpr) expr).getName(), column)) {
return true;
}
}
}
return false;
}
示例11: applyColumnRename
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean applyColumnRename(SQLName columnName, SQLName to) {
for (SQLSelectOrderByItem orderByItem : columns) {
SQLExpr expr = orderByItem.getExpr();
if (expr instanceof SQLName
&& SQLUtils.nameEquals((SQLName) expr, columnName)) {
orderByItem.setExpr(to.clone());
return true;
}
}
return false;
}
示例12: apply
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean apply(MySqlRenameTableStatement.Item item) {
if (!SQLUtils.nameEquals((SQLName) item.getName(), this.getName())) {
return false;
}
this.setName((SQLName) item.getTo().clone());
return true;
}
示例13: nameEquals
import com.alibaba.druid.sql.SQLUtils; //导入方法依赖的package包/类
public boolean nameEquals(String name) {
return SQLUtils.nameEquals(this.name, name);
}