diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2015-01-28 18:24:40 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-02-23 10:33:32 +0100 |
commit | 6a330f8ae8639e13391b1129a6428b9602e989a4 (patch) | |
tree | 8d72ace494c4627b8a2620ea90769816997f4d04 /dbaccess | |
parent | 04c1ce2f65da7ebad1b1e918e90e4c03177d480d (diff) |
Query Design: use correct name for columns that come from another query.
Change-Id: I25b4ccdc2f50ba89687e1f4c871f286251a28e21
Reviewed-on: https://gerrit.libreoffice.org/14344
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 97b11a21b64f4bac5af67819549f6e384d61c086)
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 33bab8fe526e..880cafcb74e9 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -3080,10 +3080,23 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pE } OUString sTest(_sCriteria); + // _rxColumn, if it is a "lookup" column, not a computed column, + // is guaranteed to be the column taken from the *source* of the column, + // that is either a table or another query. + // _rxColumn is *not* taken from the columns of the query we are constructing + // (and rightfully so, since it may not be part of these columns; SELECT A FROM t WHERE B = foo) + // If it is a computed column, we just constructed it above, with same Name and RealName. + // In all cases, we should use the "external" name of the column, not the "RealName"; + // the latter is the name that the column had in the source of the source query. + // An example: we are designing "SELECT A, B FROM q WHERE C='foo'" + // q itself is query "SELECT aye AS A, bee as B, cee as C FROM t" + // We are currently treating the entry "C='foo'" + // Then _rxColumn has Name "C" and RealName "cee". We should *obviously* use "C", not "cee". OSQLParseNode* pParseNode = rParser.predicateTree( _rsErrorMessage, sTest, static_cast<OQueryController&>(getController()).getNumberFormatter(), - _rxColumn); + _rxColumn, + false); return pParseNode; } |