2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 22:04:38 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
#include "ado/ACallableStatement.hxx"
|
2006-06-20 00:12:00 +00:00
|
|
|
#include <connectivity/dbexception.hxx>
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
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 = NULL; \
|
2001-04-12 11:33:30 +00:00
|
|
|
m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
|
2000-09-18 15:18:56 +00:00
|
|
|
if(pParam) \
|
|
|
|
pParam->get_Value(&m_aValue);
|
2014-02-25 17:59:09 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
//************ Class: java.sql.CallableStatement
|
2014-02-25 17:59:09 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OCallableStatement::OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const OUString& sql )
|
2000-09-18 15:18:56 +00:00
|
|
|
: OPreparedStatement( _pConnection, _TypeInfo, sql )
|
|
|
|
{
|
|
|
|
m_Command.put_CommandType(adCmdStoredProc);
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
Any SAL_CALL OCallableStatement::queryInterface( const Type & rType ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
Any aRet = OPreparedStatement::queryInterface(rType);
|
2001-08-24 05:19:41 +00:00
|
|
|
return aRet.hasValue() ? aRet : ::cppu::queryInterface(rType,static_cast< XRow*>(this));
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
return m_aValue.isNull();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
2001-04-12 11:33:30 +00:00
|
|
|
return (sal_Int64)m_aValue.getCurrency().int64;
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Any SAL_CALL OCallableStatement::getObject( sal_Int32 /*columnIndex*/, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getObject", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return Any();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
ADOParameter* pParam = NULL;
|
2001-04-12 11:33:30 +00:00
|
|
|
m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
|
2000-09-18 15:18:56 +00:00
|
|
|
if(pParam)
|
|
|
|
{
|
2001-08-30 12:20:59 +00:00
|
|
|
pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
|
2000-09-18 15:18:56 +00:00
|
|
|
pParam->put_Direction(adParamOutput);
|
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
ADOParameter* pParam = NULL;
|
2001-04-12 11:33:30 +00:00
|
|
|
m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
|
2000-09-18 15:18:56 +00:00
|
|
|
if(pParam)
|
|
|
|
{
|
2001-08-30 12:20:59 +00:00
|
|
|
pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType,m_pConnection->getEngineType()));
|
2000-09-18 15:18:56 +00:00
|
|
|
pParam->put_Direction(adParamOutput);
|
2001-04-12 11:33:30 +00:00
|
|
|
pParam->put_NumericScale((sal_Int8)scale);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBinaryStream", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getCharacterStream", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getArray", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getClob", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getBlob", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 /*columnIndex*/) throw(SQLException, RuntimeException)
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2014-07-21 10:40:45 +01:00
|
|
|
::dbtools::throwFeatureNotImplementedSQLException( "XRow::getRef", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|