[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/storage/lisk/ -> LiskRawMigrationIterator.php (source)

   1  <?php
   2  
   3  final class LiskRawMigrationIterator extends PhutilBufferedIterator {
   4  
   5    private $conn;
   6    private $table;
   7    private $cursor;
   8    private $column = 'id';
   9  
  10    public function __construct(AphrontDatabaseConnection $conn, $table) {
  11      $this->conn = $conn;
  12      $this->table = $table;
  13    }
  14  
  15    protected function didRewind() {
  16      $this->cursor = 0;
  17    }
  18  
  19    public function key() {
  20      return idx($this->current(), $this->column);
  21    }
  22  
  23    protected function loadPage() {
  24      $page = queryfx_all(
  25        $this->conn,
  26        'SELECT * FROM %T WHERE %C > %d ORDER BY ID ASC LIMIT %d',
  27        $this->table,
  28        $this->column,
  29        $this->cursor,
  30        $this->getPageSize());
  31  
  32      if ($page) {
  33        $this->cursor = idx(last($page), $this->column);
  34      }
  35  
  36      return $page;
  37    }
  38  
  39  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1