當前位置: 首頁>>代碼示例>>Java>>正文


Java TableNode.delete方法代碼示例

本文整理匯總了Java中com.taobao.tddl.optimizer.core.ast.query.TableNode.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java TableNode.delete方法的具體用法?Java TableNode.delete怎麽用?Java TableNode.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.taobao.tddl.optimizer.core.ast.query.TableNode的用法示例。


在下文中一共展示了TableNode.delete方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testPreparedDeleteSql

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
@Test
public void testPreparedDeleteSql() throws SqlParserException {
    String sql = "DELETE FROM TABLE1 WHERE ID>=? AND ID<=?";
    DeleteNode dn = delete(sql);

    Map<Integer, ParameterContext> currentParameter = new HashMap<Integer, ParameterContext>();
    ParameterContext p1 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 0, 3 });
    ParameterContext p2 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 5 });
    currentParameter.put(1, p1);
    currentParameter.put(2, p2);

    Parameters parameterSettings = new Parameters(currentParameter, false);
    dn.assignment(parameterSettings);
    dn.build();

    TableNode table1 = new TableNode("TABLE1");
    DeleteNode dnExpected = table1.delete();
    table1.query("ID>=3 AND ID<=5");
    dnExpected.build();
    assertEquals(dn, dnExpected);
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:22,代碼來源:SqlParserTest.java

示例2: testPreparedDeleteSql

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
@Test
public void testPreparedDeleteSql() throws SqlParserException, QueryException {
    String sql = "DELETE FROM TABLE1 WHERE ID>=? AND ID<=?";
    DeleteNode dn = delete(sql);

    Map<Integer, ParameterContext> parameterSettings = null;
    parameterSettings = new TreeMap<Integer, ParameterContext>();
    ParameterContext p1 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 0, 3 });
    ParameterContext p2 = new ParameterContext(ParameterMethod.setObject1, new Object[] { 1, 5 });
    parameterSettings.put(1, p1);
    parameterSettings.put(2, p2);

    dn.assignment(parameterSettings);
    dn.build();

    TableNode table1 = new TableNode("TABLE1");
    DeleteNode dnExpected = table1.delete();
    table1.query("ID>=3 AND ID<=5");
    dnExpected.build();
    assertEquals(dn, dnExpected);
}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:22,代碼來源:SqlParserTest.java

示例3: visit

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
@Override
public void visit(DMLDeleteStatement node) {
    TableNode table = null;
    if (node.getTableNames().size() == 1) {
        table = getTableNode(node.getTableNames().get(0).getIdTextUpUnescape());
    } else {
        throw new NotSupportException("not support multi table delete");
    }

    Expression expr = node.getWhereCondition();
    if (expr != null) {
        handleCondition(expr, table);
    }

    this.deleteNode = table.delete();

    if (node.isIgnore()) {
        this.deleteNode.setIgnore(node.isIgnore());
    }

    if (node.isLowPriority()) {
        this.deleteNode.setLowPriority(node.isLowPriority());
    }

    if (node.isQuick()) {
        this.deleteNode.setQuick(node.isQuick());
    }

    Limit limit = node.getLimit();
    if (limit != null) {
        throw new IllegalArgumentException("tddl not support the delete sql with limit expression");

    }

    if (node.getOrderBy() != null) {
        throw new IllegalArgumentException("tddl not support the delete sql with limit expression or order by expression");
    }
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:39,代碼來源:MySqlDeleteVisitor.java

示例4: delete

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
@Test
public void testDelete_正常() throws SqlParserException {
    String sql = "DELETE FROM TABLE1 WHERE ID>=5 AND ID<=5";
    DeleteNode dn = delete(sql);
    dn.build();

    TableNode table1 = new TableNode("TABLE1");
    DeleteNode dnExpected = table1.delete();
    table1.query("ID>=5 AND ID<=5");
    dnExpected.build();

    assertEquals(dn, dnExpected);
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:14,代碼來源:SqlParserTest.java

示例5: visit

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
public void visit(DMLDeleteStatement node) {
    TableNode table = null;
    if (node.getTableNames().size() == 1) {
        table = getTableNode(node.getTableNames().get(0).getIdTextUpUnescape());
    } else {
        throw new NotSupportException("not support multi table delete");
    }

    Expression expr = node.getWhereCondition();
    if (expr != null) {
        handleCondition(expr, table);
    }

    this.deleteNode = table.delete();
}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:16,代碼來源:MySqlDeleteVisitor.java

示例6: delete

import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
@Test
public void testDelete_正常() throws SqlParserException, QueryException {
    String sql = "DELETE FROM TABLE1 WHERE ID>=5 AND ID<=5";
    DeleteNode dn = delete(sql);
    dn.build();

    TableNode table1 = new TableNode("TABLE1");
    DeleteNode dnExpected = table1.delete();
    table1.query("ID>=5 AND ID<=5");
    dnExpected.build();

    assertEquals(dn, dnExpected);
}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:14,代碼來源:SqlParserTest.java


注:本文中的com.taobao.tddl.optimizer.core.ast.query.TableNode.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。