/** * Advances the reader to the next row in a result set. * @return array the current row, false if no more row available */ public function read() { //Try..Catch to prevent Function sequence error: -11067 try { return parent::read(); } catch (\Exception $ex) { } return false; }
/** * Advances the reader to the next row in a result set. * @return array the current row, false if no more row available */ public function read() { //Try..Catch to prevent CLI0125E Function sequence error. SQLSTATE=HY010 try { return parent::read(); } catch (\Exception $ex) { } return false; }
/** * Renders next batch of rows. * @param integer $rowsNumber set to -1 to render all rows * @return string */ public function renderChunk($rowsNumber) { /** @var ActiveDataProvider $dataProvider */ $dataProvider = $this->grid->dataProvider; /** @var \yii\db\ActiveQuery $query */ $query = $dataProvider->query; $result = ''; if ($this->rowNumber === 0) { $result .= $this->renderHeader(); } $rowCount = $this->dataReader->getRowCount(); for ($i = 0; $i < $rowsNumber || $rowsNumber === -1; $i++) { $row = $this->dataReader->read(); if ($row === false) { $this->dataReader = null; $result .= $this->renderFooter(); break; } $models = $query->populate([$row]); $result .= $this->renderRow(reset($models), $this->rowNumber++, $rowCount); } return $result; }