1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * Effective License of whole file:
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.
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.
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,
20 * Parts "Copyright by Sun Microsystems, Inc" prior to August 2011:
22 * The Contents of this file are made available subject to the terms of
23 * the GNU Lesser General Public License Version 2.1
25 * Copyright: 2000 by Sun Microsystems, Inc.
27 * Contributor(s): Joerg Budischewski
29 * All parts contributed on or after August 2011:
31 * This Source Code Form is subject to the terms of the Mozilla Public
32 * License, v. 2.0. If a copy of the MPL was not distributed with this
33 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
35 ************************************************************************/
37 #include "pq_fakedupdateableresultset.hxx"
38 #include <cppuhelper/typeprovider.hxx>
39 #include <cppuhelper/queryinterface.hxx>
41 using osl::MutexGuard
;
44 using com::sun::star::uno::Reference
;
45 using com::sun::star::uno::makeAny
;
46 using com::sun::star::uno::Sequence
;
47 using com::sun::star::uno::UNO_QUERY
;
48 using com::sun::star::uno::Any
;
49 using com::sun::star::uno::Type
;
50 using com::sun::star::uno::RuntimeException
;
52 using com::sun::star::sdbc::SQLException
;
53 using com::sun::star::sdbc::XResultSet
;
54 using com::sun::star::sdbc::XResultSetUpdate
;
55 using com::sun::star::sdbc::XRowUpdate
;
56 using com::sun::star::sdbc::XRow
;
57 using com::sun::star::sdbc::XStatement
;
59 namespace pq_sdbc_driver
62 FakedUpdateableResultSet::FakedUpdateableResultSet(
63 const ::rtl::Reference
< RefCountedMutex
> & mutex
,
64 const com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> &owner
,
65 ConnectionSettings
**pSettings
,
67 const OUString
&schema
,
68 const OUString
&table
,
69 const OUString
&aReason
)
70 : ResultSet( mutex
, owner
, pSettings
, result
, schema
, table
),
75 com::sun::star::uno::Any
FakedUpdateableResultSet::queryInterface(
76 const com::sun::star::uno::Type
& reqType
)
77 throw (com::sun::star::uno::RuntimeException
, std::exception
)
79 Any ret
= ResultSet::queryInterface( reqType
);
80 if( ! ret
.hasValue() )
81 ret
= ::cppu::queryInterface(
83 static_cast< XResultSetUpdate
* > ( this ),
84 static_cast< XRowUpdate
* > ( this ) );
89 com::sun::star::uno::Sequence
< com::sun::star::uno::Type
> FakedUpdateableResultSet::getTypes()
90 throw( com::sun::star::uno::RuntimeException
, std::exception
)
92 static cppu::OTypeCollection
*pCollection
;
95 MutexGuard
guard( osl::Mutex::getGlobalMutex() );
98 static cppu::OTypeCollection
collection(
99 getCppuType( (Reference
< XResultSetUpdate
> *) 0 ),
100 getCppuType( (Reference
< XRowUpdate
> *) 0 ),
101 ResultSet::getTypes());
102 pCollection
= &collection
;
105 return pCollection
->getTypes();
109 com::sun::star::uno::Sequence
< sal_Int8
> FakedUpdateableResultSet::getImplementationId()
110 throw( com::sun::star::uno::RuntimeException
, std::exception
)
112 return css::uno::Sequence
<sal_Int8
>();
115 void FakedUpdateableResultSet::insertRow( ) throw (SQLException
, RuntimeException
, std::exception
)
117 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
120 void FakedUpdateableResultSet::updateRow( ) throw (SQLException
, RuntimeException
, std::exception
)
122 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
125 void FakedUpdateableResultSet::deleteRow( ) throw (SQLException
, RuntimeException
, std::exception
)
127 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
130 void FakedUpdateableResultSet::cancelRowUpdates( ) throw (SQLException
, RuntimeException
, std::exception
)
132 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
135 void FakedUpdateableResultSet::moveToInsertRow( ) throw (SQLException
, RuntimeException
, std::exception
)
137 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
140 void FakedUpdateableResultSet::moveToCurrentRow( ) throw (SQLException
, RuntimeException
, std::exception
)
142 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
146 void FakedUpdateableResultSet::updateNull( sal_Int32
/* columnIndex */ ) throw (SQLException
, RuntimeException
, std::exception
)
148 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
151 void FakedUpdateableResultSet::updateBoolean( sal_Int32
/* columnIndex */, sal_Bool
/* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
153 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
156 void FakedUpdateableResultSet::updateByte( sal_Int32
/* columnIndex */, sal_Int8
/* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
158 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
161 void FakedUpdateableResultSet::updateShort( sal_Int32
/* columnIndex */, sal_Int16
/* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
163 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
166 void FakedUpdateableResultSet::updateInt( sal_Int32
/* columnIndex */, sal_Int32
/* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
168 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
171 void FakedUpdateableResultSet::updateLong( sal_Int32
/* columnIndex */, sal_Int64
/* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
173 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
176 void FakedUpdateableResultSet::updateFloat( sal_Int32
/* columnIndex */, float /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
178 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
181 void FakedUpdateableResultSet::updateDouble( sal_Int32
/* columnIndex */, double /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
183 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
186 void FakedUpdateableResultSet::updateString( sal_Int32
/* columnIndex */, const OUString
& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
188 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
191 void FakedUpdateableResultSet::updateBytes( sal_Int32
/* columnIndex */, const ::com::sun::star::uno::Sequence
< sal_Int8
>& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
193 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
196 void FakedUpdateableResultSet::updateDate( sal_Int32
/* columnIndex */, const ::com::sun::star::util::Date
& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
198 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
201 void FakedUpdateableResultSet::updateTime( sal_Int32
/* columnIndex */, const ::com::sun::star::util::Time
& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
203 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
206 void FakedUpdateableResultSet::updateTimestamp( sal_Int32
/* columnIndex */, const ::com::sun::star::util::DateTime
& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
208 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
211 void FakedUpdateableResultSet::updateBinaryStream( sal_Int32
/* columnIndex */, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& /* x */, sal_Int32
/* length */ ) throw (SQLException
, RuntimeException
, std::exception
)
213 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
216 void FakedUpdateableResultSet::updateCharacterStream( sal_Int32
/* columnIndex */, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& /* x */, sal_Int32
/* length */ ) throw (SQLException
, RuntimeException
, std::exception
)
218 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
221 void FakedUpdateableResultSet::updateObject( sal_Int32
/* columnIndex */, const ::com::sun::star::uno::Any
& /* x */ ) throw (SQLException
, RuntimeException
, std::exception
)
223 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
226 void FakedUpdateableResultSet::updateNumericObject( sal_Int32
/* columnIndex */, const ::com::sun::star::uno::Any
& /* x */, sal_Int32
/* scale */ ) throw (SQLException
, RuntimeException
, std::exception
)
228 throw SQLException( m_aReason
, *this, OUString(),1,Any() );
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */