1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

typo changes

This commit is contained in:
David Grudl
2009-09-09 17:01:30 +02:00
parent 532ed3a316
commit 7e539f8f4f
2 changed files with 119 additions and 102 deletions

View File

@@ -822,6 +822,7 @@ class DibiProcedureException extends DibiException
}
/**
* Gets the exception severity.
* @return string

View File

@@ -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;
}
}