summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/inc/connectivity/sqlnode.hxx7
-rw-r--r--connectivity/source/parse/sqliterator.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx26
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx10
4 files changed, 19 insertions, 28 deletions
diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx
index 932970273bb3..1d8381a9a321 100644
--- a/connectivity/inc/connectivity/sqlnode.hxx
+++ b/connectivity/inc/connectivity/sqlnode.hxx
@@ -464,6 +464,13 @@ namespace connectivity
// utilities to query for a specific rule, token or punctuation
#define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::eRule))
+ #define SQL_ISRULEOR2(pParseNode, e1, e2) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
+ #define SQL_ISRULEOR3(pParseNode, e1, e2, e3) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e3)))
#define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token)
#define SQL_ISTOKENOR2(pParseNode, tok0, tok1) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 ))
#define SQL_ISTOKENOR3(pParseNode, tok0, tok1, tok2) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok2 ))
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx
index 0c3b6a0cd958..325523c9f8e4 100644
--- a/connectivity/source/parse/sqliterator.cxx
+++ b/connectivity/source/parse/sqliterator.cxx
@@ -51,10 +51,6 @@
#include "diagnose_ex.h"
#include <rtl/logfile.hxx>
-#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
-
using namespace ::comphelper;
using namespace ::connectivity;
using namespace ::connectivity::sdbcx;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 45bce3e50c2f..455b343e30fa 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -76,10 +76,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
-
// here we define our functions used in the anonymous namespace to get our header file smaller
// please look at the book LargeScale C++ to know why
namespace
@@ -1432,10 +1428,9 @@ namespace
_pSelectionBrw->AddCondition(aDragLeft, aCondition, nLevel,bAddOrOnOneLine);
}
}
- else if(SQL_ISRULEOR2(pValueExp,general_set_fct ,set_fct_spec) ||
- SQL_ISRULEOR2(pValueExp,position_exp,extract_exp) ||
- SQL_ISRULEOR2(pValueExp,fold,char_substring_fct) ||
- SQL_ISRULEOR2(pValueExp,length_exp,char_value_fct))
+ else if(SQL_ISRULEOR3(pValueExp, general_set_fct, set_fct_spec, position_exp) ||
+ SQL_ISRULEOR3(pValueExp, extract_exp, fold, char_substring_fct) ||
+ SQL_ISRULEOR2(pValueExp, length_exp, char_value_fct))
{
AddFunctionCondition( _pView,
_pSelectionBrw,
@@ -1528,10 +1523,10 @@ namespace
OSQLParseNode* pFunction = pCondition->getChild(0);
- OSL_ENSURE(SQL_ISRULEOR2(pFunction,general_set_fct ,set_fct_spec) ||
- SQL_ISRULEOR2(pFunction,position_exp,extract_exp) ||
- SQL_ISRULEOR2(pFunction,fold,char_substring_fct) ||
- SQL_ISRULEOR2(pFunction,length_exp,char_value_fct),"Illegal call!");
+ OSL_ENSURE(SQL_ISRULEOR3(pFunction, general_set_fct, set_fct_spec, position_exp) ||
+ SQL_ISRULEOR3(pFunction, extract_exp, fold, char_substring_fct) ||
+ SQL_ISRULEOR2(pFunction,length_exp,char_value_fct),
+ "Illegal call!");
::rtl::OUString aCondition;
OTableFieldDescRef aDragLeft = new OTableFieldDesc();
@@ -2196,10 +2191,9 @@ namespace
eErrorCode = _pView->InsertField(aInfo, sal_True, bFirstField);
bFirstField = sal_False;
}
- else if(SQL_ISRULEOR2(pColumnRef,general_set_fct ,set_fct_spec) ||
- SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) ||
- SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) ||
- SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct))
+ else if(SQL_ISRULEOR3(pColumnRef, general_set_fct, set_fct_spec, position_exp) ||
+ SQL_ISRULEOR3(pColumnRef, extract_exp, fold, char_substring_fct) ||
+ SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct))
{
::rtl::OUString aColumns;
pColumnRef->parseNodeToPredicateStr(aColumns,
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 1b2328d8f955..8b9330e0b7cd 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -71,11 +71,6 @@ const String g_strZero = String::CreateFromAscii("0");
#define HANDLE_ID 0
#define HANDLE_COLUMN_WITDH 70
-#define SQL_ISRULEOR2(pParseNode, e1,e2) ((pParseNode)->isRule() && (\
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
- (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
-
-
// -----------------------------------------------------------------------------
namespace
{
@@ -860,9 +855,8 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes
getDesignView()->fillFunctionInfo(pColumnRef,sFunction,aSelEntry);
- if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) ||
- SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) ||
- SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
+ if( SQL_ISRULEOR3(pColumnRef, position_exp, extract_exp, fold) ||
+ SQL_ISRULEOR3(pColumnRef, char_substring_fct, length_exp, char_value_fct) )
// a calculation has been found ( can be calc and function )
{
// now parse the whole statement