mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix merge regressions / errors
This commit is contained in:
parent
8331171f2c
commit
51df4df9f1
@ -298,7 +298,7 @@ class FixtureBlueprint {
|
||||
DB::manipulate(array(
|
||||
$table => array(
|
||||
"command" => "update", "id" => $obj->ID,
|
||||
"fields" => array($fieldName => is_string($value) ? "'$value'" : $value)
|
||||
"fields" => array($fieldName => $value)
|
||||
)
|
||||
));
|
||||
$obj->$fieldName = $value;
|
||||
|
@ -576,8 +576,13 @@ class SQLSelect extends SQLConditionalExpression {
|
||||
* @return int
|
||||
*/
|
||||
public function count( $column = null) {
|
||||
// we can't clear the select if we're relying on its output by a HAVING clause
|
||||
if(!empty($this->having)) {
|
||||
$records = $this->execute();
|
||||
return $records->numRecords();
|
||||
}
|
||||
// Choose a default column
|
||||
if($column == null) {
|
||||
elseif($column == null) {
|
||||
if($this->groupby) {
|
||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||
} else {
|
||||
|
@ -596,7 +596,7 @@ class SQLQueryTest extends SapphireTest {
|
||||
public function testSelect() {
|
||||
$query = new SQLQuery('"Title"', '"MyTable"');
|
||||
$query->addSelect('"TestField"');
|
||||
$this->assertEquals(
|
||||
$this->assertSQLEquals(
|
||||
'SELECT "Title", "TestField" FROM "MyTable"',
|
||||
$query->sql()
|
||||
);
|
||||
@ -606,7 +606,7 @@ class SQLQueryTest extends SapphireTest {
|
||||
'Field' => '"Field"',
|
||||
'AnotherAlias' => '"AnotherField"'
|
||||
));
|
||||
$this->assertEquals(
|
||||
$this->assertSQLEquals(
|
||||
'SELECT "Field", "AnotherField" AS "AnotherAlias" FROM "MyTable"',
|
||||
$query->sql()
|
||||
);
|
||||
@ -615,7 +615,7 @@ class SQLQueryTest extends SapphireTest {
|
||||
$query->addSelect(array(
|
||||
'Relevance' => "MATCH (Title, MenuTitle) AGAINST ('Two as One')"
|
||||
));
|
||||
$this->assertEquals(
|
||||
$this->assertSQLEquals(
|
||||
'SELECT "Field", "AnotherField" AS "AnotherAlias", MATCH (Title, MenuTitle) AGAINST (' .
|
||||
'\'Two as One\') AS "Relevance" FROM "MyTable"',
|
||||
$query->sql()
|
||||
|
Loading…
Reference in New Issue
Block a user