Example #1
0
 /**
  * Generate the "join" part of the sql
  *
  * @return string
  */
 protected function _generateJoinSQL()
 {
     $sql = ' FROM ' . Core::getTablePrefix() . $this->fromtable->getB2DBName() . ' ' . $this->fromtable->getB2DBAlias();
     foreach ($this->jointables as $a_jt) {
         $sql .= ' ' . $a_jt['jointype'] . ' ' . Core::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 Criterion($a_crit[0], $a_crit[1]);
             $sql .= $this->_parseCriterion($a_crit);
         }
         $sql .= ')';
     }
     return $sql;
 }
Example #2
0
 /**
  * Returns a foreign table
  *
  * @param Table $table
  * 
  * @return array
  */
 public function getForeignTable($table)
 {
     return $this->_foreigntables[$table->getB2DBAlias()];
 }