Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <connectivity/virtualdbtools.hxx>
21 : #include "staticdbtools_s.hxx"
22 : #include "connectivity/dbconversion.hxx"
23 : #include <connectivity/dbtools.hxx>
24 : #include <com/sun/star/sdb/SQLContext.hpp>
25 :
26 : //........................................................................
27 : namespace connectivity
28 : {
29 : //........................................................................
30 :
31 : using namespace ::com::sun::star::util;
32 : using namespace ::com::sun::star::uno;
33 : using namespace ::com::sun::star::sdb;
34 : using namespace ::com::sun::star::lang;
35 : using namespace ::com::sun::star::sdbc;
36 : using namespace ::com::sun::star::beans;
37 : using namespace ::com::sun::star::container;
38 :
39 : //================================================================
40 : //= ODataAccessStaticTools
41 : //================================================================
42 : //----------------------------------------------------------------
43 3 : ODataAccessStaticTools::ODataAccessStaticTools()
44 : {
45 3 : }
46 :
47 : //----------------------------------------------------------------
48 0 : Date ODataAccessStaticTools::getStandardDate() const
49 : {
50 0 : return ::dbtools::DBTypeConversion::getStandardDate();
51 : }
52 :
53 : //----------------------------------------------------------------
54 0 : double ODataAccessStaticTools::getValue(const Reference< XColumn>& _rxVariant, const Date& rNullDate ) const
55 : {
56 0 : return ::dbtools::DBTypeConversion::getValue( _rxVariant, rNullDate );
57 : }
58 :
59 : //----------------------------------------------------------------
60 0 : ::rtl::OUString ODataAccessStaticTools::getFormattedValue(const Reference< XColumn >& _rxColumn, const Reference< XNumberFormatter >& _rxFormatter,
61 : const Date& _rNullDate, sal_Int32 _nKey, sal_Int16 _nKeyType) const
62 : {
63 0 : return ::dbtools::DBTypeConversion::getFormattedValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType);
64 : }
65 :
66 : //----------------------------------------------------------------
67 0 : ::rtl::OUString ODataAccessStaticTools::getFormattedValue( const Reference< XPropertySet>& _rxColumn, const Reference< XNumberFormatter>& _rxFormatter,
68 : const Locale& _rLocale, const Date& _rNullDate ) const
69 : {
70 0 : return ::dbtools::DBTypeConversion::getFormattedValue( _rxColumn, _rxFormatter, _rLocale, _rNullDate );
71 : }
72 :
73 : //----------------------------------------------------------------
74 12 : oslInterlockedCount SAL_CALL ODataAccessStaticTools::acquire()
75 : {
76 12 : return ORefBase::acquire();
77 : }
78 :
79 : //----------------------------------------------------------------
80 12 : oslInterlockedCount SAL_CALL ODataAccessStaticTools::release()
81 : {
82 12 : return ORefBase::release();
83 : }
84 :
85 : //----------------------------------------------------------------
86 0 : Reference< XConnection> ODataAccessStaticTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser,
87 : const ::rtl::OUString& _rPwd, const Reference< XComponentContext>& _rxContext) const SAL_THROW ( (SQLException) )
88 : {
89 0 : return ::dbtools::getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxContext);
90 : }
91 :
92 : //----------------------------------------------------------------
93 0 : Reference< XConnection> ODataAccessStaticTools::connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, sal_Bool _bSetAsActiveConnection) const
94 : SAL_THROW ( (SQLException, WrappedTargetException, RuntimeException) )
95 : {
96 0 : return ::dbtools::connectRowset( _rxRowSet, _rxContext, _bSetAsActiveConnection);
97 : }
98 :
99 : // ------------------------------------------------
100 1 : Reference< XConnection> ODataAccessStaticTools::getRowSetConnection(
101 : const Reference< XRowSet>& _rxRowSet)
102 : const SAL_THROW ( (RuntimeException) )
103 : {
104 1 : return ::dbtools::getConnection(_rxRowSet);
105 : }
106 :
107 : //----------------------------------------------------------------
108 0 : Reference< XNumberFormatsSupplier> ODataAccessStaticTools::getNumberFormats(const Reference< XConnection>& _rxConn, sal_Bool _bAllowDefault) const
109 : {
110 0 : return ::dbtools::getNumberFormats(_rxConn, _bAllowDefault);
111 : }
112 :
113 : //----------------------------------------------------------------
114 0 : sal_Int32 ODataAccessStaticTools::getDefaultNumberFormat( const Reference< XPropertySet >& _rxColumn, const Reference< XNumberFormatTypes >& _rxTypes,
115 : const Locale& _rLocale ) const
116 : {
117 0 : return ::dbtools::getDefaultNumberFormat( _rxColumn, _rxTypes, _rLocale );
118 : }
119 :
120 : //----------------------------------------------------------------
121 0 : void ODataAccessStaticTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld, const Reference< XPropertySet>& _rxNew, const Locale& _rLocale) const
122 : {
123 0 : ::dbtools::TransferFormComponentProperties(_rxOld, _rxNew, _rLocale);
124 0 : }
125 :
126 : //----------------------------------------------------------------
127 0 : ::rtl::OUString ODataAccessStaticTools::quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName) const
128 : {
129 0 : return ::dbtools::quoteName(_rQuote, _rName);
130 : }
131 :
132 : //----------------------------------------------------------------
133 0 : ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const ::rtl::OUString& _rCatalog, const ::rtl::OUString& _rSchema, const ::rtl::OUString& _rName ) const
134 : {
135 0 : return ::dbtools::composeTableNameForSelect( _rxConnection, _rCatalog, _rSchema, _rName );
136 : }
137 :
138 : //----------------------------------------------------------------
139 0 : ::rtl::OUString ODataAccessStaticTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet>& _xTable ) const
140 : {
141 0 : return ::dbtools::composeTableNameForSelect( _rxConnection, _xTable );
142 : }
143 :
144 : //----------------------------------------------------------------
145 0 : SQLContext ODataAccessStaticTools::prependContextInfo(SQLException& _rException, const Reference< XInterface >& _rxContext,
146 : const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) const
147 : {
148 0 : return ::dbtools::prependContextInfo(_rException, _rxContext, _rContextDescription, _rContextDetails);
149 : }
150 :
151 : //----------------------------------------------------------------
152 0 : Reference< XDataSource > ODataAccessStaticTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XComponentContext>& _rxContext ) const
153 : {
154 0 : return ::dbtools::getDataSource( _rsRegisteredName, _rxContext );
155 : }
156 :
157 : //----------------------------------------------------------------
158 0 : sal_Bool ODataAccessStaticTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const
159 : {
160 0 : return ::dbtools::canInsert( _rxCursorSet );
161 : }
162 :
163 : //----------------------------------------------------------------
164 0 : sal_Bool ODataAccessStaticTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const
165 : {
166 0 : return ::dbtools::canUpdate( _rxCursorSet );
167 : }
168 :
169 : //----------------------------------------------------------------
170 0 : sal_Bool ODataAccessStaticTools::canDelete(const Reference< XPropertySet>& _rxCursorSet) const
171 : {
172 0 : return ::dbtools::canDelete( _rxCursorSet );
173 : }
174 :
175 : //----------------------------------------------------------------
176 0 : Reference< XNameAccess > ODataAccessStaticTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection,
177 : const sal_Int32 _nCommandType, const ::rtl::OUString& _rCommand,
178 : Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
179 : {
180 : return ::dbtools::getFieldsByCommandDescriptor( _rxConnection, _nCommandType, _rCommand,
181 0 : _rxKeepFieldsAlive, _pErrorInfo );
182 : }
183 :
184 : //----------------------------------------------------------------
185 0 : Sequence< ::rtl::OUString > ODataAccessStaticTools::getFieldNamesByCommandDescriptor(
186 : const Reference< XConnection >& _rxConnection, const sal_Int32 _nCommandType,
187 : const ::rtl::OUString& _rCommand, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
188 : {
189 : return ::dbtools::getFieldNamesByCommandDescriptor( _rxConnection, _nCommandType,
190 0 : _rCommand, _pErrorInfo );
191 : }
192 :
193 : // ------------------------------------------------
194 2 : bool ODataAccessStaticTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection )
195 : {
196 2 : return ::dbtools::isEmbeddedInDatabase( _rxComponent, _rxActualConnection );
197 : }
198 :
199 : //........................................................................
200 : } // namespace connectivity
201 : //........................................................................
202 :
203 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|