Adds new right join statement to the current query.

@param string|Raw|\Closure|array $table
@param string|JoinBuilder|Raw|\Closure $key
@param string|null $operator
@param string|Raw|\Closure|null $value

@return static
@throws Exception
546163
public function rightJoin($table, $key, ?string $operator = null, $value = null): IQueryBuilderHandler
    {
        return $this->join($table, $key, $operator, $value, 'right');
    }
1061401
public function join($table, $first, $operator = null, $second = null, $type = 'inner') {
        $on = $first;
        if (!empty($operator)) {
            $on .= is_null($second) ? ' = '.$operator : sprintf(' %s %s', $operator, $second);
        }
        $this->joins[] = compact('table', 'on', 'type');
        return $this;
    }
941160
public function innerJoin($table, $leftKey, $rightKey)
	{
		$this->syntax->setJoin($table, $leftKey, $rightKey, 'inner');
		return $this;
	}
1268270
public function where($key, $operator = null, $value = null)
    {
        return $this->filter($this->operatorForWhere(...func_get_args()));
    }
993472
public function where($val1, $val2 = null, string $operator = null, bool $bind = null, string $join = null){
		$operator = $operator !== null ? strtoupper(trim($operator)) : '=';
		$bind     = $bind ?? true;

		$join = strtoupper(trim($join));
		$join = in_array($join, $this->joinArgs, true) ? $join : 'AND';

		if(in_array($operator, $this->operators, true)){
			$where = [
				is_array($val1)
					? strtoupper($val1[1]).'('.$this->dialect->quote($val1[0]).')'
					: $this->dialect->quote($val1)
			];

			if(in_array($operator, ['IN', 'NOT IN', 'ANY', 'SOME',], true)){

				if(is_array($val2)){

					if($bind){
						$where[] = $operator.'('.implode(',', array_fill(0, count($val2), '?')).')';
						$this->bindValues = array_merge($this->bindValues, $val2);
					}
					else{
						$where[] = $operator.'('.implode(',', array_map([$this->db, 'escape'], $val2)).')'; // @todo: quote
					}

				}
				else if($val2 instanceof Statement){
					$where[] = $operator.'('.$val2->sql().')';
					$this->bindValues = array_merge($this->bindValues, $val2->bindValues());
				}

			}
//			else if(in_array($operator, ['BETWEEN', 'NOT BETWEEN'], true)){
				// @todo
//			}
			else{
				$where[] = $operator;

				if($val2 instanceof Statement){
					$where[] = '('.$val2->sql().')';
					$this->bindValues = array_merge($this->bindValues, $val2->bindValues());
				}
				elseif(is_null($val2)){
					$where[] = 'NULL';
				}
				elseif(is_bool($val2)){
					$where[] = $val2 ? 'TRUE' : 'FALSE';
				}
				elseif(in_array(strtolower($val2), ['null', 'false', 'true', 'unknown'], true)){
					$where[] = strtoupper($val2);
				}
				else {

					if($bind){
						$where[] = '?';
						$this->bindValues[] = $val2;
					}
					else{
						if(!empty($val2)){
							$where[] = $val2;
						}
					}

				}

			}

			$this->where[] = [
				'join' => $join,
				'stmt' => implode(' ', $where),
			];

		}

		return $this;
	}
316909
public function leftJoin(string $table, string $key, string $operator, string $value): SelectQueryBuilder
    {
        $this->addJoin($table, $key, $operator, $value, 'left');
        return $this;
    }
1226959
public static function table($table, $value, $key = 'id', \Closure $whereCallback = null, $connection = null)
    {
        $query = DB::connection($connection)
                   ->table($table)
                   ->select("{$value} as label", "{$key} as value");

        if ($whereCallback) {
            $query->where($whereCallback);
        }

        return $query->get();
    }
44140
public function join($table, $one, $operator = null, $two = null, $type = 'inner', $where = false)
    {
        if ($one instanceof Closure) {
            $this->joins[] = new JoinClause($type, $table);

            call_user_func($one, end($this->joins));
        } else {
            $join = new JoinClause($type, $table);

            $this->joins[] = $join->on(
                $one, $operator, $two, 'and', $where
            );
        }

        return $this;
    }
183554
public function where($column, $value, $operator = '=', $table = null)
    {
        $table = $table? $table : $this->table;
        $this->db()->where($column, $value, $operator, $table);
        return $this;
    }
1205730
public function where($key, $value = true, $operator = '=')
    {
        return $this->addCondition($key, $value, $operator, 'where');
    }
1227395
public function where($column, $value, $operator = '=', $table = null)
    {
        $table = $table? $table : $this->table;
        $this->wheres[] = [
            'table' => $table,
            'column' => $column,
            'value' => $value,
            'operator' => $operator
        ];
        return $this;
    }
1018508
public function partition($key, $operator = null, $value = null)
    {
        $partitions = [new static, new static];

        $callback = func_num_args() === 1
                ? $this->valueRetriever($key)
                : $this->operatorForWhere(...func_get_args());

        foreach ($this->items as $key => $item) {
            $partitions[(int) ! $callback($item, $key)][$key] = $item;
        }

        return new static($partitions);
    }
1214898
public function rightJoinWhere($table, $first, $operator, $second)
    {
        return $this->joinWhere($table, $first, $operator, $second, 'right');
    }
172134
protected function addSimpleWhere(string $key, string $operator, $value): void
    {
        $placeholder = $this->addBindingValue($key, $value);
        $key = $this->quoteName($key);
        $this->statement .= sprintf('%s %s %s', $key, $operator, $placeholder);
        $this->statement .= PHP_EOL;
    }
1276551
private function prepareRowOperator(?string $operator, $value, int $key): string
    {
        if (!$operator) {
            $operator = is_array($value) ? 'IN' : '=';
        }

        if ($operator === 'IN' and !is_array($value)) {
            if ($key !== 0) {
                throw new SqlException('Row value should be an array in condition on key #' . $key . '.');
            }

            $operator = '=';
        }

        if ($operator !== 'IN' and is_array($value)) {
            throw new SqlException('Row value could not be an array in condition on key #' . $key . ' for operator `' . $operator . '`.');
        }

        return $operator;
    }
558878
function RightJoin(Table $table, Condition $condition, $prepend = false)
    {
        return $this->Join($table, JoinType::Right(), $condition, $prepend);
    }
162113
protected function operatorForWhere($key, $operator, $value)
    {
        return function ($item) use ($key, $operator, $value) {

            $retrieved = ArrayHelper::dataGet($item, $key);

            switch ($operator) {
                default:
                case '=':
                case '==':
                    return $retrieved == $value;
                case '!=':
                case '<>':
                    return $retrieved != $value;
                case '<':
                    return $retrieved < $value;
                case '>':
                    return $retrieved > $value;
                case '<=':
                    return $retrieved <= $value;
                case '>=':
                    return $retrieved >= $value;
                case '===':
                    return $retrieved === $value;
                case '!==':
                    return $retrieved !== $value;
            }
        };
    }