mirror of
https://github.com/dg/dibi.git
synced 2025-02-22 09:53:11 +01:00
Sqlite3Driver: for SQLite 3 is not needed to strip [] from column names
This commit is contained in:
parent
cb067a6bec
commit
47179d5632
@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
namespace Dibi\Drivers;
|
||||
|
||||
use Dibi;
|
||||
use Dibi\Helpers;
|
||||
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.');
|
||||
}
|
||||
|
||||
Dibi\Helpers::alias($config, 'database', 'file');
|
||||
Helpers::alias($config, 'database', 'file');
|
||||
$this->fmtDate = $config['formatDate'] ?? 'U';
|
||||
$this->fmtDateTime = $config['formatDateTime'] ?? 'U';
|
||||
|
||||
@ -333,18 +334,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
||||
*/
|
||||
public function fetch(bool $assoc): ?array
|
||||
{
|
||||
$row = $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;
|
||||
return Helpers::false2Null($this->resultSet->fetchArray($assoc ? SQLITE3_ASSOC : SQLITE3_NUM));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user