3838import java .util .List ;
3939
4040import net .sf .jsqlparser .statement .SetStatement ;
41+ import net .sf .jsqlparser .statement .Statement ;
4142import net .sf .jsqlparser .statement .StatementVisitor ;
4243import net .sf .jsqlparser .statement .Statements ;
4344import net .sf .jsqlparser .statement .alter .Alter ;
@@ -69,45 +70,9 @@ public class TablesNamesFinder implements SelectVisitor, FromItemVisitor, Expres
6970 * @param delete
7071 * @return
7172 */
72- public List <String > getTableList (Delete delete ) {
73+ public List <String > getTableList (Statement statement ) {
7374 init ();
74- delete .accept (this );
75- return tables ;
76- }
77-
78- /**
79- * Main entry for this Tool class. A list of found tables is returned.
80- *
81- * @param insert
82- * @return
83- */
84- public List <String > getTableList (Insert insert ) {
85- init ();
86- insert .accept (this );
87- return tables ;
88- }
89-
90- /**
91- * Main entry for this Tool class. A list of found tables is returned.
92- *
93- * @param replace
94- * @return
95- */
96- public List <String > getTableList (Replace replace ) {
97- init ();
98- replace .accept (this );
99- return tables ;
100- }
101-
102- /**
103- * Main entry for this Tool class. A list of found tables is returned.
104- *
105- * @param select
106- * @return
107- */
108- public List <String > getTableList (Select select ) {
109- init ();
110- select .accept (this );
75+ statement .accept (this );
11176 return tables ;
11277 }
11378
@@ -127,17 +92,6 @@ public void visit(Select select) {
12792 * @param update
12893 * @return
12994 */
130- public List <String > getTableList (Update update ) {
131- init ();
132- update .accept (this );
133- return tables ;
134- }
135-
136- public List <String > getTableList (CreateTable create ) {
137- init ();
138- create .accept (this );
139- return tables ;
140- }
14195
14296 public List <String > getTableList (Expression expr ) {
14397 init ();
@@ -642,7 +596,12 @@ public void visit(HexValue hexValue) {
642596
643597 @ Override
644598 public void visit (Merge merge ) {
645- throw new UnsupportedOperationException (NOT_SUPPORTED_YET );
599+ tables .add (merge .getTable ().getName ());
600+ if (merge .getUsingTable () != null ) {
601+ merge .getUsingTable ().accept (this );
602+ } else if (merge .getUsingSelect () != null ) {
603+ merge .getUsingSelect ().accept ((FromItemVisitor ) this );
604+ }
646605 }
647606
648607 @ Override
0 commit comments