? Success

User tests: Successful: Unsuccessful:

avatar eshiol
eshiol
24 Oct 2016

fixes JDatabaseQuery __toString
UNION ALL
UNION + ORDER BY

avatar eshiol eshiol - open - 24 Oct 2016
avatar eshiol eshiol - change - 24 Oct 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Oct 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 24 Oct 2016
Category Libraries
avatar jeckodevelopment jeckodevelopment - change - 24 Oct 2016
Labels Added: ?
avatar eshiol
eshiol - comment - 24 Oct 2016

If you use union and order, you will always get the error:

"Incorrect usage of UNION and ORDER BY"
$query1 = JFactory::getDbo()->getQuery(true);
$query1->select(array('id', 'title'))->from('#__content')->where('title LIKE ' . $query1->q($query1->e('A', true) . '%', false));
$query2 = JFactory::getDbo()->getQuery(true);
$query2->select(array('id', 'title'))->from('#__content')->where('title LIKE ' . $query1->q($query1->e('B', true) . '%', false));
$query1->union($query2)->order('id DESC');
JFactory::getDbo()->setQuery($query1)->execute();

unionAll doesn't work properly. The string you entered into the unionAll method was never appended to the SQL query

$query1 = JFactory::getDbo()->getQuery(true);
$query1->select(array('id', 'title'))->from('#__content')->where('title LIKE ' . $query1->q($query1->e('A', true) . '%', false));
$query2 = JFactory::getDbo()->getQuery(true);
$query2->select(array('id', 'title'))->from('#__content')->where('title LIKE ' . $query1->q($query1->e('B', true) . '%', false));
echo $query1->unionAll($query2);

Expected result

The code above should output "SELECT id, title FROM #__content WHERE title LIKE 'A%' UNION ALL (SELECT id, title FROM #__content WHERE title LIKE 'B%')".

Actual result

At the moment the output is "SELECT id, title FROM #__content WHERE title LIKE 'A%'".

avatar jeckodevelopment jeckodevelopment - change - 24 Oct 2016
Labels Removed: ?
avatar infograf768
infograf768 - comment - 26 Oct 2016

looks lik this pr is messed up.

avatar alikon
alikon - comment - 26 Oct 2016

yes files changed have nothing in common with the pr description

avatar eshiol
eshiol - comment - 26 Oct 2016

I've merged two pull requests, but I don't know why. The file to pull is the first one with the id: 22a262d
Do you think I have to close this pull request and open a new one?

avatar alikon
alikon - comment - 26 Oct 2016

yes should be the better move

avatar eshiol
eshiol - comment - 26 Oct 2016

the bug is solved #10817

avatar eshiol eshiol - close - 26 Oct 2016
avatar eshiol eshiol - change - 26 Oct 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-10-26 17:22:33
Closed_By eshiol

Add a Comment

Login with GitHub to post a comment