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:
@@ -145,7 +145,6 @@ class dibi
|
||||
/**#@+
|
||||
* Configuration options
|
||||
*/
|
||||
const RESULT_WITH_TABLES = 'resultWithTables'; // for MySQL
|
||||
const ROW_CLASS = 'rowClass';
|
||||
const ASC = 'ASC', DESC = 'DESC';
|
||||
/**#@-*/
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user