本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}