xref: /trunk/main/svx/source/form/dbtoolsclient.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/sdb/SQLContext.hpp>
34*cdf0e10cSrcweir #include "svx/dbtoolsclient.hxx"
35*cdf0e10cSrcweir #include <osl/diagnose.h>
36*cdf0e10cSrcweir #include <connectivity/formattedcolumnvalue.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir //........................................................................
39*cdf0e10cSrcweir namespace svxform
40*cdf0e10cSrcweir {
41*cdf0e10cSrcweir //........................................................................
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir     using namespace ::connectivity::simple;
44*cdf0e10cSrcweir     using namespace ::com::sun::star::sdbc;
45*cdf0e10cSrcweir     using namespace ::com::sun::star::lang;
46*cdf0e10cSrcweir     using namespace ::com::sun::star::util;
47*cdf0e10cSrcweir     using namespace ::com::sun::star::uno;
48*cdf0e10cSrcweir     using namespace ::com::sun::star::beans;
49*cdf0e10cSrcweir     using namespace ::com::sun::star::sdb;
50*cdf0e10cSrcweir     using namespace ::com::sun::star::container;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir     //====================================================================
53*cdf0e10cSrcweir     //= ODbtoolsClient
54*cdf0e10cSrcweir     //====================================================================
55*cdf0e10cSrcweir     ::osl::Mutex    ODbtoolsClient::s_aMutex;
56*cdf0e10cSrcweir     sal_Int32       ODbtoolsClient::s_nClients = 0;
57*cdf0e10cSrcweir     oslModule       ODbtoolsClient::s_hDbtoolsModule = NULL;
58*cdf0e10cSrcweir     createDataAccessToolsFactoryFunction
59*cdf0e10cSrcweir                     ODbtoolsClient::s_pFactoryCreationFunc = NULL;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir     //--------------------------------------------------------------------
62*cdf0e10cSrcweir     ODbtoolsClient::ODbtoolsClient()
63*cdf0e10cSrcweir     {
64*cdf0e10cSrcweir         m_bCreateAlready = sal_False;
65*cdf0e10cSrcweir     }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     //--------------------------------------------------------------------
68*cdf0e10cSrcweir     bool ODbtoolsClient::ensureLoaded() const
69*cdf0e10cSrcweir     {
70*cdf0e10cSrcweir         if ( !m_bCreateAlready )
71*cdf0e10cSrcweir         {
72*cdf0e10cSrcweir             m_bCreateAlready = true;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir             registerClient();
75*cdf0e10cSrcweir             if ( s_pFactoryCreationFunc )
76*cdf0e10cSrcweir             {   // loading the lib succeeded
77*cdf0e10cSrcweir                 void* pUntypedFactory = (*s_pFactoryCreationFunc)();
78*cdf0e10cSrcweir                 IDataAccessToolsFactory* pDBTFactory = static_cast< IDataAccessToolsFactory* >( pUntypedFactory );
79*cdf0e10cSrcweir                 OSL_ENSURE( pDBTFactory, "ODbtoolsClient::ODbtoolsClient: no factory returned!" );
80*cdf0e10cSrcweir                 if ( pDBTFactory )
81*cdf0e10cSrcweir                 {
82*cdf0e10cSrcweir                     m_xDataAccessFactory = pDBTFactory;
83*cdf0e10cSrcweir                     // by definition, the factory was aquired once
84*cdf0e10cSrcweir                     m_xDataAccessFactory->release();
85*cdf0e10cSrcweir                 }
86*cdf0e10cSrcweir             }
87*cdf0e10cSrcweir         }
88*cdf0e10cSrcweir         return m_xDataAccessFactory.is();
89*cdf0e10cSrcweir     }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     //--------------------------------------------------------------------
92*cdf0e10cSrcweir     ODbtoolsClient::~ODbtoolsClient()
93*cdf0e10cSrcweir     {
94*cdf0e10cSrcweir         // clear the factory _before_ revoking the client
95*cdf0e10cSrcweir         // (the revocation may unload the DBT lib)
96*cdf0e10cSrcweir         m_xDataAccessFactory = NULL;
97*cdf0e10cSrcweir         // revoke the client
98*cdf0e10cSrcweir         if ( m_bCreateAlready )
99*cdf0e10cSrcweir             revokeClient();
100*cdf0e10cSrcweir     }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     //--------------------------------------------------------------------
103*cdf0e10cSrcweir     extern "C" { static void SAL_CALL thisModule() {} }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     void ODbtoolsClient::registerClient()
106*cdf0e10cSrcweir     {
107*cdf0e10cSrcweir         ::osl::MutexGuard aGuard(s_aMutex);
108*cdf0e10cSrcweir         if (1 == ++s_nClients)
109*cdf0e10cSrcweir         {
110*cdf0e10cSrcweir             OSL_ENSURE(NULL == s_hDbtoolsModule, "ODbtoolsClient::registerClient: inconsistence: already have a module!");
111*cdf0e10cSrcweir             OSL_ENSURE(NULL == s_pFactoryCreationFunc, "ODbtoolsClient::registerClient: inconsistence: already have a factory function!");
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir             const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
114*cdf0e10cSrcweir                 SVLIBRARY( "dbtools" )
115*cdf0e10cSrcweir             );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir             // load the dbtools library
118*cdf0e10cSrcweir             s_hDbtoolsModule = osl_loadModuleRelative(
119*cdf0e10cSrcweir                 &thisModule, sModuleName.pData, 0);
120*cdf0e10cSrcweir             OSL_ENSURE(NULL != s_hDbtoolsModule, "ODbtoolsClient::registerClient: could not load the dbtools library!");
121*cdf0e10cSrcweir             if (NULL != s_hDbtoolsModule)
122*cdf0e10cSrcweir             {
123*cdf0e10cSrcweir                 // get the symbol for the method creating the factory
124*cdf0e10cSrcweir                 const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString::createFromAscii("createDataAccessToolsFactory");
125*cdf0e10cSrcweir                 //  reinterpret_cast<createDataAccessToolsFactoryFunction>
126*cdf0e10cSrcweir                 s_pFactoryCreationFunc = (createDataAccessToolsFactoryFunction)(
127*cdf0e10cSrcweir                     osl_getFunctionSymbol(s_hDbtoolsModule, sFactoryCreationFunc.pData));
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir                 if (NULL == s_pFactoryCreationFunc)
130*cdf0e10cSrcweir                 {   // did not find the symbol
131*cdf0e10cSrcweir                     OSL_ENSURE(sal_False, "ODbtoolsClient::registerClient: could not find the symbol for creating the factory!");
132*cdf0e10cSrcweir                     osl_unloadModule(s_hDbtoolsModule);
133*cdf0e10cSrcweir                     s_hDbtoolsModule = NULL;
134*cdf0e10cSrcweir                 }
135*cdf0e10cSrcweir             }
136*cdf0e10cSrcweir         }
137*cdf0e10cSrcweir     }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     //--------------------------------------------------------------------
140*cdf0e10cSrcweir     void ODbtoolsClient::revokeClient()
141*cdf0e10cSrcweir     {
142*cdf0e10cSrcweir         ::osl::MutexGuard aGuard(s_aMutex);
143*cdf0e10cSrcweir         if (0 == --s_nClients)
144*cdf0e10cSrcweir         {
145*cdf0e10cSrcweir             s_pFactoryCreationFunc = NULL;
146*cdf0e10cSrcweir             if (s_hDbtoolsModule)
147*cdf0e10cSrcweir                 osl_unloadModule(s_hDbtoolsModule);
148*cdf0e10cSrcweir             s_hDbtoolsModule = NULL;
149*cdf0e10cSrcweir         }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir         OSL_ENSURE(s_nClients >= 0,"Illegall call of revokeClient()");
152*cdf0e10cSrcweir     }
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir     //====================================================================
155*cdf0e10cSrcweir     //= OStaticDataAccessTools
156*cdf0e10cSrcweir     //====================================================================
157*cdf0e10cSrcweir     //--------------------------------------------------------------------
158*cdf0e10cSrcweir     OStaticDataAccessTools::OStaticDataAccessTools()
159*cdf0e10cSrcweir     {
160*cdf0e10cSrcweir     }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     //--------------------------------------------------------------------
163*cdf0e10cSrcweir     //add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time)
164*cdf0e10cSrcweir     bool OStaticDataAccessTools::ensureLoaded() const
165*cdf0e10cSrcweir     {
166*cdf0e10cSrcweir         if ( !ODbtoolsClient::ensureLoaded() )
167*cdf0e10cSrcweir             return false;
168*cdf0e10cSrcweir         m_xDataAccessTools = getFactory()->getDataAccessTools();
169*cdf0e10cSrcweir         return m_xDataAccessTools.is();
170*cdf0e10cSrcweir     }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     //--------------------------------------------------------------------
173*cdf0e10cSrcweir     Reference< XNumberFormatsSupplier > OStaticDataAccessTools::getNumberFormats(const Reference< XConnection>& _rxConn, sal_Bool _bAllowDefault) const
174*cdf0e10cSrcweir     {
175*cdf0e10cSrcweir         Reference< XNumberFormatsSupplier > xReturn;
176*cdf0e10cSrcweir         if ( ensureLoaded() )
177*cdf0e10cSrcweir             xReturn = m_xDataAccessTools->getNumberFormats(_rxConn, _bAllowDefault);
178*cdf0e10cSrcweir         return xReturn;
179*cdf0e10cSrcweir     }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     //--------------------------------------------------------------------
182*cdf0e10cSrcweir     sal_Int32 OStaticDataAccessTools::getDefaultNumberFormat( const Reference< XPropertySet >& _xColumn, const Reference< XNumberFormatTypes >& _xTypes, const Locale& _rLocale )
183*cdf0e10cSrcweir     {
184*cdf0e10cSrcweir         sal_Int32 nReturn = 0;
185*cdf0e10cSrcweir         if ( ensureLoaded() )
186*cdf0e10cSrcweir             nReturn = m_xDataAccessTools->getDefaultNumberFormat( _xColumn, _xTypes, _rLocale );
187*cdf0e10cSrcweir         return nReturn;
188*cdf0e10cSrcweir     }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     //--------------------------------------------------------------------
191*cdf0e10cSrcweir     Reference< XConnection> OStaticDataAccessTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName,
192*cdf0e10cSrcweir         const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const
193*cdf0e10cSrcweir             SAL_THROW ( (SQLException) )
194*cdf0e10cSrcweir     {
195*cdf0e10cSrcweir         Reference< XConnection > xReturn;
196*cdf0e10cSrcweir         if ( ensureLoaded() )
197*cdf0e10cSrcweir             xReturn = m_xDataAccessTools->getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory);
198*cdf0e10cSrcweir         return xReturn;
199*cdf0e10cSrcweir     }
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     //--------------------------------------------------------------------
202*cdf0e10cSrcweir     Reference< XConnection > OStaticDataAccessTools::connectRowset( const Reference< XRowSet >& _rxRowSet,
203*cdf0e10cSrcweir         const Reference< XMultiServiceFactory >& _rxFactory, sal_Bool _bSetAsActiveConnection ) const
204*cdf0e10cSrcweir         SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) )
205*cdf0e10cSrcweir     {
206*cdf0e10cSrcweir         Reference< XConnection > xReturn;
207*cdf0e10cSrcweir         if ( ensureLoaded() )
208*cdf0e10cSrcweir             xReturn = m_xDataAccessTools->connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection );
209*cdf0e10cSrcweir         return xReturn;
210*cdf0e10cSrcweir     }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     //--------------------------------------------------------------------
213*cdf0e10cSrcweir     Reference< XConnection > OStaticDataAccessTools::getRowSetConnection(const Reference< XRowSet >& _rxRowSet) const SAL_THROW ( (RuntimeException) )
214*cdf0e10cSrcweir     {
215*cdf0e10cSrcweir         Reference< XConnection > xReturn;
216*cdf0e10cSrcweir         if ( ensureLoaded() )
217*cdf0e10cSrcweir             xReturn = m_xDataAccessTools->getRowSetConnection(_rxRowSet);
218*cdf0e10cSrcweir         return xReturn;
219*cdf0e10cSrcweir     }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     //--------------------------------------------------------------------
222*cdf0e10cSrcweir     void OStaticDataAccessTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld,
223*cdf0e10cSrcweir         const Reference< XPropertySet>& _rxNew, const Locale& _rLocale) const
224*cdf0e10cSrcweir     {
225*cdf0e10cSrcweir         if ( ensureLoaded() )
226*cdf0e10cSrcweir             m_xDataAccessTools->TransferFormComponentProperties(_rxOld, _rxNew, _rLocale);
227*cdf0e10cSrcweir     }
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     //--------------------------------------------------------------------
230*cdf0e10cSrcweir     ::rtl::OUString OStaticDataAccessTools::quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName) const
231*cdf0e10cSrcweir     {
232*cdf0e10cSrcweir         ::rtl::OUString sReturn;
233*cdf0e10cSrcweir         if ( ensureLoaded() )
234*cdf0e10cSrcweir             sReturn = m_xDataAccessTools->quoteName(_rQuote, _rName);
235*cdf0e10cSrcweir         return sReturn;
236*cdf0e10cSrcweir     }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     // ------------------------------------------------
239*cdf0e10cSrcweir     ::rtl::OUString OStaticDataAccessTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet>& _xTable ) const
240*cdf0e10cSrcweir     {
241*cdf0e10cSrcweir         ::rtl::OUString sReturn;
242*cdf0e10cSrcweir         if ( ensureLoaded() )
243*cdf0e10cSrcweir             sReturn = m_xDataAccessTools->composeTableNameForSelect( _rxConnection, _xTable );
244*cdf0e10cSrcweir         return sReturn;
245*cdf0e10cSrcweir     }
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir     //--------------------------------------------------------------------
248*cdf0e10cSrcweir     SQLContext OStaticDataAccessTools::prependContextInfo(SQLException& _rException, const Reference< XInterface >& _rxContext,
249*cdf0e10cSrcweir         const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) const
250*cdf0e10cSrcweir     {
251*cdf0e10cSrcweir         SQLContext aReturn;
252*cdf0e10cSrcweir         if ( ensureLoaded() )
253*cdf0e10cSrcweir             aReturn = m_xDataAccessTools->prependContextInfo(_rException, _rxContext, _rContextDescription, _rContextDetails);
254*cdf0e10cSrcweir         return aReturn;
255*cdf0e10cSrcweir     }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir     //----------------------------------------------------------------
258*cdf0e10cSrcweir     Reference< XDataSource > OStaticDataAccessTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const
259*cdf0e10cSrcweir     {
260*cdf0e10cSrcweir         Reference< XDataSource > xReturn;
261*cdf0e10cSrcweir         if ( ensureLoaded() )
262*cdf0e10cSrcweir             xReturn = m_xDataAccessTools->getDataSource(_rsRegisteredName,_rxFactory);
263*cdf0e10cSrcweir         return xReturn;
264*cdf0e10cSrcweir     }
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir     //----------------------------------------------------------------
267*cdf0e10cSrcweir     sal_Bool OStaticDataAccessTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const
268*cdf0e10cSrcweir     {
269*cdf0e10cSrcweir         sal_Bool bRet = sal_False;
270*cdf0e10cSrcweir         if ( ensureLoaded() )
271*cdf0e10cSrcweir             bRet = m_xDataAccessTools->canInsert( _rxCursorSet );
272*cdf0e10cSrcweir         return bRet;
273*cdf0e10cSrcweir     }
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir     //----------------------------------------------------------------
276*cdf0e10cSrcweir     sal_Bool OStaticDataAccessTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const
277*cdf0e10cSrcweir     {
278*cdf0e10cSrcweir         sal_Bool bRet = sal_False;
279*cdf0e10cSrcweir         if ( ensureLoaded() )
280*cdf0e10cSrcweir             bRet = m_xDataAccessTools->canUpdate( _rxCursorSet );
281*cdf0e10cSrcweir         return bRet;
282*cdf0e10cSrcweir     }
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir     //----------------------------------------------------------------
285*cdf0e10cSrcweir     sal_Bool OStaticDataAccessTools::canDelete(const Reference< XPropertySet>& _rxCursorSet) const
286*cdf0e10cSrcweir     {
287*cdf0e10cSrcweir         sal_Bool bRet = sal_False;
288*cdf0e10cSrcweir         if ( ensureLoaded() )
289*cdf0e10cSrcweir             bRet = m_xDataAccessTools->canDelete( _rxCursorSet );
290*cdf0e10cSrcweir         return bRet;
291*cdf0e10cSrcweir     }
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir     //----------------------------------------------------------------
294*cdf0e10cSrcweir     Reference< XNameAccess > OStaticDataAccessTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection,
295*cdf0e10cSrcweir         const sal_Int32 _nCommandType, const ::rtl::OUString& _rCommand,
296*cdf0e10cSrcweir             Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
297*cdf0e10cSrcweir     {
298*cdf0e10cSrcweir         Reference< XNameAccess > aFields;
299*cdf0e10cSrcweir         if ( ensureLoaded() )
300*cdf0e10cSrcweir             aFields = m_xDataAccessTools->getFieldsByCommandDescriptor( _rxConnection, _nCommandType,
301*cdf0e10cSrcweir                 _rCommand, _rxKeepFieldsAlive, _pErrorInfo );
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         return aFields;
304*cdf0e10cSrcweir     }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     //----------------------------------------------------------------
307*cdf0e10cSrcweir     Sequence< ::rtl::OUString > OStaticDataAccessTools::getFieldNamesByCommandDescriptor(
308*cdf0e10cSrcweir         const Reference< XConnection >& _rxConnection, const sal_Int32 _nCommandType,
309*cdf0e10cSrcweir         const ::rtl::OUString& _rCommand, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
310*cdf0e10cSrcweir     {
311*cdf0e10cSrcweir         Sequence< ::rtl::OUString > aNames;
312*cdf0e10cSrcweir         if ( ensureLoaded() )
313*cdf0e10cSrcweir             aNames = m_xDataAccessTools->getFieldNamesByCommandDescriptor( _rxConnection, _nCommandType,
314*cdf0e10cSrcweir                 _rCommand, _pErrorInfo );
315*cdf0e10cSrcweir         return aNames;
316*cdf0e10cSrcweir     }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir     //----------------------------------------------------------------
319*cdf0e10cSrcweir     bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection )
320*cdf0e10cSrcweir     {
321*cdf0e10cSrcweir         bool bReturn = false;
322*cdf0e10cSrcweir         if ( ensureLoaded() )
323*cdf0e10cSrcweir             bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, _rxActualConnection );
324*cdf0e10cSrcweir         return bReturn;
325*cdf0e10cSrcweir     }
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir     //----------------------------------------------------------------
328*cdf0e10cSrcweir     bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent )
329*cdf0e10cSrcweir     {
330*cdf0e10cSrcweir         bool bReturn = false;
331*cdf0e10cSrcweir         if ( ensureLoaded() )
332*cdf0e10cSrcweir         {
333*cdf0e10cSrcweir             Reference< XConnection > xDummy;
334*cdf0e10cSrcweir             bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, xDummy );
335*cdf0e10cSrcweir         }
336*cdf0e10cSrcweir         return bReturn;
337*cdf0e10cSrcweir     }
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     //====================================================================
340*cdf0e10cSrcweir     //= DBToolsObjectFactory
341*cdf0e10cSrcweir     //====================================================================
342*cdf0e10cSrcweir     //----------------------------------------------------------------
343*cdf0e10cSrcweir     DBToolsObjectFactory::DBToolsObjectFactory()
344*cdf0e10cSrcweir     {
345*cdf0e10cSrcweir     }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir     //----------------------------------------------------------------
348*cdf0e10cSrcweir     DBToolsObjectFactory::~DBToolsObjectFactory()
349*cdf0e10cSrcweir     {
350*cdf0e10cSrcweir     }
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir     //----------------------------------------------------------------
353*cdf0e10cSrcweir     ::std::auto_ptr< ::dbtools::FormattedColumnValue > DBToolsObjectFactory::createFormattedColumnValue(
354*cdf0e10cSrcweir         const ::comphelper::ComponentContext& _rContext, const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn )
355*cdf0e10cSrcweir     {
356*cdf0e10cSrcweir         ::std::auto_ptr< ::dbtools::FormattedColumnValue > pValue;
357*cdf0e10cSrcweir         if ( ensureLoaded() )
358*cdf0e10cSrcweir             pValue = getFactory()->createFormattedColumnValue( _rContext, _rxRowSet, _rxColumn );
359*cdf0e10cSrcweir         return pValue;
360*cdf0e10cSrcweir     }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir //........................................................................
363*cdf0e10cSrcweir }   // namespace svxform
364*cdf0e10cSrcweir //........................................................................
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 
367