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

#192 spaces in order function #205

Merged
merged 3 commits into from
Feb 23, 2017

Conversation

alextech
Copy link
Contributor

@alextech alextech commented Jan 5, 2017

Fixing #192 processing of ORDER BY correctly splits by multiple spaces, but ignores the fact that extra spaces are still there.

… spaces, but ignores the fact that extra spaces are still there.
@@ -651,7 +651,7 @@ protected function processOrder(PlatformInterface $platform, DriverInterface $dr
$v = self::ORDER_ASCENDING;
}
}
if (strtoupper($v) == self::ORDER_DESCENDING) {
if (strtoupper(trim($v)) == self::ORDER_DESCENDING) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any guarantee that $v is already uppercase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is directly from input $select->order('col_name desc') or 'col_name DESC'. That said, case should not matter here just to find if defaults should be applied, so I will switch to case insensitive comparison.

@@ -400,6 +400,13 @@ public function testOrder()
$this->assertEquals(['name ASC', 'age DESC'], $select->getRawState('order'));

$select = new Select;
$select->order('name DESC');
Copy link
Member

Choose a reason for hiding this comment

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

This should be in a new test, not added to the same test.

@ezimuel ezimuel merged commit 5f966f8 into zendframework:master Feb 23, 2017
@ezimuel
Copy link
Contributor

ezimuel commented Feb 23, 2017

@alextech thanks for your contribution!

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.

3 participants