src/QueryBuilder.php
public function select(string $fields): QueryBuilderInterface
	{
		// Split fields by comma
		$fieldsArray = explode(',', $fields);
		$fieldsArray = array_map('mb_trim', $fieldsArray);

		// Split on 'As'
		foreach ($fieldsArray as $key => $field)
		{
			if (stripos($field, 'as') !== FALSE)
			{
				$fieldsArray[$key] = preg_split('` as `i', $field);
				$fieldsArray[$key] = array_map('mb_trim', $fieldsArray[$key]);
			}
		}

		// Quote the identifiers
		$safeArray = $this->driver->quoteIdent($fieldsArray);

		unset($fieldsArray);

		// Join the strings back together
		for($i = 0, $c = count($safeArray); $i < $c; $i++)
		{
			if (\is_array($safeArray[$i]))
			{
				$safeArray[$i] = implode(' AS ', $safeArray[$i]);
			}
		}

		$this->state->appendSelectString(implode(', ', $safeArray));

		return $this;
	}
public function select(string $fields): QueryBuilderInterface
	{
		// Split fields by comma
		$fieldsArray = explode(',', $fields);
		$fieldsArray = array_map('mb_trim', $fieldsArray);

		// Split on 'As'
		foreach ($fieldsArray as $key => $field)
		{
			if (stripos($field, 'as') !== FALSE)
			{
				$fieldsArray[$key] = preg_split('` as `i', $field);
				$fieldsArray[$key] = array_map('mb_trim', $fieldsArray[$key]);
			}
		}

		// Quote the identifiers
		$safeArray = $this->driver->quoteIdent($fieldsArray);

		unset($fieldsArray);

		// Join the strings back together
		for($i = 0, $c = count($safeArray); $i < $c; $i++)
		{
			if (\is_array($safeArray[$i]))
			{
				$safeArray[$i] = implode(' AS ', $safeArray[$i]);
			}
		}

		$this->state->appendSelectString(implode(', ', $safeArray));

		return $this;
	}
public function select ( string $ fields ) : QueryBuilderInterface { // Split fields by comma $ fieldsArray = explode ( ',' , $ fields ) ; $ fieldsArray = array_map ( 'mb_trim' , $ fieldsArray ) ; // Split on 'As' foreach ( $ fieldsArray as $ key => $ field ) { if ( stripos ( $ field , 'as' ) !== FALSE ) { $ fieldsArray [ $ key ] = preg_split ( '` as `i' , $ field ) ; $ fieldsArray [ $ key ] = array_map ( 'mb_trim' , $ fieldsArray [ $ key ] ) ; } } // Quote the identifiers $ safeArray = $ this -> driver -> quoteIdent ( $ fieldsArray ) ; unset ( $ fieldsArray ) ; // Join the strings back together for ( $ i = 0 , $ c = count ( $ safeArray ) ; $ i < $ c ; $ i ++ ) { if ( \ is_array ( $ safeArray [ $ i ] ) ) { $ safeArray [ $ i ] = implode ( ' AS ' , $ safeArray [ $ i ] ) ; } } $ this -> state -> appendSelectString ( implode ( ', ' , $ safeArray ) ) ; return $ this ; }
Specifies rows to select in a query

@param string $fields
@return QueryBuilderInterface
Specifies rows to select in a query