Package net.sf.jsqlparser.statement.delete

Examples of net.sf.jsqlparser.statement.delete.Delete


        {if (true) return insert;}
    throw new Error("Missing return statement in function");
  }

  final public Delete Delete() throws ParseException {
        Delete delete = new Delete();
        Table table = null;
        Expression where = null;
    jj_consume_token(K_DELETE);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_FROM:
      jj_consume_token(K_FROM);
      break;
    default:
      jj_la1[15] = jj_gen;
      ;
    }
    table = TableWithAlias();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_WHERE:
      where = WhereClause();
                           delete.setWhere(where);
      break;
    default:
      jj_la1[16] = jj_gen;
      ;
    }
        delete.setTable(table);
        {if (true) return delete;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here


    @Test
  public void testGetTableListFromDelete2() throws Exception {
    String sql = "DELETE FROM MY_TABLE1";
    net.sf.jsqlparser.statement.Statement statement = pm.parse(new StringReader(sql));

    Delete deleteStatement = (Delete) statement;
    TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
    List<String> tableList = tablesNamesFinder.getTableList(deleteStatement);
    assertEquals(1, tableList.size());
    assertTrue(tableList.contains("MY_TABLE1"));
  }
View Full Code Here

  }

  public void testDelete() throws JSQLParserException {
    String statement = "DELETE FROM mytable WHERE mytable.col = 9";

    Delete delete = (Delete) parserManager.parse(new StringReader(statement));
    assertEquals("mytable", delete.getTable().getName());
    assertEquals(statement, "" + delete);
  }
View Full Code Here

    @Test
  public void testGetTableListFromDelete() throws Exception {
    String sql = "DELETE FROM MY_TABLE1 as AL WHERE a = (SELECT a from MY_TABLE2)";
    net.sf.jsqlparser.statement.Statement statement = pm.parse(new StringReader(sql));

    Delete deleteStatement = (Delete) statement;
    TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
    List<String> tableList = tablesNamesFinder.getTableList(deleteStatement);
    assertEquals(2, tableList.size());
    assertTrue(tableList.contains("MY_TABLE1"));
    assertTrue(tableList.contains("MY_TABLE2"));
View Full Code Here

     * @return number of rows affected
     */
    private int handleDelete(String sql) throws JSQLParserException {
        log.info("handle delete incoming query: " + sql);
        int returnval = 0;
        Delete delete = (Delete) this.parserManager.parse(new StringReader(sql));

        String domain = this.getWriteTableName(delete.getTable());
        log.info("handle delete domain is: " + domain);
        Expression express = delete.getWhere();

        SQLDeleteExpressionVisitor vistor = new SQLDeleteExpressionVisitor();
        vistor.setValue(express);

        String[] vals = express.toString().split("=");
View Full Code Here

        return new SimpleDBResultSet(this.connection, items, domain);
    }
   
    private int handleDelete() throws JSQLParserException {   
      int returnval = 0;
        Delete delete = (Delete) this.parserManager.parse(new StringReader(this.sql));
        String domain = delete.getTable().getName();
        Expression express = delete.getWhere();

        String[] vals = express.toString().split("=");

        DeleteAttributesRequest req = new DeleteAttributesRequest();
        req.setDomainName(domain);
View Full Code Here

TOP

Related Classes of net.sf.jsqlparser.statement.delete.Delete

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.