system/Database/BaseBuilder.php
public function getCompiledSelect(bool $reset = true): string
	{
		$select = $this->compileSelect();

		if ($reset === true)
		{
			$this->resetSelect();
		}

		return $this->compileFinalQuery($select);
	}
public function getCompiledSelect(bool $reset = true): string
	{
		$select = $this->compileSelect();

		if ($reset === true)
		{
			$this->resetSelect();
		}

		return $this->compileFinalQuery($select);
	}
Get SELECT query string

Compiles a SELECT query string and returns the sql.

@param boolean $reset TRUE: resets QB values; FALSE: leave QB values alone

@return string