// Path: src/main/java/com/elong/pb/newdda/client/router/result/router/BinaryOperator.java
// public enum BinaryOperator {
// 
//     EQUAL("="), BETWEEN("BETWEEN"), IN("IN"), NOT_IN("NOT IN");
// 
//     private final String expression;
// 
//     private BinaryOperator(String expression) {
//         this.expression = expression;
//     }
// 
//     @Override
//     public String toString() {
//         return expression;
//     }
// 
//     public String getExpression() {
//         return expression;
//     }
// 
// }


import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement;
import com.elong.pb.newdda.client.router.result.router.BinaryOperator;
package com.elong.pb.newdda.client.router.parser.visitor.basic.mysql;


/**
 * MySQL的INSERT语句访问器.
 */
public class MySqlInsertVisitor extends AbstractMySqlVisitor {

    public boolean visit(final MySqlInsertStatement x) {
        getSqlParserContext().setCurrentTable(x.getTableName().toString(), x.getAlias());
        if (null == x.getValues()) {
            return super.visit(x);
        }
        for (int i = 0; i < x.getColumns().size(); i++) {
// Path: src/main/java/com/elong/pb/newdda/client/router/result/router/BinaryOperator.java
// public enum BinaryOperator {
// 
//     EQUAL("="), BETWEEN("BETWEEN"), IN("IN"), NOT_IN("NOT IN");
// 
//     private final String expression;
// 
//     private BinaryOperator(String expression) {
//         this.expression = expression;
//     }
// 
//     @Override
//     public String toString() {
//         return expression;
//     }
// 
//     public String getExpression() {
//         return expression;
//     }
// 
// }


// Path: src/main/java/com/elong/pb/newdda/client/router/parser/visitor/basic/mysql/MySqlInsertVisitor.java
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement;
import com.elong.pb.newdda.client.router.result.router.BinaryOperator;

package com.elong.pb.newdda.client.router.parser.visitor.basic.mysql;


/**
 * MySQL的INSERT语句访问器.
 */
public class MySqlInsertVisitor extends AbstractMySqlVisitor {

    public boolean visit(final MySqlInsertStatement x) {
        getSqlParserContext().setCurrentTable(x.getTableName().toString(), x.getAlias());
        if (null == x.getValues()) {
            return super.visit(x);
        }
        for (int i = 0; i < x.getColumns().size(); i++) {
            getSqlParserContext().addCondition(x.getColumns().get(i).toString(), x.getTableName().toString(), BinaryOperator.EQUAL, x.getValues().getValues().get(i), getDatabaseType(), getParameters());