mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix postgres / PDO support
This commit is contained in:
parent
ef58799103
commit
cbf9e40115
@ -163,7 +163,7 @@ class PDOConnector extends DBConnector
|
|||||||
$connCollation = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'connection_collation');
|
$connCollation = Config::inst()->get('SilverStripe\ORM\Connect\MySQLDatabase', 'connection_collation');
|
||||||
|
|
||||||
// Set charset if given and not null. Can explicitly set to empty string to omit
|
// Set charset if given and not null. Can explicitly set to empty string to omit
|
||||||
if ($parameters['driver'] !== 'sqlsrv') {
|
if (!in_array($parameters['driver'], ['sqlsrv', 'pgsql'])) {
|
||||||
$charset = isset($parameters['charset'])
|
$charset = isset($parameters['charset'])
|
||||||
? $parameters['charset']
|
? $parameters['charset']
|
||||||
: $connCharset;
|
: $connCharset;
|
||||||
|
@ -104,17 +104,17 @@ class PDODatabaseTest extends SapphireTest
|
|||||||
$this->markTestSkipped('This test requires the current DB connector is PDO');
|
$this->markTestSkipped('This test requires the current DB connector is PDO');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = new SQLUpdate('MySQLDatabaseTest_Data');
|
$query = new SQLUpdate('"MySQLDatabaseTest_Data"');
|
||||||
$query->setAssignments(array('Title' => 'New Title'));
|
$query->setAssignments(array('"Title"' => 'New Title'));
|
||||||
|
|
||||||
// Test update which affects no rows
|
// Test update which affects no rows
|
||||||
$query->setWhere(array('Title' => 'Bob'));
|
$query->setWhere(array('"Title"' => 'Bob'));
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
$this->assertInstanceOf(PDOQuery::class, $result);
|
$this->assertInstanceOf(PDOQuery::class, $result);
|
||||||
$this->assertEquals(0, DB::affected_rows());
|
$this->assertEquals(0, DB::affected_rows());
|
||||||
|
|
||||||
// Test update which affects some rows
|
// Test update which affects some rows
|
||||||
$query->setWhere(array('Title' => 'First Item'));
|
$query->setWhere(array('"Title"' => 'First Item'));
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
$this->assertInstanceOf(PDOQuery::class, $result);
|
$this->assertInstanceOf(PDOQuery::class, $result);
|
||||||
$this->assertEquals(1, DB::affected_rows());
|
$this->assertEquals(1, DB::affected_rows());
|
||||||
|
Loading…
Reference in New Issue
Block a user