merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / simpledbt / staticdbtools_s.cxx
blob464971bfcb9fa6da0de25eeb51b98dfd4d1f6b43
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: staticdbtools_s.cxx,v $
10 * $Revision: 1.13 $
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 <connectivity/virtualdbtools.hxx>
34 #include "staticdbtools_s.hxx"
35 #include <connectivity/dbconversion.hxx>
36 #include <connectivity/dbtools.hxx>
37 #include <com/sun/star/sdb/SQLContext.hpp>
39 //........................................................................
40 namespace connectivity
42 //........................................................................
44 using namespace ::com::sun::star::util;
45 using namespace ::com::sun::star::uno;
46 using namespace ::com::sun::star::sdb;
47 using namespace ::com::sun::star::lang;
48 using namespace ::com::sun::star::sdbc;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::container;
52 //================================================================
53 //= ODataAccessStaticTools
54 //================================================================
55 //----------------------------------------------------------------
56 ODataAccessStaticTools::ODataAccessStaticTools()
60 //----------------------------------------------------------------
61 Date ODataAccessStaticTools::getStandardDate() const
63 return ::dbtools::DBTypeConversion::getStandardDate();
66 //----------------------------------------------------------------
67 double ODataAccessStaticTools::getValue(const Reference< XColumn>& _rxVariant, const Date& rNullDate, sal_Int16 nKeyType) const
69 return ::dbtools::DBTypeConversion::getValue(_rxVariant, rNullDate, nKeyType);
72 //----------------------------------------------------------------
73 ::rtl::OUString ODataAccessStaticTools::getValue(const Reference< XColumn >& _rxColumn, const Reference< XNumberFormatter >& _rxFormatter,
74 const Date& _rNullDate, sal_Int32 _nKey, sal_Int16 _nKeyType) const
76 return ::dbtools::DBTypeConversion::getValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType);
79 //----------------------------------------------------------------
80 ::rtl::OUString ODataAccessStaticTools::getValue( const Reference< XPropertySet>& _rxColumn, const Reference< XNumberFormatter>& _rxFormatter,
81 const Locale& _rLocale, const Date& _rNullDate ) const
83 return ::dbtools::DBTypeConversion::getValue( _rxColumn, _rxFormatter, _rLocale, _rNullDate );
86 //----------------------------------------------------------------
87 oslInterlockedCount SAL_CALL ODataAccessStaticTools::acquire()
89 return ORefBase::acquire();
92 //----------------------------------------------------------------
93 oslInterlockedCount SAL_CALL ODataAccessStaticTools::release()
95 return ORefBase::release();
98 //----------------------------------------------------------------
99 Reference< XConnection> ODataAccessStaticTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser,
100 const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const SAL_THROW ( (SQLException) )
102 return ::dbtools::getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory);
105 //----------------------------------------------------------------
106 Reference< XConnection> ODataAccessStaticTools::connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, sal_Bool _bSetAsActiveConnection) const
107 SAL_THROW ( (SQLException, WrappedTargetException, RuntimeException) )
109 return ::dbtools::connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection);
112 // ------------------------------------------------
113 Reference< XConnection> ODataAccessStaticTools::getRowSetConnection(
114 const Reference< XRowSet>& _rxRowSet)
115 const SAL_THROW ( (RuntimeException) )
117 return ::dbtools::getConnection(_rxRowSet);
120 //----------------------------------------------------------------
121 Reference< XNumberFormatsSupplier> ODataAccessStaticTools::getNumberFormats(const Reference< XConnection>& _rxConn, sal_Bool _bAllowDefault) const
123 return ::dbtools::getNumberFormats(_rxConn, _bAllowDefault);
126 //----------------------------------------------------------------
127 sal_Int32 ODataAccessStaticTools::getDefaultNumberFormat( const Reference< XPropertySet >& _rxColumn, const Reference< XNumberFormatTypes >& _rxTypes,
128 const Locale& _rLocale ) const
130 return ::dbtools::getDefaultNumberFormat( _rxColumn, _rxTypes, _rLocale );
133 //----------------------------------------------------------------
134 void ODataAccessStaticTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld, const Reference< XPropertySet>& _rxNew, const Locale& _rLocale) const
136 ::dbtools::TransferFormComponentProperties(_rxOld, _rxNew, _rLocale);
139 //----------------------------------------------------------------
140 ::rtl::OUString ODataAccessStaticTools::quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName) const
142 return ::dbtools::quoteName(_rQuote, _rName);
145 //----------------------------------------------------------------
146 ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const ::rtl::OUString& _rCatalog, const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rName ) const
148 return ::dbtools::composeTableNameForSelect( _rxConnection, _rCatalog, _rSchema, _rName );
151 //----------------------------------------------------------------
152 ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet>& _xTable ) const
154 return ::dbtools::composeTableNameForSelect( _rxConnection, _xTable );
157 //----------------------------------------------------------------
158 SQLContext ODataAccessStaticTools::prependContextInfo(SQLException& _rException, const Reference< XInterface >& _rxContext,
159 const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) const
161 return ::dbtools::prependContextInfo(_rException, _rxContext, _rContextDescription, _rContextDetails);
164 //----------------------------------------------------------------
165 Reference< XDataSource > ODataAccessStaticTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const
167 return ::dbtools::getDataSource( _rsRegisteredName, _rxFactory );
170 //----------------------------------------------------------------
171 sal_Bool ODataAccessStaticTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const
173 return ::dbtools::canInsert( _rxCursorSet );
176 //----------------------------------------------------------------
177 sal_Bool ODataAccessStaticTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const
179 return ::dbtools::canUpdate( _rxCursorSet );
182 //----------------------------------------------------------------
183 sal_Bool ODataAccessStaticTools::canDelete(const Reference< XPropertySet>& _rxCursorSet) const
185 return ::dbtools::canDelete( _rxCursorSet );
188 //----------------------------------------------------------------
189 Reference< XNameAccess > ODataAccessStaticTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection,
190 const sal_Int32 _nCommandType, const ::rtl::OUString& _rCommand,
191 Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
193 return ::dbtools::getFieldsByCommandDescriptor( _rxConnection, _nCommandType, _rCommand,
194 _rxKeepFieldsAlive, _pErrorInfo );
197 //----------------------------------------------------------------
198 Sequence< ::rtl::OUString > ODataAccessStaticTools::getFieldNamesByCommandDescriptor(
199 const Reference< XConnection >& _rxConnection, const sal_Int32 _nCommandType,
200 const ::rtl::OUString& _rCommand, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
202 return ::dbtools::getFieldNamesByCommandDescriptor( _rxConnection, _nCommandType,
203 _rCommand, _pErrorInfo );
206 // ------------------------------------------------
207 bool ODataAccessStaticTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection )
209 return ::dbtools::isEmbeddedInDatabase( _rxComponent, _rxActualConnection );
212 //........................................................................
213 } // namespace connectivity
214 //........................................................................