mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6612 from ajoneil/dblib-pdo
Fixes for using dblib PDO driver.
This commit is contained in:
commit
9e3df22b32
@ -156,9 +156,10 @@ class PDOConnector extends DBConnector {
|
|||||||
if(!isset($charset)) {
|
if(!isset($charset)) {
|
||||||
$charset = $connCharset;
|
$charset = $connCharset;
|
||||||
}
|
}
|
||||||
$options = array(
|
$options = array();
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $charset . ' COLLATE ' . $connCollation
|
if($parameters['driver'] == 'mysql') {
|
||||||
);
|
$options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $charset . ' COLLATE ' . $connCollation;
|
||||||
|
}
|
||||||
if(self::is_emulate_prepare()) {
|
if(self::is_emulate_prepare()) {
|
||||||
$options[PDO::ATTR_EMULATE_PREPARES] = true;
|
$options[PDO::ATTR_EMULATE_PREPARES] = true;
|
||||||
}
|
}
|
||||||
@ -178,7 +179,7 @@ class PDOConnector extends DBConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getVersion() {
|
public function getVersion() {
|
||||||
return $this->pdoConnection->getAttribute(PDO::ATTR_SERVER_VERSION);
|
return @$this->pdoConnection->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function escapeString($value) {
|
public function escapeString($value) {
|
||||||
@ -227,14 +228,14 @@ class PDOConnector extends DBConnector {
|
|||||||
$result = $this->pdoConnection->exec($sql);
|
$result = $this->pdoConnection->exec($sql);
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
if ($result !== false) {
|
if($this->hasError($this->pdoConnection)) {
|
||||||
return $this->rowCount = $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->databaseError($this->getLastError(), $errorLevel, $sql);
|
$this->databaseError($this->getLastError(), $errorLevel, $sql);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->rowCount = $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function query($sql, $errorLevel = E_USER_ERROR) {
|
public function query($sql, $errorLevel = E_USER_ERROR) {
|
||||||
$this->beforeQuery($sql);
|
$this->beforeQuery($sql);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user