User: rt      
Date: 2006/07/26 00:21:28

Modified:
   dba/connectivity/source/commontools/dbmetadata.cxx

Log:
 INTEGRATION: CWS dba204b (1.2.2); FILE MERGED
 2006/07/17 08:06:34 fs 1.2.2.1: #i67260# +restrictIdentifiersToSQL92

File Changes:

Directory: /dba/connectivity/source/commontools/
================================================

File [changed]: dbmetadata.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbmetadata.cxx?r1=1.2&r2=1.3
Delta lines:  +56 -3
--------------------
--- dbmetadata.cxx      10 Jul 2006 14:20:08 -0000      1.2
+++ dbmetadata.cxx      26 Jul 2006 07:21:25 -0000      1.3
@@ -44,6 +44,15 @@
 #ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
 /** === end UNO includes === **/
 
 #ifndef TOOLS_DIAGNOSE_EX_H
@@ -62,6 +71,12 @@
     using ::com::sun::star::sdbc::XDatabaseMetaData;
     using ::com::sun::star::lang::IllegalArgumentException;
     using ::com::sun::star::uno::Exception;
+    using ::com::sun::star::uno::Any;
+    using ::com::sun::star::container::XChild;
+    using ::com::sun::star::uno::UNO_QUERY_THROW;
+    using ::com::sun::star::beans::XPropertySet;
+    using ::com::sun::star::uno::Sequence;
+    using ::com::sun::star::beans::PropertyValue;
     /** === end UNO using === **/
 
     //====================================================================
@@ -92,6 +107,34 @@
             if ( !_metaDataImpl.xConnection.is() )
                 throwSQLException( "not connected", 
SQL_CONNECTION_DOES_NOT_EXIST, NULL );
         }
+
+        static bool lcl_getDataSourceSetting( const sal_Char* _asciiName, 
const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
+        {
+            try
+            {
+                Reference< XChild > connectionAsChild( _metaData.xConnection, 
UNO_QUERY_THROW );
+                Reference< XPropertySet > dataSource( 
connectionAsChild->getParent(), UNO_QUERY_THROW );
+
+                Sequence< PropertyValue > dataSourceSettings;
+                OSL_VERIFY( dataSource->getPropertyValue( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "Info" ) ) ) >>= dataSourceSettings );
+
+                const PropertyValue* setting( 
dataSourceSettings.getConstArray() );
+                const PropertyValue* settingEnd( setting + 
dataSourceSettings.getLength() );
+                for ( ; setting != settingEnd; ++setting )
+                {
+                    if ( setting->Name.equalsAscii( _asciiName ) )
+                    {
+                        _out_setting = setting->Value;
+                        return true;
+                    }
+                }
+            }
+            catch( const Exception& )
+            {
+               DBG_UNHANDLED_EXCEPTION();
+            }
+            return false;
+        }
     }
 
        //====================================================================
@@ -155,6 +198,16 @@
                DBG_UNHANDLED_EXCEPTION();
         }
         return supportsSubQueries;
+    }
+
+    //--------------------------------------------------------------------
+    bool SAL_CALL DatabaseMetaData::restrictIdentifiersToSQL92() const
+    {
+        bool restrict( false );
+        Any setting;
+        if ( lcl_getDataSourceSetting( "EnableSQL92Check", *m_pImpl, setting ) 
)
+            OSL_VERIFY( setting >>= restrict );
+        return restrict;
     }
 
 //........................................................................




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

Reply via email to