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