处理所有行
@param array $data
@param integer $fetchStyle
@return array
329721
public function parseAll(array $data, int $fetchStyle, $fetchArgument = null, array $ctorArgs = array()): array
    {
        $result = [];
        foreach($data as $row)
        {
            switch($fetchStyle)
            {
                case \PDO::FETCH_COLUMN:
                    $item = $this->fetchParser->parseRow($row, \PDO::FETCH_BOTH);
                    $result[] = $item[$fetchArgument ?? 0] ?? null;
                    break;
                default:
                    $result[] = $this->fetchParser->parseRow($row, $fetchStyle);
                    break;
            }
        }
        return $result;
    }
477659
private function buildFetchCallback( $fetchOptions, $flatten )
    {

        $original = $this->fetchOptions & ( self::TYPE_DETECT | self::TYPE_AGNOSTIC | self::FLATTEN_IF_POSSIBLE | self::FLATTEN_PREVENT | self::STYLE_ASSOC | self::STYLE_NUM );
        $new = $fetchOptions & ( self::TYPE_DETECT | self::TYPE_AGNOSTIC | self::FLATTEN_IF_POSSIBLE | self::FLATTEN_PREVENT | self::STYLE_ASSOC | self::STYLE_NUM );

        // nothing has changed - don't need to change the callback
        if( $original === $new ) {
            return false;
        }

        // only fetch assoc if we're configured for it and we aren't flattening (which would destroy it anyway)
        $this->fetchType = ( $fetchOptions & self::STYLE_ASSOC and !$flatten ) ? PGSQL_ASSOC : PGSQL_NUM;

        // types and keys
        // determine types - this could be enabled to automatically convert types (to something other than a string)
        // off by default as the performance hit has yet to be determined
        if( $fetchOptions & self::TYPE_DETECT ) {

            $typeCallbacks = $this->getFieldTypeCallbacks();
            if( $this->fetchType === PGSQL_ASSOC ) {
                $keys = array_keys( $typeCallbacks );
            } else {
                $keys = range(0, count($typeCallbacks) - 1);
            }

            // flatten
            if( $flatten ) {

                $typeCallback = array_pop( $typeCallbacks );
                $this->fetchCallback = function( $row ) use ( $keys, $typeCallback ) {
                    return call_user_func( $typeCallback, $row[0] );
                };

            } else {

                $this->fetchCallback = function( $row ) use ( $keys, $typeCallbacks ) {
                    return array_combine(
                        $keys,
                        array_map( 'call_user_func', $typeCallbacks, $row )
                    );
                };

            }

        } elseif( $flatten ) {

            $this->fetchCallback = function( $row ) {
                return array_shift( $row );
            };

        } else {

            $this->fetchCallback = function( $row ) {
                return $row;
            };

        }

        return true;

    }
447079
public function pdoQuery($sql = null, $palceholderValues = null, $fetchmode = \PDO::FETCH_ASSOC)
    {
        $pdoStatement = $this->pdoExecute($sql, $palceholderValues);
        if (!$pdoStatement) {
            $data = false;
        }
        $data['result'] = 1;
        $isSelect = false;
        if ($sql != null) {//代表手动执行的sql
            $str = strtolower(substr(trim($sql), 0, 6));
            if ($str == 'select' || strripos($str, 'show') !== false) {
                $isSelect = true;
            }
        }
        if ($this->isSelect() || $isSelect) {
            $data['result'] = $pdoStatement->fetchAll($fetchmode);
            $data['insert_id'] = 0;
            $data['affected_rows'] = 0;
        } else {
            $data['insert_id'] = $this->pdoInsertId();
            $data['affected_rows'] = $pdoStatement->rowCount();
        }
        $pdoStatement->closeCursor();
        $this->clear();
        return $data;
    }
225678
public function query($query, array $binds = [], $fetch = null)
    {
        $request = new StdClass();

        $request->query = $query;
        $request->binds = $binds;

        $connection = $this->getConnection();
        $query      = (string) $request->query;
        $stmt       = $connection->prepare($query);

        //bind some more values
        foreach ($request->binds as $key => $value) {
            $stmt->bindValue($key, $value);
        }

        //PDO Execute
        if (!$stmt->execute()) {
            $error = $stmt->errorInfo();

            //unpack binds for the report
            foreach ($binds as $key => $value) {
                $query = str_replace($key, "'$value'", $query);
            }

            //throw Exception
            throw SqlException::forQueryError($query, $error[2]);
        }

        //clear binds
        $this->binds = [];

        if (!is_callable($fetch)) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

            //log query
            $this->log([
                'query'     => $query,
                'binds'     => $binds,
                'results'   => $results
            ]);

            return $results;
        }

        if ($fetch instanceof Closure) {
            $fetch = $fetch->bindTo($this, get_class($this));
        }

        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            if (call_user_func($fetch, $row, $this) === false) {
                break;
            }
        }

        return $this;
    }
740919
public function fetch($where, $order=array(), $skipNum=0, $fetchNum=-1) {
		$obj = $this->getConnection();
        if (empty($where)) {
            return array();
        }
        foreach ($where as $key => $value) {
            $obj->where($key, $value);
        }
		if (empty($order) == false) {
			foreach ($order as $key => $value) {
				$obj->orderBy($key, $value);
			}
		}
		$limits = array();
		if ($fetchNum > 0) {
			if ($skipNum >= 0) {
				array_push($limits, $skipNum);
			}
			array_push($limits, $fetchNum);
		}
		if (empty($limits)) {
		    return $obj->get($this->getDao()->getTableName());
        }

		return $obj->get($this->getDao()->getTableName(), $limits);
	}
698129
public function doQueryOne($query, $data = null)
	{
		// Prepare and execute the entered query
		$prepQuery = parent::prepare($query);
		$prepQuery->execute($data);
		
		// Since this function is only to return one row, only return the first row
		return $prepQuery->fetch();
	}
875114
public function run($data)
    {
        $this->lastResult = new \DataFilter\Result($this);
        $this->lastResult->check($data);
        return $this->lastResult;
    }
1201171
public function selectRow($struct, $fetch = \PDO::FETCH_ASSOC, $fetchArgs = null): \Generator
    {
        $lifetime = $this->lifetime;
        $rowLifetime = $lifetime ? $lifetime + 5 : 0;

        $key = $this->key('selectRow', [$struct, $fetch, $fetchArgs]);

        $countCache = $this->name($key . '_count')->doGet();
        if (($count = $this->getResult($countCache)) === null) {
            $rows = $this->db->selectRow($struct, $fetch, $fetchArgs);
            if (!$rows->valid()) {
                $this->reset();

                return;
            }

            $index = 0;
            foreach ($rows as $row) {
                yield $row;

                $this->name($key . '_' . (string) $index++)
                    ->expiresAfter($rowLifetime)
                    ->doSave($row);
            }

            $this->name($key . '_count')
                ->expiresAfter($lifetime)
                ->doSave((string) $index);
        } else {
            for ($i = 0; $i < $count; ++$i) {
                yield $this->getResult(
                    $this->name($key . '_' . (string) $i)
                        ->doGet()
                );
            }
        }

        $this->reset();
    }
499102
function fetch() {

        $this->execute();

        list( $index, $row ) = each( $this->rows );

        return $row;

    }
562020
private function format($data)
    {
        $_data = [];
        foreach ($data as $fields => $value) {
            $fields = array_map('trim', explode(',', $fields)); //拆分多个字段一个值，形如['field1,field2'=>value]
            foreach ($fields as $field) {
                $_data[$field] = $value;
            }
        }
        return $_data;
    }
75200
public function fetch($template, $data = array())
    {
        $view = $this->render($template, $data);

        return ($view) ? $view->render() : '';
    }
408269
protected function runPrepared($query, array $bindings, $fetchMode=null)
    {
        return $this->attempt(function () use ($query, $bindings) {

            $statement = $this->prepared($query, $bindings);
            $statement->execute();

            return $statement;
        }, $query);

    }
1186440
public function run($data = []) {
		$filterCollection = ScenarioHelper::forgeCollection($this->filters);
		$data =  ScenarioHelper::runAll($filterCollection, $data);
		return $data;
	}
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());
        }
    }
943701
public function fetch($fetchMode = \PDO::FETCH_BOTH)
    {
        $fetchResult = $this->mysqliStatement->fetch();

        if ($fetchResult === false) {
            throw new MysqliException($this->mysqliStatement->error, $this->mysqliStatement->errno);
        }

        if ($fetchResult === null) {
            return;
        }

        $values = array();
        foreach ($this->result as $value) {
            $values[] = $value;
        }

        if ($fetchMode === null) {
            $fetchMode = $this->defaultFetchMode;
        }

        switch ($fetchMode) {
            case \PDO::FETCH_NUM:
                return $values;
            case \PDO::FETCH_ASSOC:
                return array_combine($this->resultFields, $values);
            case \PDO::FETCH_BOTH:
                $result = array_combine($this->resultFields, $values);
                $result += $values;

                return $result;
            default:
                throw MysqliException::fetchModeNotSupported($fetchMode);
        }
    }
13455
public function fetch($obj_data,$req_data=[]){
		if(!is_array($req_data)){
			$message = 'fetch($obj_data,$req_data),$req_data must be array';
			throw new \yii\web\HttpException(406,$message);
		} 
		$data = '';
		if(is_array($obj_data) && !empty($obj_data)){
			$modules 	= $obj_data[0];
			$file 		= $obj_data[1];
			
			$function 	= $obj_data[2];
			$is_remote 	= $obj_data[3];
			if($modules && $file && $function){
				$ModulesConfig = $this->getModulesConfig();
				if(isset($ModulesConfig[$modules])){
					$moduleConfig = $ModulesConfig[$modules];
					if($is_remote){
						# 远程 
						# 把模块更新的session更新到redis上面，以供其他模块使用
						session_commit();
						$data = $this->getRemotePostData($modules,$moduleConfig,$file,$function,$req_data,$timeout = 20);
					}else{
						# 本地
						$file   = str_replace("/","\\",$file);
						$function_exec = $moduleConfig['moduleDir']."\\o\\".$file;
						$function_exec .= "::".$function;
						$data = \call_user_func_array($function_exec,$req_data);
						$data = CFunc::object_to_array(json_decode($data));
					}
				}else{
					$message = "!! Get Data From Local Module <$modules> Error: Module is not config in Profile.";
					throw new \yii\web\HttpException(406,$message);
					
					
		
				}
			}else{
				$message = "!! Get Data From Local Module <$modules> Error: param:obj_data must is array and count >= 3.";
				throw new \yii\web\HttpException(406,$message);
				
			}
		}else{
			$message = "!! Get Data From Local Module <$modules> Error: param:obj_data is Empty OR is not Array .";
			throw new \yii\web\HttpException(406,$message);
			
			
		}
		return $data;
	}
1111232
private function fetch($getData=true) {
      try{
         $this->connection();
         $this->resultset = $this->id_conn->prepare($this->sql);
         $this->resultset->execute($this->placeholder_data);
         $this->resultset->setFetchMode( $this->{'FETCH_' . strtoupper( $this->type_fetch )} );
         if ( $getData ) {
            $this->rows     = $this->resultset->fetchAll();
            $this->rowCount = $this->resultset->rowCount();
            // while ( $row = $this->resultset->fetch() ) {
            //    $this->rows[] = $row;
            //    $this->rowCount++;
            // }
         }

         $this->get_instance();
      } catch (\PDOException $e) {
         die("Error: " . $e->getMessage() . "<br/>");
      }

      return $this;
   }