public function render_join()
{
if (!$this->args['join']) {
return '';
}
$joins = array();
foreach ($this->args['join'] as $j) {
$jj = '';
$jj .= $j['t'] . ' join ';
$jj .= $this->bt($j['f1']);
if (!is_null($j['fa'])) {
$jj .= ' as ' . $this->bt($j['fa']);
}
$jj .= ' on ';
if ($j['expr']) {
$jj .= $this->consume($j['expr']);
} else {
$jj .= $this->bt($j['fa'] ?: $j['f1']) . '.' . $this->bt($j['f2']) . ' = ' . $this->bt($j['m1']) . '.' . $this->bt($j['m2']);
}
$joins[] = $jj;
}
return implode(' ', $joins);
}