1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AConnection.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "ado/AConnection.hxx"
34 #include "ado/ADatabaseMetaData.hxx"
35 #include "ado/ADriver.hxx"
36 #include "ado/AStatement.hxx"
37 #include "ado/ACallableStatement.hxx"
38 #include "ado/APreparedStatement.hxx"
39 #include "ado/ACatalog.hxx"
40 #include <com/sun/star/sdbc/ColumnValue.hpp>
41 #include <com/sun/star/sdbc/TransactionIsolation.hpp>
42 #include <com/sun/star/sdbc/XRow.hpp>
43 #include <com/sun/star/lang/DisposedException.hpp>
44 #include <cppuhelper/typeprovider.hxx>
45 #include "connectivity/dbexception.hxx"
46 #include <osl/file.hxx>
47 #include "resource/ado_res.hrc"
49 using namespace dbtools
;
50 using namespace connectivity::ado
;
51 using namespace com::sun::star::uno
;
52 using namespace com::sun::star::lang
;
53 using namespace com::sun::star::beans
;
54 using namespace com::sun::star::sdbc
;
55 using namespace com::sun::star::sdbcx
;
57 //------------------------------------------------------------------------------
58 IMPLEMENT_SERVICE_INFO(OConnection
,"com.sun.star.sdbcx.AConnection","com.sun.star.sdbc.Connection");
59 // --------------------------------------------------------------------------------
60 OConnection::OConnection(ODriver
* _pDriver
) throw(SQLException
, RuntimeException
)
61 : OSubComponent
<OConnection
, OConnection_BASE
>((::cppu::OWeakObject
*)_pDriver
, this),
65 m_pAdoConnection(NULL
),
66 m_bAutocommit(sal_True
),
70 osl_incrementInterlockedCount( &m_refCount
);
72 IClassFactory2
* pIUnknown
= NULL
;
73 IUnknown
*pOuter
= NULL
;
75 hr
= CoGetClassObject( ADOS::CLSID_ADOCONNECTION_21
,
83 ADOConnection
*pCon
= NULL
;
84 hr
= pIUnknown
->CreateInstanceLic( pOuter
,
86 ADOS::IID_ADOCONNECTION_21
,
92 OSL_ENSURE( pCon
, "OConnection::OConnection: invalid ADO object!" );
94 m_pAdoConnection
= new WpADOConnection( pCon
);
95 // CreateInstanceLic returned an object which was already acquired
100 // Class Factory is no longer needed
101 pIUnknown
->Release();
104 osl_decrementInterlockedCount( &m_refCount
);
106 //-----------------------------------------------------------------------------
107 OConnection::~OConnection()
110 //-----------------------------------------------------------------------------
111 void OConnection::construct(const ::rtl::OUString
& url
,const Sequence
< PropertyValue
>& info
)
113 osl_incrementInterlockedCount( &m_refCount
);
115 setConnectionInfo(info
);
117 sal_Int32 nLen
= url
.indexOf(':');
118 nLen
= url
.indexOf(':',nLen
+1);
119 ::rtl::OUString
aDSN(url
.copy(nLen
+1)),aUID
,aPWD
;
120 if ( aDSN
.compareToAscii("access:",7) == 0 )
123 sal_Int32 nTimeout
= 20;
124 sal_Bool bSilent
= sal_True
;
125 const PropertyValue
*pIter
= info
.getConstArray();
126 const PropertyValue
*pEnd
= pIter
+ info
.getLength();
127 for(;pIter
!= pEnd
;++pIter
)
129 if(!pIter
->Name
.compareToAscii("Timeout"))
130 pIter
->Value
>>= nTimeout
;
131 else if(!pIter
->Name
.compareToAscii("Silent"))
132 pIter
->Value
>>= bSilent
;
133 else if(!pIter
->Name
.compareToAscii("user"))
134 pIter
->Value
>>= aUID
;
135 else if(!pIter
->Name
.compareToAscii("password"))
136 pIter
->Value
>>= aPWD
;
142 if(m_pAdoConnection
->Open(aDSN
,aUID
,aPWD
,adConnectUnspecified
))
143 m_pAdoConnection
->PutCommandTimeout(nTimeout
);
145 ADOS::ThrowException(*m_pAdoConnection
,*this);
146 if(m_pAdoConnection
->get_State() != adStateOpen
)
147 throwGenericSQLException( STR_NO_CONNECTION
,*this );
149 WpADOProperties aProps
= m_pAdoConnection
->get_Properties();
152 OTools::putValue(aProps
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:ODBC Parsing")),sal_True
);
153 OLEVariant
aVar(OTools::getValue(aProps
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:Engine Type"))));
154 if(!aVar
.isNull() && !aVar
.isEmpty())
155 m_nEngineType
= aVar
;
161 ::dbtools::throwFunctionSequenceException(*this);
164 catch(const Exception
)
166 osl_decrementInterlockedCount( &m_refCount
);
169 osl_decrementInterlockedCount( &m_refCount
);
171 //-----------------------------------------------------------------------------
172 void SAL_CALL
OConnection::release() throw()
176 // --------------------------------------------------------------------------------
177 Reference
< XStatement
> SAL_CALL
OConnection::createStatement( ) throw(SQLException
, RuntimeException
)
179 ::osl::MutexGuard
aGuard( m_aMutex
);
180 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
182 OStatement
* pStmt
= new OStatement(this);
183 Reference
< XStatement
> xStmt
= pStmt
;
184 m_aStatements
.push_back(WeakReferenceHelper(*pStmt
));
187 // --------------------------------------------------------------------------------
188 Reference
< XPreparedStatement
> SAL_CALL
OConnection::prepareStatement( const ::rtl::OUString
& sql
) throw(SQLException
, RuntimeException
)
190 ::osl::MutexGuard
aGuard( m_aMutex
);
191 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
194 OPreparedStatement
* pStmt
= new OPreparedStatement(this,m_aTypeInfo
,sql
);
195 Reference
< XPreparedStatement
> xPStmt
= pStmt
;
196 m_aStatements
.push_back(WeakReferenceHelper(*pStmt
));
199 // --------------------------------------------------------------------------------
200 Reference
< XPreparedStatement
> SAL_CALL
OConnection::prepareCall( const ::rtl::OUString
& sql
) throw(SQLException
, RuntimeException
)
202 ::osl::MutexGuard
aGuard( m_aMutex
);
203 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
206 OCallableStatement
* pStmt
= new OCallableStatement(this,m_aTypeInfo
,sql
);
207 Reference
< XPreparedStatement
> xPStmt
= pStmt
;
208 m_aStatements
.push_back(WeakReferenceHelper(*pStmt
));
211 // --------------------------------------------------------------------------------
212 ::rtl::OUString SAL_CALL
OConnection::nativeSQL( const ::rtl::OUString
& _sql
) throw(SQLException
, RuntimeException
)
214 ::osl::MutexGuard
aGuard( m_aMutex
);
215 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
218 ::rtl::OUString sql
= _sql
;
219 WpADOProperties aProps
= m_pAdoConnection
->get_Properties();
222 OTools::putValue(aProps
,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Jet OLEDB:ODBC Parsing")),sal_True
);
223 WpADOCommand aCommand
;
225 aCommand
.put_ActiveConnection((IDispatch
*)*m_pAdoConnection
);
226 aCommand
.put_CommandText(sql
);
227 sql
= aCommand
.get_CommandText();
232 // --------------------------------------------------------------------------------
233 void SAL_CALL
OConnection::setAutoCommit( sal_Bool autoCommit
) throw(SQLException
, RuntimeException
)
235 ::osl::MutexGuard
aGuard( m_aMutex
);
236 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
239 m_bAutocommit
= autoCommit
;
241 m_pAdoConnection
->BeginTrans();
243 m_pAdoConnection
->RollbackTrans();
245 // --------------------------------------------------------------------------------
246 sal_Bool SAL_CALL
OConnection::getAutoCommit( ) throw(SQLException
, RuntimeException
)
248 ::osl::MutexGuard
aGuard( m_aMutex
);
249 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
252 return m_bAutocommit
;
254 // --------------------------------------------------------------------------------
255 void SAL_CALL
OConnection::commit( ) throw(SQLException
, RuntimeException
)
257 ::osl::MutexGuard
aGuard( m_aMutex
);
258 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
261 m_pAdoConnection
->CommitTrans();
263 // --------------------------------------------------------------------------------
264 void SAL_CALL
OConnection::rollback( ) throw(SQLException
, RuntimeException
)
266 ::osl::MutexGuard
aGuard( m_aMutex
);
267 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
270 m_pAdoConnection
->RollbackTrans();
272 // --------------------------------------------------------------------------------
273 sal_Bool SAL_CALL
OConnection::isClosed( ) throw(SQLException
, RuntimeException
)
275 ::osl::MutexGuard
aGuard( m_aMutex
);
277 return OConnection_BASE::rBHelper
.bDisposed
&& !m_pAdoConnection
->get_State();
279 // --------------------------------------------------------------------------------
280 Reference
< XDatabaseMetaData
> SAL_CALL
OConnection::getMetaData( ) throw(SQLException
, RuntimeException
)
282 ::osl::MutexGuard
aGuard( m_aMutex
);
283 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
286 Reference
< XDatabaseMetaData
> xMetaData
= m_xMetaData
;
289 xMetaData
= new ODatabaseMetaData(this);
290 m_xMetaData
= xMetaData
;
295 // --------------------------------------------------------------------------------
296 void SAL_CALL
OConnection::setReadOnly( sal_Bool readOnly
) throw(SQLException
, RuntimeException
)
298 ::osl::MutexGuard
aGuard( m_aMutex
);
299 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
303 m_pAdoConnection
->put_Mode(readOnly
? adModeRead
: adModeReadWrite
);
304 ADOS::ThrowException(*m_pAdoConnection
,*this);
306 // --------------------------------------------------------------------------------
307 sal_Bool SAL_CALL
OConnection::isReadOnly( ) throw(SQLException
, RuntimeException
)
309 ::osl::MutexGuard
aGuard( m_aMutex
);
310 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
313 return m_pAdoConnection
->get_Mode() == adModeRead
;
315 // --------------------------------------------------------------------------------
316 void SAL_CALL
OConnection::setCatalog( const ::rtl::OUString
& catalog
) throw(SQLException
, RuntimeException
)
318 ::osl::MutexGuard
aGuard( m_aMutex
);
319 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
321 m_pAdoConnection
->PutDefaultDatabase(catalog
);
322 ADOS::ThrowException(*m_pAdoConnection
,*this);
324 // --------------------------------------------------------------------------------
325 ::rtl::OUString SAL_CALL
OConnection::getCatalog( ) throw(SQLException
, RuntimeException
)
327 ::osl::MutexGuard
aGuard( m_aMutex
);
328 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
330 return m_pAdoConnection
->GetDefaultDatabase();
332 // --------------------------------------------------------------------------------
333 void SAL_CALL
OConnection::setTransactionIsolation( sal_Int32 level
) throw(SQLException
, RuntimeException
)
335 ::osl::MutexGuard
aGuard( m_aMutex
);
336 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
339 IsolationLevelEnum eIso
;
342 case TransactionIsolation::NONE
:
343 eIso
= adXactUnspecified
;
345 case TransactionIsolation::READ_UNCOMMITTED
:
346 eIso
= adXactReadUncommitted
;
348 case TransactionIsolation::READ_COMMITTED
:
349 eIso
= adXactReadCommitted
;
351 case TransactionIsolation::REPEATABLE_READ
:
352 eIso
= adXactRepeatableRead
;
354 case TransactionIsolation::SERIALIZABLE
:
355 eIso
= adXactSerializable
;
358 OSL_ENSURE(0,"OConnection::setTransactionIsolation invalid level");
361 m_pAdoConnection
->put_IsolationLevel(eIso
);
362 ADOS::ThrowException(*m_pAdoConnection
,*this);
364 // --------------------------------------------------------------------------------
365 sal_Int32 SAL_CALL
OConnection::getTransactionIsolation( ) throw(SQLException
, RuntimeException
)
367 ::osl::MutexGuard
aGuard( m_aMutex
);
368 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
372 switch(m_pAdoConnection
->get_IsolationLevel())
374 case adXactUnspecified
:
375 nRet
= TransactionIsolation::NONE
;
377 case adXactReadUncommitted
:
378 nRet
= TransactionIsolation::READ_UNCOMMITTED
;
380 case adXactReadCommitted
:
381 nRet
= TransactionIsolation::READ_COMMITTED
;
383 case adXactRepeatableRead
:
384 nRet
= TransactionIsolation::REPEATABLE_READ
;
386 case adXactSerializable
:
387 nRet
= TransactionIsolation::SERIALIZABLE
;
390 OSL_ENSURE(0,"OConnection::setTransactionIsolation invalid level");
392 ADOS::ThrowException(*m_pAdoConnection
,*this);
395 // --------------------------------------------------------------------------------
396 Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
OConnection::getTypeMap( ) throw(SQLException
, RuntimeException
)
398 ::osl::MutexGuard
aGuard( m_aMutex
);
399 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
404 // --------------------------------------------------------------------------------
405 void SAL_CALL
OConnection::setTypeMap( const Reference
< ::com::sun::star::container::XNameAccess
>& /*typeMap*/ ) throw(SQLException
, RuntimeException
)
407 ::dbtools::throwFeatureNotImplementedException( "XConnection::setTypeMap", *this );
409 // --------------------------------------------------------------------------------
411 void SAL_CALL
OConnection::close( ) throw(SQLException
, RuntimeException
)
414 ::osl::MutexGuard
aGuard( m_aMutex
);
415 checkDisposed(OConnection_BASE::rBHelper
.bDisposed
);
420 // --------------------------------------------------------------------------------
422 Any SAL_CALL
OConnection::getWarnings( ) throw(SQLException
, RuntimeException
)
426 // --------------------------------------------------------------------------------
427 void SAL_CALL
OConnection::clearWarnings( ) throw(SQLException
, RuntimeException
)
430 //--------------------------------------------------------------------
431 void OConnection::buildTypeInfo() throw( SQLException
)
433 ::osl::MutexGuard
aGuard( m_aMutex
);
435 ADORecordset
*pRecordset
= m_pAdoConnection
->getTypeInfo();
438 pRecordset
->AddRef();
439 VARIANT_BOOL bIsAtBOF
;
440 pRecordset
->get_BOF(&bIsAtBOF
);
442 sal_Bool bOk
= sal_True
;
443 if ( bIsAtBOF
== VARIANT_TRUE
)
444 bOk
= SUCCEEDED(pRecordset
->MoveNext());
449 static const ::rtl::OUString
s_sVarChar(RTL_CONSTASCII_USTRINGPARAM("VarChar"));
453 OExtendedTypeInfo
* aInfo
= new OExtendedTypeInfo();
454 aInfo
->aSimpleType
.aTypeName
= ADOS::getField(pRecordset
,nPos
++).get_Value();
455 aInfo
->eType
= (DataTypeEnum
)(sal_Int32
)ADOS::getField(pRecordset
,nPos
++).get_Value();
456 if ( aInfo
->eType
== adWChar
&& aInfo
->aSimpleType
.aTypeName
== s_sVarChar
)
457 aInfo
->eType
= adVarWChar
;
458 aInfo
->aSimpleType
.nType
= (sal_Int16
)ADOS::MapADOType2Jdbc(static_cast<DataTypeEnum
>(aInfo
->eType
));
459 aInfo
->aSimpleType
.nPrecision
= ADOS::getField(pRecordset
,nPos
++).get_Value();
460 aInfo
->aSimpleType
.aLiteralPrefix
= ADOS::getField(pRecordset
,nPos
++).get_Value();
461 aInfo
->aSimpleType
.aLiteralSuffix
= ADOS::getField(pRecordset
,nPos
++).get_Value();
462 aInfo
->aSimpleType
.aCreateParams
= ADOS::getField(pRecordset
,nPos
++).get_Value();
463 aInfo
->aSimpleType
.bNullable
= ADOS::getField(pRecordset
,nPos
++).get_Value();
464 aInfo
->aSimpleType
.bCaseSensitive
= ADOS::getField(pRecordset
,nPos
++).get_Value();
465 aInfo
->aSimpleType
.nSearchType
= ADOS::getField(pRecordset
,nPos
++).get_Value();
466 aInfo
->aSimpleType
.bUnsigned
= ADOS::getField(pRecordset
,nPos
++).get_Value();
467 aInfo
->aSimpleType
.bCurrency
= ADOS::getField(pRecordset
,nPos
++).get_Value();
468 aInfo
->aSimpleType
.bAutoIncrement
= ADOS::getField(pRecordset
,nPos
++).get_Value();
469 aInfo
->aSimpleType
.aLocalTypeName
= ADOS::getField(pRecordset
,nPos
++).get_Value();
470 aInfo
->aSimpleType
.nMinimumScale
= ADOS::getField(pRecordset
,nPos
++).get_Value();
471 aInfo
->aSimpleType
.nMaximumScale
= ADOS::getField(pRecordset
,nPos
++).get_Value();
472 aInfo
->aSimpleType
.nNumPrecRadix
= ADOS::getField(pRecordset
,nPos
++).get_Value();
473 // Now that we have the type info, save it
474 // in the Hashtable if we don't already have an
475 // entry for this SQL type.
477 m_aTypeInfo
.insert(OTypeInfoMap::value_type(aInfo
->eType
,aInfo
));
479 while ( SUCCEEDED(pRecordset
->MoveNext()) );
481 pRecordset
->Release();
484 //------------------------------------------------------------------------------
485 void OConnection::disposing()
487 ::osl::MutexGuard
aGuard(m_aMutex
);
489 OConnection_BASE::disposing();
491 m_bClosed
= sal_True
;
492 m_xMetaData
= ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbc::XDatabaseMetaData
>();
493 m_xCatalog
= ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbcx::XTablesSupplier
>();
496 m_pAdoConnection
->Close();
498 OTypeInfoMap::iterator aIter
= m_aTypeInfo
.begin();
499 for (; aIter
!= m_aTypeInfo
.end(); ++aIter
)
500 delete aIter
->second
;
504 delete m_pAdoConnection
;
505 m_pAdoConnection
= NULL
;
509 // -----------------------------------------------------------------------------
510 sal_Int64 SAL_CALL
OConnection::getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rId
) throw (::com::sun::star::uno::RuntimeException
)
512 return (rId
.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId
.getConstArray(), 16 ) )
514 reinterpret_cast< sal_Int64
>( this )
516 OConnection_BASE::getSomething(rId
);
518 // -----------------------------------------------------------------------------
519 Sequence
< sal_Int8
> OConnection::getUnoTunnelImplementationId()
521 static ::cppu::OImplementationId
* pId
= 0;
524 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
527 static ::cppu::OImplementationId aId
;
531 return pId
->getImplementationId();
533 // -----------------------------------------------------------------------------
534 const OExtendedTypeInfo
* OConnection::getTypeInfoFromType(const OTypeInfoMap
& _rTypeInfo
,
536 const ::rtl::OUString
& _sTypeName
,
537 sal_Int32 _nPrecision
,
539 sal_Bool
& _brForceToType
)
541 const OExtendedTypeInfo
* pTypeInfo
= NULL
;
542 _brForceToType
= sal_False
;
544 ::std::pair
<OTypeInfoMap::const_iterator
, OTypeInfoMap::const_iterator
> aPair
= _rTypeInfo
.equal_range(_nType
);
545 OTypeInfoMap::const_iterator aIter
= aPair
.first
;
546 if(aIter
!= _rTypeInfo
.end()) // compare with end is correct here
548 for(;aIter
!= aPair
.second
;++aIter
)
550 // search the best matching type
551 OExtendedTypeInfo
* pInfo
= aIter
->second
;
553 ::rtl::OUString sDBTypeName
= pInfo
->aSimpleType
.aTypeName
;
554 sal_Int32 nDBTypePrecision
= pInfo
->aSimpleType
.nPrecision
; (void)nDBTypePrecision
;
555 sal_Int32 nDBTypeScale
= pInfo
->aSimpleType
.nMaximumScale
; (void)nDBTypeScale
;
556 sal_Int32 nAdoType
= pInfo
->eType
; (void)nAdoType
;
558 if ( ( !_sTypeName
.getLength()
559 || (pInfo
->aSimpleType
.aTypeName
.equalsIgnoreAsciiCase(_sTypeName
))
561 && (pInfo
->aSimpleType
.nPrecision
>= _nPrecision
)
562 && (pInfo
->aSimpleType
.nMaximumScale
>= _nScale
)
568 if (aIter
== aPair
.second
)
570 for(aIter
= aPair
.first
; aIter
!= aPair
.second
; ++aIter
)
572 // search the best matching type (now comparing the local names)
573 if ( (aIter
->second
->aSimpleType
.aLocalTypeName
.equalsIgnoreAsciiCase(_sTypeName
))
574 && (aIter
->second
->aSimpleType
.nPrecision
>= _nPrecision
)
575 && (aIter
->second
->aSimpleType
.nMaximumScale
>= _nScale
)
578 // we can not assert here because we could be in d&d
580 OSL_ENSURE(sal_False,
581 ( ::rtl::OString("getTypeInfoFromType: assuming column type ")
582 += ::rtl::OString(aIter->second->aTypeName.getStr(), aIter->second->aTypeName.getLength(), gsl_getSystemTextEncoding())
583 += ::rtl::OString("\" (expected type name ")
584 += ::rtl::OString(_sTypeName.getStr(), _sTypeName.getLength(), gsl_getSystemTextEncoding())
585 += ::rtl::OString(" matches the type's local name).")).getStr());
592 if (aIter
== aPair
.second
)
593 { // no match for the names, no match for the local names
594 // -> drop the precision and the scale restriction, accept any type with the property
597 // we can not assert here because we could be in d&d
598 pTypeInfo
= aPair
.first
->second
;
599 _brForceToType
= sal_True
;
602 pTypeInfo
= aIter
->second
;
604 else if ( _sTypeName
.getLength() )
606 ::comphelper::TStringMixEqualFunctor
aCase(sal_False
);
607 // search for typeinfo where the typename is equal _sTypeName
608 OTypeInfoMap::const_iterator aFind
= ::std::find_if(_rTypeInfo
.begin(),
611 ::std::bind2nd(aCase
, _sTypeName
),
613 ::std::mem_fun(&OExtendedTypeInfo::getDBName
),
614 ::std::select2nd
<OTypeInfoMap::value_type
>())
617 if(aFind
!= _rTypeInfo
.end())
618 pTypeInfo
= aFind
->second
;
621 // we can not assert here because we could be in d&d
622 // OSL_ENSURE(pTypeInfo, "getTypeInfoFromType: no type info found for this type!");
625 // -----------------------------------------------------------------------------