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

DibiResult: removed setWithTables & 'resultWithTables' configuration option (BC break!)

This commit is contained in:
David Grudl
2010-02-24 04:59:00 +01:00
parent a2323271d4
commit 4054bdc231
2 changed files with 2 additions and 57 deletions

View File

@@ -145,7 +145,6 @@ class dibi
/**#@+
* Configuration options
*/
const RESULT_WITH_TABLES = 'resultWithTables'; // for MySQL
const ROW_CLASS = 'rowClass';
const ASC = 'ASC', DESC = 'DESC';
/**#@-*/

View File

@@ -42,9 +42,6 @@ class DibiResult extends DibiObject implements IDataSource
/** @var DibiResultInfo */
private $meta;
/** @var array user keys */
private $keys;
/** @var bool Already fetched? Used for allowance for first seek(0) */
private $fetched = FALSE;
@@ -60,10 +57,6 @@ class DibiResult extends DibiObject implements IDataSource
public function __construct($driver, $config)
{
$this->driver = $driver;
if (!empty($config[dibi::RESULT_WITH_TABLES])) {
$this->setWithTables(TRUE);
}
}
@@ -207,15 +200,8 @@ class DibiResult extends DibiObject implements IDataSource
*/
final public function fetch()
{
if ($this->keys === NULL) {
$row = $this->getDriver()->fetch(TRUE);
if (!is_array($row)) return FALSE;
} else {
$row = $this->getDriver()->fetch(FALSE);
if (!is_array($row)) return FALSE;
$row = array_combine($this->keys, $row);
}
$row = $this->getDriver()->fetch(TRUE);
if (!is_array($row)) return FALSE;
$this->fetched = TRUE;
@@ -495,46 +481,6 @@ class DibiResult extends DibiObject implements IDataSource
/**
* 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->getInfo()->getColumns() as $col) {
$name = $col->getFullname();
if (isset($cols[$name])) {
$fix = 1;
while (isset($cols[$name . '#' . $fix])) $fix++;
$name .= '#' . $fix;
}
$cols[$name] = TRUE;
}
$this->keys = array_keys($cols);
} else {
$this->keys = NULL;
}
return $this;
}
/**
* Qualifiy each key with the table name?
* @return bool
*/
final public function getWithTables()
{
return (bool) $this->keys;
}
/**
* Define column type.
* @param string column