src/bundles/Database/Builder.php
public function compile_where( &$query )
	{
		$build = '';

		foreach( $query->wheres as $where ) 
		{
			// to make nested wheres possible you can pass an closure 
			// wich will create a new query where you can add your nested wheres
			if ( !isset( $where[2] ) && is_closure( $where[1] ) )
			{
				$sub_query = new Query;

				call_user_func( $where[1], $sub_query );

				// The parameters get added by the call of compile where
				$build .= ' '.$where[0].' ( '.substr( $this->compile_where( $sub_query ), 7 ).' )';

				continue;
			}

			// when we have an array as where values we have 
			// to parameterize them
			if ( is_array( $where[3] ) ) 
			{
				$where[3] = '('.$this->parameterize( $where[3] ).')';
			}
			else
			{
				$where[3] = $this->param( $where[3] );
			}

			// we always need to escepe where 1 wich referrs to the key
			$where[1] = $this->escape( $where[1] );

			// implode the beauty
			$build .= ' '.implode( ' ', $where );
		}

		return $build;
	}
public function compile_where( &$query )
	{
		$build = '';

		foreach( $query->wheres as $where ) 
		{
			// to make nested wheres possible you can pass an closure 
			// wich will create a new query where you can add your nested wheres
			if ( !isset( $where[2] ) && is_closure( $where[1] ) )
			{
				$sub_query = new Query;

				call_user_func( $where[1], $sub_query );

				// The parameters get added by the call of compile where
				$build .= ' '.$where[0].' ( '.substr( $this->compile_where( $sub_query ), 7 ).' )';

				continue;
			}

			// when we have an array as where values we have 
			// to parameterize them
			if ( is_array( $where[3] ) ) 
			{
				$where[3] = '('.$this->parameterize( $where[3] ).')';
			}
			else
			{
				$where[3] = $this->param( $where[3] );
			}

			// we always need to escepe where 1 wich referrs to the key
			$where[1] = $this->escape( $where[1] );

			// implode the beauty
			$build .= ' '.implode( ' ', $where );
		}

		return $build;
	}
public function compile_where ( & $ query ) { $ build = '' ; foreach ( $ query -> wheres as $ where ) { // to make nested wheres possible you can pass an closure  // wich will create a new query where you can add your nested wheres if ( ! isset ( $ where [ 2 ] ) && is_closure ( $ where [ 1 ] ) ) { $ sub_query = new Query ; call_user_func ( $ where [ 1 ] , $ sub_query ) ; // The parameters get added by the call of compile where $ build .= ' ' . $ where [ 0 ] . ' ( ' . substr ( $ this -> compile_where ( $ sub_query ) , 7 ) . ' )' ; continue ; } // when we have an array as where values we have  // to parameterize them if ( is_array ( $ where [ 3 ] ) ) { $ where [ 3 ] = '(' . $ this -> parameterize ( $ where [ 3 ] ) . ')' ; } else { $ where [ 3 ] = $ this -> param ( $ where [ 3 ] ) ; } // we always need to escepe where 1 wich referrs to the key $ where [ 1 ] = $ this -> escape ( $ where [ 1 ] ) ; // implode the beauty $ build .= ' ' . implode ( ' ' , $ where ) ; } return $ build ; }
Build the where part

@param Query 		$query
@return string
Build the where part