Tag: cws_src680_dba205b
User: fs      
Date: 2006/08/09 12:47:39

Modified:
   dba/connectivity/source/drivers/mozab/MResultSetMetaData.cxx

Log:
 #b6248060# isSearchable: exlcude COUNTRY columns

File Changes:

Directory: /dba/connectivity/source/drivers/mozab/
==================================================

File [changed]: MResultSetMetaData.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/mozab/MResultSetMetaData.cxx?r1=1.5&r2=1.5.38.1
Delta lines:  +40 -8
--------------------
--- MResultSetMetaData.cxx      20 Jun 2006 01:44:43 -0000      1.5
+++ MResultSetMetaData.cxx      9 Aug 2006 19:47:37 -0000       1.5.38.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: MResultSetMetaData.cxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.5.38.1 $
  *
- *  last change: $Author: hr $ $Date: 2006/06/20 01:44:43 $
+ *  last change: $Author: fs $ $Date: 2006/08/09 19:47:37 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -47,6 +47,9 @@
 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
 #include <cppuhelper/typeprovider.hxx>
 #endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
 #ifndef CONNECTIVITY_SRESULSETMETADATA_HXX
 #include "MResultSetMetaData.hxx"
 #endif
@@ -58,6 +61,7 @@
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
 using namespace com::sun::star::sdbc;
+using namespace com::sun::star::beans;
 using namespace ::dbtools;
 using namespace ::comphelper;
 
@@ -108,8 +112,17 @@
 {
        checkColumnIndex(column);
 
-       Any 
aName((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
-       return aName.hasValue() ? getString(aName) : 
getString((*m_xColumns)[column-1]->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)));
+    ::rtl::OUString sColumnName;
+    try
+    {
+        Reference< XPropertySet > xColumnProps( (*m_xColumns)[column-1], 
UNO_QUERY_THROW );
+        OSL_VERIFY( xColumnProps->getPropertyValue( 
OMetaConnection::getPropMap().getNameByIndex( PROPERTY_ID_NAME ) ) >>= 
sColumnName );
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+    return sColumnName;
 }
 // -------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OResultSetMetaData::getTableName( sal_Int32 
/*column*/ ) throw(SQLException, RuntimeException)
@@ -176,9 +189,28 @@
 }
 // -------------------------------------------------------------------------
 
-sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 /*column*/ ) 
throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) 
throw(SQLException, RuntimeException)
 {
-    OSL_TRACE("In/Out : OResultSetMetaData::isSearchable() : True");
+    ::rtl::OUString sColumnName( getColumnName( column ) );
+
+    if ( !m_pTable || !m_pTable->getConnection() )
+    {
+        OSL_ENSURE( false, "OResultSetMetaData::isSearchable: suspicious: 
called without table or connection!" );
+        return sal_False;
+    }
+
+    if ( m_pTable->getConnection()->isLDAP() )
+    {
+        const OColumnAlias& aAliases( 
m_pTable->getConnection()->getColumnAlias() );
+        OColumnAlias::ProgrammaticName eProgrammatic( 
aAliases.getProgrammaticNameIndex( sColumnName ) );
+        if  (   ( eProgrammatic == OColumnAlias::HOMECOUNTRY )
+            ||  ( eProgrammatic == OColumnAlias::WORKCOUNTRY )
+            )
+            // for those, we know that they're not searchable in the 
Mozilla/LDAP implementation.
+            // There might be more ...
+            return sal_False;
+    }
+
        return sal_True;
 }
 // -------------------------------------------------------------------------




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

Reply via email to