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