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(
|
DB::manipulate(array(
|
||||||
$table => array(
|
$table => array(
|
||||||
"command" => "update", "id" => $obj->ID,
|
"command" => "update", "id" => $obj->ID,
|
||||||
"fields" => array($fieldName => is_string($value) ? "'$value'" : $value)
|
"fields" => array($fieldName => $value)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$obj->$fieldName = $value;
|
$obj->$fieldName = $value;
|
||||||
|
@ -576,8 +576,13 @@ class SQLSelect extends SQLConditionalExpression {
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function count( $column = null) {
|
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
|
// Choose a default column
|
||||||
if($column == null) {
|
elseif($column == null) {
|
||||||
if($this->groupby) {
|
if($this->groupby) {
|
||||||
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
$column = 'DISTINCT ' . implode(", ", $this->groupby);
|
||||||
} else {
|
} else {
|
||||||
|
@ -596,7 +596,7 @@ class SQLQueryTest extends SapphireTest {
|
|||||||
public function testSelect() {
|
public function testSelect() {
|
||||||
$query = new SQLQuery('"Title"', '"MyTable"');
|
$query = new SQLQuery('"Title"', '"MyTable"');
|
||||||
$query->addSelect('"TestField"');
|
$query->addSelect('"TestField"');
|
||||||
$this->assertEquals(
|
$this->assertSQLEquals(
|
||||||
'SELECT "Title", "TestField" FROM "MyTable"',
|
'SELECT "Title", "TestField" FROM "MyTable"',
|
||||||
$query->sql()
|
$query->sql()
|
||||||
);
|
);
|
||||||
@ -606,7 +606,7 @@ class SQLQueryTest extends SapphireTest {
|
|||||||
'Field' => '"Field"',
|
'Field' => '"Field"',
|
||||||
'AnotherAlias' => '"AnotherField"'
|
'AnotherAlias' => '"AnotherField"'
|
||||||
));
|
));
|
||||||
$this->assertEquals(
|
$this->assertSQLEquals(
|
||||||
'SELECT "Field", "AnotherField" AS "AnotherAlias" FROM "MyTable"',
|
'SELECT "Field", "AnotherField" AS "AnotherAlias" FROM "MyTable"',
|
||||||
$query->sql()
|
$query->sql()
|
||||||
);
|
);
|
||||||
@ -615,7 +615,7 @@ class SQLQueryTest extends SapphireTest {
|
|||||||
$query->addSelect(array(
|
$query->addSelect(array(
|
||||||
'Relevance' => "MATCH (Title, MenuTitle) AGAINST ('Two as One')"
|
'Relevance' => "MATCH (Title, MenuTitle) AGAINST ('Two as One')"
|
||||||
));
|
));
|
||||||
$this->assertEquals(
|
$this->assertSQLEquals(
|
||||||
'SELECT "Field", "AnotherField" AS "AnotherAlias", MATCH (Title, MenuTitle) AGAINST (' .
|
'SELECT "Field", "AnotherField" AS "AnotherAlias", MATCH (Title, MenuTitle) AGAINST (' .
|
||||||
'\'Two as One\') AS "Relevance" FROM "MyTable"',
|
'\'Two as One\') AS "Relevance" FROM "MyTable"',
|
||||||
$query->sql()
|
$query->sql()
|
||||||
|
Loading…
Reference in New Issue
Block a user