src/QueryBuilder.php
protected function _compile(string $type='', string $table=''): string
	{
		// Get the base clause for the query
		$sql = $this->_compileType($type, $this->driver->quoteTable($table));

		$clauses = [
			'queryMap',
			'groupString',
			'orderString',
			'havingMap',
		];

		// Set each type of subclause
		foreach($clauses as $clause)
		{
			$func = 'get' . ucFirst($clause);
			$param = $this->state->$func();
			if (\is_array($param))
			{
				foreach($param as $q)
				{
					$sql .= $q['conjunction'] . $q['string'];
				}
			}
			else
			{
				$sql .= $param;
			}
		}

		// Set the limit via the class variables
		$limit = $this->state->getLimit();
		if (is_numeric($limit))
		{
			$sql = $this->driver->getSql()->limit($sql, $limit, $this->state->getOffset());
		}

		// See if the query plan, rather than the
		// query data should be returned
		if ($this->explain === TRUE)
		{
			$sql = $this->driver->getSql()->explain($sql);
		}

		return $sql;
	}
protected function _compile(string $type='', string $table=''): string
	{
		// Get the base clause for the query
		$sql = $this->_compileType($type, $this->driver->quoteTable($table));

		$clauses = [
			'queryMap',
			'groupString',
			'orderString',
			'havingMap',
		];

		// Set each type of subclause
		foreach($clauses as $clause)
		{
			$func = 'get' . ucFirst($clause);
			$param = $this->state->$func();
			if (\is_array($param))
			{
				foreach($param as $q)
				{
					$sql .= $q['conjunction'] . $q['string'];
				}
			}
			else
			{
				$sql .= $param;
			}
		}

		// Set the limit via the class variables
		$limit = $this->state->getLimit();
		if (is_numeric($limit))
		{
			$sql = $this->driver->getSql()->limit($sql, $limit, $this->state->getOffset());
		}

		// See if the query plan, rather than the
		// query data should be returned
		if ($this->explain === TRUE)
		{
			$sql = $this->driver->getSql()->explain($sql);
		}

		return $sql;
	}
protected function _compile ( string $ type = '' , string $ table = '' ) : string { // Get the base clause for the query $ sql = $ this -> _compileType ( $ type , $ this -> driver -> quoteTable ( $ table ) ) ; $ clauses = [ 'queryMap' , 'groupString' , 'orderString' , 'havingMap' , ] ; // Set each type of subclause foreach ( $ clauses as $ clause ) { $ func = 'get' . ucFirst ( $ clause ) ; $ param = $ this -> state -> $ func ( ) ; if ( \ is_array ( $ param ) ) { foreach ( $ param as $ q ) { $ sql .= $ q [ 'conjunction' ] . $ q [ 'string' ] ; } } else { $ sql .= $ param ; } } // Set the limit via the class variables $ limit = $ this -> state -> getLimit ( ) ; if ( is_numeric ( $ limit ) ) { $ sql = $ this -> driver -> getSql ( ) -> limit ( $ sql , $ limit , $ this -> state -> getOffset ( ) ) ; } // See if the query plan, rather than the // query data should be returned if ( $ this -> explain === TRUE ) { $ sql = $ this -> driver -> getSql ( ) -> explain ( $ sql ) ; } return $ sql ; }
String together the sql statements for sending to the db

@param string $type
@param string $table
@return string
String together the sql statements for sending to the db