1*caf5cd79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*caf5cd79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*caf5cd79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*caf5cd79SAndrew Rist * distributed with this work for additional information 6*caf5cd79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*caf5cd79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*caf5cd79SAndrew Rist * "License"); you may not use this file except in compliance 9*caf5cd79SAndrew Rist * with the License. You may obtain a copy of the License at 10*caf5cd79SAndrew Rist * 11*caf5cd79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*caf5cd79SAndrew Rist * 13*caf5cd79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*caf5cd79SAndrew Rist * software distributed under the License is distributed on an 15*caf5cd79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*caf5cd79SAndrew Rist * KIND, either express or implied. See the License for the 17*caf5cd79SAndrew Rist * specific language governing permissions and limitations 18*caf5cd79SAndrew Rist * under the License. 19*caf5cd79SAndrew Rist * 20*caf5cd79SAndrew Rist *************************************************************/ 21*caf5cd79SAndrew Rist 22*caf5cd79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX 25cdf0e10cSrcweir #define CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <connectivity/virtualdbtools.hxx> 28cdf0e10cSrcweir #include "refbase.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir //........................................................................ 31cdf0e10cSrcweir namespace connectivity 32cdf0e10cSrcweir { 33cdf0e10cSrcweir //........................................................................ 34cdf0e10cSrcweir 35cdf0e10cSrcweir //================================================================ 36cdf0e10cSrcweir //= ODataAccessStaticTools 37cdf0e10cSrcweir //================================================================ 38cdf0e10cSrcweir class ODataAccessStaticTools 39cdf0e10cSrcweir :public simple::IDataAccessTypeConversion 40cdf0e10cSrcweir ,public simple::IDataAccessTools 41cdf0e10cSrcweir ,public ORefBase 42cdf0e10cSrcweir { 43cdf0e10cSrcweir public: 44cdf0e10cSrcweir ODataAccessStaticTools(); 45cdf0e10cSrcweir 46cdf0e10cSrcweir // IDataAccessTypeConversion 47cdf0e10cSrcweir // ------------------------------------------------ 48cdf0e10cSrcweir virtual ::com::sun::star::util::Date getStandardDate() const; 49cdf0e10cSrcweir 50cdf0e10cSrcweir // ------------------------------------------------ 51cdf0e10cSrcweir virtual double getValue( 52cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant, 53cdf0e10cSrcweir const ::com::sun::star::util::Date& rNullDate ) const; 54cdf0e10cSrcweir 55cdf0e10cSrcweir // ------------------------------------------------ 56cdf0e10cSrcweir virtual ::rtl::OUString getFormattedValue( 57cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn, 58cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter, 59cdf0e10cSrcweir const ::com::sun::star::util::Date& _rNullDate, 60cdf0e10cSrcweir sal_Int32 _nKey, 61cdf0e10cSrcweir sal_Int16 _nKeyType) const; 62cdf0e10cSrcweir 63cdf0e10cSrcweir // ------------------------------------------------ 64cdf0e10cSrcweir virtual ::rtl::OUString getFormattedValue( 65cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn, 66cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter, 67cdf0e10cSrcweir const ::com::sun::star::lang::Locale& _rLocale, 68cdf0e10cSrcweir const ::com::sun::star::util::Date& _rNullDate 69cdf0e10cSrcweir ) const; 70cdf0e10cSrcweir 71cdf0e10cSrcweir // IDataAccessTools 72cdf0e10cSrcweir // ------------------------------------------------ 73cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback( 74cdf0e10cSrcweir const ::rtl::OUString& _rDataSourceName, 75cdf0e10cSrcweir const ::rtl::OUString& _rUser, 76cdf0e10cSrcweir const ::rtl::OUString& _rPwd, 77cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory 78cdf0e10cSrcweir ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // ------------------------------------------------ 81cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( 82cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, 83cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, 84cdf0e10cSrcweir sal_Bool _bSetAsActiveConnection 85cdf0e10cSrcweir ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException 86cdf0e10cSrcweir , ::com::sun::star::lang::WrappedTargetException 87cdf0e10cSrcweir , ::com::sun::star::uno::RuntimeException ) ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir // ------------------------------------------------ 90cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection( 91cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet) 92cdf0e10cSrcweir const SAL_THROW ( (::com::sun::star::uno::RuntimeException) ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // ------------------------------------------------ 95cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats( 96cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn, 97cdf0e10cSrcweir sal_Bool _bAllowDefault 98cdf0e10cSrcweir ) const; 99cdf0e10cSrcweir 100cdf0e10cSrcweir // ------------------------------------------------ 101cdf0e10cSrcweir virtual sal_Int32 getDefaultNumberFormat( 102cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn, 103cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes, 104cdf0e10cSrcweir const ::com::sun::star::lang::Locale& _rLocale 105cdf0e10cSrcweir ) const; 106cdf0e10cSrcweir 107cdf0e10cSrcweir // ------------------------------------------------ 108cdf0e10cSrcweir virtual void TransferFormComponentProperties( 109cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld, 110cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew, 111cdf0e10cSrcweir const ::com::sun::star::lang::Locale& _rLocale 112cdf0e10cSrcweir ) const; 113cdf0e10cSrcweir 114cdf0e10cSrcweir // ------------------------------------------------ 115cdf0e10cSrcweir virtual ::rtl::OUString quoteName( 116cdf0e10cSrcweir const ::rtl::OUString& _rQuote, 117cdf0e10cSrcweir const ::rtl::OUString& _rName 118cdf0e10cSrcweir ) const; 119cdf0e10cSrcweir 120cdf0e10cSrcweir // ------------------------------------------------ 121cdf0e10cSrcweir virtual ::rtl::OUString composeTableNameForSelect( 122cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, 123cdf0e10cSrcweir const ::rtl::OUString& _rCatalog, 124cdf0e10cSrcweir const ::rtl::OUString& _rSchema, 125cdf0e10cSrcweir const ::rtl::OUString& _rName 126cdf0e10cSrcweir ) const; 127cdf0e10cSrcweir 128cdf0e10cSrcweir // ------------------------------------------------ 129cdf0e10cSrcweir virtual ::rtl::OUString composeTableNameForSelect( 130cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, 131cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable 132cdf0e10cSrcweir ) const; 133cdf0e10cSrcweir 134cdf0e10cSrcweir // ------------------------------------------------ 135cdf0e10cSrcweir virtual ::com::sun::star::sdb::SQLContext prependContextInfo( 136cdf0e10cSrcweir ::com::sun::star::sdbc::SQLException& _rException, 137cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, 138cdf0e10cSrcweir const ::rtl::OUString& _rContextDescription, 139cdf0e10cSrcweir const ::rtl::OUString& _rContextDetails 140cdf0e10cSrcweir ) const; 141cdf0e10cSrcweir 142cdf0e10cSrcweir // ------------------------------------------------ 143cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource( 144cdf0e10cSrcweir const ::rtl::OUString& _rsRegisteredName, 145cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory 146cdf0e10cSrcweir ) const; 147cdf0e10cSrcweir 148cdf0e10cSrcweir // ------------------------------------------------ 149cdf0e10cSrcweir /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT 150cdf0e10cSrcweir @param _rxCursorSet the property set 151cdf0e10cSrcweir */ 152cdf0e10cSrcweir virtual sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const; 153cdf0e10cSrcweir 154cdf0e10cSrcweir // ------------------------------------------------ 155cdf0e10cSrcweir /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE 156cdf0e10cSrcweir @param _rxCursorSet the property set 157cdf0e10cSrcweir */ 158cdf0e10cSrcweir virtual sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const; 159cdf0e10cSrcweir 160cdf0e10cSrcweir // ------------------------------------------------ 161cdf0e10cSrcweir /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE 162cdf0e10cSrcweir @param _rxCursorSet the property set 163cdf0e10cSrcweir */ 164cdf0e10cSrcweir virtual sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const; 165cdf0e10cSrcweir 166cdf0e10cSrcweir // ------------------------------------------------ 167cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > 168cdf0e10cSrcweir getFieldsByCommandDescriptor( 169cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, 170cdf0e10cSrcweir const sal_Int32 _nCommandType, 171cdf0e10cSrcweir const ::rtl::OUString& _rCommand, 172cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive, 173cdf0e10cSrcweir ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL 174cdf0e10cSrcweir ) SAL_THROW( ( ) ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir // ------------------------------------------------ 177cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > 178cdf0e10cSrcweir getFieldNamesByCommandDescriptor( 179cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, 180cdf0e10cSrcweir const sal_Int32 _nCommandType, 181cdf0e10cSrcweir const ::rtl::OUString& _rCommand, 182cdf0e10cSrcweir ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL 183cdf0e10cSrcweir ) SAL_THROW( ( ) ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir // ------------------------------------------------ 186cdf0e10cSrcweir virtual bool isEmbeddedInDatabase( 187cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent, 188cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection 189cdf0e10cSrcweir ); 190cdf0e10cSrcweir 191cdf0e10cSrcweir // disambiguate IReference 192cdf0e10cSrcweir // ------------------------------------------------ 193cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 194cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 195cdf0e10cSrcweir }; 196cdf0e10cSrcweir 197cdf0e10cSrcweir //........................................................................ 198cdf0e10cSrcweir } // namespace connectivity 199cdf0e10cSrcweir //........................................................................ 200cdf0e10cSrcweir 201cdf0e10cSrcweir #endif // CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX 202cdf0e10cSrcweir 203