/** * write the query output to the file(s) */ public function write() { $this->startFile(); $i = 0; while ($line = $this->streamer->next()) { fwrite($this->handle, $line); if ($this->atMaxLineSize(++$i)) { $this->goToNextFile(); } } $this->endFile(); }