/** * Generate the "join" part of the sql * * @return string */ protected function _generateJoinSQL() { $sql = ' FROM ' . B2DB::getTablePrefix() . $this->fromtable->getB2DBName() . ' ' . $this->fromtable->getB2DBAlias(); foreach ($this->jointables as $a_jt) { $sql .= ' ' . $a_jt['jointype'] . ' ' . B2DB::getTablePrefix() . $a_jt['jointable']->getB2DBName() . ' ' . $a_jt['jointable']->getB2DBAlias(); $sql .= ' ON (' . $a_jt['col1'] . self::DB_EQUALS . $a_jt['col2']; foreach ($a_jt['criterias'] as $a_crit) { $sql .= ' AND '; $a_crit = new B2DBCriterion($a_crit[0], $a_crit[1]); $sql .= $this->_parseCriterion($a_crit); } $sql .= ')'; } return $sql; }
/** * Returns a foreign table * * @param B2DBTable $table * * @return array */ public function getForeignTable($table) { return $this->_foreigntables[$table->getB2DBAlias()]; }