diff options
Diffstat (limited to 'dbaccess/source/ui/querydesign/QueryDesignView.cxx')
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 80 |
1 files changed, 34 insertions, 46 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 33c8c725e..c290cbb79 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: QueryDesignView.cxx,v $ - * $Revision: 1.96.8.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -186,11 +183,6 @@ namespace sal_Bool bHaving, bool _bAddOrOnOneLine); - void fillFunctionInfo( OQueryDesignView* _pView - ,const ::connectivity::OSQLParseNode* pNode - ,const ::rtl::OUString& sFunctionTerm - ,OTableFieldDescRef& aInfo); - //------------------------------------------------------------------------------ ::rtl::OUString quoteTableAlias(sal_Bool _bQuote, const ::rtl::OUString& _sAliasName, const ::rtl::OUString& _sQuote) { @@ -2180,35 +2172,6 @@ namespace return eErrorCode; } //------------------------------------------------------------------------------ - void fillFunctionInfo( OQueryDesignView* _pView - ,const ::connectivity::OSQLParseNode* pNode - ,const ::rtl::OUString& sFunctionTerm - ,OTableFieldDescRef& aInfo) - { - // get the type out of the funtion name - OQueryController& rController = static_cast<OQueryController&>(_pView->getController()); - sal_Int32 nDataType = DataType::DOUBLE; - ::rtl::OUString sFieldName = sFunctionTerm; - OSQLParseNode* pFunctionName = pNode->getChild(0); - if ( !SQL_ISPUNCTUATION(pFunctionName,"{") ) - { - if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) ) - pFunctionName = pFunctionName->getChild(0); - - ::rtl::OUString sFunctionName = pFunctionName->getTokenValue(); - if ( !sFunctionName.getLength() ) - sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8); - - nDataType = OSQLParser::getFunctionReturnType( - sFunctionName - ,&rController.getParser().getContext()); - } - aInfo->SetDataType(nDataType); - aInfo->SetFieldType(TAB_NORMAL_FIELD); - aInfo->SetField(sFieldName); - aInfo->SetTabWindow(NULL); - } - //------------------------------------------------------------------------------ SqlParseError InstallFields(OQueryDesignView* _pView, const ::connectivity::OSQLParseNode* pNode, OJoinTableView::OTableWindowMap* pTabList ) @@ -2216,7 +2179,7 @@ namespace if( pNode==0 || !SQL_ISRULE(pNode,select_statement)) return eNoSelectStatement; - ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2); + ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2); // selection sal_Bool bFirstField = sal_True; // bei der Initialisierung muß auf alle Faelle das erste Feld neu aktiviert werden SqlParseError eErrorCode = eOk; @@ -2247,9 +2210,6 @@ namespace if ( SQL_ISRULE(pColumnRef,derived_column) ) { - if ( !xConnection.is() ) - break; - ::rtl::OUString aColumnAlias(rController.getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein pColumnRef = pColumnRef->getChild(0); OTableFieldDescRef aInfo = new OTableFieldDesc(); @@ -2330,7 +2290,7 @@ namespace } else { - fillFunctionInfo(_pView,pColumnRef,aColumns,aInfo); + _pView->fillFunctionInfo(pColumnRef,aColumns,aInfo); aInfo->SetFieldAlias(aColumnAlias); } @@ -2451,7 +2411,7 @@ namespace _pView->getLocale(), static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()), &rController.getParser().getContext()); - fillFunctionInfo(_pView,pArgument,sCondition,aDragLeft); + _pView->fillFunctionInfo(pArgument,sCondition,aDragLeft); aDragLeft->SetFunctionType(FKT_OTHER); aDragLeft->SetOrderDir(eOrderDir); aDragLeft->SetVisible(sal_False); @@ -2483,7 +2443,7 @@ namespace const ::connectivity::OSQLParseNode* pSelectRoot ) { SqlParseError eErrorCode = eOk; - if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf()) + if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf()) // opt_group_by_clause { OQueryController& rController = static_cast<OQueryController&>(_pView->getController()); ::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2); @@ -2518,7 +2478,7 @@ namespace &rController.getParser().getContext(), sal_True, sal_True); // quote is to true because we need quoted elements inside the function - fillFunctionInfo(_pView,pArgument,sGroupByExpression,aDragInfo); + _pView->fillFunctionInfo(pArgument,sGroupByExpression,aDragInfo); aDragInfo->SetFunctionType(FKT_OTHER); aDragInfo->SetGroupBy(sal_True); aDragInfo->SetVisible(sal_False); @@ -3242,4 +3202,32 @@ bool OQueryDesignView::initByParseIterator( ::dbtools::SQLExceptionInfo* _pError } return eErrorCode == eOk; } +//------------------------------------------------------------------------------ +void OQueryDesignView::fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode + ,const ::rtl::OUString& sFunctionTerm + ,OTableFieldDescRef& aInfo) +{ + // get the type out of the funtion name + OQueryController& rController = static_cast<OQueryController&>(getController()); + sal_Int32 nDataType = DataType::DOUBLE; + ::rtl::OUString sFieldName = sFunctionTerm; + OSQLParseNode* pFunctionName = pNode->getChild(0); + if ( !SQL_ISPUNCTUATION(pFunctionName,"{") ) + { + if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) ) + pFunctionName = pFunctionName->getChild(0); + + ::rtl::OUString sFunctionName = pFunctionName->getTokenValue(); + if ( !sFunctionName.getLength() ) + sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8); + + nDataType = OSQLParser::getFunctionReturnType( + sFunctionName + ,&rController.getParser().getContext()); + } + aInfo->SetDataType(nDataType); + aInfo->SetFieldType(TAB_NORMAL_FIELD); + aInfo->SetField(sFieldName); + aInfo->SetTabWindow(NULL); +} // ----------------------------------------------------------------------------- |