summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-09-04 15:39:21 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-09-04 15:39:38 +0200
commita62a046df3302e5763b7a568ac25032bb1501d44 (patch)
treeafa5e7de1ce841b1b51d541eeab5c9299ff653d4 /connectivity
parent6803fc4cc80ce1944d98535b3c4395c90ca61880 (diff)
fdo#55703 automagically use IS NULL fo 'null' in query design.
Change-Id: I31bcec74a786df016d994834e6146fb7a76e72cb
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/parse/sqlbison.y70
-rw-r--r--connectivity/source/parse/sqlnode.cxx1
2 files changed, 47 insertions, 24 deletions
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y
index 5d2e1838fb81..44f962e52205 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 19f8257c4daf..c20ad8608c82 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" }
};