diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2016-03-28 16:42:33 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2016-03-28 15:46:47 +0000 |
commit | df47441ebe0eaf97c2ab7ce854323c18f4d1fe79 (patch) | |
tree | 98b08f733ebf50161062293d125ab09ad4284691 | |
parent | 5e12e630ff0a5c3dcc6d29d9c841044dd710d2a5 (diff) |
Reduce scope in QueryDesignView.cxx
Change-Id: Ia7f3ee29427dbe103560fe5d831eb40e771b3aba
Reviewed-on: https://gerrit.libreoffice.org/23568
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 58739040531d..74ad4988987c 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -718,6 +718,10 @@ namespace OTableFields& _rFieldList, bool bMulti ) { + Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection(); + if(!xConnection.is()) + return false; + OUString aFieldName,aCriteria,aWhereStr,aHavingStr,aWork/*,aOrderStr*/; // print line by line joined with AND sal_uInt16 nMaxCriteria = 0; @@ -727,9 +731,6 @@ namespace { nMaxCriteria = ::std::max<sal_uInt16>(nMaxCriteria,(sal_uInt16)(*aIter)->GetCriteria().size()); } - Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection(); - if(!xConnection.is()) - return false; try { const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); @@ -1372,11 +1373,11 @@ namespace const ::connectivity::OSQLParseNode* pValueExp = pCondition->getChild(0); if (SQL_ISRULE(pValueExp, column_ref ) ) { - OUString aColumnName; OUString aCondition; Reference< XConnection> xConnection = rController.getConnection(); if ( xConnection.is() ) { + OUString aColumnName; Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); // the international doesn't matter I have a string pCondition->parseNodeToPredicateStr(aCondition, @@ -1504,13 +1505,13 @@ namespace SQL_ISRULEOR3(pFunction, extract_exp, fold, char_substring_fct) || SQL_ISRULEOR2(pFunction,length_exp,char_value_fct), "Illegal call!"); - OUString aCondition; - OTableFieldDescRef aDragLeft = new OTableFieldDesc(); - OUString aColumnName; Reference< XConnection> xConnection = rController.getConnection(); if(xConnection.is()) { + OUString aCondition; + OUString aColumnName; + OTableFieldDescRef aDragLeft = new OTableFieldDesc(); Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); pCondition->parseNodeToPredicateStr(aCondition, xConnection, @@ -1711,12 +1712,12 @@ namespace { OUString aName,aCondition; - ::connectivity::OSQLParseNode *pLhs = pCondition->getChild(0); - ::connectivity::OSQLParseNode *pRhs = pCondition->getChild(2); // Field name Reference< XConnection> xConnection = rController.getConnection(); if(xConnection.is()) { + ::connectivity::OSQLParseNode *pLhs = pCondition->getChild(0); + ::connectivity::OSQLParseNode *pRhs = pCondition->getChild(2); pLhs->parseNodeToStr(aName, xConnection, &rController.getParser().getContext(), |