Skip to content

Commit

Permalink
Add support for truncate table (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarxos authored and wumpz committed Dec 6, 2018
1 parent 4da4f13 commit 11be715
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public void visit(Drop drop) {

@Override
public void visit(Truncate truncate) {
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
visit(truncate.getTable());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ public void testGetTableListFromDelete2() throws Exception {
assertTrue(tableList.contains("MY_TABLE1"));
}

@Test
public void testGetTableListFromTruncate() throws Exception {
String sql = "TRUNCATE TABLE MY_TABLE1";
List<String> tables = new TablesNamesFinder().getTableList(pm.parse(new StringReader(sql)));
assertEquals(1, tables.size());
assertTrue(tables.contains("MY_TABLE1"));
}

@Test
public void testGetTableListFromDeleteWithJoin() throws Exception {
String sql = "DELETE t1, t2 FROM MY_TABLE1 t1 JOIN MY_TABLE2 t2 ON t1.id = t2.id";
Expand Down

0 comments on commit 11be715

Please sign in to comment.