Search in sources :

Example 1 with HandlerBuilder

use of com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder in project dble by actiontech.

the class NonBlockingSession method executeMultiResultSet.

private void executeMultiResultSet(PlanNode node) {
    init();
    HandlerBuilder builder = new HandlerBuilder(node, this);
    try {
        // no next
        builder.build(false);
    } catch (SQLSyntaxErrorException e) {
        LOGGER.info(String.valueOf(source) + " execute plan is : " + node, e);
        source.writeErrMessage(ErrorCode.ER_YES, "optimizer build error");
    } catch (NoSuchElementException e) {
        LOGGER.info(String.valueOf(source) + " execute plan is : " + node, e);
        this.terminate();
        source.writeErrMessage(ErrorCode.ER_NO_VALID_CONNECTION, "no valid connection");
    } catch (MySQLOutPutException e) {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info(String.valueOf(source) + " execute plan is : " + node, e);
        }
        this.terminate();
        source.writeErrMessage(e.getSqlState(), e.getMessage(), e.getErrorCode());
    } catch (Exception e) {
        LOGGER.info(String.valueOf(source) + " execute plan is : " + node, e);
        this.terminate();
        source.writeErrMessage(ErrorCode.ER_HANDLE_DATA, e.toString());
    }
}
Also used : SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) HandlerBuilder(com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder) SQLSyntaxErrorException(java.sql.SQLSyntaxErrorException) MySQLOutPutException(com.actiontech.dble.plan.common.exception.MySQLOutPutException) MySQLOutPutException(com.actiontech.dble.plan.common.exception.MySQLOutPutException)

Example 2 with HandlerBuilder

use of com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder in project dble by actiontech.

the class ExplainHandler method buildNodes.

private static BaseHandlerBuilder buildNodes(RouteResultset rrs, ServerConnection c) {
    SQLSelectStatement ast = (SQLSelectStatement) rrs.getSqlStatement();
    MySQLPlanNodeVisitor visitor = new MySQLPlanNodeVisitor(c.getSchema(), c.getCharset().getResultsIndex(), DbleServer.getInstance().getTmManager(), false);
    visitor.visit(ast);
    PlanNode node = visitor.getTableNode();
    node.setSql(rrs.getStatement());
    node.setUpFields();
    PlanUtil.checkTablesPrivilege(c, node, ast);
    node = MyOptimizer.optimize(node);
    if (!PlanUtil.containsSubQuery(node) && !visitor.isContainSchema()) {
        node.setAst(ast);
    }
    HandlerBuilder builder = new HandlerBuilder(node, c.getSession2());
    return builder.getBuilder(c.getSession2(), node, true);
}
Also used : PlanNode(com.actiontech.dble.plan.node.PlanNode) SQLSelectStatement(com.alibaba.druid.sql.ast.statement.SQLSelectStatement) MySQLPlanNodeVisitor(com.actiontech.dble.plan.visitor.MySQLPlanNodeVisitor) HandlerBuilder(com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder) BaseHandlerBuilder(com.actiontech.dble.backend.mysql.nio.handler.builder.BaseHandlerBuilder)

Aggregations

HandlerBuilder (com.actiontech.dble.backend.mysql.nio.handler.builder.HandlerBuilder)2 BaseHandlerBuilder (com.actiontech.dble.backend.mysql.nio.handler.builder.BaseHandlerBuilder)1 MySQLOutPutException (com.actiontech.dble.plan.common.exception.MySQLOutPutException)1 PlanNode (com.actiontech.dble.plan.node.PlanNode)1 MySQLPlanNodeVisitor (com.actiontech.dble.plan.visitor.MySQLPlanNodeVisitor)1 SQLSelectStatement (com.alibaba.druid.sql.ast.statement.SQLSelectStatement)1 SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)1