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


Java MysqlPlanVisitorImpl类代码示例

本文整理汇总了Java中com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl的典型用法代码示例。如果您正苦于以下问题:Java MysqlPlanVisitorImpl类的具体用法?Java MysqlPlanVisitorImpl怎么用?Java MysqlPlanVisitorImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MysqlPlanVisitorImpl类属于com.taobao.tddl.repo.mysql.sqlconvertor包,在下文中一共展示了MysqlPlanVisitorImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(IFunction.BuiltInFunction.TIMESTAMPDIFF).append("(");
    sb.append(func.getArgs().get(0));
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
    sb.append(")");

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:TimestampDiff.java

示例2: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,直接用in
    if (right instanceof List) {
        sb.append(" in ");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" = any (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:26,代码来源:EqualAny.java

示例3: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(IFunction.BuiltInFunction.CHAR).append("(");
    int size = func.getArgs().size();
    for (int i = 0; i < size - 1; i++) {
        // typeinfo1
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(i)).getString());
        if (i < size - 2) {
            sb.append(",");
        }
    }

    size = func.getArgs().size();
    if (!ExecUtils.isNull(func.getArgs().get(size - 1))) {
        sb.append(" USING ").append(func.getArgs().get(size - 1));
    }
    sb.append(")");
    return sb.toString();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:25,代码来源:Char.java

示例4: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(IFunction.BuiltInFunction.TIMESTAMPADD).append("(");
    sb.append(func.getArgs().get(0));
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
    sb.append(")");

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:19,代码来源:TimestampAdd.java

示例5: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append("TRIM").append("(");

    if (func.getArgs().size() == 2) {
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
    } else {
        sb.append(func.getArgs().get(2)).append(" ");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(" FROM ");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
    }

    sb.append(")");

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:24,代码来源:Trim.java

示例6: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,直接用not in
    if (right instanceof List) {
        sb.append(" not in ");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" != all (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:26,代码来源:NotEqualAll.java

示例7: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();
    
    sb.append(IFunction.BuiltInFunction.TIMESTAMPDIFF).append("(");
    sb.append(func.getArgs().get(0));
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
    sb.append(")");
   

    return sb.toString();

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:20,代码来源:TimestampDiff.java

示例8: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();
    
    
    sb.append(IFunction.BuiltInFunction.TIMESTAMPADD).append("(");
    sb.append(func.getArgs().get(0));
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());
    sb.append(")");
    
   

    return sb.toString();

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:22,代码来源:TimestampAdd.java

示例9: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,找出最小值,转成>=
    if (right instanceof List) {

        DataType type = ((Filter) func.getExtraFunction()).getArgType();
        Object min = Collections.min((List) right, type);

        sb.append(" >= ");
        sb.append(parentVisitor.getNewVisitor(min).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" >= any (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:GreaterEqualAny.java

示例10: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,找出最大值,转成<
    if (right instanceof List) {

        DataType type = ((Filter) func.getExtraFunction()).getArgType();
        Object max = Collections.max((List) right, type);

        sb.append(" < ");
        sb.append(parentVisitor.getNewVisitor(max).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" < any (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:LessAny.java

示例11: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,找出最小值,转成>
    if (right instanceof List) {

        DataType type = ((Filter) func.getExtraFunction()).getArgType();
        Object min = Collections.min((List) right, type);

        sb.append(" > ");
        sb.append(parentVisitor.getNewVisitor(min).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" > any (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:GreaterAny.java

示例12: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,找出最大值,转成<=
    if (right instanceof List) {

        DataType type = ((Filter) func.getExtraFunction()).getArgType();
        Object max = Collections.max((List) right, type);

        sb.append(" <= ");
        sb.append(parentVisitor.getNewVisitor(max).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" <= any (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:LessEqualAny.java

示例13: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(IFunction.BuiltInFunction.CAST).append("(");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());
    sb.append(" as ");
    // typename
    sb.append(func.getArgs().get(1));

    // typeinfo
    if (func.getArgs().size() > 2) {
        sb.append("(");
        // typeinfo1
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(2)).getString());

        // typeinfo2
        if (func.getArgs().size() > 3) {
            sb.append(",");
            sb.append(parentVisitor.getNewVisitor(func.getArgs().get(3)).getString());
        }
        sb.append(")");
    }
    sb.append(")");

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:32,代码来源:Cast.java

示例14: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(IFunction.BuiltInFunction.GET_FORMAT).append("(");
    sb.append(func.getArgs().get(0));
    sb.append(",");
    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
    sb.append(")");
    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:16,代码来源:GetFormat.java

示例15: constructColumnNameForFunction

import com.taobao.tddl.repo.mysql.sqlconvertor.MysqlPlanVisitorImpl; //导入依赖的package包/类
@Override
public String constructColumnNameForFunction(IDataNodeExecutor query, boolean bindVal,
                                             AtomicInteger bindValSequence,
                                             Map<Integer, ParameterContext> paramMap, IFunction func,
                                             MysqlPlanVisitorImpl parentVisitor) {
    StringBuilder sb = new StringBuilder();

    sb.append(parentVisitor.getNewVisitor(func.getArgs().get(0)).getString());

    Object right = func.getArgs().get(1);

    // 右边被提前计算过了,找出最大值,转成>
    if (right instanceof List) {

        DataType type = ((Filter) func.getExtraFunction()).getArgType();
        Object max = Collections.max((List) right, type);

        sb.append(" > ");
        sb.append(parentVisitor.getNewVisitor(max).getString());
    } else {
        // 右边没进行计算,还是个子查询,理论上不会发生
        sb.append(" > all (");
        sb.append(parentVisitor.getNewVisitor(func.getArgs().get(1)).getString());
        sb.append(")");
    }

    return sb.toString();

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:30,代码来源:GreaterAll.java


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