public function fetchField($field=null, $options=null)
    {
        $this->getQuery()->type('select');
        if ($options) {
            $this->getQuery()->set(static::formatQueryOptions($options));
        }
        if ($field) {
            $this->getQuery()->remove('fields')->set('fields', $field);
        }
        $fields = StringHelper::explode(',', $this->getQuery()['fields']);
        $fields = array_map(function ($v) {
            $vs = preg_split('/(as)?\s+/', trim($v));
            return $vs[count($vs)-1];
        }, $fields);
        
        $rows = $this->query();
        
        $result = [];
        if ($rows) foreach ($rows as $v) {
            $result[] = $v[$fields[0]];
        }
        return $result;
    }
public function fetchField($field=null, $options=null)
    {
        $this->getQuery()->type('select');
        if ($options) {
            $this->getQuery()->set(static::formatQueryOptions($options));
        }
        if ($field) {
            $this->getQuery()->remove('fields')->set('fields', $field);
        }
        $fields = StringHelper::explode(',', $this->getQuery()['fields']);
        $fields = array_map(function ($v) {
            $vs = preg_split('/(as)?\s+/', trim($v));
            return $vs[count($vs)-1];
        }, $fields);
        
        $rows = $this->query();
        
        $result = [];
        if ($rows) foreach ($rows as $v) {
            $result[] = $v[$fields[0]];
        }
        return $result;
    }
public function fetchField ( $ field = null , $ options = null ) { $ this -> getQuery ( ) -> type ( 'select' ) ; if ( $ options ) { $ this -> getQuery ( ) -> set ( static :: formatQueryOptions ( $ options ) ) ; } if ( $ field ) { $ this -> getQuery ( ) -> remove ( 'fields' ) -> set ( 'fields' , $ field ) ; } $ fields = StringHelper :: explode ( ',' , $ this -> getQuery ( ) [ 'fields' ] ) ; $ fields = array_map ( function ( $ v ) { $ vs = preg_split ( '/(as)?\s+/' , trim ( $ v ) ) ; return $ vs [ count ( $ vs ) - 1 ] ; } , $ fields ) ; $ rows = $ this -> query ( ) ; $ result = [ ] ; if ( $ rows ) foreach ( $ rows as $ v ) { $ result [ ] = $ v [ $ fields [ 0 ] ] ; } return $ result ; }
select one filed values
@param  string $field
@param  mixed  $options
@return array
select one filed values