[Libreoffice-commits] core.git: dbaccess/source

Julien Nabet serval2412 at yahoo.fr
Mon Mar 28 15:47:17 UTC 2016


 dbaccess/source/ui/querydesign/QueryDesignView.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit df47441ebe0eaf97c2ab7ce854323c18f4d1fe79
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon Mar 28 16:42:33 2016 +0200

    Reduce scope in QueryDesignView.cxx
    
    Change-Id: Ia7f3ee29427dbe103560fe5d831eb40e771b3aba
    Reviewed-on: https://gerrit.libreoffice.org/23568
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 5873904..74ad498 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(),


More information about the Libreoffice-commits mailing list