22#include <com/sun/star/sdbc/DataType.hpp>
26#include <com/sun/star/lang/DisposedException.hpp>
39#define CHECK_RETURN(x) \
41 ADOS::ThrowException(m_pConnection->getConnection(),*this);
57OPreparedStatement::OPreparedStatement(
OConnection* _pConnection,
const OUString&
sql)
63 OUString sErrorMessage;
65 std::unique_ptr<OSQLParseNode> pNode = aParser.
parseTree(sErrorMessage,
sql);
70 sal_Int32 nParameterCount = 0;
72 pNode->parseNodeToStr( sNewSql, _pConnection );
89 OSL_FAIL(
"OPreparedStatement::~OPreparedStatement: not disposed!" );
98 return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
99 static_cast< XPreparedStatement*
>(
this),
100 static_cast< XParameters*
>(
this),
101 static_cast< XResultSetMetaDataSupplier*
>(
this));
135 ::osl::MutexGuard aGuard(
m_aMutex );
145 ::osl::MutexGuard aGuard(
m_aMutex );
152 ADORecordset* pSet=
nullptr;
166 ::osl::MutexGuard aGuard(
m_aMutex );
170 ADORecordset* pSet=
nullptr;
176 throw SQLException();
185 ::osl::MutexGuard aGuard(
m_aMutex );
191 if(
nCount < (parameterIndex-1))
193 OUString sDefaultName =
"parame" + OUString::number(parameterIndex);
207 if ( _eType !=
eType && _eType != adDBTimeStamp )
227 setParameter( parameterIndex, adLongVarWChar, std::numeric_limits< sal_Int32 >::max(),
x );
232 ::osl::MutexGuard aGuard(
m_aMutex );
240 ::osl::MutexGuard aGuard(
m_aMutex );
348 case DataType::DECIMAL:
349 case DataType::NUMERIC:
350 setString(parameterIndex,::comphelper::getString(x));
360 setNull(parameterIndex,sqlType);
368 STR_UNKNOWN_PARA_TYPE,
369 "$position$", OUString::number(parameterIndex)
395 x->readBytes(aData,length);
402 ::osl::MutexGuard aGuard(
m_aMutex );
435 const OUString& _sDefaultName,
436 sal_Int32& _rParameterCount)
446 OUString sParameterName = _sDefaultName + OUString::number(++_rParameterCount);
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement")
void append(OSQLParseNode *pNewSubTree)
void replaceAndDelete(OSQLParseNode *pOldSubTree, OSQLParseNode *pNewSubTree)
OSQLParseNode * getChild(sal_uInt32 nPos) const
std::unique_ptr< OSQLParseNode > parseTree(OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false)
OUString getResourceStringWithSubstitution(TranslateId pResId, const char *_pAsciiPatternToReplace, const OUString &_rStringToSubstitute) const
loads a string from the shared resource file, and replaces a given ASCII pattern with a given string
static void ThrowException(ADOConnection *_pAdoCon, const css::uno::Reference< css::uno::XInterface > &_xInterface)
ODriver * getDriver() const
WpADOConnection & getConnection()
css::uno::Reference< css::uno::XComponentContext > getContext() const
sal_Int32 getInt32() const
void setIDispatch(IDispatch *pDispInterface)
virtual void SAL_CALL release() noexcept override
virtual ~OPreparedStatement() override
virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 > &x) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery() override
virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const css::uno::Any &x) override
virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob > &x) override
virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) override
void setParameter(sal_Int32 parameterIndex, const DataTypeEnum &_eType, sal_Int32 _nSize, const OLEVariant &Val)
virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray > &x) override
virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef > &x) override
virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString &typeName) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
void replaceParameterNodeName(OSQLParseNode const *_pNode, const OUString &_sDefaultName, sal_Int32 &_nParameterCount)
virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) override
virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const css::util::Time &x) override
ADOParameters * m_pParameters
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const css::util::DateTime &x) override
virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob > &x) override
virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) override
virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const css::util::Date &x) override
virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) override
virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) override
virtual void SAL_CALL setString(sal_Int32 parameterIndex, const OUString &x) override
virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) override
virtual sal_Int32 SAL_CALL executeUpdate() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream > &x, sal_Int32 length) override
virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const css::uno::Any &x, sal_Int32 targetSqlType, sal_Int32 scale) override
virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData() override
virtual sal_Bool SAL_CALL execute() override
virtual void SAL_CALL clearParameters() override
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData
virtual void SAL_CALL disposing() override
virtual void SAL_CALL close() override
virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) override
virtual void SAL_CALL setLong(sal_Int32 parameterIndex, sal_Int64 x) override
virtual void SAL_CALL acquire() noexcept override
OConnection * m_pConnection
virtual void SAL_CALL acquire() noexcept override
css::uno::WeakReference< css::sdbc::XResultSet > m_xResultSet
CursorTypeEnum m_eCursorType
virtual void SAL_CALL clearWarnings() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL disposing() override
OLEVariant m_RecordsAffected
virtual void SAL_CALL release() noexcept override
WpADORecordset m_RecordSet
ADOParameters * get_Parameters() const
bool put_Prepared(VARIANT_BOOL bPrepared) const
ADOParameter * CreateParameter(std::u16string_view _bstr, DataTypeEnum Type, ParameterDirectionEnum Direction, long nSize, const OLEVariant &Value)
bool Execute(OLEVariant &RecordsAffected, OLEVariant &Parameters, long Options, ADORecordset **ppiRset)
bool put_CommandText(std::u16string_view aCon)
bool PutValue(const OLEVariant &aVariant)
sal_Int32 GetAttributes() const
DataTypeEnum GetADOType() const
bool put_Size(sal_Int32 _nSize)
void put_Type(const DataTypeEnum &_eType)
bool AppendChunk(const OLEVariant &aVariant)
bool get_CacheSize(sal_Int32 &_nRet) const
bool put_MaxRecords(ADO_LONGPTR _nRet)
bool put_CacheSize(sal_Int32 _nRet)
bool Open(VARIANT Source, VARIANT ActiveConnection, CursorTypeEnum CursorType, LockTypeEnum LockType, sal_Int32 Options)
bool get_CursorType(CursorTypeEnum &_nRet) const
bool get_LockType(LockTypeEnum &_nRet) const
bool get_MaxRecords(ADO_LONGPTR &_nRet) const
mutable::osl::Mutex m_aMutex
constexpr OUStringLiteral aData
void checkDisposed(bool _bThrow)
#define SQL_ISRULE(pParseNode, eRule)