コード例 #1
0
ファイル: Join.php プロジェクト: Konro1/pms
 public function compile($db = NULL)
 {
     if ($this->context_model() and $meta = Jam::meta(Jam_Query_Builder::aliased_model($this->context_model()))) {
         $db = Database::instance($meta->db());
     }
     $original_on = $this->_on;
     $original_using = $this->_using;
     $original_table = $this->_table;
     if (!empty($this->_on)) {
         foreach ($this->_on as &$condition) {
             $condition[0] = Jam_Query_Builder::resolve_attribute_name($condition[0], $this->model() ? $this->model() : $this->_table);
             $condition[2] = Jam_Query_Builder::resolve_attribute_name($condition[2], $this->context_model());
         }
     }
     $this->_table = Jam_Query_Builder::resolve_table_alias($this->_table);
     if (!empty($this->_using)) {
         foreach ($this->_using as &$column) {
             $column = Jam_Query_Builder::resolve_attribute_name($column, $this->meta());
         }
     }
     $additional_joins = '';
     foreach ($this->_joins as $join) {
         $additional_joins .= ' ' . $join->compile($db);
     }
     $compiled = parent::compile($db) . $additional_joins;
     $this->_on = $original_on;
     $this->_using = $original_using;
     $this->_table = $original_table;
     return $compiled;
 }
コード例 #2
0
ファイル: select.php プロジェクト: vienbk91/fuelphp17
 /**
  * Adds "OR ON .
  * .." conditions for the last created JOIN statement.
  *
  * @param mixed $c1
  *        	column name or array($column, $alias) or object
  * @param string $op
  *        	logic operator
  * @param mixed $c2
  *        	column name or array($column, $alias) or object
  *        	
  * @return $this
  */
 public function or_on($c1, $op, $c2)
 {
     $this->_last_join->or_on($c1, $op, $c2);
     return $this;
 }