@param             $result
@param string|null $index
@param bool        $assoc

@return bool|\chillerlan\Database\Result
198199
protected function __getResult($result, string $index = null, bool $assoc = null){

		if(is_bool($result)){
			return $result; // @codeCoverageIgnore
		}

		$out = new Result(null, $this->convert_encoding_src, $this->convert_encoding_dest);
		$i   = 0;

		while($row = call_user_func_array($assoc === true ? 'pg_fetch_assoc' : 'pg_fetch_row', [$result])){
			$key = $i;

			$j = 0;
			foreach($row as $k => $item){
				// https://gitter.im/arenanet/api-cdi?at=594326ba31f589c64fafe554
				$fieldType = pg_field_type($result, $j);

				if($fieldType === 'bool'){
					$row[$k] = $item === 't';
				}
				elseif(in_array($fieldType, ['int2', 'int4', 'int8'], true)){
					$row[$k] = (int)$item;

				}
				elseif(in_array($fieldType, ['float4', 'float8'], true)){
					$row[$k] = (float)$item; // @codeCoverageIgnore
				}

				$j++;
			}

			if($assoc && !empty($index)){
				$key = $row[$index];
			}

			$out[$key] = $row;
			$i++;
		}

		pg_free_result($result);

		return $i === 0 ? true : $out;
	}
176052
public function buildResult($result)
    {
        $chatMembers = [];

        foreach ($result as $item) {
            $chatMembers[] = new ChatMember($item);
        }

        return $chatMembers;
    }
1130460
public function setResult($name = null, $result = null)
    {
        if (null === $result) {
            $result = $name;
            array_push($this->results, $result);

            return $this;
        }

        $this->results[(string) $name] = $result;

        return $this;
    }
1083439
public function delete(&$result)
    {
        $entity = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($entity)) {
            return $result;
        }

        $mediator = [];

        foreach ($this->definition->localKeys() as $entityField => $mediatorField) {
            $mediator[$mediatorField] = $this->accessor->getPropertyValue($result, $entityField);
        }

        foreach ($this->definition->foreignKeys() as $mediatorField => $entityField) {
            $mediator[$mediatorField] = $this->accessor->getPropertyValue($entity, $entityField);
        }

        $this->storage->delete($mediator, $this->definition->mediator())->execute();
        $this->accessor->setPropertyValue($result, $this->definition->container(), $entity);

        return $result;
    }
986944
protected function jsonResult(&$result, $json = [], $assoc = false, $withRelationAttr = [])
    {
        foreach ($json as $name) {
            if (isset($result[$name])) {
                $result[$name] = json_decode($result[$name], $assoc);

                if (isset($withRelationAttr[$name])) {
                    foreach ($withRelationAttr[$name] as $key => $closure) {
                        $data                = get_object_vars($result[$name]);
                        $result[$name]->$key = $closure(isset($result[$name]->$key) ? $result[$name]->$key : null, $data);
                    }
                }
            }
        }
    }
864785
public static function addResultAtIndex(Result $result, $index)
    {
        // Add result
        $results = static::getResults();
        $results[$index] = $result;

        // Store results
        static::setResults($results);
    }
678994
public function loadAssoc()
	{
		// Initialise variables
		$return = null;

		// Execute the query
		if (!$this->execute())
		{
			return null;
		}

		// Get the first row from the result set as an associative array
		if ($row = $this->fetchAssoc())
		{
			$return = $row;
		}

		// Free up system resources and return
		$this->freeResult();

		return $return;
	}
931538
public function query($sql_string, $return=self::FETCH_ASSOC)
	{
		$query = self::exec( $sql_string );
		if ( $query ) {
			return $query->fetch($return);
		} 
		return 0;		
	}
64529
private function outputResult($result)
    {
        $this->io->writeln(sprintf('<comment>%s</comment>', $this->app['extend.action.io']->getOutput()), OutputInterface::OUTPUT_PLAIN);

        if ($result === 0) {
            $this->io->success('Autoloaders updated');
            $this->auditLog(__CLASS__, 'Autoloaders updated');
        } else {
            $this->io->error('Autoloaders failed update');
        }

        return $result;
    }
217979
protected function prepareAccessTokenResponse(array $result)
    {
        if ($this->getAccessTokenResourceOwnerId() !== null) {
            $result['resource_owner_id'] = $this->getValueByKey(
                $result,
                $this->getAccessTokenResourceOwnerId()
            );
        }
        return $result;
    }
1201692
public function mapResult(ResultIterator $result) {
		//check numer of rows returned
		if ($result->countRows() == 0)
			return null;
	
		//get result column types
		$this->columnTypes = $result->getColumnTypes();
		
		//build type handler list
		if ($this->defaultClass != 'stdClass' || !is_null($this->resultMap))
			$this->buildTypeHandlerList();
		
		//get row as an object and map using its model
		return $this->map($result->fetchObject());
	}
748213
protected function _makeResult(array $result) {
        return Result::make($result, $this->getClient())->setModelClass($this->_fullModelClass());
    }
69766
protected function getResult(callable $callable, array $args, string $index = null, bool $assoc = null){
		$out = new Result(null, $this->convert_encoding_src, $this->convert_encoding_dest);
		$i   = 0;

		/** @noinspection PhpAssignmentInConditionInspection */
		while($row = call_user_func_array($callable, $args)){
			$key = $assoc && !empty($index) ? $row[$index] : $i;

			$out[$key] = $row;
			$i++;
		}

		return $i === 0 ? true : $out;
	}
219095
public static function decode($string, $assoc = true)
    {
        $result = self::decodeRecursive($string, $assoc);
        return $result[0];
    }
521807
public function onResult(\pq\Result $result = null) {
		if ($result && $result->status != \pq\Result::TUPLES_OK) {
			return $result;
		}
		
		$rowset = $this->getRowsetPrototype();
		if (is_callable($rowset)) {
			return $rowset($result);
		} elseif ($rowset) {
			return new $rowset($this, $result);
		}
		
		return $result;
	}
1183650
public function getJsonResponse(array $query = array(), $assoc = true)
    {
        //argument 2 must be bool
        Argument::i()->test(2, 'bool');
        
        return json_decode($this->getResponse($query), $assoc);
    }
1370079
private static function getResult($result, ConnectionInterface $connection = null, string $profileKey = '')
    {
        if (App::isCoContext()) {
            return new DbCoResult($result, $connection, $profileKey);
        }

        return new DbDataResult($result, $connection, $profileKey);
    }