1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: staticdbtools_s.hxx,v $
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 #ifndef CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX
32 #define CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX
34 #include <connectivity/virtualdbtools.hxx>
35 #include "refbase.hxx"
37 //........................................................................
38 namespace connectivity
40 //........................................................................
42 //================================================================
43 //= ODataAccessStaticTools
44 //================================================================
45 class ODataAccessStaticTools
46 :public simple::IDataAccessTypeConversion
47 ,public simple::IDataAccessTools
51 ODataAccessStaticTools();
53 // IDataAccessTypeConversion
54 // ------------------------------------------------
55 virtual ::com::sun::star::util::Date
getStandardDate() const;
57 // ------------------------------------------------
58 virtual double getValue(
59 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
>& _rxVariant
,
60 const ::com::sun::star::util::Date
& rNullDate
,
61 sal_Int16 nKeyType
) const;
63 // ------------------------------------------------
64 virtual ::rtl::OUString
getValue(
65 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdb::XColumn
>& _rxColumn
,
66 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>& _rxFormatter
,
67 const ::com::sun::star::util::Date
& _rNullDate
,
69 sal_Int16 _nKeyType
) const;
71 // ------------------------------------------------
72 virtual ::rtl::OUString
getValue(
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxColumn
,
74 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
>& _rxFormatter
,
75 const ::com::sun::star::lang::Locale
& _rLocale
,
76 const ::com::sun::star::util::Date
& _rNullDate
80 // ------------------------------------------------
81 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> getConnection_withFeedback(
82 const ::rtl::OUString
& _rDataSourceName
,
83 const ::rtl::OUString
& _rUser
,
84 const ::rtl::OUString
& _rPwd
,
85 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
86 ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException
) );
88 // ------------------------------------------------
89 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> connectRowset(
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSet
>& _rxRowSet
,
91 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
,
92 sal_Bool _bSetAsActiveConnection
93 ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
94 , ::com::sun::star::lang::WrappedTargetException
95 , ::com::sun::star::uno::RuntimeException
) );
97 // ------------------------------------------------
98 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> getRowSetConnection(
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRowSet
>& _rxRowSet
)
100 const SAL_THROW ( (::com::sun::star::uno::RuntimeException
) );
102 // ------------------------------------------------
103 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> getNumberFormats(
104 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
,
105 sal_Bool _bAllowDefault
108 // ------------------------------------------------
109 virtual sal_Int32
getDefaultNumberFormat(
110 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxColumn
,
111 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatTypes
>& _rxTypes
,
112 const ::com::sun::star::lang::Locale
& _rLocale
115 // ------------------------------------------------
116 virtual void TransferFormComponentProperties(
117 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxOld
,
118 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxNew
,
119 const ::com::sun::star::lang::Locale
& _rLocale
122 // ------------------------------------------------
123 virtual ::rtl::OUString
quoteName(
124 const ::rtl::OUString
& _rQuote
,
125 const ::rtl::OUString
& _rName
128 // ------------------------------------------------
129 virtual ::rtl::OUString
composeTableNameForSelect(
130 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
131 const ::rtl::OUString
& _rCatalog
,
132 const ::rtl::OUString
& _rSchema
,
133 const ::rtl::OUString
& _rName
136 // ------------------------------------------------
137 virtual ::rtl::OUString
composeTableNameForSelect(
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
139 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xTable
142 // ------------------------------------------------
143 virtual ::com::sun::star::sdb::SQLContext
prependContextInfo(
144 ::com::sun::star::sdbc::SQLException
& _rException
,
145 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxContext
,
146 const ::rtl::OUString
& _rContextDescription
,
147 const ::rtl::OUString
& _rContextDetails
150 // ------------------------------------------------
151 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDataSource
> getDataSource(
152 const ::rtl::OUString
& _rsRegisteredName
,
153 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
156 // ------------------------------------------------
157 /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
158 @param _rxCursorSet the property set
160 virtual sal_Bool
canInsert(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxCursorSet
) const;
162 // ------------------------------------------------
163 /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
164 @param _rxCursorSet the property set
166 virtual sal_Bool
canUpdate(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxCursorSet
) const;
168 // ------------------------------------------------
169 /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
170 @param _rxCursorSet the property set
172 virtual sal_Bool
canDelete(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxCursorSet
) const;
174 // ------------------------------------------------
175 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
176 getFieldsByCommandDescriptor(
177 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
178 const sal_Int32 _nCommandType
,
179 const ::rtl::OUString
& _rCommand
,
180 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>& _rxKeepFieldsAlive
,
181 ::dbtools::SQLExceptionInfo
* _pErrorInfo
= NULL
184 // ------------------------------------------------
185 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
186 getFieldNamesByCommandDescriptor(
187 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
188 const sal_Int32 _nCommandType
,
189 const ::rtl::OUString
& _rCommand
,
190 ::dbtools::SQLExceptionInfo
* _pErrorInfo
= NULL
193 // ------------------------------------------------
194 virtual bool isEmbeddedInDatabase(
195 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& _rxComponent
,
196 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxActualConnection
199 // disambiguate IReference
200 // ------------------------------------------------
201 virtual oslInterlockedCount SAL_CALL
acquire();
202 virtual oslInterlockedCount SAL_CALL
release();
205 //........................................................................
206 } // namespace connectivity
207 //........................................................................
209 #endif // CONNECTIVITY_STATIC_DBTOOLS_SIMPLE_HXX