mirror of
https://github.com/dg/dibi.git
synced 2025-08-10 08:04:32 +02:00
Connection: added option [result][normalize] [Closes #367]
This commit is contained in:
@@ -45,6 +45,7 @@ class Connection implements IConnection
|
|||||||
* Connection options: (see driver-specific options too)
|
* Connection options: (see driver-specific options too)
|
||||||
* - lazy (bool) => if true, connection will be established only when required
|
* - lazy (bool) => if true, connection will be established only when required
|
||||||
* - result (array) => result set options
|
* - result (array) => result set options
|
||||||
|
* - normalize => normalizes result fields (default: true)
|
||||||
* - formatDateTime => date-time format
|
* - formatDateTime => date-time format
|
||||||
* empty for decoding as Dibi\DateTime (default)
|
* empty for decoding as Dibi\DateTime (default)
|
||||||
* "..." formatted according to given format, see https://www.php.net/manual/en/datetime.format.php
|
* "..." formatted according to given format, see https://www.php.net/manual/en/datetime.format.php
|
||||||
@@ -401,7 +402,7 @@ class Connection implements IConnection
|
|||||||
*/
|
*/
|
||||||
public function createResultSet(ResultDriver $resultDriver): Result
|
public function createResultSet(ResultDriver $resultDriver): Result
|
||||||
{
|
{
|
||||||
return (new Result($resultDriver))
|
return (new Result($resultDriver, $this->config['result']['normalize'] ?? true))
|
||||||
->setFormats($this->formats);
|
->setFormats($this->formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,10 +41,12 @@ class Result implements IDataSource
|
|||||||
private $formats = [];
|
private $formats = [];
|
||||||
|
|
||||||
|
|
||||||
public function __construct(ResultDriver $driver)
|
public function __construct(ResultDriver $driver, bool $normalize = true)
|
||||||
{
|
{
|
||||||
$this->driver = $driver;
|
$this->driver = $driver;
|
||||||
$this->detectTypes();
|
if ($normalize) {
|
||||||
|
$this->detectTypes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user