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