PageRenderTime 38ms CodeModel.GetById 35ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/core/db/DbPgResult.php

http://zoop.googlecode.com/
PHP | 56 lines | 47 code | 9 blank | 0 comment | 4 complexity | 7d4c89b199407bc22728869344abdb09 MD5 | raw file
 1<?php
 2class DbPgResult extends DbResultSet
 3{
 4	private $cur;
 5	private $max;
 6	
 7	function __construct($link, $res)
 8	{
 9		parent::__construct($link, $res);
10		$this->cur = 0;
11		$this->max = pg_num_rows($this->res) - 1;
12	}
13	
14	function numRows()
15	{
16		return $this->max + 1;
17	}
18	
19	function rewind()
20	{
21		$this->cur = 0;
22	}
23	
24	function current()
25	{
26		if($this->max == -1)
27			return false;
28		return pg_fetch_assoc($this->res, $this->cur);
29	}
30	
31	function key()
32	{
33		return $this->cur;
34	}
35	
36	function next()
37	{
38		$this->cur++;
39		if($this->cur > $this->max)
40			return false;
41		return pg_fetch_assoc($this->res, $this->cur);
42	}
43	
44	function valid()
45	{
46		if($this->cur > $this->max)
47			return false;
48		
49		return true;
50	}
51	
52	function affectedRows()
53	{
54		return pg_affected_rows($this->res);
55	}
56}