本文整理汇总了Java中com.taobao.tddl.optimizer.core.plan.dml.IDelete类的典型用法代码示例。如果您正苦于以下问题:Java IDelete类的具体用法?Java IDelete怎么用?Java IDelete使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDelete类属于com.taobao.tddl.optimizer.core.plan.dml包,在下文中一共展示了IDelete类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toDataNodeExecutor
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Override
public IPut toDataNodeExecutor(int shareIndex) {
IDelete delete = ASTNodeFactory.getInstance().createDelete();
delete.setConsistent(true);
delete.executeOn(this.getNode().getDataNode());
delete.setQueryTree((IQueryTree) this.getNode().toDataNodeExecutor());
if (this.getNode().getActualTableName() != null) {
delete.setTableName(this.getNode().getActualTableName());
} else if (this.getNode() instanceof KVIndexNode) {
delete.setTableName(((KVIndexNode) this.getNode()).getIndexName());
} else {
delete.setTableName(this.getNode().getTableName());
}
delete.setIndexName(this.getNode().getIndexUsed().getName());
delete.setBatchIndexs(this.getBatchIndexs());
delete.setIgnore(this.isIgnore());
delete.setQuick(this.isQuick());
delete.setLowPriority(this.lowPriority);
delete.setHighPriority(this.highPriority);
delete.setDelayed(this.isDelayed());
delete.setMultiValues(this.isMultiValues());
delete.setMultiValues(this.getMultiValues());
delete.setExistSequenceVal(this.isExistSequenceVal());
return delete;
}
示例2: testDelete
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Test
public void testDelete() {
String sql = "DELETE FROM TABLE1 WHERE ID = ?";
Map<Integer, ParameterContext> currentParameter = new HashMap<Integer, ParameterContext>();
ParameterContext p1 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 2 });
currentParameter.put(1, p1);
Parameters parameterSettings = new Parameters();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 1 }));
parameterSettings.addBatch();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 2 }));
parameterSettings.addBatch();
IDataNodeExecutor plan = optimizer.optimizeAndAssignment(sql, parameterSettings, null, false);
Assert.assertTrue(plan instanceof IMerge);
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(0)).getBatchIndexs(), Arrays.asList(0));
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(1)).getBatchIndexs(), Arrays.asList(1));
}
示例3: accept
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Override
public void accept(PlanVisitor visitor) {
if (this instanceof IInsert) {
visitor.visit((IInsert) this);
} else if (this instanceof IDelete) {
visitor.visit((IDelete) this);
} else if (this instanceof IUpdate) {
visitor.visit((IUpdate) this);
} else if (this instanceof IReplace) {
visitor.visit((IReplace) this);
}
}
示例4: ParameterContext
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Test
public void testDelete_范围查询() {
String sql = "DELETE FROM TABLE1 WHERE ID > ? AND ID < ?";
Map<Integer, ParameterContext> currentParameter = new HashMap<Integer, ParameterContext>();
ParameterContext p1 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 2 });
currentParameter.put(1, p1);
Parameters parameterSettings = new Parameters();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 1 }));
parameterSettings.getCurrentParameter().put(2,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 2, 4 }));
parameterSettings.addBatch();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 2 }));
parameterSettings.getCurrentParameter().put(2,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 2, 5 }));
parameterSettings.addBatch();
IDataNodeExecutor plan = optimizer.optimizeAndAssignment(sql, parameterSettings, null, false);
Assert.assertTrue(plan instanceof IMerge);
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(0)).getBatchIndexs(), Arrays.asList(0));
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(1)).getBatchIndexs(), Arrays.asList(1));
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(2)).getBatchIndexs(), Arrays.asList(0, 1));
}
示例5: IN
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Test
public void testDelete_in查询() {
String sql = "DELETE FROM TABLE1 WHERE ID IN (?,?)";
Map<Integer, ParameterContext> currentParameter = new HashMap<Integer, ParameterContext>();
ParameterContext p1 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 2 });
currentParameter.put(1, p1);
Parameters parameterSettings = new Parameters();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 2 }));
parameterSettings.getCurrentParameter().put(2,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 2, 3 }));
parameterSettings.addBatch();
parameterSettings.getCurrentParameter().put(1,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 3 }));
parameterSettings.getCurrentParameter().put(2,
new ParameterContext(ParameterMethod.setObject1, new Object[] { 2, 4 }));
parameterSettings.addBatch();
IDataNodeExecutor plan = optimizer.optimizeAndAssignment(sql, parameterSettings, null, false);
Assert.assertTrue(plan instanceof IMerge);
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(0)).getBatchIndexs(), Arrays.asList(0));
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(1)).getBatchIndexs(), Arrays.asList(1));
Assert.assertEquals(((IDelete) ((IMerge) plan).getSubNodes().get(2)).getBatchIndexs(), Arrays.asList(0, 1));
}
示例6: toDataNodeExecutor
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
public IDataNodeExecutor toDataNodeExecutor() throws QueryException {
IDelete delete = ASTNodeFactory.getInstance().createDelete();
delete.setConsistent(true);
delete.executeOn(this.getDataNode());
delete.setQueryTree(this.getNode().toDataNodeExecutor());
if (this.getNode().getActualTableName() != null) {
delete.setTableName(this.getNode().getActualTableName());
} else if (this.getNode() instanceof KVIndexNode) {
delete.setTableName(((KVIndexNode) this.getNode()).getIndexName());
} else {
delete.setTableName(this.getNode().getTableName());
}
delete.setIndexName(this.getNode().getIndexUsed().getName());
return delete;
}
示例7: createDelete
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
public IDelete createDelete() {
return new Delete();
}
示例8: setUpdateColumns
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Override
public IDelete setUpdateColumns(List<ISelectable> columns) {
throw new NotSupportException();
}
示例9: setUpdateValues
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Override
public IDelete setUpdateValues(List<Object> values) {
throw new NotSupportException();
}
示例10: copy
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
@Override
public IDelete copy() {
IDelete delete = ASTNodeFactory.getInstance().createDelete();
copySelfTo(delete);
return delete;
}
示例11: visit
import com.taobao.tddl.optimizer.core.plan.dml.IDelete; //导入依赖的package包/类
public abstract void visit(IDelete delete);