当前位置: 首页>>代码示例>>Java>>正文


Java MySqlDeleteStatement类代码示例

本文整理汇总了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;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:26,代码来源:MycatSchemaStatVisitor.java

示例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);
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:26,代码来源:SchemaUtil.java

示例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;
}
 
开发者ID:actiontech,项目名称:dble,代码行数:22,代码来源:ServerSchemaStatVisitor.java

示例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;
}
 
开发者ID:tongbanjie,项目名称:baymax,代码行数:27,代码来源:SqlVisitor.java

示例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;
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:40,代码来源:DruidParserFactory.java

示例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();
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:16,代码来源:SQLDeleteBuilderImpl.java

示例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;
}
 
开发者ID:dianping,项目名称:zebra,代码行数:16,代码来源:ShardColumnValueUtil.java

示例8: endVisit

import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
public void endVisit(MySqlDeleteStatement x) {
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:3,代码来源:MycatSchemaStatVisitor.java

示例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);
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:7,代码来源:DruidDeleteParser.java

示例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;
}
 
开发者ID:zuonima,项目名称:sql-utils,代码行数:61,代码来源:MysqlConditionVisitor.java

示例11: endVisit

import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public void endVisit(MySqlDeleteStatement x) {
}
 
开发者ID:actiontech,项目名称:dble,代码行数:4,代码来源:ServerSchemaStatVisitor.java

示例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);
}
 
开发者ID:balancebeam,项目名称:sherlock,代码行数:6,代码来源:MySQLDeleteVisitor.java

示例13: endVisit

import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement; //导入依赖的package包/类
@Override
public void endVisit(MySqlDeleteStatement x) {

}
 
开发者ID:tongbanjie,项目名称:baymax,代码行数:5,代码来源:SqlVisitor.java


注:本文中的com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlDeleteStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。