summaryrefslogtreecommitdiffstats
path: root/connectivity/source/drivers/ado/ACallableStatement.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /connectivity/source/drivers/ado/ACallableStatement.cxx
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'connectivity/source/drivers/ado/ACallableStatement.cxx')
-rw-r--r--connectivity/source/drivers/ado/ACallableStatement.cxx223
1 files changed, 223 insertions, 0 deletions
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
new file mode 100644
index 000000000..d572a8f99
--- /dev/null
+++ b/connectivity/source/drivers/ado/ACallableStatement.cxx
@@ -0,0 +1,223 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <ado/ACallableStatement.hxx>
+#include <connectivity/dbexception.hxx>
+#include <cppuhelper/queryinterface.hxx>
+
+using namespace connectivity::ado;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::container;
+
+IMPLEMENT_SERVICE_INFO(OCallableStatement,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
+
+#define GET_PARAM() \
+ ADOParameter* pParam = nullptr; \
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
+ if(pParam) \
+ pParam->get_Value(&m_aValue);
+
+//************ Class: java.sql.CallableStatement
+
+OCallableStatement::OCallableStatement( OConnection* _pConnection, const OUString& sql )
+ : OPreparedStatement( _pConnection, sql )
+{
+ m_Command.put_CommandType(adCmdStoredProc);
+}
+
+
+Any SAL_CALL OCallableStatement::queryInterface( const Type & rType )
+{
+ Any aRet = OPreparedStatement::queryInterface(rType);
+ return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< XRow*>(this));
+}
+
+
+sal_Bool SAL_CALL OCallableStatement::wasNull( )
+{
+ return m_aValue.isNull();
+}
+
+
+sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getBool();
+}
+
+sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getInt8();
+}
+
+Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getByteSequence();
+}
+
+css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getDate();
+}
+
+double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getDouble();
+}
+
+
+float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getFloat();
+}
+
+
+sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getInt32();
+}
+
+
+sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return static_cast<sal_Int64>(m_aValue.getCurrency().int64);
+}
+
+
+Any SAL_CALL OCallableStatement::getObject( sal_Int32 /*columnIndex*/, const Reference< css::container::XNameAccess >& /*typeMap*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getObject", *this );
+ return Any();
+}
+
+
+sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getInt16();
+}
+
+
+OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getString();
+}
+
+
+ css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getTime();
+}
+
+
+ css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
+{
+ GET_PARAM()
+ return m_aValue.getDateTime();
+}
+
+
+void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& /*typeName*/ )
+{
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
+ if(pParam)
+ {
+ pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
+ pParam->put_Direction(adParamOutput);
+ }
+}
+
+void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale )
+{
+ ADOParameter* pParam = nullptr;
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
+ if(pParam)
+ {
+ pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
+ pParam->put_Direction(adParamOutput);
+ pParam->put_NumericScale(static_cast<sal_Int8>(scale));
+ }
+}
+
+
+Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 /*columnIndex*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBinaryStream", *this );
+ return nullptr;
+}
+
+Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 /*columnIndex*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
+ return nullptr;
+}
+
+
+Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 /*columnIndex*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *this );
+ return nullptr;
+}
+
+
+Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 /*columnIndex*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getClob", *this );
+ return nullptr;
+}
+
+Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 /*columnIndex*/ )
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBlob", *this );
+ return nullptr;
+}
+
+
+Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 /*columnIndex*/)
+{
+ ::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *this );
+ return nullptr;
+}
+
+
+void SAL_CALL OCallableStatement::acquire() throw()
+{
+ OPreparedStatement::acquire();
+}
+
+void SAL_CALL OCallableStatement::release() throw()
+{
+ OPreparedStatement::release();
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */