[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - connectivity/source
Lionel Elie Mamane
lionel at mamane.lu
Sat Jun 29 00:46:43 PDT 2013
connectivity/source/parse/sqlnode.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit ca0bbec3c9ce2defee96743cf63227e46cd01c11
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Fri Jun 28 16:12:26 2013 +0200
fdo#66130 correct "skip column name" condition for LIKE predicate
When converting a parse tree to SQL snippet for a predicate in the
context of a column, we skip the name of the same column in 'simple'
cases.
This is used mainly in the "Criterion" lines of query design,
and in the search/filter dialogs of forms, tables, etc.
In all other cases (such as when creating a full SQL command, or for
references to *other* columns than the context one), the column name
must be printed out.
In this respect, the condition "should we skip the column name?" in
impl_parseLikeNodeToString_throw was buggy, and different from the
one in the general case (in impl_parseNodeToString_throw), leading
to generating invalid SQL like:
SELECT foo, bar FROM baz LEFT JOIN qux ON LIKE qux.quu
instead of
SELECT foo, bar FROM baz LEFT JOIN qux ON baz.baa LIKE qux.quu
Change-Id: Ie14fce319554a66feb0fd0ce1a03d947a46a820a
Reviewed-on: https://gerrit.libreoffice.org/4606
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 272deb1..c6799bb 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -756,7 +756,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c
SQLParseNodeParameter aNewParam(rParam);
//aNewParam.bQuote = sal_True; // why setting this to true? @see http://www.openoffice.org/issues/show_bug.cgi?id=75557
- if (bSimple && (!rParam.xField.is() || !columnMatchP(m_aChildren[0], rParam)))
+ if ( !(bSimple && rParam.bPredicate && rParam.xField.is() && SQL_ISRULE(m_aChildren[0],column_ref) && columnMatchP(m_aChildren[0], rParam)) )
m_aChildren[0]->impl_parseNodeToString_throw( rString, aNewParam, bSimple );
const OSQLParseNode* pPart2 = m_aChildren[1];
More information about the Libreoffice-commits
mailing list