function _track_aliases($table)
{
if (is_array($table)) {
foreach ($table as $t) {
$this->_track_aliases($t);
}
return;
}
// Does the string contain a comma? If so, we need to separate
// the string into discreet statements
if (strpos($table, ',') !== FALSE) {
return $this->_track_aliases(explode(',', $table));
}
// if a table alias is used we can recognize it by a space
if (strpos($table, " ") !== FALSE) {
// if the alias is written with the AS keyword, remove it
$table = preg_replace('/ AS /i', ' ', $table);
// Grab the alias
$table = trim(strrchr($table, " "));
// Store the alias, if it doesn't already exist
if (!in_array($table, $this->ar_aliased_tables)) {
$this->ar_aliased_tables[] = $table;
}
}
}