1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-07 14:46:50 +02:00

DibiResult: added getResultDriver()

This commit is contained in:
David Grudl
2012-01-19 00:12:08 +01:00
parent ea0d6d02ba
commit c7b9a91fc2

View File

@@ -71,12 +71,11 @@ class DibiResult extends DibiObject implements IDataSource
/** /**
* Returns the result set resource. * @deprecated
* @return mixed
*/ */
final public function getResource() final public function getResource()
{ {
return $this->getDriver()->getResultResource(); return $this->getResultDriver()->getResultResource();
} }
@@ -100,7 +99,7 @@ class DibiResult extends DibiObject implements IDataSource
* @return IDibiResultDriver * @return IDibiResultDriver
* @throws RuntimeException * @throws RuntimeException
*/ */
private function getDriver() final public function getResultDriver()
{ {
if ($this->driver === NULL) { if ($this->driver === NULL) {
throw new RuntimeException('Result-set was released from memory.'); throw new RuntimeException('Result-set was released from memory.');
@@ -123,7 +122,7 @@ class DibiResult extends DibiObject implements IDataSource
*/ */
final public function seek($row) final public function seek($row)
{ {
return ($row !== 0 || $this->fetched) ? (bool) $this->getDriver()->seek($row) : TRUE; return ($row !== 0 || $this->fetched) ? (bool) $this->getResultDriver()->seek($row) : TRUE;
} }
@@ -134,7 +133,7 @@ class DibiResult extends DibiObject implements IDataSource
*/ */
final public function count() final public function count()
{ {
return $this->getDriver()->getRowCount(); return $this->getResultDriver()->getRowCount();
} }
@@ -145,7 +144,7 @@ class DibiResult extends DibiObject implements IDataSource
*/ */
final public function getRowCount() final public function getRowCount()
{ {
return $this->getDriver()->getRowCount(); return $this->getResultDriver()->getRowCount();
} }
@@ -157,7 +156,7 @@ class DibiResult extends DibiObject implements IDataSource
final public function rowCount() final public function rowCount()
{ {
trigger_error(__METHOD__ . '() is deprecated; use count($res) or $res->getRowCount() instead.', E_USER_WARNING); trigger_error(__METHOD__ . '() is deprecated; use count($res) or $res->getRowCount() instead.', E_USER_WARNING);
return $this->getDriver()->getRowCount(); return $this->getResultDriver()->getRowCount();
} }
@@ -211,7 +210,7 @@ class DibiResult extends DibiObject implements IDataSource
*/ */
final public function fetch() final public function fetch()
{ {
$row = $this->getDriver()->fetch(TRUE); $row = $this->getResultDriver()->fetch(TRUE);
if (!is_array($row)) { if (!is_array($row)) {
return FALSE; return FALSE;
} }
@@ -228,7 +227,7 @@ class DibiResult extends DibiObject implements IDataSource
*/ */
final public function fetchSingle() final public function fetchSingle()
{ {
$row = $this->getDriver()->fetch(TRUE); $row = $this->getResultDriver()->fetch(TRUE);
if (!is_array($row)) { if (!is_array($row)) {
return FALSE; return FALSE;
} }
@@ -486,7 +485,7 @@ class DibiResult extends DibiObject implements IDataSource
{ {
$cache = DibiColumnInfo::getTypeCache(); $cache = DibiColumnInfo::getTypeCache();
try { try {
foreach ($this->getDriver()->getResultColumns() as $col) { foreach ($this->getResultDriver()->getResultColumns() as $col) {
$this->types[$col['name']] = $cache->{$col['nativetype']}; $this->types[$col['name']] = $cache->{$col['nativetype']};
} }
} catch (DibiNotSupportedException $e) {} } catch (DibiNotSupportedException $e) {}
@@ -535,7 +534,7 @@ class DibiResult extends DibiObject implements IDataSource
} }
} elseif ($type === dibi::BINARY) { } elseif ($type === dibi::BINARY) {
$row[$key] = $this->getDriver()->unescape($value, $type); $row[$key] = $this->getResultDriver()->unescape($value, $type);
} }
} }
} }
@@ -603,7 +602,7 @@ class DibiResult extends DibiObject implements IDataSource
public function getInfo() public function getInfo()
{ {
if ($this->meta === NULL) { if ($this->meta === NULL) {
$this->meta = new DibiResultInfo($this->getDriver()); $this->meta = new DibiResultInfo($this->getResultDriver());
} }
return $this->meta; return $this->meta;
} }