? Pending
Related to # 10817

User tests: Successful: Unsuccessful:

avatar fruppel
fruppel
7 Apr 2015

There is an issues with the __toString method of the class JDatabaseQuery.

unionAll did not work as expected, ie the string you entered into the unionAll method was never appended to the SQL query

Steps to reproduce the issue

$db = JFactory::getDbo();
$query = $db->getQuery(true);

echo $query
    ->select('*')
    ->from('#__table_1')
    ->unionAll(
        $db->getQuery(true)
        ->select('*')
        ->from('#__table_2')
    );

Expected result

The code above should output "SELECT * FROM #__table_1 UNION ALL ( SELECT * FROM #__table_2)".

Actual result

At the moment the output is "SELECT * FROM #__table_1".

Additional comments

This PR also fixes a problem with the ordering of UNION and ORDER BY. You can see how to reproduce and test it here: #6789.

avatar fruppel fruppel - open - 7 Apr 2015
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2015
Labels Added: ?
avatar fruppel
fruppel - comment - 7 Apr 2015

It does not seem to be a problem with the tests, but rather with my file. Travis keeps telling me

FILE: ...home/travis/build/joomla/joomla-cms/libraries/joomla/database/query.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
382 | ERROR | Whitespace found at end of line
387 | ERROR | Whitespace found at end of line

I can't find any whitespaces at these lines.
I edited the file completely on Github, may this be the problem? Sorry - it's my first PR. Any help would be appreciated.

avatar zero-24
zero-24 - comment - 7 Apr 2015

@fruppel i have just send you a PR to fix the whitespaces :smile:

fruppel#1

avatar fruppel fruppel - reference | - 7 Apr 15
avatar fruppel
fruppel - comment - 7 Apr 2015

Thank you @zero-24 :+1:
I think I found the problem with the whitespaces. The Github editor adds tabs on each new (empty) line which I have to remove next time.

avatar zero-24
zero-24 - comment - 7 Apr 2015

I think I found the problem with the whitespaces. The Github editor adds tabs on each new (empty) line which I have to remove next time.

Exact :smile:

avatar zero-24 zero-24 - change - 7 Apr 2015
Category Libraries
avatar fruppel
fruppel - comment - 16 Apr 2015

Changed the order of "ORDER" and "UNION/UNION ALL" to fix #6789

avatar fruppel fruppel - change - 16 Apr 2015
Title
unionAll is not working as expected
Problems with JDatabaseQuery __toString
avatar locii
locii - comment - 16 Apr 2015

Confirmed that this pull requests fixes the related issue in #6789.

avatar sovainfo
sovainfo - comment - 16 Apr 2015

Object to applying order to the set. See #3565

avatar fruppel fruppel - change - 17 Apr 2015
Title
Problems with JDatabaseQuery __toString
Problem with JDatabaseQuery __toString
avatar fruppel
fruppel - comment - 17 Apr 2015

@sovainfo ok I understand the problem. I reverted my last commit

avatar RonakParmar RonakParmar - test_item - 13 Jun 2016 - Tested unsuccessfully
avatar RonakParmar
RonakParmar - comment - 13 Jun 2016

I have tested this item ? unsuccessfully on 8d6bb9f

Still not fix for #6789.

Already fixed in #4127 PR.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6693.

avatar csthomas
csthomas - comment - 4 Nov 2016

Can we close it as it is fixed at #10817

avatar roland-d roland-d - change - 4 Nov 2016
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-11-04 12:17:50
Closed_By roland-d
Rel_Number 0 10817
Relation Type Related to
avatar roland-d
roland-d - comment - 4 Nov 2016

Closed in favor of #10817


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/6693.

avatar roland-d roland-d - edited - 4 Nov 2016
avatar roland-d roland-d - close - 4 Nov 2016

Add a Comment

Login with GitHub to post a comment