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