1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_connectivity.hxx" 30 #include <connectivity/virtualdbtools.hxx> 31 #include "staticdbtools_s.hxx" 32 #include "connectivity/dbconversion.hxx" 33 #include <connectivity/dbtools.hxx> 34 #include <com/sun/star/sdb/SQLContext.hpp> 35 36 //........................................................................ 37 namespace connectivity 38 { 39 //........................................................................ 40 41 using namespace ::com::sun::star::util; 42 using namespace ::com::sun::star::uno; 43 using namespace ::com::sun::star::sdb; 44 using namespace ::com::sun::star::lang; 45 using namespace ::com::sun::star::sdbc; 46 using namespace ::com::sun::star::beans; 47 using namespace ::com::sun::star::container; 48 49 //================================================================ 50 //= ODataAccessStaticTools 51 //================================================================ 52 //---------------------------------------------------------------- 53 ODataAccessStaticTools::ODataAccessStaticTools() 54 { 55 } 56 57 //---------------------------------------------------------------- 58 Date ODataAccessStaticTools::getStandardDate() const 59 { 60 return ::dbtools::DBTypeConversion::getStandardDate(); 61 } 62 63 //---------------------------------------------------------------- 64 double ODataAccessStaticTools::getValue(const Reference< XColumn>& _rxVariant, const Date& rNullDate ) const 65 { 66 return ::dbtools::DBTypeConversion::getValue( _rxVariant, rNullDate ); 67 } 68 69 //---------------------------------------------------------------- 70 ::rtl::OUString ODataAccessStaticTools::getFormattedValue(const Reference< XColumn >& _rxColumn, const Reference< XNumberFormatter >& _rxFormatter, 71 const Date& _rNullDate, sal_Int32 _nKey, sal_Int16 _nKeyType) const 72 { 73 return ::dbtools::DBTypeConversion::getFormattedValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType); 74 } 75 76 //---------------------------------------------------------------- 77 ::rtl::OUString ODataAccessStaticTools::getFormattedValue( const Reference< XPropertySet>& _rxColumn, const Reference< XNumberFormatter>& _rxFormatter, 78 const Locale& _rLocale, const Date& _rNullDate ) const 79 { 80 return ::dbtools::DBTypeConversion::getFormattedValue( _rxColumn, _rxFormatter, _rLocale, _rNullDate ); 81 } 82 83 //---------------------------------------------------------------- 84 oslInterlockedCount SAL_CALL ODataAccessStaticTools::acquire() 85 { 86 return ORefBase::acquire(); 87 } 88 89 //---------------------------------------------------------------- 90 oslInterlockedCount SAL_CALL ODataAccessStaticTools::release() 91 { 92 return ORefBase::release(); 93 } 94 95 //---------------------------------------------------------------- 96 Reference< XConnection> ODataAccessStaticTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, 97 const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const SAL_THROW ( (SQLException) ) 98 { 99 return ::dbtools::getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory); 100 } 101 102 //---------------------------------------------------------------- 103 Reference< XConnection> ODataAccessStaticTools::connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, sal_Bool _bSetAsActiveConnection) const 104 SAL_THROW ( (SQLException, WrappedTargetException, RuntimeException) ) 105 { 106 return ::dbtools::connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection); 107 } 108 109 // ------------------------------------------------ 110 Reference< XConnection> ODataAccessStaticTools::getRowSetConnection( 111 const Reference< XRowSet>& _rxRowSet) 112 const SAL_THROW ( (RuntimeException) ) 113 { 114 return ::dbtools::getConnection(_rxRowSet); 115 } 116 117 //---------------------------------------------------------------- 118 Reference< XNumberFormatsSupplier> ODataAccessStaticTools::getNumberFormats(const Reference< XConnection>& _rxConn, sal_Bool _bAllowDefault) const 119 { 120 return ::dbtools::getNumberFormats(_rxConn, _bAllowDefault); 121 } 122 123 //---------------------------------------------------------------- 124 sal_Int32 ODataAccessStaticTools::getDefaultNumberFormat( const Reference< XPropertySet >& _rxColumn, const Reference< XNumberFormatTypes >& _rxTypes, 125 const Locale& _rLocale ) const 126 { 127 return ::dbtools::getDefaultNumberFormat( _rxColumn, _rxTypes, _rLocale ); 128 } 129 130 //---------------------------------------------------------------- 131 void ODataAccessStaticTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld, const Reference< XPropertySet>& _rxNew, const Locale& _rLocale) const 132 { 133 ::dbtools::TransferFormComponentProperties(_rxOld, _rxNew, _rLocale); 134 } 135 136 //---------------------------------------------------------------- 137 ::rtl::OUString ODataAccessStaticTools::quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName) const 138 { 139 return ::dbtools::quoteName(_rQuote, _rName); 140 } 141 142 //---------------------------------------------------------------- 143 ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const ::rtl::OUString& _rCatalog, const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rName ) const 144 { 145 return ::dbtools::composeTableNameForSelect( _rxConnection, _rCatalog, _rSchema, _rName ); 146 } 147 148 //---------------------------------------------------------------- 149 ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet>& _xTable ) const 150 { 151 return ::dbtools::composeTableNameForSelect( _rxConnection, _xTable ); 152 } 153 154 //---------------------------------------------------------------- 155 SQLContext ODataAccessStaticTools::prependContextInfo(SQLException& _rException, const Reference< XInterface >& _rxContext, 156 const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) const 157 { 158 return ::dbtools::prependContextInfo(_rException, _rxContext, _rContextDescription, _rContextDetails); 159 } 160 161 //---------------------------------------------------------------- 162 Reference< XDataSource > ODataAccessStaticTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const 163 { 164 return ::dbtools::getDataSource( _rsRegisteredName, _rxFactory ); 165 } 166 167 //---------------------------------------------------------------- 168 sal_Bool ODataAccessStaticTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const 169 { 170 return ::dbtools::canInsert( _rxCursorSet ); 171 } 172 173 //---------------------------------------------------------------- 174 sal_Bool ODataAccessStaticTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const 175 { 176 return ::dbtools::canUpdate( _rxCursorSet ); 177 } 178 179 //---------------------------------------------------------------- 180 sal_Bool ODataAccessStaticTools::canDelete(const Reference< XPropertySet>& _rxCursorSet) const 181 { 182 return ::dbtools::canDelete( _rxCursorSet ); 183 } 184 185 //---------------------------------------------------------------- 186 Reference< XNameAccess > ODataAccessStaticTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection, 187 const sal_Int32 _nCommandType, const ::rtl::OUString& _rCommand, 188 Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) ) 189 { 190 return ::dbtools::getFieldsByCommandDescriptor( _rxConnection, _nCommandType, _rCommand, 191 _rxKeepFieldsAlive, _pErrorInfo ); 192 } 193 194 //---------------------------------------------------------------- 195 Sequence< ::rtl::OUString > ODataAccessStaticTools::getFieldNamesByCommandDescriptor( 196 const Reference< XConnection >& _rxConnection, const sal_Int32 _nCommandType, 197 const ::rtl::OUString& _rCommand, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) ) 198 { 199 return ::dbtools::getFieldNamesByCommandDescriptor( _rxConnection, _nCommandType, 200 _rCommand, _pErrorInfo ); 201 } 202 203 // ------------------------------------------------ 204 bool ODataAccessStaticTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection ) 205 { 206 return ::dbtools::isEmbeddedInDatabase( _rxComponent, _rxActualConnection ); 207 } 208 209 //........................................................................ 210 } // namespace connectivity 211 //........................................................................ 212 213