本文整理汇总了Java中com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement类的典型用法代码示例。如果您正苦于以下问题:Java MySqlDeleteStatement类的具体用法?Java MySqlDeleteStatement怎么用?Java MySqlDeleteStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MySqlDeleteStatement类属于com.alibaba.druid.sql.dialect.mysql.ast.statement包,在下文中一共展示了MySqlDeleteStatement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的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: isNoSharding
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
private static boolean isNoSharding(ServerConnection source, SQLExprTableSource table, SQLStatement stmt, String contextSchema, StringPtr sqlSchema)
throws SQLException {
SchemaInfo schemaInfo = SchemaUtil.getSchemaInfo(source.getUser(), contextSchema, table);
ServerPrivileges.CheckType checkType = ServerPrivileges.CheckType.SELECT;
if (stmt instanceof MySqlUpdateStatement) {
checkType = ServerPrivileges.CheckType.UPDATE;
} else if (stmt instanceof SQLSelectStatement) {
checkType = ServerPrivileges.CheckType.SELECT;
} else if (stmt instanceof MySqlDeleteStatement) {
checkType = ServerPrivileges.CheckType.DELETE;
}
if (!ServerPrivileges.checkPrivilege(source, schemaInfo.schema, schemaInfo.table, checkType)) {
String msg = "The statement DML privilege check is not passed, sql:" + stmt;
throw new SQLNonTransientException(msg);
}
if (!RouterUtil.isNoSharding(schemaInfo.schemaConfig, schemaInfo.table)) {
return false;
} else if (sqlSchema.get() == null) {
sqlSchema.set(schemaInfo.schema);
return true;
} else {
return sqlSchema.get().equals(schemaInfo.schema);
}
}
示例3: visit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public boolean visit(MySqlDeleteStatement x) {
setAliasMap();
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);
}
accept(x.getWhere());
accept(x.getOrderBy());
accept(x.getLimit());
return false;
}
示例4: visit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的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: create
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
public static DruidParser create(SchemaConfig schema, SQLStatement statement, SchemaStatVisitor visitor)
{
DruidParser parser = null;
if (statement instanceof SQLSelectStatement)
{
if(schema.isNeedSupportMultiDBType())
{
parser = getDruidParserForMultiDB(schema, statement, visitor);
}
if (parser == null)
{
parser = new DruidSelectParser();
}
} else if (statement instanceof MySqlInsertStatement)
{
parser = new DruidInsertParser();
} else if (statement instanceof MySqlDeleteStatement)
{
parser = new DruidDeleteParser();
} else if (statement instanceof MySqlCreateTableStatement)
{
parser = new DruidCreateTableParser();
} else if (statement instanceof MySqlUpdateStatement)
{
parser = new DruidUpdateParser();
} else if (statement instanceof SQLAlterTableStatement)
{
parser = new DruidAlterTableParser();
} else if (statement instanceof MySqlLockTableStatement) {
parser = new DruidLockTableParser();
} else
{
parser = new DefaultDruidParser();
}
return parser;
}
示例6: createSQLDeleteStatement
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
public SQLDeleteStatement createSQLDeleteStatement() {
if (JdbcConstants.ORACLE.equals(dbType)) {
return new OracleDeleteStatement();
}
if (JdbcConstants.MYSQL.equals(dbType)) {
return new MySqlDeleteStatement();
}
if (JdbcConstants.POSTGRESQL.equals(dbType)) {
return new PGDeleteStatement();
}
return new SQLDeleteStatement();
}
示例7: getWhere
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
private static SQLExpr getWhere(SQLParsedResult parseResult) {
SQLExpr expr = null;
SQLStatement stmt = parseResult.getStmt();
if (parseResult.getType() == SqlType.SELECT) {
MySqlSelectQueryBlock query = (MySqlSelectQueryBlock) (((SQLSelectStatement) stmt).getSelect()).getQuery();
expr = query.getWhere();
} else if (parseResult.getType() == SqlType.UPDATE) {
expr = ((MySqlUpdateStatement) stmt).getWhere();
} else if (parseResult.getType() == SqlType.DELETE) {
expr = ((MySqlDeleteStatement) stmt).getWhere();
}
return expr;
}
示例8: endVisit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
public void endVisit(MySqlDeleteStatement x) {
}
示例9: statementParse
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public void statementParse(SchemaConfig schema, RouteResultset rrs, SQLStatement stmt) throws SQLNonTransientException {
MySqlDeleteStatement delete = (MySqlDeleteStatement)stmt;
String tableName = StringUtil.removeBackquote(delete.getTableName().getSimpleName().toUpperCase());
ctx.addTable(tableName);
}
示例10: visit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public boolean visit(MySqlDeleteStatement x) {
print0(ucase ? "DELETE " : "delete ");
for (int i = 0, size = x.getHintsSize(); i < size; ++i) {
SQLCommentHint hint = x.getHints().get(i);
hint.accept(this);
print(' ');
}
if (x.isLowPriority()) {
print0(ucase ? "LOW_PRIORITY " : "low_priority ");
}
if (x.isQuick()) {
print0(ucase ? "QUICK " : "quick ");
}
if (x.isIgnore()) {
print0(ucase ? "IGNORE " : "ignore ");
}
if (x.getFrom() == null) {
print0(ucase ? "FROM " : "from ");
x.getTableSource().accept(this);
} else {
x.getTableSource().accept(this);
println();
print0(ucase ? "FROM " : "from ");
x.getFrom().accept(this);
}
if (x.getUsing() != null) {
println();
print0(ucase ? "USING " : "using ");
x.getUsing().accept(this);
}
SQLExpr where = x.getWhere();//又到了重点部分
if (where != null) {
println();
this.indentCount++;
printWhere();
printExpr(where);
this.indentCount--;
}
if (x.getOrderBy() != null) {
println();
x.getOrderBy().accept(this);
}
if (x.getLimit() != null) {
println();
x.getLimit().accept(this);
}
deleteWhere();
return false;
}
示例11: endVisit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public void endVisit(MySqlDeleteStatement x) {
}
示例12: visit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public boolean visit(final MySqlDeleteStatement x) {
setCurrentTable(x.getTableName().toString(), Optional.fromNullable(x.getAlias()));
return super.visit(x);
}
示例13: endVisit
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public void endVisit(MySqlDeleteStatement x) {
}