[Libreoffice-commits] core.git: 2 commits - connectivity/source

Lionel Elie Mamane lionel at mamane.lu
Fri Jun 28 07:25:47 PDT 2013


 connectivity/source/parse/sqlnode.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2cfb215de60eaa253766237c711f4f714dedb3c7
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri Jun 28 16:25:11 2013 +0200

    impl_parseLikeNodeToString_throw should be called only on a like_predicate
    
    Change-Id: I3597aadab8b13703ed7b7731d530320c4e5999be

diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 9b31519..5b034e2 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -747,6 +747,7 @@ void OSQLParseNode::impl_parseTableRangeNodeToString_throw(OUStringBuffer& rStri
 void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam, bool bSimple ) const
 {
     SAL_INFO( "connectivity.parse", "parse Ocke.Janssen at sun.com OSQLParseNode::impl_parseLikeNodeToString_throw" );
+    assert(SQL_ISRULE(this,like_predicate));
     OSL_ENSURE(count() == 2,"count != 2: Prepare for GPF");
 
     const OSQLParseNode* pEscNode = NULL;
commit ede7f6ae5fa9fd7a466066de74941a09117cc9a0
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

diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 07c2daf..9b31519 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -755,7 +755,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 && !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