Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / Adapter / Driver / IbmDb2 / Result.php
blob711917c510e249d5b5c135a78793f34ae93d3e81
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Db\Adapter\Driver\IbmDb2;
12 use Zend\Db\Adapter\Driver\ResultInterface;
13 use Zend\Db\Adapter\Exception;
15 class Result implements ResultInterface
17 /**
18 * @var resource
20 protected $resource;
22 /**
23 * @var int
25 protected $position = 0;
27 /**
28 * @var bool
30 protected $currentComplete = false;
32 /**
33 * @var mixed
35 protected $currentData = null;
37 /**
38 * @var mixed
40 protected $generatedValue = null;
42 /**
43 * @param resource $resource
44 * @param mixed $generatedValue
45 * @return Result
47 public function initialize($resource, $generatedValue = null)
49 $this->resource = $resource;
50 $this->generatedValue = $generatedValue;
51 return $this;
54 /**
55 * (PHP 5 &gt;= 5.0.0)<br/>
56 * Return the current element
57 * @link http://php.net/manual/en/iterator.current.php
58 * @return mixed Can return any type.
60 public function current()
62 if ($this->currentComplete) {
63 return $this->currentData;
66 $this->currentData = db2_fetch_assoc($this->resource);
67 return $this->currentData;
70 /**
71 * @return mixed
73 public function next()
75 $this->currentData = db2_fetch_assoc($this->resource);
76 $this->currentComplete = true;
77 $this->position++;
78 return $this->currentData;
81 /**
82 * @return int|string
84 public function key()
86 return $this->position;
89 /**
90 * @return bool
92 public function valid()
94 return ($this->currentData !== false);
97 /**
98 * (PHP 5 &gt;= 5.0.0)<br/>
99 * Rewind the Iterator to the first element
100 * @link http://php.net/manual/en/iterator.rewind.php
101 * @return void Any returned value is ignored.
103 public function rewind()
105 if ($this->position > 0) {
106 throw new Exception\RuntimeException(
107 'This result is a forward only result set, calling rewind() after moving forward is not supported'
110 $this->currentData = db2_fetch_assoc($this->resource);
111 $this->currentComplete = true;
112 $this->position = 1;
116 * Force buffering
118 * @return void
120 public function buffer()
122 return null;
126 * Check if is buffered
128 * @return bool|null
130 public function isBuffered()
132 return false;
136 * Is query result?
138 * @return bool
140 public function isQueryResult()
142 return (db2_num_fields($this->resource) > 0);
146 * Get affected rows
148 * @return int
150 public function getAffectedRows()
152 return db2_num_rows($this->resource);
156 * Get generated value
158 * @return mixed|null
160 public function getGeneratedValue()
162 return $this->generatedValue;
166 * Get the resource
168 * @return mixed
170 public function getResource()
172 return $this->resource;
176 * Get field count
178 * @return int
180 public function getFieldCount()
182 return db2_num_fields($this->resource);
186 * @return null|int
188 public function count()
190 return null;