Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * Effective License of whole file:
5 : : *
6 : : * This library is free software; you can redistribute it and/or
7 : : * modify it under the terms of the GNU Lesser General Public
8 : : * License version 2.1, as published by the Free Software Foundation.
9 : : *
10 : : * This library is distributed in the hope that it will be useful,
11 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : : * Lesser General Public License for more details.
14 : : *
15 : : * You should have received a copy of the GNU Lesser General Public
16 : : * License along with this library; if not, write to the Free Software
17 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 : : * MA 02111-1307 USA
19 : : *
20 : : * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
21 : : *
22 : : * The Contents of this file are made available subject to the terms of
23 : : * the GNU Lesser General Public License Version 2.1
24 : : *
25 : : * Copyright: 2000 by Sun Microsystems, Inc.
26 : : *
27 : : * Contributor(s): Joerg Budischewski
28 : : *
29 : : * All parts contributed on or after August 2011:
30 : : *
31 : : * Version: MPL 1.1 / GPLv3+ / LGPLv2.1+
32 : : *
33 : : * The contents of this file are subject to the Mozilla Public License Version
34 : : * 1.1 (the "License"); you may not use this file except in compliance with
35 : : * the License or as specified alternatively below. You may obtain a copy of
36 : : * the License at http://www.mozilla.org/MPL/
37 : : *
38 : : * Software distributed under the License is distributed on an "AS IS" basis,
39 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
40 : : * for the specific language governing rights and limitations under the
41 : : * License.
42 : : *
43 : : * Major Contributor(s):
44 : : * [ Copyright (C) 2011 Lionel Elie Mamane <lionel@mamane.lu> ]
45 : : *
46 : : * All Rights Reserved.
47 : : *
48 : : * For minor contributions see the git repository.
49 : : *
50 : : * Alternatively, the contents of this file may be used under the terms of
51 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
52 : : * the GNU Lesser General Public License Version 2.1 or later (the "LGPLv2.1+"),
53 : : * in which case the provisions of the GPLv3+ or the LGPLv2.1+ are applicable
54 : : * instead of those above.
55 : : *
56 : : ************************************************************************/
57 : :
58 : : #include "pq_fakedupdateableresultset.hxx"
59 : : #include <cppuhelper/typeprovider.hxx>
60 : : #include <cppuhelper/queryinterface.hxx>
61 : :
62 : : using osl::MutexGuard;
63 : :
64 : : using rtl::OUString;
65 : :
66 : : using com::sun::star::uno::Reference;
67 : : using com::sun::star::uno::makeAny;
68 : : using com::sun::star::uno::Sequence;
69 : : using com::sun::star::uno::UNO_QUERY;
70 : : using com::sun::star::uno::Any;
71 : : using com::sun::star::uno::Type;
72 : : using com::sun::star::uno::RuntimeException;
73 : :
74 : : using com::sun::star::sdbc::SQLException;
75 : : using com::sun::star::sdbc::XResultSet;
76 : : using com::sun::star::sdbc::XResultSetUpdate;
77 : : using com::sun::star::sdbc::XRowUpdate;
78 : : using com::sun::star::sdbc::XRow;
79 : : using com::sun::star::sdbc::XStatement;
80 : :
81 : : namespace pq_sdbc_driver
82 : : {
83 : :
84 : 0 : FakedUpdateableResultSet::FakedUpdateableResultSet(
85 : : const ::rtl::Reference< RefCountedMutex > & mutex,
86 : : const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
87 : : ConnectionSettings **pSettings,
88 : : PGresult *result,
89 : : const rtl::OUString &schema,
90 : : const rtl::OUString &table,
91 : : const rtl::OUString &aReason )
92 : : : ResultSet( mutex, owner, pSettings, result, schema, table ),
93 : 0 : m_aReason( aReason )
94 : 0 : {}
95 : :
96 : :
97 : 0 : com::sun::star::uno::Any FakedUpdateableResultSet::queryInterface(
98 : : const com::sun::star::uno::Type & reqType )
99 : : throw (com::sun::star::uno::RuntimeException)
100 : : {
101 : 0 : Any ret = ResultSet::queryInterface( reqType );
102 : 0 : if( ! ret.hasValue() )
103 : : ret = ::cppu::queryInterface(
104 : : reqType,
105 : : static_cast< XResultSetUpdate * > ( this ),
106 : 0 : static_cast< XRowUpdate * > ( this ) );
107 : 0 : return ret;
108 : : }
109 : :
110 : :
111 : 0 : com::sun::star::uno::Sequence< com::sun::star::uno::Type > FakedUpdateableResultSet::getTypes()
112 : : throw( com::sun::star::uno::RuntimeException )
113 : : {
114 : : static cppu::OTypeCollection *pCollection;
115 : 0 : if( ! pCollection )
116 : : {
117 : 0 : MutexGuard guard( osl::Mutex::getGlobalMutex() );
118 : 0 : if( !pCollection )
119 : : {
120 : : static cppu::OTypeCollection collection(
121 : 0 : getCppuType( (Reference< XResultSetUpdate> *) 0 ),
122 : 0 : getCppuType( (Reference< XRowUpdate> *) 0 ),
123 : 0 : ResultSet::getTypes());
124 : 0 : pCollection = &collection;
125 : 0 : }
126 : : }
127 : 0 : return pCollection->getTypes();
128 : :
129 : : }
130 : :
131 : 0 : com::sun::star::uno::Sequence< sal_Int8> FakedUpdateableResultSet::getImplementationId()
132 : : throw( com::sun::star::uno::RuntimeException )
133 : : {
134 : : static cppu::OImplementationId *pId;
135 : 0 : if( ! pId )
136 : : {
137 : 0 : MutexGuard guard( osl::Mutex::getGlobalMutex() );
138 : 0 : if( ! pId )
139 : : {
140 : 0 : static cppu::OImplementationId id(sal_False);
141 : 0 : pId = &id;
142 : 0 : }
143 : : }
144 : 0 : return pId->getImplementationId();
145 : : }
146 : :
147 : 0 : void FakedUpdateableResultSet::insertRow( ) throw (SQLException, RuntimeException)
148 : : {
149 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
150 : : }
151 : :
152 : 0 : void FakedUpdateableResultSet::updateRow( ) throw (SQLException, RuntimeException)
153 : : {
154 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
155 : : }
156 : :
157 : 0 : void FakedUpdateableResultSet::deleteRow( ) throw (SQLException, RuntimeException)
158 : : {
159 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
160 : : }
161 : :
162 : 0 : void FakedUpdateableResultSet::cancelRowUpdates( ) throw (SQLException, RuntimeException)
163 : : {
164 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
165 : : }
166 : :
167 : 0 : void FakedUpdateableResultSet::moveToInsertRow( ) throw (SQLException, RuntimeException)
168 : : {
169 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
170 : : }
171 : :
172 : 0 : void FakedUpdateableResultSet::moveToCurrentRow( ) throw (SQLException, RuntimeException)
173 : : {
174 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
175 : : }
176 : :
177 : :
178 : 0 : void FakedUpdateableResultSet::updateNull( sal_Int32 /* columnIndex */ ) throw (SQLException, RuntimeException)
179 : : {
180 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
181 : : }
182 : :
183 : 0 : void FakedUpdateableResultSet::updateBoolean( sal_Int32 /* columnIndex */, sal_Bool /* x */ ) throw (SQLException, RuntimeException)
184 : : {
185 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
186 : : }
187 : :
188 : 0 : void FakedUpdateableResultSet::updateByte( sal_Int32 /* columnIndex */, sal_Int8 /* x */ ) throw (SQLException, RuntimeException)
189 : : {
190 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
191 : : }
192 : :
193 : 0 : void FakedUpdateableResultSet::updateShort( sal_Int32 /* columnIndex */, sal_Int16 /* x */ ) throw (SQLException, RuntimeException)
194 : : {
195 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
196 : : }
197 : :
198 : 0 : void FakedUpdateableResultSet::updateInt( sal_Int32 /* columnIndex */, sal_Int32 /* x */ ) throw (SQLException, RuntimeException)
199 : : {
200 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
201 : : }
202 : :
203 : 0 : void FakedUpdateableResultSet::updateLong( sal_Int32 /* columnIndex */, sal_Int64 /* x */ ) throw (SQLException, RuntimeException)
204 : : {
205 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
206 : : }
207 : :
208 : 0 : void FakedUpdateableResultSet::updateFloat( sal_Int32 /* columnIndex */, float /* x */ ) throw (SQLException, RuntimeException)
209 : : {
210 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
211 : : }
212 : :
213 : 0 : void FakedUpdateableResultSet::updateDouble( sal_Int32 /* columnIndex */, double /* x */ ) throw (SQLException, RuntimeException)
214 : : {
215 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
216 : : }
217 : :
218 : 0 : void FakedUpdateableResultSet::updateString( sal_Int32 /* columnIndex */, const ::rtl::OUString& /* x */ ) throw (SQLException, RuntimeException)
219 : : {
220 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
221 : : }
222 : :
223 : 0 : void FakedUpdateableResultSet::updateBytes( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Sequence< sal_Int8 >& /* x */ ) throw (SQLException, RuntimeException)
224 : : {
225 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
226 : : }
227 : :
228 : 0 : void FakedUpdateableResultSet::updateDate( sal_Int32 /* columnIndex */, const ::com::sun::star::util::Date& /* x */ ) throw (SQLException, RuntimeException)
229 : : {
230 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
231 : : }
232 : :
233 : 0 : void FakedUpdateableResultSet::updateTime( sal_Int32 /* columnIndex */, const ::com::sun::star::util::Time& /* x */ ) throw (SQLException, RuntimeException)
234 : : {
235 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
236 : : }
237 : :
238 : 0 : void FakedUpdateableResultSet::updateTimestamp( sal_Int32 /* columnIndex */, const ::com::sun::star::util::DateTime& /* x */ ) throw (SQLException, RuntimeException)
239 : : {
240 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
241 : : }
242 : :
243 : 0 : void FakedUpdateableResultSet::updateBinaryStream( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /* x */, sal_Int32 /* length */ ) throw (SQLException, RuntimeException)
244 : : {
245 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
246 : : }
247 : :
248 : 0 : void FakedUpdateableResultSet::updateCharacterStream( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& /* x */, sal_Int32 /* length */ ) throw (SQLException, RuntimeException)
249 : : {
250 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
251 : : }
252 : :
253 : 0 : void FakedUpdateableResultSet::updateObject( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Any& /* x */ ) throw (SQLException, RuntimeException)
254 : : {
255 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
256 : : }
257 : :
258 : 0 : void FakedUpdateableResultSet::updateNumericObject( sal_Int32 /* columnIndex */, const ::com::sun::star::uno::Any& /* x */, sal_Int32 /* scale */ ) throw (SQLException, RuntimeException)
259 : : {
260 : 0 : throw SQLException( m_aReason, *this, OUString(),1,Any() );
261 : : }
262 : :
263 : : }
|