From 705be8fb85e50b8ddff172eaa34c44d9f113b533 Mon Sep 17 00:00:00 2001 From: DarkDef Date: Tue, 18 Aug 2020 20:48:24 +0300 Subject: [PATCH] Fix #18229: Add a flag to set Connection to SyBase mode Co-authored-by: Alexander Makarov --- framework/CHANGELOG.md | 1 + framework/db/Connection.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 95cdda6307..acc5ceafcc 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -5,6 +5,7 @@ Yii Framework 2 Change Log ------------------------ - Bug #18233: Add PHP 8 support (samdark) +- Bug #18229: Add flag for recognize SyBase databases on uses pdo_dblib (darkdef) 2.0.37 August 07, 2020 diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 30c97d9646..d69cb58edf 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -418,6 +418,11 @@ class Connection extends Component * @see enableLogging */ public $enableProfiling = true; + /** + * @var bool If the database connected via pdo_dblib is SyBase. + * @since 2.0.38 + */ + public $isSybase = false; /** * @var Transaction the currently active transaction @@ -720,7 +725,7 @@ class Connection extends Component $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->emulatePrepare); } } - if (in_array($this->getDriverName(), ['mssql', 'dblib'], true)) { + if (!$this->isSybase && in_array($this->getDriverName(), ['mssql', 'dblib'], true)) { $this->pdo->exec('SET ANSI_NULL_DFLT_ON ON'); } if ($this->charset !== null && in_array($this->getDriverName(), ['pgsql', 'mysql', 'mysqli', 'cubrid'], true)) {