mirror of
https://github.com/dg/dibi.git
synced 2025-08-07 22:56:35 +02:00
Sqlite3Driver: for SQLite 3 is not needed to strip [] from column names
This commit is contained in:
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||||||
namespace Dibi\Drivers;
|
namespace Dibi\Drivers;
|
||||||
|
|
||||||
use Dibi;
|
use Dibi;
|
||||||
|
use Dibi\Helpers;
|
||||||
use SQLite3;
|
use SQLite3;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +64,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
throw new Dibi\NotSupportedException('Options dbcharset and charset are not longer supported.');
|
throw new Dibi\NotSupportedException('Options dbcharset and charset are not longer supported.');
|
||||||
}
|
}
|
||||||
|
|
||||||
Dibi\Helpers::alias($config, 'database', 'file');
|
Helpers::alias($config, 'database', 'file');
|
||||||
$this->fmtDate = $config['formatDate'] ?? 'U';
|
$this->fmtDate = $config['formatDate'] ?? 'U';
|
||||||
$this->fmtDateTime = $config['formatDateTime'] ?? 'U';
|
$this->fmtDateTime = $config['formatDateTime'] ?? 'U';
|
||||||
|
|
||||||
@@ -333,18 +334,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
|||||||
*/
|
*/
|
||||||
public function fetch(bool $assoc): ?array
|
public function fetch(bool $assoc): ?array
|
||||||
{
|
{
|
||||||
$row = $this->resultSet->fetchArray($assoc ? SQLITE3_ASSOC : SQLITE3_NUM);
|
return Helpers::false2Null($this->resultSet->fetchArray($assoc ? SQLITE3_ASSOC : SQLITE3_NUM));
|
||||||
if (!$row) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ($row && $assoc) {
|
|
||||||
$tmp = [];
|
|
||||||
foreach ($row as $k => $v) {
|
|
||||||
$tmp[str_replace(['[', ']'], '', $k)] = $v;
|
|
||||||
}
|
|
||||||
return $tmp;
|
|
||||||
}
|
|
||||||
return $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user