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/AStatement.hxx"
21 #include "ado/AConnection.hxx"
22 #include "ado/AResultSet.hxx"
23 #include <comphelper/property.hxx>
24 #include <comphelper/uno3.hxx>
25 #include <osl/thread.h>
26 #include <cppuhelper/typeprovider.hxx>
27 #include <comphelper/sequence.hxx>
28 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
29 #include <com/sun/star/sdbc/ResultSetType.hpp>
30 #include <com/sun/star/sdbc/FetchDirection.hpp>
31 #include "connectivity/dbexception.hxx"
32 #include <comphelper/types.hxx>
38 using namespace ::comphelper
;
40 #define CHECK_RETURN(x) \
42 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
46 using namespace connectivity::ado
;
49 using namespace com::sun::star::uno
;
50 using namespace com::sun::star::lang
;
51 using namespace com::sun::star::beans
;
52 using namespace com::sun::star::sdbc
;
53 using namespace ::std
;
55 OStatement_Base::OStatement_Base(OConnection
* _pConnection
) : OStatement_BASE(m_aMutex
)
56 ,OPropertySetHelper(OStatement_BASE::rBHelper
)
57 ,OSubComponent
<OStatement_Base
, OStatement_BASE
>((::cppu::OWeakObject
*)_pConnection
, this)
58 ,m_pConnection(_pConnection
)
61 ,m_eLockType(adLockReadOnly
)
62 ,m_eCursorType(adOpenForwardOnly
)
64 osl_atomic_increment( &m_refCount
);
67 if(m_Command
.IsValid())
68 m_Command
.putref_ActiveConnection(m_pConnection
->getConnection());
70 ADOS::ThrowException(*m_pConnection
->getConnection(),*this);
72 m_RecordsAffected
.setNoArg();
73 m_Parameters
.setNoArg();
75 m_pConnection
->acquire();
77 osl_atomic_decrement( &m_refCount
);
80 void OStatement_Base::disposeResultSet()
82 // free the cursor if alive
83 Reference
< XComponent
> xComp(m_xResultSet
.get(), UNO_QUERY
);
90 void OStatement_Base::disposing()
92 ::osl::MutexGuard
aGuard(m_aMutex
);
97 if ( m_Command
.IsValid() )
98 m_Command
.putref_ActiveConnection( NULL
);
101 if ( m_RecordSet
.IsValid() )
102 m_RecordSet
.PutRefDataSource( NULL
);
106 m_pConnection
->release();
109 OStatement_BASE::disposing();
112 void SAL_CALL
OStatement_Base::release() throw()
117 Any SAL_CALL
OStatement_Base::queryInterface( const Type
& rType
) throw(RuntimeException
)
119 Any aRet
= OStatement_BASE::queryInterface(rType
);
120 return aRet
.hasValue() ? aRet
: OPropertySetHelper::queryInterface(rType
);
123 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
OStatement_Base::getTypes( ) throw(::com::sun::star::uno::RuntimeException
)
125 ::cppu::OTypeCollection
aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XMultiPropertySet
> *)0 ),
126 ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
> *)0 ),
127 ::getCppuType( (const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> *)0 ));
129 return ::comphelper::concatSequences(aTypes
.getTypes(),OStatement_BASE::getTypes());
134 void SAL_CALL
OStatement_Base::cancel( ) throw(RuntimeException
)
136 ::osl::MutexGuard
aGuard( m_aMutex
);
137 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
140 CHECK_RETURN(m_Command
.Cancel())
144 void SAL_CALL
OStatement_Base::close( ) throw(SQLException
, RuntimeException
)
147 ::osl::MutexGuard
aGuard( m_aMutex
);
148 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
155 void SAL_CALL
OStatement::clearBatch( ) throw(SQLException
, RuntimeException
)
161 void OStatement_Base::reset() throw (SQLException
)
163 ::osl::MutexGuard
aGuard( m_aMutex
);
164 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
169 if (m_xResultSet
.get().is())
174 // If a ResultSet was created for this Statement, close it
177 void OStatement_Base::clearMyResultSet () throw (SQLException
)
179 ::osl::MutexGuard
aGuard( m_aMutex
);
180 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
184 Reference
<XCloseable
> xCloseable
;
185 if ( ::comphelper::query_interface( m_xResultSet
.get(), xCloseable
) )
188 catch( const DisposedException
& ) { }
190 m_xResultSet
.clear();
193 sal_Int32
OStatement_Base::getRowCount () throw( SQLException
)
195 ::osl::MutexGuard
aGuard( m_aMutex
);
196 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
199 return m_RecordsAffected
;
203 // Given a SQL type, return the maximum precision for the column.
204 // Returns -1 if not known
207 sal_Int32
OStatement_Base::getPrecision ( sal_Int32 sqlType
)
209 ::osl::MutexGuard
aGuard( m_aMutex
);
210 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
215 aInfo
.nType
= (sal_Int16
)sqlType
;
216 if (!m_aTypeInfo
.empty())
218 ::std::vector
<OTypeInfo
>::const_iterator aIter
= ::std::find(m_aTypeInfo
.begin(),m_aTypeInfo
.end(),aInfo
);
219 for(;aIter
!= m_aTypeInfo
.end();++aIter
)
221 prec
= ::std::max(prec
,(*aIter
).nPrecision
);
232 void OStatement_Base::setWarning (const SQLWarning
&ex
) throw( SQLException
)
234 ::osl::MutexGuard
aGuard( m_aMutex
);
235 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
241 void OStatement_Base::assignRecordSet( ADORecordset
* _pRS
)
243 WpADORecordset
aOldRS( m_RecordSet
);
244 m_RecordSet
= WpADORecordset( _pRS
);
246 if ( aOldRS
.IsValid() )
247 aOldRS
.PutRefDataSource( NULL
);
249 if ( m_RecordSet
.IsValid() )
250 m_RecordSet
.PutRefDataSource( (IDispatch
*)m_Command
);
253 sal_Bool SAL_CALL
OStatement_Base::execute( const OUString
& sql
) throw(SQLException
, RuntimeException
)
255 ::osl::MutexGuard
aGuard( m_aMutex
);
256 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
259 // Reset the statement handle and warning
265 ADORecordset
* pSet
= NULL
;
266 CHECK_RETURN(m_Command
.put_CommandText(sql
))
267 CHECK_RETURN(m_Command
.Execute(m_RecordsAffected
,m_Parameters
,adCmdText
,&pSet
))
269 assignRecordSet( pSet
);
271 catch (SQLWarning
& ex
)
274 // Save pointer to warning and save with ResultSet
275 // object once it is created.
280 return m_RecordSet
.IsValid();
283 Reference
< XResultSet
> SAL_CALL
OStatement_Base::executeQuery( const OUString
& sql
) throw(SQLException
, RuntimeException
)
285 ::osl::MutexGuard
aGuard( m_aMutex
);
286 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
291 m_xResultSet
= WeakReference
<XResultSet
>(NULL
);
295 CHECK_RETURN(m_Command
.put_CommandText(sql
))
297 aCmd
.setIDispatch(m_Command
);
300 CHECK_RETURN(aSet
.put_CacheSize(m_nFetchSize
))
301 CHECK_RETURN(aSet
.put_MaxRecords(m_nMaxRows
))
302 CHECK_RETURN(aSet
.Open(aCmd
,aCon
,m_eCursorType
,m_eLockType
,adOpenUnspecified
))
305 CHECK_RETURN(aSet
.get_CacheSize(m_nFetchSize
))
306 CHECK_RETURN(aSet
.get_MaxRecords(m_nMaxRows
))
307 CHECK_RETURN(aSet
.get_CursorType(m_eCursorType
))
308 CHECK_RETURN(aSet
.get_LockType(m_eLockType
))
310 OResultSet
* pSet
= new OResultSet(aSet
,this);
311 Reference
< XResultSet
> xRs
= pSet
;
314 m_xResultSet
= WeakReference
<XResultSet
>(xRs
);
320 Reference
< XConnection
> SAL_CALL
OStatement_Base::getConnection( ) throw(SQLException
, RuntimeException
)
322 ::osl::MutexGuard
aGuard( m_aMutex
);
323 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
326 return (Reference
< XConnection
>)m_pConnection
;
330 Any SAL_CALL
OStatement::queryInterface( const Type
& rType
) throw(RuntimeException
)
332 Any aRet
= ::cppu::queryInterface(rType
,static_cast< XBatchExecution
*> (this));
333 return aRet
.hasValue() ? aRet
: OStatement_Base::queryInterface(rType
);
337 void SAL_CALL
OStatement::addBatch( const OUString
& sql
) throw(SQLException
, RuntimeException
)
339 ::osl::MutexGuard
aGuard( m_aMutex
);
340 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
343 m_aBatchList
.push_back(sql
);
346 Sequence
< sal_Int32
> SAL_CALL
OStatement::executeBatch( ) throw(SQLException
, RuntimeException
)
348 ::osl::MutexGuard
aGuard( m_aMutex
);
349 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
356 for(::std::list
< OUString
>::const_iterator i
=m_aBatchList
.begin();i
!= m_aBatchList
.end();++i
,++nLen
)
357 aBatchSql
= aBatchSql
+ *i
+ ";";
360 if ( m_RecordSet
.IsValid() )
361 m_RecordSet
.PutRefDataSource( NULL
);
363 m_RecordSet
.Create();
365 CHECK_RETURN(m_Command
.put_CommandText(aBatchSql
))
366 if ( m_RecordSet
.IsValid() )
367 m_RecordSet
.PutRefDataSource((IDispatch
*)m_Command
);
369 CHECK_RETURN(m_RecordSet
.UpdateBatch(adAffectAll
))
371 ADORecordset
* pSet
=NULL
;
372 Sequence
< sal_Int32
> aRet(nLen
);
373 sal_Int32
* pArray
= aRet
.getArray();
374 for(sal_Int32 j
=0;j
<nLen
;++j
)
377 OLEVariant aRecordsAffected
;
378 if(m_RecordSet
.NextRecordset(aRecordsAffected
,&pSet
) && pSet
)
380 assignRecordSet( pSet
);
383 if(m_RecordSet
.get_RecordCount(nValue
))
392 sal_Int32 SAL_CALL
OStatement_Base::executeUpdate( const OUString
& sql
) throw(SQLException
, RuntimeException
)
394 ::osl::MutexGuard
aGuard( m_aMutex
);
395 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
401 ADORecordset
* pSet
= NULL
;
402 CHECK_RETURN(m_Command
.put_CommandText(sql
))
403 CHECK_RETURN(m_Command
.Execute(m_RecordsAffected
,m_Parameters
,adCmdText
|adExecuteNoRecords
,&pSet
))
405 catch (SQLWarning
& ex
) {
407 // Save pointer to warning and save with ResultSet
408 // object once it is created.
412 if(!m_RecordsAffected
.isEmpty() && !m_RecordsAffected
.isNull() && m_RecordsAffected
.getType() != VT_ERROR
)
413 return m_RecordsAffected
;
419 Reference
< XResultSet
> SAL_CALL
OStatement_Base::getResultSet( ) throw(SQLException
, RuntimeException
)
421 ::osl::MutexGuard
aGuard( m_aMutex
);
422 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
429 sal_Int32 SAL_CALL
OStatement_Base::getUpdateCount( ) throw(SQLException
, RuntimeException
)
431 ::osl::MutexGuard
aGuard( m_aMutex
);
432 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
436 if(m_RecordSet
.IsValid() && m_RecordSet
.get_RecordCount(nRet
))
442 sal_Bool SAL_CALL
OStatement_Base::getMoreResults( ) throw(SQLException
, RuntimeException
)
444 ::osl::MutexGuard
aGuard( m_aMutex
);
445 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
450 // clear previous warnings
454 // Call SQLMoreResults
458 ADORecordset
* pSet
=NULL
;
459 OLEVariant aRecordsAffected
;
460 if(m_RecordSet
.IsValid() && m_RecordSet
.NextRecordset(aRecordsAffected
,&pSet
) && pSet
)
461 assignRecordSet( pSet
);
463 catch (SQLWarning
&ex
)
466 // Save pointer to warning and save with ResultSet
467 // object once it is created.
471 return m_RecordSet
.IsValid();
476 Any SAL_CALL
OStatement_Base::getWarnings( ) throw(SQLException
, RuntimeException
)
478 ::osl::MutexGuard
aGuard( m_aMutex
);
479 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
482 return makeAny(m_aLastWarning
);
487 void SAL_CALL
OStatement_Base::clearWarnings( ) throw(SQLException
, RuntimeException
)
489 ::osl::MutexGuard
aGuard( m_aMutex
);
490 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
493 m_aLastWarning
= SQLWarning();
497 sal_Int32
OStatement_Base::getQueryTimeOut() const throw(SQLException
, RuntimeException
)
499 return m_Command
.get_CommandTimeout();
502 sal_Int32
OStatement_Base::getMaxRows() const throw(SQLException
, RuntimeException
)
505 if(!(m_RecordSet
.IsValid() && m_RecordSet
.get_MaxRecords(nRet
)))
506 ::dbtools::throwFunctionSequenceException(NULL
);
510 sal_Int32
OStatement_Base::getResultSetConcurrency() const throw(SQLException
, RuntimeException
)
517 nValue
= ResultSetConcurrency::READ_ONLY
;
520 nValue
= ResultSetConcurrency::UPDATABLE
;
527 sal_Int32
OStatement_Base::getResultSetType() const throw(SQLException
, RuntimeException
)
530 switch(m_eCursorType
)
532 case adOpenUnspecified
:
533 case adOpenForwardOnly
:
534 nValue
= ResultSetType::FORWARD_ONLY
;
538 nValue
= ResultSetType::SCROLL_INSENSITIVE
;
541 nValue
= ResultSetType::SCROLL_SENSITIVE
;
547 sal_Int32
OStatement_Base::getFetchDirection() const throw(SQLException
, RuntimeException
)
549 return FetchDirection::FORWARD
;
552 sal_Int32
OStatement_Base::getFetchSize() const throw(SQLException
, RuntimeException
)
557 sal_Int32
OStatement_Base::getMaxFieldSize() const throw(SQLException
, RuntimeException
)
562 OUString
OStatement_Base::getCursorName() const throw(SQLException
, RuntimeException
)
564 return m_Command
.GetName();
567 void OStatement_Base::setQueryTimeOut(sal_Int32 seconds
) throw(SQLException
, RuntimeException
)
569 ::osl::MutexGuard
aGuard( m_aMutex
);
570 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
573 m_Command
.put_CommandTimeout(seconds
);
576 void OStatement_Base::setMaxRows(sal_Int32 _par0
) throw(SQLException
, RuntimeException
)
578 ::osl::MutexGuard
aGuard( m_aMutex
);
579 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
584 void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0
) throw(SQLException
, RuntimeException
)
586 ::osl::MutexGuard
aGuard( m_aMutex
);
587 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
591 case ResultSetConcurrency::READ_ONLY
:
592 m_eLockType
= adLockReadOnly
;
595 m_eLockType
= adLockOptimistic
;
600 void OStatement_Base::setResultSetType(sal_Int32 _par0
) throw(SQLException
, RuntimeException
)
602 ::osl::MutexGuard
aGuard( m_aMutex
);
603 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
608 case ResultSetType::FORWARD_ONLY
:
609 m_eCursorType
= adOpenForwardOnly
;
611 case ResultSetType::SCROLL_INSENSITIVE
:
612 m_eCursorType
= adOpenKeyset
;
614 case ResultSetType::SCROLL_SENSITIVE
:
615 m_eCursorType
= adOpenDynamic
;
620 void OStatement_Base::setFetchDirection(sal_Int32
/*_par0*/) throw(SQLException
, RuntimeException
)
622 ::osl::MutexGuard
aGuard( m_aMutex
);
623 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
624 ::dbtools::throwFeatureNotImplementedException( "Statement::FetchDirection", *this );
627 void OStatement_Base::setFetchSize(sal_Int32 _par0
) throw(SQLException
, RuntimeException
)
629 ::osl::MutexGuard
aGuard( m_aMutex
);
630 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
633 m_nFetchSize
= _par0
;
636 void OStatement_Base::setMaxFieldSize(sal_Int32
/*_par0*/) throw(SQLException
, RuntimeException
)
638 ::osl::MutexGuard
aGuard( m_aMutex
);
639 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
640 ::dbtools::throwFeatureNotImplementedException( "Statement::MaxFieldSize", *this );
643 void OStatement_Base::setCursorName(const OUString
&_par0
) throw(SQLException
, RuntimeException
)
645 ::osl::MutexGuard
aGuard( m_aMutex
);
646 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
648 m_Command
.put_Name(_par0
);
652 ::cppu::IPropertyArrayHelper
* OStatement_Base::createArrayHelper( ) const
654 Sequence
< com::sun::star::beans::Property
> aProps(10);
655 com::sun::star::beans::Property
* pProperties
= aProps
.getArray();
657 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME
),
658 PROPERTY_ID_CURSORNAME
, cppu::UnoType
<OUString
>::get(), 0);
659 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING
),
660 PROPERTY_ID_ESCAPEPROCESSING
, ::getBooleanCppuType(), 0);
661 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION
),
662 PROPERTY_ID_FETCHDIRECTION
, cppu::UnoType
<sal_Int32
>::get(), 0);
663 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE
),
664 PROPERTY_ID_FETCHSIZE
, cppu::UnoType
<sal_Int32
>::get(), 0);
665 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE
),
666 PROPERTY_ID_MAXFIELDSIZE
, cppu::UnoType
<sal_Int32
>::get(), 0);
667 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS
),
668 PROPERTY_ID_MAXROWS
, cppu::UnoType
<sal_Int32
>::get(), 0);
669 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT
),
670 PROPERTY_ID_QUERYTIMEOUT
, cppu::UnoType
<sal_Int32
>::get(), 0);
671 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY
),
672 PROPERTY_ID_RESULTSETCONCURRENCY
, cppu::UnoType
<sal_Int32
>::get(), 0);
673 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE
),
674 PROPERTY_ID_RESULTSETTYPE
, cppu::UnoType
<sal_Int32
>::get(), 0);
675 pProperties
[nPos
++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS
),
676 PROPERTY_ID_USEBOOKMARKS
, ::getBooleanCppuType(), 0);
678 return new ::cppu::OPropertyArrayHelper(aProps
);
682 ::cppu::IPropertyArrayHelper
& OStatement_Base::getInfoHelper()
684 return *const_cast<OStatement_Base
*>(this)->getArrayHelper();
687 sal_Bool
OStatement_Base::convertFastPropertyValue(
688 Any
& rConvertedValue
,
692 throw (::com::sun::star::lang::IllegalArgumentException
)
694 sal_Bool bModified
= sal_False
;
696 sal_Bool bValidAdoRS
= m_RecordSet
.IsValid();
697 // some of the properties below, when set, are remembered in a member, and applied in the next execute
698 // For these properties, the record set does not need to be valid to allow setting them.
699 // For all others (where the values are forwarded to the ADO RS directly), the recordset must be valid.
705 case PROPERTY_ID_MAXROWS
:
706 bModified
= ::comphelper::tryPropertyValue( rConvertedValue
, rOldValue
, rValue
, bValidAdoRS
? getMaxRows() : m_nMaxRows
);
709 case PROPERTY_ID_RESULTSETTYPE
:
710 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getResultSetType());
712 case PROPERTY_ID_FETCHSIZE
:
713 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchSize());
715 case PROPERTY_ID_RESULTSETCONCURRENCY
:
716 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getResultSetConcurrency());
718 case PROPERTY_ID_QUERYTIMEOUT
:
719 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getQueryTimeOut());
721 case PROPERTY_ID_MAXFIELDSIZE
:
722 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getMaxFieldSize());
724 case PROPERTY_ID_CURSORNAME
:
725 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getCursorName());
727 case PROPERTY_ID_FETCHDIRECTION
:
728 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchDirection());
732 catch( const Exception
& e
)
734 bModified
= sal_True
; // will ensure that the property is set
735 OSL_FAIL( "OStatement_Base::convertFastPropertyValue: caught something strange!" );
741 void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
,const Any
& rValue
) throw (Exception
)
745 case PROPERTY_ID_QUERYTIMEOUT
:
746 setQueryTimeOut(comphelper::getINT32(rValue
));
748 case PROPERTY_ID_MAXFIELDSIZE
:
749 setMaxFieldSize(comphelper::getINT32(rValue
));
751 case PROPERTY_ID_MAXROWS
:
752 setMaxRows(comphelper::getINT32(rValue
));
754 case PROPERTY_ID_CURSORNAME
:
755 setCursorName(comphelper::getString(rValue
));
757 case PROPERTY_ID_RESULTSETCONCURRENCY
:
758 setResultSetConcurrency(comphelper::getINT32(rValue
));
760 case PROPERTY_ID_RESULTSETTYPE
:
761 setResultSetType(comphelper::getINT32(rValue
));
763 case PROPERTY_ID_FETCHDIRECTION
:
764 setFetchDirection(comphelper::getINT32(rValue
));
766 case PROPERTY_ID_FETCHSIZE
:
767 setFetchSize(comphelper::getINT32(rValue
));
769 case PROPERTY_ID_ESCAPEPROCESSING
:
770 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
771 case PROPERTY_ID_USEBOOKMARKS
:
772 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
778 void OStatement_Base::getFastPropertyValue(Any
& rValue
,sal_Int32 nHandle
) const
782 case PROPERTY_ID_QUERYTIMEOUT
:
783 rValue
<<= getQueryTimeOut();
785 case PROPERTY_ID_MAXFIELDSIZE
:
786 rValue
<<= getMaxFieldSize();
788 case PROPERTY_ID_MAXROWS
:
789 rValue
<<= getMaxRows();
791 case PROPERTY_ID_CURSORNAME
:
792 rValue
<<= getCursorName();
794 case PROPERTY_ID_RESULTSETCONCURRENCY
:
795 rValue
<<= getResultSetConcurrency();
797 case PROPERTY_ID_RESULTSETTYPE
:
798 rValue
<<= getResultSetType();
800 case PROPERTY_ID_FETCHDIRECTION
:
801 rValue
<<= getFetchDirection();
803 case PROPERTY_ID_FETCHSIZE
:
804 rValue
<<= getFetchSize();
806 case PROPERTY_ID_ESCAPEPROCESSING
:
809 case PROPERTY_ID_USEBOOKMARKS
:
815 OStatement::~OStatement()
818 IMPLEMENT_SERVICE_INFO(OStatement
,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement");
820 void SAL_CALL
OStatement_Base::acquire() throw()
822 OStatement_BASE::acquire();
825 void SAL_CALL
OStatement::acquire() throw()
827 OStatement_Base::acquire();
830 void SAL_CALL
OStatement::release() throw()
832 OStatement_Base::release();
835 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
)
837 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
840 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */