Skip to content

Commit

Permalink
SqlsrvDriver: workaround for "Driver's SQLSetConnectAttr failed on OD…
Browse files Browse the repository at this point in the history
…BC <=13" bug
  • Loading branch information
dg committed Mar 10, 2021
1 parent d09b462 commit 40ad77c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Dibi/Drivers/SqlsrvDriver.php
Expand Up @@ -63,11 +63,13 @@ public function __construct(array $config)
$options['UID'] = (string) $options['UID'];
$options['Database'] = (string) $options['Database'];

sqlsrv_configure('WarningsReturnAsErrors', 0);
$this->connection = sqlsrv_connect($config['host'], $options);
sqlsrv_configure('WarningsReturnAsErrors', 1);
}

if (!is_resource($this->connection)) {
$info = sqlsrv_errors();
$info = sqlsrv_errors(SQLSRV_ERR_ERRORS);
throw new Dibi\DriverException($info[0]['message'], $info[0]['code']);
}
$this->version = sqlsrv_server_info($this->connection)['SQLServerVersion'];
Expand Down

0 comments on commit 40ad77c

Please sign in to comment.