Fix merge regressions / errors

This commit is contained in:
Damian Mooyman 2015-06-02 20:19:12 +12:00
parent 8331171f2c
commit 51df4df9f1
3 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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()