Fetches the next row from a result set

@param	resource	$statement - Query statement
@param	integer		$fetch_style - Fetch type
@return	mixed
484441
public function fetch($statement, $fetch_style = LikePDO::FETCH_ASSOC)
	{
		if(!is_resource($statement))
		{
			throw new LikePDOException("There is no active statement");
			return false;
		}
		else
		{
			switch($fetch_style)
			{
				case LikePDO::FETCH_ASSOC :
					return mssql_fetch_assoc($statement);
				break;
				case LikePDO::FETCH_NUM :
					return mssql_fetch_row($statement);
				break;
				case LikePDO::FETCH_OBJ :
					return mssql_fetch_object($statement);
				break;
			}
		}
	}
849053
protected function queryStatement(Statement $statement)
    {
        // 要查询的SQL语句必须是字符串
        if ($statement->isNull()) {
            trigger_error('要查询的语句不能为空', E_USER_ERROR);
        }

        // 记录开始时间
        $begin = timeLog();

        // 获取要执行的语句的Prepare和Params
        $prepare = $statement->getPrepare();
        $params = $statement->getParams();

        //是否需要记录日志
        $logEnabled = $this->logEnabled();

        //先记录日志,以免出错崩溃
        if ($logEnabled) {
            FileLog::instance()->sqlBefore('query', $statement->getSql());
        }

        // 从读服务器进行读操作
        $connect = $this->connectRead();

        // 如果绑定参数为空,直接执行就好.
        if (empty($params)) {
            $ret = $connect->query($prepare);
            $result = $ret->fetchAll(\PDO::FETCH_ASSOC);
            unset($ret);
        } else {
            $result = $this->bindQuery($connect, $prepare, $params);
        }

        // 计算耗时
        $interval = timeLog($begin);

        //如果需要记录日志
        if ($logEnabled) {
            // 记录耗时
            FileLog::instance()->sqlAfter('afterQuery', $statement->getSql(), $result, $interval, $statement->getOperation());

            // 记录调试信息
            Debug::setSql('Query', $prepare, $interval * 1000, $params, $statement->getSql());
        }
        return $result;
    }
45935
protected function statement($query, $fetchMode=null)
    {

        return $this->attempt(function () use ($query, $fetchMode) {

            $statement = $this->pdo()->prepare("$query");

            if ($fetchMode !== null) {
                $statement->setFetchMode($fetchMode);
            }
            return $statement;
        }, $query);

    }
996236
public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
    {
        // do not try fetching from the statement if it's not expected to contain result
        // in order to prevent exceptional situation
        if ($this->stmt === null || ! $this->result) {
            return false;
        }

        $args      = func_get_args();
        $fetchMode = $fetchMode ?: $this->defaultFetchMode;

        if ($fetchMode === FetchMode::COLUMN) {
            return $this->fetchColumn();
        }

        if (isset(self::$fetchMap[$fetchMode])) {
            return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false;
        }

        if (in_array($fetchMode, [FetchMode::STANDARD_OBJECT, FetchMode::CUSTOM_OBJECT], true)) {
            $className = $this->defaultFetchClass;
            $ctorArgs  = $this->defaultFetchClassCtorArgs;

            if (count($args) >= 2) {
                $className = $args[1];
                $ctorArgs  = $args[2] ?? [];
            }

            return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false;
        }

        throw new SQLSrvException('Fetch mode is not supported!');
    }
403758
public function fetchColumn(string $statement, array $bindings = [], int $columnNum = 0)
    {
        $sth = $this->execute($statement, $bindings);
        $result = $sth->fetchColumn($columnNum);

        $this->freeResource($sth);

        return $result;
    }
648371
public function fetch()
    {
        
        if ((null !== $this->statement) && $this->statement->fetch()) {
            $row = [];
            foreach ($this->stmt_results as $dbColumnName => $dbColumnValue) {
                $row[$this->stmt_cols[$dbColumnName]] = $dbColumnValue;
            }
            return $row;
        } elseif ($this->result instanceof \mysqli_result) {
            return mysqli_fetch_array($this->result, MYSQLI_ASSOC);
        } else {
            return null;
            
            if (!isset($this->result)) {
                throw new Exception('The database result resource is not currently set.');
            }
        }
    }
799575
public function fetchColumn($column_number = 0)
	{
		if($this->executed == true)
		{
			if(!$this->resource && $this->isFetched == false)
			{
				return false;
			}
		}
		else
		{
			throw new LikePDOStatement("There is no active statement");
			return false;
		}
		
		$result = NULL;
		
		if($this->isFetched == true)
		{
			if($this->isFetchAll == true)
			{
				return false;
			}
			else
			{
				if(isset($this->columns[$column_number]))
				{
					switch($this->fetchResultMode)
					{
						case LikePDO::FETCH_ASSOC :
							if(isset($this->fetch[$this->columns[$column_number]]))
							{
								return $this->fetch[$this->columns[$column_number]];
							}
						break;
						case LikePDO::FETCH_BOTH :
							if(isset($this->fetch[$this->columns[$column_number]]))
							{
								return $this->fetch[$this->columns[$column_number]];
							}
						break;
						case LikePDO::FETCH_BOUND :
							if(!$this->fetchColumn)
								$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
							if(isset($this->fetchColumn[$column_number]))
								return $this->fetchColumn[$column_number];
						break;
						case LikePDO::FETCH_CLASS :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_INTO :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_LAZY :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_NAMED :
							if(!$this->fetchColumn)
								$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
							if(isset($this->fetchColumn[$column_number]))
								return $this->fetchColumn[$column_number];
						break;
						case LikePDO::FETCH_NUM :
							if(isset($this->fetch[$column_number]))
								return $this->fetch[$column_number];
						break;
						case LikePDO::FETCH_OBJ :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
					}
				}
			}
		}
		else
		{
			if(!$this->fetchColumn)
				$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
			if(isset($this->fetchColumn[$column_number]))
				return $this->fetchColumn[$column_number];
		}
		
		return false;
	}
937697
public function fetchAll($fetchStyle = \PDO::FETCH_BOTH, $fetchArgument = null, $ctorArgs = [])
    {
        return $this->statement->fetchAll($fetchStyle);
    }
1232848
public function fetch($resultSet){
		$row = @sqlite_fetch_array($resultSet, SQLITE_ASSOC);
		if($row){
			$charset = $this->charset === null ? null : $this->charset . '//TRANSLIT';

			$fields = array();
			foreach($row as $key => $val){
				if($charset !== null && is_string($val))
					$val = iconv($this->dbcharset, $charset, $val);
				$key = str_replace(array('[', ']'), '', $key);
				$pos = strpos($key, '.');
				if($pos !== false)
					$key = substr($key, $pos + 1);
				$fields[$key] = $val;
			}
			$row = $fields;
		}
		return $row;
	}
36267
public function fetch($type = parent::FETCH_TYPE_NUM)
    {
        $callback = $this->_callback;
        $row = $this->_statement->fetch($type);

        return $row === false ? $row : $callback($row);
    }
1260219
public static function Fetch($statement, $parameters=array(), $fetchMode=PDO::FETCH_BOTH)
	{
		$db = self::connect($fetchMode);
		
		try
		{
			$query = $db->prepare($statement);
			
			if($query)
			{
				foreach($parameters as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
	
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
				
				$query->execute();
			}
			else
			{
				throw new \Exception("Sorry, there was a problem with the query statement.");
			}
		}
		catch (PDOException $e)
		{
			$exception = "Sorry, there was a problem with the query. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		return $query->fetch($fetchMode);
	}
792087
public function get($sql, $params = array(), $style = PDO::FETCH_ASSOC) {
		$statement = $this->query($sql, $params);

		$results = [];

		while ($row = $statement->fetch($style)) {
			$results[] = $row;
		}

		return $results;
	}
515076
public function nextRowset()
    {
        try {
            return $this->_stmt->nextRowset();
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
        }
    }
1039071
protected function fetchSingleValue($statement, array $params = array(), array $types = array())
    {
        return $this->getDb()->fetchColumn($statement, $params, 0, $types);
    }
1188793
public function last_affected_rows( Statement $statement = NULL ) {

		if ( $statement && ! $this->last_statement === $statement )
			return FALSE;

		return $this->last_affected_rows;
	}
37175
public function fetchStyle($style)
    {
        if (!in_array($style, [Sql::FETCH_ROW, Sql::FETCH_ASSOC, Sql::FETCH_RAW], true)) {
            throw new \Exception("Invalid fetch style specified");
        }
        $this->fetchStyle = $style;
    }
1068381
public function getRow($fetch_style = null)
    {
        if (is_null($fetch_style)) {
            $fetch_style = \PDO::FETCH_ASSOC;
        }
        try {
            return $this->stmt->fetch($fetch_style);
        } catch (\PDOException $e) {
            die("Error: " . $e->getMessage());
        }
    }