tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / connectivity / source / drivers / evoab2 / NPreparedStatement.cxx
blobf518122ebfcd5487206ea3a33e6fd2f2c20ecb5b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "NPreparedStatement.hxx"
22 #include <connectivity/dbexception.hxx>
23 #include <connectivity/dbtools.hxx>
24 #include <rtl/ref.hxx>
25 #include <comphelper/diagnose_ex.hxx>
27 #include <strings.hrc>
29 using namespace connectivity::evoab;
30 using namespace com::sun::star::uno;
31 using namespace com::sun::star::lang;
32 using namespace com::sun::star::sdbc;
33 using namespace com::sun::star::container;
34 using namespace com::sun::star::io;
35 using namespace com::sun::star::util;
37 IMPLEMENT_SERVICE_INFO(OEvoabPreparedStatement,u"com.sun.star.sdbcx.evoab.PreparedStatement"_ustr,u"com.sun.star.sdbc.PreparedStatement"_ustr);
40 OEvoabPreparedStatement::OEvoabPreparedStatement( OEvoabConnection* _pConnection )
41 :OCommonStatement(_pConnection)
46 void OEvoabPreparedStatement::construct( const OUString& _sql )
48 m_sSqlStatement = _sql;
50 m_aQueryData = impl_getEBookQuery_throw( m_sSqlStatement );
51 ENSURE_OR_THROW( m_aQueryData.getQuery(), "no EBookQuery" );
52 ENSURE_OR_THROW( m_aQueryData.xSelectColumns.is(), "no SelectColumn" );
54 // create our meta data
55 rtl::Reference<OEvoabResultSetMetaData> pMeta
56 = new OEvoabResultSetMetaData( m_aQueryData.sTable );
57 m_xMetaData = pMeta;
58 pMeta->setEvoabFields( m_aQueryData.xSelectColumns );
62 OEvoabPreparedStatement::~OEvoabPreparedStatement()
67 void SAL_CALL OEvoabPreparedStatement::acquire() noexcept
69 OCommonStatement::acquire();
73 void SAL_CALL OEvoabPreparedStatement::release() noexcept
75 OCommonStatement::release();
79 Any SAL_CALL OEvoabPreparedStatement::queryInterface( const Type & rType )
81 Any aRet = OCommonStatement::queryInterface(rType);
82 if(!aRet.hasValue())
83 aRet = OPreparedStatement_BASE::queryInterface(rType);
84 return aRet;
87 Sequence< Type > SAL_CALL OEvoabPreparedStatement::getTypes( )
89 return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
93 Reference< XResultSetMetaData > SAL_CALL OEvoabPreparedStatement::getMetaData( )
95 ::osl::MutexGuard aGuard( m_aMutex );
96 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
98 // the meta data should have been created at construction time
99 ENSURE_OR_THROW( m_xMetaData.is(), "internal error: no meta data" );
100 return m_xMetaData;
104 void SAL_CALL OEvoabPreparedStatement::close( )
106 ::osl::MutexGuard aGuard( m_aMutex );
107 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
109 free_column_resources();
110 // Reset last warning message
111 try {
112 clearWarnings ();
113 OCommonStatement::close();
115 catch (SQLException &) {
116 // If we get an error, ignore
122 sal_Bool SAL_CALL OEvoabPreparedStatement::execute( )
124 ::osl::MutexGuard aGuard( m_aMutex );
125 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
127 Reference< XResultSet> xRS = impl_executeQuery_throw( m_aQueryData );
128 return xRS.is();
132 sal_Int32 SAL_CALL OEvoabPreparedStatement::executeUpdate( )
134 ::osl::MutexGuard aGuard( m_aMutex );
135 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
136 ::dbtools::throwFeatureNotImplementedSQLException( u"XStatement::executeUpdate"_ustr, *this );
137 return 0;
141 void SAL_CALL OEvoabPreparedStatement::setString( sal_Int32 /*parameterIndex*/, const OUString& /*x*/ )
143 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setString"_ustr, *this );
147 Reference< XConnection > SAL_CALL OEvoabPreparedStatement::getConnection( )
149 ::osl::MutexGuard aGuard( m_aMutex );
150 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
152 return impl_getConnection();
156 Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::executeQuery( )
158 ::osl::MutexGuard aGuard( m_aMutex );
159 checkDisposed(OCommonStatement_IBase::rBHelper.bDisposed);
161 return impl_executeQuery_throw( m_aQueryData );
165 void SAL_CALL OEvoabPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ )
167 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBoolean"_ustr, *this );
171 void SAL_CALL OEvoabPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ )
173 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setByte"_ustr, *this );
177 void SAL_CALL OEvoabPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ )
179 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setDate"_ustr, *this );
183 void SAL_CALL OEvoabPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const css::util::Time& /*aVal*/ )
185 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setTime"_ustr, *this );
189 void SAL_CALL OEvoabPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ )
191 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setTimestamp"_ustr, *this );
195 void SAL_CALL OEvoabPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ )
197 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setDouble"_ustr, *this );
201 void SAL_CALL OEvoabPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ )
203 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setFloat"_ustr, *this );
207 void SAL_CALL OEvoabPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ )
209 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setInt"_ustr, *this );
213 void SAL_CALL OEvoabPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ )
215 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setLong"_ustr, *this );
219 void SAL_CALL OEvoabPreparedStatement::setNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/ )
221 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setNull"_ustr, *this );
225 void SAL_CALL OEvoabPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ )
227 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setClob"_ustr, *this );
231 void SAL_CALL OEvoabPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ )
233 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBlob"_ustr, *this );
237 void SAL_CALL OEvoabPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ )
239 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setArray"_ustr, *this );
243 void SAL_CALL OEvoabPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ )
245 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setRef"_ustr, *this );
249 void SAL_CALL OEvoabPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ )
251 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setObjectWithInfo"_ustr, *this );
255 void SAL_CALL OEvoabPreparedStatement::setObjectNull( sal_Int32 /*parameterIndex*/, sal_Int32 /*sqlType*/, const OUString& /*typeName*/ )
257 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setObjectNull"_ustr, *this );
261 void SAL_CALL OEvoabPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x )
263 if(!::dbtools::implSetObject(this,parameterIndex,x))
265 const OUString sError( getOwnConnection()->getResources().getResourceStringWithSubstitution(
266 STR_UNKNOWN_PARA_TYPE,
267 "$position$", OUString::number(parameterIndex)
268 ) );
269 ::dbtools::throwGenericSQLException(sError,*this);
274 void SAL_CALL OEvoabPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ )
276 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setShort"_ustr, *this );
280 void SAL_CALL OEvoabPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ )
282 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBytes"_ustr, *this );
286 void SAL_CALL OEvoabPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ )
288 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setCharacterStream"_ustr, *this );
292 void SAL_CALL OEvoabPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< XInputStream >& /*x*/, sal_Int32 /*length*/ )
294 ::dbtools::throwFunctionNotSupportedSQLException( u"XParameters::setBinaryStream"_ustr, *this );
298 void SAL_CALL OEvoabPreparedStatement::clearParameters( )
302 Reference< XResultSet > SAL_CALL OEvoabPreparedStatement::getResultSet( )
304 return nullptr;
307 sal_Int32 SAL_CALL OEvoabPreparedStatement::getUpdateCount( )
309 return 0;
312 sal_Bool SAL_CALL OEvoabPreparedStatement::getMoreResults( )
314 return false;
318 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */