From 7e539f8f4f1d21a977ef42207e423c29838094bc Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 9 Sep 2009 17:01:30 +0200 Subject: [PATCH] typo changes --- dibi/drivers/firebird.php | 1 + dibi/libs/DibiResult.php | 220 ++++++++++++++++++++------------------ 2 files changed, 119 insertions(+), 102 deletions(-) diff --git a/dibi/drivers/firebird.php b/dibi/drivers/firebird.php index b67fa009..0e55f1b1 100644 --- a/dibi/drivers/firebird.php +++ b/dibi/drivers/firebird.php @@ -822,6 +822,7 @@ class DibiProcedureException extends DibiException } + /** * Gets the exception severity. * @return string diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index d1223140..5b762177 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -98,6 +98,40 @@ class DibiResult extends DibiObject implements IDataSource + /** + * Frees the resources allocated for this result set. + * @return void + */ + final public function free() + { + if ($this->driver !== NULL) { + $this->driver->free(); + $this->driver = $this->meta = NULL; + } + } + + + + /** + * Safe access to property $driver. + * @return IDibiDriver + * @throws InvalidStateException + */ + private function getDriver() + { + if ($this->driver === NULL) { + throw new InvalidStateException('Result-set was released from memory.'); + } + + return $this->driver; + } + + + + /********************* rows ****************d*g**/ + + + /** * Moves cursor position without fetching row. * @param int the 0-based cursor pos to seek to @@ -111,6 +145,17 @@ class DibiResult extends DibiObject implements IDataSource + /** + * Required by the Countable interface. + * @return int + */ + final public function count() + { + return $this->getDriver()->getRowCount(); + } + + + /** * Returns the number of rows in a result set. * @return int @@ -124,7 +169,7 @@ class DibiResult extends DibiObject implements IDataSource /** * Returns the number of rows in a result set. Alias for getRowCount(). - * @return int + * @deprecated */ final public function rowCount() { @@ -134,56 +179,19 @@ class DibiResult extends DibiObject implements IDataSource /** - * Frees the resources allocated for this result set. - * @return void + * Required by the IteratorAggregate interface. + * @param int offset + * @param int limit + * @return DibiResultIterator */ - final public function free() + final public function getIterator($offset = NULL, $limit = NULL) { - if ($this->driver !== NULL) { - $this->driver->free(); - $this->driver = NULL; - } + return new DibiResultIterator($this, $offset, $limit); } - /** - * Qualifiy each column name with the table name? - * @param bool - * @return DibiResult provides a fluent interface - * @throws DibiException - */ - final public function setWithTables($val) - { - if ($val) { - $cols = array(); - foreach ($this->getMeta() as $info) { - $name = $info['fullname']; - if (isset($cols[$name])) { - $fix = 1; - while (isset($cols[$name . '#' . $fix])) $fix++; - $name .= '#' . $fix; - } - $cols[$name] = TRUE; - } - $this->withTables = array_keys($cols); - - } else { - $this->withTables = FALSE; - } - return $this; - } - - - - /** - * Qualifiy each key with the table name? - * @return bool - */ - final public function getWithTables() - { - return (bool) $this->withTables; - } + /********************* fetching rows ****************d*g**/ @@ -439,6 +447,50 @@ class DibiResult extends DibiObject implements IDataSource + /********************* meta info ****************d*g**/ + + + + /** + * Qualifiy each column name with the table name? + * @param bool + * @return DibiResult provides a fluent interface + * @throws DibiException + */ + final public function setWithTables($val) + { + if ($val) { + $cols = array(); + foreach ($this->getMeta() as $info) { + $name = $info['fullname']; + if (isset($cols[$name])) { + $fix = 1; + while (isset($cols[$name . '#' . $fix])) $fix++; + $name .= '#' . $fix; + } + $cols[$name] = TRUE; + } + $this->withTables = array_keys($cols); + + } else { + $this->withTables = FALSE; + } + return $this; + } + + + + /** + * Qualifiy each key with the table name? + * @return bool + */ + final public function getWithTables() + { + return (bool) $this->withTables; + } + + + /** * Define column type. * @param string column @@ -548,6 +600,23 @@ class DibiResult extends DibiObject implements IDataSource + /** + * Meta lazy initialization. + * @return array + */ + private function getMeta() + { + if ($this->meta === NULL) { + $this->meta = $this->getDriver()->getColumnsMeta(); + foreach ($this->meta as & $row) { + $row['type'] = DibiColumnInfo::detectType($row['nativetype']); + } + } + return $this->meta; + } + + + /** * Gets an array of meta informations about columns. * @return array of DibiColumnInfo @@ -578,6 +647,10 @@ class DibiResult extends DibiObject implements IDataSource + /********************* misc tools ****************d*g**/ + + + /** * Displays complete result-set as HTML table for debug purposes. * @return void @@ -613,61 +686,4 @@ class DibiResult extends DibiObject implements IDataSource } } - - - /** - * Required by the IteratorAggregate interface. - * @param int offset - * @param int limit - * @return DibiResultIterator - */ - final public function getIterator($offset = NULL, $limit = NULL) - { - return new DibiResultIterator($this, $offset, $limit); - } - - - - /** - * Required by the Countable interface. - * @return int - */ - final public function count() - { - return $this->getRowCount(); - } - - - - /** - * Safe access to property $driver. - * @return IDibiDriver - * @throws InvalidStateException - */ - private function getDriver() - { - if ($this->driver === NULL) { - throw new InvalidStateException('Result-set was released from memory.'); - } - - return $this->driver; - } - - - - /** - * Meta lazy initialization. - * @return array - */ - private function getMeta() - { - if ($this->meta === NULL) { - $this->meta = $this->getDriver()->getColumnsMeta(); - foreach ($this->meta as & $row) { - $row['type'] = DibiColumnInfo::detectType($row['nativetype']); - } - } - return $this->meta; - } - }