diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2011-10-30 13:34:01 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2011-10-30 13:37:02 +0100 |
commit | 6efdf794cdd0c979ffead0e5051309f711b23997 (patch) | |
tree | 9ba7eebdcd64e9d85c7543ef6547204824996cc1 /dbaccess | |
parent | add const (diff) | |
download | core-6efdf794cdd0c979ffead0e5051309f711b23997.tar.gz core-6efdf794cdd0c979ffead0e5051309f711b23997.zip |
factorise multiple SQL_ISRULEOR2 implementations into one
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 10 |
2 files changed, 12 insertions, 24 deletions
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 |