From 665c6998649e7b8c99afcaa0e133b71f4a83e917 Mon Sep 17 00:00:00 2001 From: Angel Date: Fri, 17 Jun 2022 11:51:35 +0800 Subject: [PATCH] [update] the default commands can be overridden by the connection command option. #1048 --- src/Medoo.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Medoo.php b/src/Medoo.php index 00cdb440..1d775670 100644 --- a/src/Medoo.php +++ b/src/Medoo.php @@ -234,9 +234,7 @@ public function __construct(array $options) } $option = $options['option'] ?? []; - $commands = (isset($options['command']) && is_array($options['command'])) ? - $options['command'] : - []; + $commands = []; switch ($this->type) { @@ -469,6 +467,10 @@ public function __construct(array $options) ); } + if (isset($options['command']) && is_array($options['command'])) { + $commands = array_merge($commands, $options['command']); + } + foreach ($commands as $value) { $this->pdo->exec($value); }