2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* $RCSfile: ACallableStatement.cxx,v $
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2007-03-26 12:55:51 +00:00
|
|
|
* $Revision: 1.9 $
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2007-03-26 12:55:51 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2007-03-26 13:55:51 $
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2005-09-08 04:25:53 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 01:10:46 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_connectivity.hxx"
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
#ifndef _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_
|
|
|
|
#include "ado/ACallableStatement.hxx"
|
|
|
|
#endif
|
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
#ifndef _DBHELPER_DBEXCEPTION_HXX_
|
|
|
|
#include <connectivity/dbexception.hxx>
|
|
|
|
#endif
|
|
|
|
|
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;
|
|
|
|
using namespace com::sun::star::lang;
|
|
|
|
|
|
|
|
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);
|
|
|
|
//**************************************************************
|
|
|
|
//************ Class: java.sql.CallableStatement
|
|
|
|
//**************************************************************
|
2001-04-12 11:33:30 +00:00
|
|
|
OCallableStatement::OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql )
|
2000-09-18 15:18:56 +00:00
|
|
|
: OPreparedStatement( _pConnection, _TypeInfo, sql )
|
|
|
|
{
|
|
|
|
m_Command.put_CommandType(adCmdStoredProc);
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OCallableStatement::wasNull( ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
return m_aValue.isNull();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
::com::sun::star::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getObject", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return Any();
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::com::sun::star::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
::com::sun::star::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
|
|
|
|
{
|
|
|
|
GET_PARAM()
|
|
|
|
return m_aValue;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
2006-06-20 00:12:00 +00:00
|
|
|
void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getBinaryStream", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
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
|
|
|
{
|
2006-06-20 00:12:00 +00:00
|
|
|
::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this );
|
2000-09-18 15:18:56 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2001-04-30 09:16:19 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2007-03-26 12:55:51 +00:00
|
|
|
void SAL_CALL OCallableStatement::acquire() throw()
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
|
|
|
OPreparedStatement::acquire();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2007-03-26 12:55:51 +00:00
|
|
|
void SAL_CALL OCallableStatement::release() throw()
|
2001-04-30 09:16:19 +00:00
|
|
|
{
|
|
|
|
OPreparedStatement::release();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|