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

Norbert Thiebaud nthiebaud at gmail.com
Thu Sep 4 06:40:09 PDT 2014


 connectivity/source/parse/sqlbison.y        |   70 ++++++++++++++++++----------
 connectivity/source/parse/sqlnode.cxx       |    1 
 include/connectivity/sqlnode.hxx            |    1 
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |    2 
 4 files changed, 49 insertions(+), 25 deletions(-)

New commits:
commit a62a046df3302e5763b7a568ac25032bb1501d44
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Thu Sep 4 15:39:21 2014 +0200

    fdo#55703 automagically use IS NULL fo 'null' in query design.
    
    Change-Id: I31bcec74a786df016d994834e6146fb7a76e72cb

diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 5d2e183..44f962e 100644
--- a/connectivity/source/parse/sqlbison.y
+++ b/connectivity/source/parse/sqlbison.y
@@ -645,6 +645,7 @@ manipulative_statement_list:
 ***/
 
 sql_not:
+/* vide */
 	{$$ = SQL_NEW_RULE;}
 	|	SQL_TOKEN_NOT
 	;
@@ -1091,28 +1092,49 @@ boolean_primary:
 		}
 	|	row_value_constructor_elem  /*[^')' ',']*/
 		{
-    		if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// boolean_primary: rule 3
-			{
-			    $$ = SQL_NEW_RULE;
-			    sal_Int16 nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1);
-			    if(nErg == 1)
-			    {
-				    OSQLParseNode* pTemp = $$;
-				    $$ = pTemp->removeAt((sal_uInt32)0);
-				    delete pTemp;
-			    }
-			    else
-			    {
-				    delete $$;
-				    if(nErg)
-					    YYERROR;
-				    else
-					    YYABORT;
-			    }
-			}
-			else
-				YYERROR;
-		}
+                    if(xxx_pGLOBAL_SQLPARSER->inPredicateCheck())// boolean_primary: rule 3
+                    {
+                        $$ = SQL_NEW_RULE;
+                        sal_Int16 nErg = 0;
+                        if ( SQL_ISTOKEN( $1, NULL))
+                        {
+                            OSQLParseNode* pColumnRef = newNode("", SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::column_ref));
+                            pColumnRef->append(newNode(xxx_pGLOBAL_SQLPARSER->getFieldName(),SQL_NODE_NAME));
+                            OSQLParseNode* pTFN = new OSQLInternalNode("", SQL_NODE_RULE,OSQLParser::RuleID(OSQLParseNode::test_for_null));
+                            pTFN->append(pColumnRef);
+
+                            OSQLParseNode* pNPP2 = new OSQLInternalNode("", SQL_NODE_RULE, OSQLParser::RuleID(OSQLParseNode::null_predicate_part_2));
+                            pNPP2->append(new OSQLInternalNode("", SQL_NODE_KEYWORD, SQL_TOKEN_IS));
+                            pNPP2->append(new OSQLInternalNode("", SQL_NODE_RULE, OSQLParser::RuleID(OSQLParseNode::sql_not)));
+                            pNPP2->append(new OSQLInternalNode("", SQL_NODE_KEYWORD, SQL_TOKEN_NULL));
+                            pTFN->append(pNPP2);
+
+                            $$->append(pTFN);
+
+                            nErg = 1;
+                        }
+                        else
+                        {
+                            nErg = xxx_pGLOBAL_SQLPARSER->buildComparsionRule($$,$1);
+                        }
+                        if(nErg == 1)
+                        {
+                            OSQLParseNode* pTemp = $$;
+                            $$ = pTemp->removeAt((sal_uInt32)0);
+                            delete pTemp;
+                        }
+                        else
+                        {
+                            delete $$;
+                            if(nErg)
+                                YYERROR;
+                            else
+                                YYABORT;
+                        }
+                    }
+                    else
+                        YYERROR;
+                }
 	;
 parenthesized_boolean_value_expression:
    '(' search_condition ')'
@@ -4746,8 +4768,8 @@ sal_Int16 OSQLParser::buildStringNodes(OSQLParseNode*& pLiteral)
 
 sal_Int16 OSQLParser::buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral)
 {
-	OSQLParseNode* pComp = new OSQLInternalNode("=", SQL_NODE_EQUAL);
-	return buildPredicateRule(pAppend,pLiteral,pComp);
+    OSQLParseNode* pComp = new OSQLInternalNode("=", SQL_NODE_EQUAL);
+    return buildPredicateRule(pAppend,pLiteral,pComp);
 }
 
 
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 19f8257..c20ad86 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1448,6 +1448,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
             { OSQLParseNode::character_string_type, "character_string_type" },
             { OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" },
             { OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" },
+            { OSQLParseNode::null_predicate_part_2, "null_predicate_part_2" },
             { OSQLParseNode::cast_spec, "cast_spec" },
             { OSQLParseNode::window_function, "window_function" }
         };
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
index af0b606..980ec62 100644
--- a/include/connectivity/sqlnode.hxx
+++ b/include/connectivity/sqlnode.hxx
@@ -229,6 +229,7 @@ namespace connectivity
             character_string_type,
             other_like_predicate_part_2,
             between_predicate_part_2,
+            null_predicate_part_2,
             cast_spec,
             window_function,
             rule_count             // last value
commit 6803fc4cc80ce1944d98535b3c4395c90ca61880
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Thu Sep 4 15:31:53 2014 +0200

    fix unit test breakage on mac due to magic number
    
    Change-Id: Idca4f6faafaaa169a7efb6d85d11f0b78dbfc085

diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 7dfa7ad..fc1bcfd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -191,7 +191,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlRectangleRelsize, "dml-rectangle-relsize.docx")
     // This was around 19560, as we did not read wp14:pctHeight for
     // drawinglayer shapes and the fallback data was invalid.
     OString aMessage("Height is only " + OString::number(getShape(1)->getSize().Height));
-    CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), getShape(1)->getSize().Height >= 20973);
+    CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), getShape(1)->getSize().Height >= 20967);
 
     // This was around 0: relative size of 0% was imported as 0, not "fall back to absolute size".
     CPPUNIT_ASSERT(getShape(2)->getSize().Height > 300);


More information about the Libreoffice-commits mailing list