本文整理汇总了Java中com.taobao.tddl.optimizer.core.ast.query.TableNode.put方法的典型用法代码示例。如果您正苦于以下问题:Java TableNode.put方法的具体用法?Java TableNode.put怎么用?Java TableNode.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.ast.query.TableNode
的用法示例。
在下文中一共展示了TableNode.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TABLE1
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //导入方法依赖的package包/类
@Test
public void testReplace_多字段_多记录() throws SqlParserException {
String sql = "REPLACE INTO TABLE1(ID, NAME, SCHOOL) VALUES (1, 'sun', 'sysu'),(2, 'sun', 'sysu'),(3, 'sun', 'sysu')";
PutNode in = put(sql);
in.build();
TableNode table1 = new TableNode("TABLE1");
PutNode inExpected = table1.put("ID NAME SCHOOL",
new Object[] { Arrays.asList(1, "sun", "sysu"), Arrays.asList(2, "sun", "sysu"),
Arrays.asList(3, "sun", "sysu") });
inExpected.build();
assertEquals(in, inExpected);
}
示例2: TableNode
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //导入方法依赖的package包/类
@Test
public void testPut_全字段() {
TableNode table = new TableNode("TABLE1");
Comparable values[] = { 2, "sysu", "sun" };
PutNode put = table.put("ID SCHOOL NAME", values);
IDataNodeExecutor plan = optimizer.optimizeAndAssignment(put, null, null);
Assert.assertTrue(plan instanceof IPut);
String sql = "REPLACE INTO TABLE1(ID,SCHOOL,NAME) VALUES(2,'sysu','sun')";
plan = optimizer.optimizeAndAssignment(sql, null, null, false);
Assert.assertTrue(plan instanceof IPut);
}
示例3: visit
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //导入方法依赖的package包/类
public void visit(DMLReplaceStatement node) {
TableNode table = getTableNode(node);
String insertColumns = this.getInsertColumnsStr(node);
List<RowExpression> exprList = node.getRowList();
if (exprList != null && exprList.size() == 1) {
RowExpression expr = exprList.get(0);
Comparable[] iv = getRowValue(expr);
this.replaceNode = table.put(insertColumns, iv);
} else {
throw new NotSupportException("could not support multi row values.");
}
}
示例4: TableNode
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //导入方法依赖的package包/类
@Test
public void testPut_全字段() throws QueryException {
TableNode table = new TableNode("TABLE1");
Comparable values[] = { 2, "sysu", "sun" };
PutNode put = table.put("ID SCHOOL NAME", values);
IDataNodeExecutor plan = optimizer.optimizeAndAssignment(put, null, null);
Assert.assertTrue(plan instanceof IPut);
String sql = "REPLACE INTO TABLE1(ID,SCHOOL,NAME) VALUES(2,'sysu','sun')";
plan = optimizer.optimizeAndAssignment(sql, null, null, false);
Assert.assertTrue(plan instanceof IPut);
}