1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #include "ado/ACallableStatement.hxx"
21 #include <connectivity/dbexception.hxx>
23 using namespace connectivity::ado
;
24 using namespace com::sun::star::uno
;
25 using namespace com::sun::star::lang
;
26 using namespace com::sun::star::beans
;
27 using namespace com::sun::star::sdbc
;
28 using namespace com::sun::star::container
;
30 IMPLEMENT_SERVICE_INFO(OCallableStatement
,"com.sun.star.sdbcx.ACallableStatement","com.sun.star.sdbc.CallableStatement");
33 ADOParameter* pParam = NULL; \
34 m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
36 pParam->get_Value(&m_aValue);
38 //************ Class: java.sql.CallableStatement
40 OCallableStatement::OCallableStatement( OConnection
* _pConnection
,const OTypeInfoMap
& _TypeInfo
,const OUString
& sql
)
41 : OPreparedStatement( _pConnection
, _TypeInfo
, sql
)
43 m_Command
.put_CommandType(adCmdStoredProc
);
47 Any SAL_CALL
OCallableStatement::queryInterface( const Type
& rType
) throw(RuntimeException
)
49 Any aRet
= OPreparedStatement::queryInterface(rType
);
50 return aRet
.hasValue() ? aRet
: ::cppu::queryInterface(rType
,static_cast< XRow
*>(this));
55 sal_Bool SAL_CALL
OCallableStatement::wasNull( ) throw(SQLException
, RuntimeException
)
57 return m_aValue
.isNull();
61 sal_Bool SAL_CALL
OCallableStatement::getBoolean( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
67 sal_Int8 SAL_CALL
OCallableStatement::getByte( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
73 Sequence
< sal_Int8
> SAL_CALL
OCallableStatement::getBytes( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
79 ::com::sun::star::util::Date SAL_CALL
OCallableStatement::getDate( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
85 double SAL_CALL
OCallableStatement::getDouble( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
92 float SAL_CALL
OCallableStatement::getFloat( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
99 sal_Int32 SAL_CALL
OCallableStatement::getInt( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
106 sal_Int64 SAL_CALL
OCallableStatement::getLong( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
109 return (sal_Int64
)m_aValue
.getCurrency().int64
;
113 Any SAL_CALL
OCallableStatement::getObject( sal_Int32
/*columnIndex*/, const Reference
< ::com::sun::star::container::XNameAccess
>& /*typeMap*/ ) throw(SQLException
, RuntimeException
)
115 ::dbtools::throwFeatureNotImplementedException( "XRow::getObject", *this );
120 sal_Int16 SAL_CALL
OCallableStatement::getShort( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
127 OUString SAL_CALL
OCallableStatement::getString( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
134 ::com::sun::star::util::Time SAL_CALL
OCallableStatement::getTime( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
141 ::com::sun::star::util::DateTime SAL_CALL
OCallableStatement::getTimestamp( sal_Int32 columnIndex
) throw(SQLException
, RuntimeException
)
148 void SAL_CALL
OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
, sal_Int32 sqlType
, const OUString
& /*typeName*/ ) throw(SQLException
, RuntimeException
)
150 ADOParameter
* pParam
= NULL
;
151 m_pParameters
->get_Item(OLEVariant(sal_Int32(parameterIndex
-1)),&pParam
);
154 pParam
->put_Type(ADOS::MapJdbc2ADOType(sqlType
,m_pConnection
->getEngineType()));
155 pParam
->put_Direction(adParamOutput
);
159 void SAL_CALL
OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex
, sal_Int32 sqlType
, sal_Int32 scale
) throw(SQLException
, RuntimeException
)
161 ADOParameter
* pParam
= NULL
;
162 m_pParameters
->get_Item(OLEVariant(sal_Int32(parameterIndex
-1)),&pParam
);
165 pParam
->put_Type(ADOS::MapJdbc2ADOType(sqlType
,m_pConnection
->getEngineType()));
166 pParam
->put_Direction(adParamOutput
);
167 pParam
->put_NumericScale((sal_Int8
)scale
);
173 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
OCallableStatement::getBinaryStream( sal_Int32
/*columnIndex*/ ) throw(SQLException
, RuntimeException
)
175 ::dbtools::throwFeatureNotImplementedException( "XRow::getBinaryStream", *this );
179 Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
OCallableStatement::getCharacterStream( sal_Int32
/*columnIndex*/ ) throw(SQLException
, RuntimeException
)
181 ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
186 Reference
< XArray
> SAL_CALL
OCallableStatement::getArray( sal_Int32
/*columnIndex*/ ) throw(SQLException
, RuntimeException
)
188 ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this );
193 Reference
< XClob
> SAL_CALL
OCallableStatement::getClob( sal_Int32
/*columnIndex*/ ) throw(SQLException
, RuntimeException
)
195 ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this );
199 Reference
< XBlob
> SAL_CALL
OCallableStatement::getBlob( sal_Int32
/*columnIndex*/ ) throw(SQLException
, RuntimeException
)
201 ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this );
206 Reference
< XRef
> SAL_CALL
OCallableStatement::getRef( sal_Int32
/*columnIndex*/) throw(SQLException
, RuntimeException
)
208 ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this );
213 void SAL_CALL
OCallableStatement::acquire() throw()
215 OPreparedStatement::acquire();
218 void SAL_CALL
OCallableStatement::release() throw()
220 OPreparedStatement::release();
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */