Tag: cws_dev300_dba30c
User: oj      
Date: 2008-05-05 11:09:06+0000
Modified:
   dba/dbaccess/source/core/api/KeySet.cxx
   dba/dbaccess/source/core/api/KeySet.hxx
   dba/dbaccess/source/core/api/RowSetCache.cxx
   dba/dbaccess/source/core/api/makefile.mk
   dba/dbaccess/source/core/api/table.cxx

Log:
 #i87131# collect keys only once, getKeys always refetch keys

File Changes:

Directory: /dba/dbaccess/source/core/api/
=========================================

File [changed]: KeySet.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/KeySet.cxx?r1=1.72&r2=1.72.8.1
Delta lines:  +12 -6
--------------------
--- KeySet.cxx  2008-04-10 12:24:35+0000        1.72
+++ KeySet.cxx  2008-05-05 11:09:02+0000        1.72.8.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: KeySet.cxx,v $
- * $Revision: 1.72 $
+ * $Revision: 1.72.8.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -153,12 +153,14 @@
 DBG_NAME(OKeySet)
 // -------------------------------------------------------------------------
 OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
+                 const Reference< XIndexAccess>& _xTableKeys,
                                 const ::rtl::OUString& _rUpdateTableName,      
  // this can be the alias or the full qualified name
                                 const Reference< XSingleSelectQueryAnalyzer >& 
_xComposer)
             :m_pKeyColumnNames(NULL)
                        ,m_pColumnNames(NULL)
             ,m_pForeignColumnNames(NULL)
                        ,m_xTable(_xTable)
+            ,m_xTableKeys(_xTableKeys)
                        ,m_xComposer(_xComposer)
                        ,m_sUpdateTableName(_rUpdateTableName)
                        ,m_bRowCountFinal(sal_False)
@@ -874,10 +876,14 @@
 {
        // use keys and indexes for excat postioning
        // first the keys
+       
+       Reference<XIndexAccess> xKeys = m_xTableKeys;
+    if ( !xKeys.is() )
+    {
        Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
-       Reference<XIndexAccess> xKeys;
        if(xKeySup.is())
                xKeys = xKeySup->getKeys();
+    }
 
        Reference<XColumnsSupplier> xKeyColsSup;
        Reference<XNameAccess> xKeyColumns;

File [changed]: KeySet.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/KeySet.hxx?r1=1.29&r2=1.29.8.1
Delta lines:  +4 -2
-------------------
--- KeySet.hxx  2008-04-10 12:24:53+0000        1.29
+++ KeySet.hxx  2008-05-05 11:09:02+0000        1.29.8.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: KeySet.hxx,v $
- * $Revision: 1.29 $
+ * $Revision: 1.29.8.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -98,6 +98,7 @@
         SelectColumnsMetaData*                                  
m_pColumnNames;         // contains all column names
         SelectColumnsMetaData*                                  
m_pForeignColumnNames;  // contains all column names of the rest
                connectivity::OSQLTable                                         
                        m_xTable; // reference to our table
+        ::com::sun::star::uno::Reference< 
::com::sun::star::container::XIndexAccess>    m_xTableKeys;
                ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XPreparedStatement>   m_xStatement;
                ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet>                   m_xSet;
                ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> 
                                m_xRow;
@@ -133,6 +134,7 @@
                virtual ~OKeySet();
        public:
                OKeySet(const connectivity::OSQLTable& _xTable,
+                const ::com::sun::star::uno::Reference< 
::com::sun::star::container::XIndexAccess>& _xTableKeys,
                                const ::rtl::OUString& _rUpdateTableName,
                                const ::com::sun::star::uno::Reference< 
::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _xComposer);
                

File [changed]: RowSetCache.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetCache.cxx?r1=1.97&r2=1.97.8.1
Delta lines:  +9 -8
-------------------
--- RowSetCache.cxx     2008-04-10 12:26:52+0000        1.97
+++ RowSetCache.cxx     2008-05-05 11:09:03+0000        1.97.8.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: RowSetCache.cxx,v $
- * $Revision: 1.97 $
+ * $Revision: 1.97.8.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -164,6 +164,7 @@
        sal_Bool bAllKeysFound = sal_False;
        sal_Int32 nTablesCount = 0;
 
+    Reference< XIndexAccess> xUpdateTableKeys;
        ::rtl::OUString aUpdateTableName = _rUpdateTableName;
        Reference< XConnection> xConnection;
        if(_xAnalyzer.is())
@@ -193,15 +194,15 @@
                                Reference<XKeysSupplier> 
xKeys(m_aUpdateTable,UNO_QUERY);
                                if(xKeys.is())
                                {
-                                       Reference< XIndexAccess> xKeyIndex = 
xKeys->getKeys();
-                                       if ( xKeyIndex.is() )
+                                       xUpdateTableKeys = xKeys->getKeys();
+                                       if ( xUpdateTableKeys.is() )
                                        {
                                                Reference<XColumnsSupplier> 
xColumnsSupplier;
                                                // search the one and only 
primary key
-                                               for(sal_Int32 i=0;i< 
xKeyIndex->getCount();++i)
+                        const sal_Int32 nCount = xUpdateTableKeys->getCount();
+                                               for(sal_Int32 i = 0 ; i < 
nCount ; ++i)
                                                {
-                                                       Reference<XPropertySet> 
xProp;
-                                                       
::cppu::extractInterface(xProp,xKeyIndex->getByIndex(i));
+                                                       Reference<XPropertySet> 
xProp(xUpdateTableKeys->getByIndex(i),UNO_QUERY);
                                                        sal_Int32 nKeyType = 0;
                                                        
xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
                                                        if(KeyType::PRIMARY == 
nKeyType)
@@ -327,7 +328,7 @@
                                }
                        }
 
-                       OKeySet* pKeySet = new 
OKeySet(m_aUpdateTable,aUpdateTableName ,_xAnalyzer);
+                       OKeySet* pKeySet = new 
OKeySet(m_aUpdateTable,xUpdateTableKeys,aUpdateTableName ,_xAnalyzer);
                        try
                        {
                                m_pCacheSet = pKeySet;

File [changed]: makefile.mk
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/makefile.mk?r1=1.15&r2=1.15.8.1
Delta lines:  +2 -5
-------------------
--- makefile.mk 2008-04-10 12:32:26+0000        1.15
+++ makefile.mk 2008-05-05 11:09:03+0000        1.15.8.1
@@ -8,7 +8,7 @@
 #
 # $RCSfile: makefile.mk,v $
 #
-# $Revision: 1.15 $
+# $Revision: 1.15.8.1 $
 #
 # This file is part of OpenOffice.org.
 #
@@ -53,9 +53,6 @@
                $(SLO)$/CRowSetColumn.obj                               \
                $(SLO)$/querycomposer.obj                               \
                $(SLO)$/CIndexes.obj                                    \
-               $(SLO)$/CKey.obj                                                
\
-               $(SLO)$/CKeys.obj                                               
\
-               $(SLO)$/CKeyColumns.obj                                 \
                $(SLO)$/BookmarkSet.obj                                 \
                $(SLO)$/KeySet.obj                                              
\
                $(SLO)$/StaticSet.obj                                   \

File [changed]: table.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/table.cxx?r1=1.61&r2=1.61.8.1
Delta lines:  +4 -6
-------------------
--- table.cxx   2008-04-10 12:35:59+0000        1.61
+++ table.cxx   2008-05-05 11:09:03+0000        1.61.8.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: table.cxx,v $
- * $Revision: 1.61 $
+ * $Revision: 1.61.8.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -77,9 +77,7 @@
 #ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
 #include <com/sun/star/sdbcx/Privilege.hpp>
 #endif
-#ifndef DBACCESS_CORE_API_KEYS_HXX
-#include "CKeys.hxx"
-#endif
+#include <connectivity/TKeys.hxx>
 #ifndef DBACCESS_INDEXES_HXX_
 #include "CIndexes.hxx"
 #endif
@@ -470,7 +468,7 @@
 // 
-----------------------------------------------------------------------------
 sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames)
 {
-       return new OKeys(this,m_aMutex,_rNames,NULL);
+       return new connectivity::OKeysHelper(this,m_aMutex,_rNames);
 }
 // 
-----------------------------------------------------------------------------
 sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames)




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

Reply via email to