public function buildFrom($indexes, &$params)
{
if (empty($indexes)) {
return '';
}
foreach ($indexes as $i => $index) {
if ($index instanceof Query) {
list($sql, $params) = $this->build($index, $params);
$indexes[$i] = "({$sql}) " . $this->db->quoteIndexName($i);
} elseif (is_string($i)) {
if (strpos($index, '(') === false) {
$index = $this->db->quoteIndexName($index);
}
$indexes[$i] = "{$index} " . $this->db->quoteIndexName($i);
} elseif (strpos($index, '(') === false) {
if (preg_match('/^(.*?)(?i:\\s+as|)\\s+([^ ]+)$/', $index, $matches)) {
// with alias
$indexes[$i] = $this->db->quoteIndexName($matches[1]) . ' ' . $this->db->quoteIndexName($matches[2]);
} else {
$indexes[$i] = $this->db->quoteIndexName($index);
}
}
}
if (is_array($indexes)) {
$indexes = implode(', ', $indexes);
}
return 'FROM ' . $indexes;
}