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 <callablestatement.hxx>
21 : #include <com/sun/star/lang/DisposedException.hpp>
22 : #include <cppuhelper/typeprovider.hxx>
23 : #include <comphelper/property.hxx>
24 : #include "dbastrings.hrc"
25 :
26 : using namespace dbaccess;
27 : using namespace ::com::sun::star::sdbc;
28 : using namespace ::com::sun::star::sdbcx;
29 : using namespace ::com::sun::star::beans;
30 : using namespace ::com::sun::star::uno;
31 : using namespace ::com::sun::star::lang;
32 : using namespace ::cppu;
33 : using namespace ::osl;
34 :
35 : // com::sun::star::lang::XTypeProvider
36 0 : Sequence< Type > OCallableStatement::getTypes() throw (RuntimeException, std::exception)
37 : {
38 : SAL_INFO("dbaccess", "OCallableStatement::getTypes" );
39 0 : OTypeCollection aTypes(::getCppuType( (const Reference< XRow > *)0 ),
40 0 : ::getCppuType( (const Reference< XOutParameters > *)0 ),
41 0 : OPreparedStatement::getTypes() );
42 :
43 0 : return aTypes.getTypes();
44 : }
45 :
46 0 : Sequence< sal_Int8 > OCallableStatement::getImplementationId() throw (RuntimeException, std::exception)
47 : {
48 0 : return css::uno::Sequence<sal_Int8>();
49 : }
50 :
51 : // com::sun::star::uno::XInterface
52 0 : Any OCallableStatement::queryInterface( const Type & rType ) throw (RuntimeException, std::exception)
53 : {
54 : //SAL_INFO("dbaccess", "OCallableStatement::queryInterface" );
55 0 : Any aIface = OPreparedStatement::queryInterface( rType );
56 0 : if (!aIface.hasValue())
57 0 : aIface = ::cppu::queryInterface(
58 : rType,
59 : static_cast< XRow * >( this ),
60 0 : static_cast< XOutParameters * >( this ));
61 0 : return aIface;
62 : }
63 :
64 0 : void OCallableStatement::acquire() throw ()
65 : {
66 0 : OPreparedStatement::acquire();
67 0 : }
68 :
69 0 : void OCallableStatement::release() throw ()
70 : {
71 0 : OPreparedStatement::release();
72 0 : }
73 :
74 : // XServiceInfo
75 0 : OUString OCallableStatement::getImplementationName( ) throw(RuntimeException, std::exception)
76 : {
77 : SAL_INFO("dbaccess", "OCallableStatement::getImplementationName" );
78 0 : return OUString("com.sun.star.sdb.OCallableStatement");
79 : }
80 :
81 0 : Sequence< OUString > OCallableStatement::getSupportedServiceNames( ) throw (RuntimeException, std::exception)
82 : {
83 : SAL_INFO("dbaccess", "OCallableStatement::getSupportedServiceNames" );
84 0 : Sequence< OUString > aSNS( 2 );
85 0 : aSNS.getArray()[0] = SERVICE_SDBC_CALLABLESTATEMENT;
86 0 : aSNS.getArray()[1] = SERVICE_SDB_CALLABLESTATEMENT;
87 0 : return aSNS;
88 : }
89 :
90 : // XOutParameters
91 0 : void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName ) throw(SQLException, RuntimeException, std::exception)
92 : {
93 : SAL_INFO("dbaccess", "OCallableStatement::registerOutParameter" );
94 0 : MutexGuard aGuard(m_aMutex);
95 :
96 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
97 :
98 0 : Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY)->registerOutParameter( parameterIndex, sqlType, typeName );
99 0 : }
100 :
101 0 : void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException, std::exception)
102 : {
103 : SAL_INFO("dbaccess", "OCallableStatement::registerNumericOutParameter" );
104 0 : MutexGuard aGuard(m_aMutex);
105 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
106 :
107 0 : Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY)->registerNumericOutParameter( parameterIndex, sqlType, scale );
108 0 : }
109 :
110 : // XRow
111 0 : sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException, std::exception)
112 : {
113 : SAL_INFO("dbaccess", "OCallableStatement::wasNull" );
114 0 : MutexGuard aGuard(m_aMutex);
115 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
116 :
117 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->wasNull();
118 : }
119 :
120 0 : OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
121 : {
122 : SAL_INFO("dbaccess", "OCallableStatement::getString" );
123 0 : MutexGuard aGuard(m_aMutex);
124 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
125 :
126 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getString( columnIndex );
127 : }
128 :
129 0 : sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
130 : {
131 : SAL_INFO("dbaccess", "OCallableStatement::getBoolean" );
132 0 : MutexGuard aGuard(m_aMutex);
133 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
134 :
135 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBoolean( columnIndex );
136 : }
137 :
138 0 : sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
139 : {
140 : SAL_INFO("dbaccess", "OCallableStatement::getByte" );
141 0 : MutexGuard aGuard(m_aMutex);
142 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
143 :
144 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getByte( columnIndex );
145 : }
146 :
147 0 : sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
148 : {
149 : SAL_INFO("dbaccess", "OCallableStatement::getShort" );
150 0 : MutexGuard aGuard(m_aMutex);
151 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
152 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getShort( columnIndex );
153 : }
154 :
155 0 : sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
156 : {
157 : SAL_INFO("dbaccess", "OCallableStatement::getInt" );
158 0 : MutexGuard aGuard(m_aMutex);
159 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
160 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getInt( columnIndex );
161 : }
162 :
163 0 : sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
164 : {
165 : SAL_INFO("dbaccess", "OCallableStatement::getLong" );
166 0 : MutexGuard aGuard(m_aMutex);
167 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
168 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getLong( columnIndex );
169 : }
170 :
171 0 : float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
172 : {
173 : SAL_INFO("dbaccess", "OCallableStatement::getFloat" );
174 0 : MutexGuard aGuard(m_aMutex);
175 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
176 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getFloat( columnIndex );
177 : }
178 :
179 0 : double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
180 : {
181 : SAL_INFO("dbaccess", "OCallableStatement::getDouble" );
182 0 : MutexGuard aGuard(m_aMutex);
183 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
184 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDouble( columnIndex );
185 : }
186 :
187 0 : Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
188 : {
189 : SAL_INFO("dbaccess", "OCallableStatement::getBytes" );
190 0 : MutexGuard aGuard(m_aMutex);
191 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
192 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBytes( columnIndex );
193 : }
194 :
195 0 : ::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
196 : {
197 : SAL_INFO("dbaccess", "OCallableStatement::getDate" );
198 0 : MutexGuard aGuard(m_aMutex);
199 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
200 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getDate( columnIndex );
201 : }
202 :
203 0 : ::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
204 : {
205 : SAL_INFO("dbaccess", "OCallableStatement::getTime" );
206 0 : MutexGuard aGuard(m_aMutex);
207 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
208 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getTime( columnIndex );
209 : }
210 :
211 0 : ::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
212 : {
213 : SAL_INFO("dbaccess", "OCallableStatement::getTimestamp" );
214 0 : MutexGuard aGuard(m_aMutex);
215 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
216 :
217 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getTimestamp( columnIndex );
218 : }
219 :
220 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
221 : {
222 : SAL_INFO("dbaccess", "OCallableStatement::getBinaryStream" );
223 0 : MutexGuard aGuard(m_aMutex);
224 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
225 :
226 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBinaryStream( columnIndex );
227 : }
228 :
229 0 : Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
230 : {
231 : SAL_INFO("dbaccess", "OCallableStatement::getCharacterStream" );
232 0 : MutexGuard aGuard(m_aMutex);
233 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
234 :
235 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getCharacterStream( columnIndex );
236 : }
237 :
238 0 : Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(SQLException, RuntimeException, std::exception)
239 : {
240 : SAL_INFO("dbaccess", "OCallableStatement::getObject" );
241 0 : MutexGuard aGuard(m_aMutex);
242 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
243 :
244 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getObject( columnIndex, typeMap );
245 : }
246 :
247 0 : Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
248 : {
249 : SAL_INFO("dbaccess", "OCallableStatement::getRef" );
250 0 : MutexGuard aGuard(m_aMutex);
251 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
252 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getRef( columnIndex );
253 : }
254 :
255 0 : Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
256 : {
257 : SAL_INFO("dbaccess", "OCallableStatement::getBlob" );
258 0 : MutexGuard aGuard(m_aMutex);
259 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
260 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getBlob( columnIndex );
261 : }
262 :
263 0 : Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
264 : {
265 : SAL_INFO("dbaccess", "OCallableStatement::getClob" );
266 0 : MutexGuard aGuard(m_aMutex);
267 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
268 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getClob( columnIndex );
269 : }
270 :
271 0 : Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex ) throw(SQLException, RuntimeException, std::exception)
272 : {
273 : SAL_INFO("dbaccess", "OCallableStatement::getArray" );
274 0 : MutexGuard aGuard(m_aMutex);
275 0 : ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
276 0 : return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY)->getArray( columnIndex );
277 : }
278 :
279 :
280 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|