Shakespeare escribió:
> You could make life a little bit simpler by storing relevant tablenames in a
> table (!) and scanning your queries and cache for these names. Not 100%
> accurate, but it might help a little.
Actually, that's exactly my current PHP-side solution ;-)
<?php
$regex_tables = implode('|', $tables); // $tables contains table names
$regex = '/\W(FROM|JOIN)\s+(' . $regex_tables . ')(?:\W|$)/i';
preg_match_all($regex, $sql, $matches);
if(isset($matches[2]) && count($matches[2])>0){
$tables = array_unique($matches[2]);
sort($tables);
}
?>
--
--
http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
http://bits.demogracia.com
-- Mi web de humor al baño María:
http://www.demogracia.com
--