LibreOffice Module dbaccess (master) 1
callablestatement.cxx
Go to the documentation of this file.
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 <callablestatement.hxx>
23#include <strings.hxx>
24
25using namespace dbaccess;
26using namespace ::com::sun::star::sdbc;
27using namespace ::com::sun::star::sdbcx;
28using namespace ::com::sun::star::beans;
29using namespace ::com::sun::star::uno;
30using namespace ::com::sun::star::lang;
31using namespace ::cppu;
32using namespace ::osl;
33
34// css::lang::XTypeProvider
35Sequence< Type > OCallableStatement::getTypes()
36{
37 OTypeCollection aTypes(cppu::UnoType<XRow>::get(),
40
41 return aTypes.getTypes();
42}
43
45{
46 return css::uno::Sequence<sal_Int8>();
47}
48
49// css::uno::XInterface
51{
53 if (!aIface.hasValue())
54 aIface = ::cppu::queryInterface(
55 rType,
56 static_cast< XRow * >( this ),
57 static_cast< XOutParameters * >( this ));
58 return aIface;
59}
60
62{
64}
65
67{
69}
70
71// XServiceInfo
73{
74 return "com.sun.star.sdb.OCallableStatement";
75}
76
78{
80}
81
82// XOutParameters
83void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName )
84{
85 MutexGuard aGuard(m_aMutex);
86
87 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
88
89 Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerOutParameter( parameterIndex, sqlType, typeName );
90}
91
92void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale )
93{
94 MutexGuard aGuard(m_aMutex);
95 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
96
97 Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerNumericOutParameter( parameterIndex, sqlType, scale );
98}
99
100// XRow
102{
103 MutexGuard aGuard(m_aMutex);
104 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
105
106 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->wasNull();
107}
108
109OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
110{
111 MutexGuard aGuard(m_aMutex);
112 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
113
114 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getString( columnIndex );
115}
116
117sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
118{
119 MutexGuard aGuard(m_aMutex);
120 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
121
122 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBoolean( columnIndex );
123}
124
125sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
126{
127 MutexGuard aGuard(m_aMutex);
128 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
129
130 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getByte( columnIndex );
131}
132
133sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
134{
135 MutexGuard aGuard(m_aMutex);
136 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
137 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getShort( columnIndex );
138}
139
140sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
141{
142 MutexGuard aGuard(m_aMutex);
143 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
144 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getInt( columnIndex );
145}
146
147sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
148{
149 MutexGuard aGuard(m_aMutex);
150 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
151 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getLong( columnIndex );
152}
153
154float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
155{
156 MutexGuard aGuard(m_aMutex);
157 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
158 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getFloat( columnIndex );
159}
160
161double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
162{
163 MutexGuard aGuard(m_aMutex);
164 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
165 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDouble( columnIndex );
166}
167
168Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
169{
170 MutexGuard aGuard(m_aMutex);
171 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
172 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBytes( columnIndex );
173}
174
175css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
176{
177 MutexGuard aGuard(m_aMutex);
178 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
179 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDate( columnIndex );
180}
181
182css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
183{
184 MutexGuard aGuard(m_aMutex);
185 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
186 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTime( columnIndex );
187}
188
189css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
190{
191 MutexGuard aGuard(m_aMutex);
192 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
193
194 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTimestamp( columnIndex );
195}
196
197Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex )
198{
199 MutexGuard aGuard(m_aMutex);
200 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
201
202 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBinaryStream( columnIndex );
203}
204
205Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex )
206{
207 MutexGuard aGuard(m_aMutex);
208 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
209
210 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getCharacterStream( columnIndex );
211}
212
213Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& typeMap )
214{
215 MutexGuard aGuard(m_aMutex);
216 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
217
218 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getObject( columnIndex, typeMap );
219}
220
221Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex )
222{
223 MutexGuard aGuard(m_aMutex);
224 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
225 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getRef( columnIndex );
226}
227
228Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex )
229{
230 MutexGuard aGuard(m_aMutex);
231 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
232 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBlob( columnIndex );
233}
234
235Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex )
236{
237 MutexGuard aGuard(m_aMutex);
238 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
239 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getClob( columnIndex );
240}
241
242Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex )
243{
244 MutexGuard aGuard(m_aMutex);
245 ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
246 return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getArray( columnIndex );
247}
248
249
250/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::beans::XPropertySet > m_xAggregateAsSet
Definition: statement.hxx:56
mutable::osl::Mutex m_aMutex
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual sal_Bool SAL_CALL wasNull() override
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
virtual void SAL_CALL registerNumericOutParameter(sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL registerOutParameter(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString &typeName) override
virtual void SAL_CALL release() noexcept override
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Type
OUString typeName
sal_Int32 scale
constexpr OUStringLiteral SERVICE_SDBC_CALLABLESTATEMENT
Definition: strings.hxx:170
constexpr OUStringLiteral SERVICE_SDB_CALLABLESTATEMENT
Definition: strings.hxx:187
unsigned char sal_Bool
signed char sal_Int8
const SvXMLTokenMapEntry aTypes[]