Tag: cws_src680_dba24d
User: oj      
Date: 2007-11-26 07:31:10+0000
Modified:
   dba/dbaccess/source/ui/querydesign/QueryDesignView.cxx

Log:
 #i83810# parse statement and compress it

File Changes:

Directory: /dba/dbaccess/source/ui/querydesign/
===============================================

File [changed]: QueryDesignView.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/QueryDesignView.cxx?r1=1.88.2.1&r2=1.88.2.2
Delta lines:  +24 -3
--------------------
--- QueryDesignView.cxx 2007-11-22 13:20:23+0000        1.88.2.1
+++ QueryDesignView.cxx 2007-11-26 07:31:07+0000        1.88.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: QueryDesignView.cxx,v $
  *
- *  $Revision: 1.88.2.1 $
+ *  $Revision: 1.88.2.2 $
  *
- *  last change: $Author: oj $ $Date: 2007/11/22 13:20:23 $
+ *  last change: $Author: oj $ $Date: 2007/11/26 07:31:07 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -2986,7 +2986,7 @@
        // ----------------- Tabellenliste aufbauen ----------------------
 
        const ::std::vector<OTableConnection*>* pConnList = 
m_pTableView->getTableConnections();
-       Reference< XConnection> xConnection = 
static_cast<OQueryController*>(getController())->getConnection();
+       Reference< XConnection> xConnection = pController->getConnection();
        ::rtl::OUString 
aTableListStr(GenerateFromClause(xConnection,pTabList,pConnList));
        DBG_ASSERT(aTableListStr.getLength(), "OQueryDesignView::getStatement() 
: unerwartet : habe Felder, aber keine Tabellen !");
        // wenn es Felder gibt, koennen die nur durch Einfuegen aus einer schon 
existenten Tabelle entstanden sein; wenn andererseits
@@ -3054,6 +3054,27 @@
                m_pController->showError(aError);
        }
 
+    if ( xConnection.is() )
+    {
+        ::connectivity::OSQLParser& rParser( pController->getParser() );
+        ::rtl::OUString sErrorMessage;
+        ::std::auto_ptr<OSQLParseNode> pParseNode( rParser.parseTree( 
sErrorMessage, aSqlCmd, sal_True ) );
+        if ( pParseNode.get() )
+        {
+            OSQLParseNode* pNode = pParseNode->getChild(3)->getChild(1);
+            if ( pNode->count() > 1 )
+            {
+                       ::connectivity::OSQLParseNode * pCondition = 
pNode->getChild(1);
+                       if ( pCondition ) // no where clause
+                {
+                    OSQLParseNode::compress(pCondition);
+                    ::rtl::OUString sTemp;
+                    pParseNode->parseNodeToStr(sTemp,xConnection);
+                    aSqlCmd = sTemp;
+                }
+            }
+        }
+    }
        return aSqlCmd;
 }
 // 
-----------------------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to