Upgrade to 3.6.1
This commit is contained in:
@@ -212,6 +212,12 @@ class Database
|
||||
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||
|
||||
// TODO: behavior without this attribute would be preferrable
|
||||
// (actual types instead of all strings) but would be a breaking change
|
||||
if ($this->type === 'sqlite') {
|
||||
$this->connection->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
|
||||
}
|
||||
|
||||
// store the connection
|
||||
static::$connections[$this->id] = $this;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ class Db
|
||||
|
||||
// try to connect with the default
|
||||
// connection settings if no params are set
|
||||
$defaults = [
|
||||
$params ??= [
|
||||
'type' => Config::get('db.type', 'mysql'),
|
||||
'host' => Config::get('db.host', 'localhost'),
|
||||
'user' => Config::get('db.user', 'root'),
|
||||
@@ -54,7 +54,6 @@ class Db
|
||||
'prefix' => Config::get('db.prefix', ''),
|
||||
'port' => Config::get('db.port', '')
|
||||
];
|
||||
$params = $params ?? $defaults;
|
||||
|
||||
return static::$connection = new Database($params);
|
||||
}
|
||||
|
@@ -290,9 +290,10 @@ abstract class Sql
|
||||
// add keys
|
||||
foreach ($inner['keys'] as $key => $columns) {
|
||||
// quote each column name and make a list string out of the column names
|
||||
$columns = implode(', ', array_map(function ($name) {
|
||||
return $this->quoteIdentifier($name);
|
||||
}, $columns));
|
||||
$columns = implode(', ', array_map(
|
||||
fn ($name) => $this->quoteIdentifier($name),
|
||||
$columns
|
||||
));
|
||||
|
||||
if ($key === 'primary') {
|
||||
$key = 'PRIMARY KEY';
|
||||
@@ -526,7 +527,7 @@ abstract class Sql
|
||||
];
|
||||
}
|
||||
|
||||
$limit = $limit ?? '18446744073709551615';
|
||||
$limit ??= '18446744073709551615';
|
||||
|
||||
$offsetBinding = $this->bindingName('offset');
|
||||
$limitBinding = $this->bindingName('limit');
|
||||
|
@@ -82,9 +82,10 @@ class Sqlite extends Sql
|
||||
$keys = [];
|
||||
foreach ($inner['keys'] as $key => $columns) {
|
||||
// quote each column name and make a list string out of the column names
|
||||
$columns = implode(', ', array_map(function ($name) {
|
||||
return $this->quoteIdentifier($name);
|
||||
}, $columns));
|
||||
$columns = implode(', ', array_map(
|
||||
fn ($name) => $this->quoteIdentifier($name),
|
||||
$columns
|
||||
));
|
||||
|
||||
if ($key === 'primary') {
|
||||
$inner['query'] .= ',' . PHP_EOL . 'PRIMARY KEY (' . $columns . ')';
|
||||
|
Reference in New Issue
Block a user