示例#1
0
文件: Row.php 项目: smasty/neevo
 /**
  * Creates a row instance.
  * @param array $data
  * @param Result $result
  */
 public function __construct(array $data, Result $result)
 {
     $this->data = $data;
     $this->connection = $result->getConnection();
     $this->table = $result->getTable();
     $this->primary = $result->getPrimaryKey();
     $this->frozen = !$this->table || !$this->primary || !isset($this->data[$this->primary]);
 }
示例#2
0
文件: Manager.php 项目: smasty/neevo
 /**
  * SELECT statement factory.
  * @param string|array $columns Array or comma-separated list (optional)
  * @param string $table
  * @return Result fluent interface
  */
 public function select($columns = null, $table = null)
 {
     $result = new Result($this->connection, $columns, $table);
     foreach ($this->observers as $observer) {
         $result->attachObserver($observer, $this->observers->getInfo());
     }
     return $result;
 }
示例#3
0
 /**
  * Implementation of SeekableIterator.
  * @param int $offset
  * @throws OutOfRangeException|DriverException
  */
 public function seek($offset)
 {
     try {
         $this->result->seek($offset);
     } catch (DriverException $e) {
         throw $e;
     } catch (NeevoException $e) {
         throw new OutOfRangeException("Cannot seek to offset {$offset}.", null, $e);
     }
     $this->row = $this->result->fetch();
     $this->pointer = $offset;
 }
示例#4
0
 public function testParseSourceJoinSubqueryAutoAlias()
 {
     $sq1 = new Result($this->connection, 'tab2');
     $sq2 = new Result($this->connection, 'tab3');
     $result = new Result($this->connection, 'tab1');
     $this->assertEquals("`tab1`\nLEFT JOIN (\n\tSELECT *\n\tFROM `tab2`\n) `_join_1` ON `foo`" . "\nLEFT JOIN (\n\tSELECT *\n\tFROM `tab3`\n) `_join_2` ON `bar`", $this->parser($result->leftJoin($sq1, ':foo')->leftJoin($sq2, ':bar'))->parseSource());
 }
示例#5
0
 public function testExplain()
 {
     $this->assertEquals(DummyResult::$dataExplain, $this->result->explain());
 }
示例#6
0
文件: RowTest.php 项目: smasty/neevo
 protected function setUp()
 {
     $this->result = new Result(new Connection('driver=Dummy'), 'author');
     $this->row = new Row($this->result->getConnection()->getDriver()->getRow(0), $this->result);
 }