JSqlParser -- https://github.com/JSQLParser/JSqlParser
Which is a full-blown parser, so if the parser hasn't implemeted various stuff (for example: old-style-outer-joins in T-SQL, it will fail)
So I thought... with a little bit of changes... it might be easy to implement: Set<String> SqlFormatter.getTableNames(sql) in this project!
Would it be hard to enhance this package to also extract table names (at a "best effort", 100% correctness is not important, just as long as it's better than the SQL Table Name Parser)
I know this is a SQL Formatter, but can it also be used to extract table names from a SQL Statement!
Previously I have worked with:
SQL Table Name Parser -- https://github.com/mnadeem/sql-table-name-parser Which uses "regex" to extract table names -- but it's not really reliable
JSqlParser -- https://github.com/JSQLParser/JSqlParser Which is a full-blown parser, so if the parser hasn't implemeted various stuff (for example: old-style-outer-joins in T-SQL, it will fail)
So I thought... with a little bit of changes... it might be easy to implement:
Set<String> SqlFormatter.getTableNames(sql)
in this project! Would it be hard to enhance this package to also extract table names (at a "best effort", 100% correctness is not important, just as long as it's better than theSQL Table Name Parser
)