Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fixes #5162 #5855

Closed
wants to merge 4 commits into from
Closed

Conversation

samsonasik
Copy link
Contributor

Fixes #5162

@weierophinney
Copy link
Member

@ralphschindler Can you update with a milestone, please?

$sqlStr46 = '( SELECT "foo".* FROM "foo" WHERE a = b ) UNION ALL ( SELECT "bar".* FROM "bar" WHERE c = d ) ORDER BY "a" DESC';
$internalTests46 = array(
'processCombine' => array('UNION ALL', 'SELECT "bar".* FROM "bar" WHERE c = d')
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ralphschindler $select46 <- this test case will conflict with test case on #5643 , if #5643 will going to be merge after it, please let me know and I will update the test case or if any suggestion to make no conflict ( new function or something)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not what I would expect the output to be. If you're doing this:

$select46->combine($select46b, Select::COMBINE_UNION, 'ALL')->order(array('a DESC'));

I am expecting that you're applying an order to $select46, which is the first SELECT. So I'd be expecting, by reading your code, you are attempting to produce this:

( SELECT "foo".* FROM "foo" WHERE a = b ORDER BY "a" DESC ) UNION ALL ( SELECT "bar".* FROM "bar" WHERE c = d )

@samsonasik
Copy link
Contributor Author

@ralphschindler I think you're right. I revert the change to Zend\Db\Sql\Select.php and only leave the updated test as your suggestion at #5162 for it. I think the test case is still needed to prove it ;).

Thank you.

@ralphschindler ralphschindler added this to the 2.3.0 milestone Mar 11, 2014
@ralphschindler
Copy link
Member

Can you rebase develop (with yesterdays changes to Select.php) and point this PR to develop for me? If you can do that soon, I can get this in without having to use a mergetool ;)

@ralphschindler
Copy link
Member

I think this would be test 48 now

ralphschindler pushed a commit that referenced this pull request Mar 11, 2014
Fixed CS
Merge branch 'combineunionorder' of git://github.com/samsonasik/zf2 into hotfix/5855

* 'combineunionorder' of git://github.com/samsonasik/zf2:
  fix T_OBJECT_OPERATOR on php 5.3
  fix array syntax for php 5.3
  undo change on Select.php, and leave the test case
  Fixes #5162

Conflicts:
	tests/ZendTest/Db/Sql/SelectTest.php
ralphschindler pushed a commit that referenced this pull request Mar 11, 2014
Merge branch 'hotfix/5855' into develop

* hotfix/5855:
  fix T_OBJECT_OPERATOR on php 5.3
  fix array syntax for php 5.3
  undo change on Select.php, and leave the test case
  Fixes #5162
@ralphschindler
Copy link
Member

Merged to develop (the merging was actually not hard ;) )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Union + Order = broken
4 participants