0

I m using JSQLPARSER for the first time and I wonder if it s possible to detect remote links (oracle dblink)?

If for example a simple select * from table1@remote

Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51
BabeteOne
  • 37
  • 3

1 Answers1

0

For JSqlParser this would be no special identifier. However, it will accept it as a normal table name. You could extract all used table names using something like:

String sql = "select * from table1@remote";
Statement stmt = CCJSqlParserUtil.parse(sql);
TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
List<String> tableList = tablesNamesFinder.getTableList(stmt);
assertEquals(1, tableList.size());
assertTrue(tableList.contains("table1@remote"));

And after that, you have to check, like I did with junits assertions, if a table name matches remote dblink syntax.

wumpz
  • 8,257
  • 3
  • 30
  • 25