If you only need to handle fairly straightforward queries you can probably get away with using a regular expression to pull out the table names. Something like this should probably work:
my @tables = $query =~ /(?:FROM|JOIN)\s+(\w+)/gi;
If you want to handle more cases, there are a number of SQL parsing modules available on CPAN, such as the one recommended by wfsp above.
In reply to Re: Grabbing source table names from a SQL query
by dirving
in thread Grabbing source table names from a SQL query
by PoorLuzer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |