argument('db').'-'.date("Y-m-d").'.db3'); $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true)); $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING); $dbh->beginTransaction(); $query = "INSERT INTO channel ( id , name , type , language , summary , owner_id , setting,created_at ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? )"; try{ $stmt = $dbh->prepare($query); }catch(PDOException $e){ Log::info($e); return 1; } $bar = $this->output->createProgressBar(Channel::where('status',30)->count()); foreach (Channel::where('status',30) ->select(['uid','name','type','lang', 'summary','owner_uid','setting','created_at']) ->cursor() as $row) { $currData = array( $row->uid, $row->name, $row->type, $row->lang, $row->summary, $row->owner_uid, $row->setting, $row->created_at, ); $stmt->execute($currData); $bar->advance(); } $dbh->commit(); $bar->finish(); Log::debug('task export offline channel-table finished'); return 0; } }