BUGFIX: ORDER BY in nested query does not work under MSSQL, remove

This commit is contained in:
Mateusz Uzdowski 2010-10-08 00:56:52 +00:00
parent a2e998ab79
commit cec87a859e
2 changed files with 9 additions and 7 deletions

View File

@ -93,13 +93,11 @@ class SubmittedFormReportField extends FormField {
foreach($submissions as $submission) {
$inClause[] = $submission->ID;
}
$csvHeaders = DB::query("SELECT DISTINCT \"Name\" , \"Title\" FROM
((
SELECT \"Name\" , \"Title\" FROM \"SubmittedFormField\"
LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\"
WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ")
ORDER BY \"SubmittedFormField\".\"ParentID\" DESC, \"SubmittedFormField\".\"ID\"
) AS \"tmp\")");
$csvHeaders = DB::query("SELECT \"Name\" , \"Title\" FROM \"SubmittedFormField\"
LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\"
WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ")
ORDER BY \"SubmittedFormField\".\"ParentID\" DESC, \"SubmittedFormField\".\"ID\"
");
if ($csvHeaders) $csvHeaders = $csvHeaders->map();
if($submissions && $submissions->exists()) {

View File

@ -69,6 +69,10 @@ class SubmittedFormTest extends FunctionalTest {
// check the number of records in the export
$this->assertEquals(count($data), 12);
$this->assertEquals(count($data[1]), 4);
$this->assertEquals(count($data[2]), 4);
$this->assertEquals(count($data[11]), 4);
$this->assertEquals($data[1][1], 'quote " and comma , test');
$this->assertEquals($data[1][2], 'Value 1');
$this->assertEquals($data[2][1], 'Value 2');