User: ihi     
Date: 2006/10/18 06:09:04

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

Log:
 INTEGRATION: CWS dba205b (1.5.38); FILE MERGED
 2006/08/09 19:47:37 fs 1.5.38.1: #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.6&r2=1.7
Delta lines:  +37 -5
--------------------
--- MResultSetMetaData.cxx      17 Sep 2006 02:57:25 -0000      1.6
+++ MResultSetMetaData.cxx      18 Oct 2006 13:09:01 -0000      1.7
@@ -50,6 +50,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
@@ -61,6 +64,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;
 
@@ -111,8 +115,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)
@@ -179,9 +192,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