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)) {