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
;
48 //------------------------------------------------------------------------------
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
;
54 //------------------------------------------------------------------------------
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
);
79 //------------------------------------------------------------------------------
80 void OStatement_Base::disposeResultSet()
82 // free the cursor if alive
83 Reference
< XComponent
> xComp(m_xResultSet
.get(), UNO_QUERY
);
86 m_xResultSet
= Reference
< XResultSet
>();
89 //------------------------------------------------------------------------------
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();
111 //-----------------------------------------------------------------------------
112 void SAL_CALL
OStatement_Base::release() throw()
116 //-----------------------------------------------------------------------------
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
);
122 // -------------------------------------------------------------------------
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());
132 // -------------------------------------------------------------------------
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())
142 // -------------------------------------------------------------------------
144 void SAL_CALL
OStatement_Base::close( ) throw(SQLException
, RuntimeException
)
147 ::osl::MutexGuard
aGuard( m_aMutex
);
148 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
153 // -------------------------------------------------------------------------
155 void SAL_CALL
OStatement::clearBatch( ) throw(SQLException
, RuntimeException
)
159 // -------------------------------------------------------------------------
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())
172 //--------------------------------------------------------------------
174 // If a ResultSet was created for this Statement, close it
175 //--------------------------------------------------------------------
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
= Reference
< XResultSet
>();
192 //--------------------------------------------------------------------
193 sal_Int32
OStatement_Base::getRowCount () throw( SQLException
)
195 ::osl::MutexGuard
aGuard( m_aMutex
);
196 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
199 return m_RecordsAffected
;
201 //--------------------------------------------------------------------
203 // Given a SQL type, return the maximum precision for the column.
204 // Returns -1 if not known
205 //--------------------------------------------------------------------
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
);
227 //--------------------------------------------------------------------
230 //--------------------------------------------------------------------
232 void OStatement_Base::setWarning (const SQLWarning
&ex
) throw( SQLException
)
234 ::osl::MutexGuard
aGuard( m_aMutex
);
235 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
240 // -------------------------------------------------------------------------
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
);
252 // -------------------------------------------------------------------------
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();
282 // -------------------------------------------------------------------------
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
);
318 // -------------------------------------------------------------------------
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
;
328 // -------------------------------------------------------------------------
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
);
335 // -------------------------------------------------------------------------
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
);
345 // -------------------------------------------------------------------------
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
+ OUString(";");
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
))
389 // -------------------------------------------------------------------------
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
;
417 // -------------------------------------------------------------------------
419 Reference
< XResultSet
> SAL_CALL
OStatement_Base::getResultSet( ) throw(SQLException
, RuntimeException
)
421 ::osl::MutexGuard
aGuard( m_aMutex
);
422 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
427 // -------------------------------------------------------------------------
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
))
440 // -------------------------------------------------------------------------
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();
473 // -------------------------------------------------------------------------
475 // -------------------------------------------------------------------------
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
);
484 // -------------------------------------------------------------------------
486 // -------------------------------------------------------------------------
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();
495 // -------------------------------------------------------------------------
496 //------------------------------------------------------------------------------
497 sal_Int32
OStatement_Base::getQueryTimeOut() const throw(SQLException
, RuntimeException
)
499 return m_Command
.get_CommandTimeout();
501 //------------------------------------------------------------------------------
502 sal_Int32
OStatement_Base::getMaxRows() const throw(SQLException
, RuntimeException
)
505 if(!(m_RecordSet
.IsValid() && m_RecordSet
.get_MaxRecords(nRet
)))
506 ::dbtools::throwFunctionSequenceException(NULL
);
509 //------------------------------------------------------------------------------
510 sal_Int32
OStatement_Base::getResultSetConcurrency() const throw(SQLException
, RuntimeException
)
517 nValue
= ResultSetConcurrency::READ_ONLY
;
520 nValue
= ResultSetConcurrency::UPDATABLE
;
526 //------------------------------------------------------------------------------
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
;
546 //------------------------------------------------------------------------------
547 sal_Int32
OStatement_Base::getFetchDirection() const throw(SQLException
, RuntimeException
)
549 return FetchDirection::FORWARD
;
551 //------------------------------------------------------------------------------
552 sal_Int32
OStatement_Base::getFetchSize() const throw(SQLException
, RuntimeException
)
556 //------------------------------------------------------------------------------
557 sal_Int32
OStatement_Base::getMaxFieldSize() const throw(SQLException
, RuntimeException
)
561 //------------------------------------------------------------------------------
562 OUString
OStatement_Base::getCursorName() const throw(SQLException
, RuntimeException
)
564 return m_Command
.GetName();
566 //------------------------------------------------------------------------------
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
);
575 //------------------------------------------------------------------------------
576 void OStatement_Base::setMaxRows(sal_Int32 _par0
) throw(SQLException
, RuntimeException
)
578 ::osl::MutexGuard
aGuard( m_aMutex
);
579 checkDisposed(OStatement_BASE::rBHelper
.bDisposed
);
583 //------------------------------------------------------------------------------
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
;
599 //------------------------------------------------------------------------------
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
;
619 //------------------------------------------------------------------------------
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 );
626 //------------------------------------------------------------------------------
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
;
635 //------------------------------------------------------------------------------
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 );
642 //------------------------------------------------------------------------------
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
);
651 // -------------------------------------------------------------------------
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 DECL_PROP0(CURSORNAME
, OUString
);
658 DECL_BOOL_PROP0(ESCAPEPROCESSING
);
659 DECL_PROP0(FETCHDIRECTION
,sal_Int32
);
660 DECL_PROP0(FETCHSIZE
, sal_Int32
);
661 DECL_PROP0(MAXFIELDSIZE
,sal_Int32
);
662 DECL_PROP0(MAXROWS
, sal_Int32
);
663 DECL_PROP0(QUERYTIMEOUT
,sal_Int32
);
664 DECL_PROP0(RESULTSETCONCURRENCY
,sal_Int32
);
665 DECL_PROP0(RESULTSETTYPE
,sal_Int32
);
666 DECL_BOOL_PROP0(USEBOOKMARKS
);
669 return new ::cppu::OPropertyArrayHelper(aProps
);
672 // -------------------------------------------------------------------------
673 ::cppu::IPropertyArrayHelper
& OStatement_Base::getInfoHelper()
675 return *const_cast<OStatement_Base
*>(this)->getArrayHelper();
677 // -------------------------------------------------------------------------
678 sal_Bool
OStatement_Base::convertFastPropertyValue(
679 Any
& rConvertedValue
,
683 throw (::com::sun::star::lang::IllegalArgumentException
)
685 sal_Bool bModified
= sal_False
;
687 sal_Bool bValidAdoRS
= m_RecordSet
.IsValid();
688 // some of the properties below, when set, are remembered in a member, and applied in the next execute
689 // For these properties, the record set does not need to be valid to allow setting them.
690 // For all others (where the values are forwarded to the ADO RS directly), the recordset must be valid.
696 case PROPERTY_ID_MAXROWS
:
697 bModified
= ::comphelper::tryPropertyValue( rConvertedValue
, rOldValue
, rValue
, bValidAdoRS
? getMaxRows() : m_nMaxRows
);
700 case PROPERTY_ID_RESULTSETTYPE
:
701 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getResultSetType());
703 case PROPERTY_ID_FETCHSIZE
:
704 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchSize());
706 case PROPERTY_ID_RESULTSETCONCURRENCY
:
707 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getResultSetConcurrency());
709 case PROPERTY_ID_QUERYTIMEOUT
:
710 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getQueryTimeOut());
712 case PROPERTY_ID_MAXFIELDSIZE
:
713 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getMaxFieldSize());
715 case PROPERTY_ID_CURSORNAME
:
716 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getCursorName());
718 case PROPERTY_ID_FETCHDIRECTION
:
719 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, getFetchDirection());
723 catch( const Exception
& e
)
725 bModified
= sal_True
; // will ensure that the property is set
726 OSL_FAIL( "OStatement_Base::convertFastPropertyValue: caught something strange!" );
731 // -------------------------------------------------------------------------
732 void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
,const Any
& rValue
) throw (Exception
)
736 case PROPERTY_ID_QUERYTIMEOUT
:
737 setQueryTimeOut(comphelper::getINT32(rValue
));
739 case PROPERTY_ID_MAXFIELDSIZE
:
740 setMaxFieldSize(comphelper::getINT32(rValue
));
742 case PROPERTY_ID_MAXROWS
:
743 setMaxRows(comphelper::getINT32(rValue
));
745 case PROPERTY_ID_CURSORNAME
:
746 setCursorName(comphelper::getString(rValue
));
748 case PROPERTY_ID_RESULTSETCONCURRENCY
:
749 setResultSetConcurrency(comphelper::getINT32(rValue
));
751 case PROPERTY_ID_RESULTSETTYPE
:
752 setResultSetType(comphelper::getINT32(rValue
));
754 case PROPERTY_ID_FETCHDIRECTION
:
755 setFetchDirection(comphelper::getINT32(rValue
));
757 case PROPERTY_ID_FETCHSIZE
:
758 setFetchSize(comphelper::getINT32(rValue
));
760 case PROPERTY_ID_ESCAPEPROCESSING
:
761 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
762 case PROPERTY_ID_USEBOOKMARKS
:
763 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
768 // -------------------------------------------------------------------------
769 void OStatement_Base::getFastPropertyValue(Any
& rValue
,sal_Int32 nHandle
) const
773 case PROPERTY_ID_QUERYTIMEOUT
:
774 rValue
<<= getQueryTimeOut();
776 case PROPERTY_ID_MAXFIELDSIZE
:
777 rValue
<<= getMaxFieldSize();
779 case PROPERTY_ID_MAXROWS
:
780 rValue
<<= getMaxRows();
782 case PROPERTY_ID_CURSORNAME
:
783 rValue
<<= getCursorName();
785 case PROPERTY_ID_RESULTSETCONCURRENCY
:
786 rValue
<<= getResultSetConcurrency();
788 case PROPERTY_ID_RESULTSETTYPE
:
789 rValue
<<= getResultSetType();
791 case PROPERTY_ID_FETCHDIRECTION
:
792 rValue
<<= getFetchDirection();
794 case PROPERTY_ID_FETCHSIZE
:
795 rValue
<<= getFetchSize();
797 case PROPERTY_ID_ESCAPEPROCESSING
:
800 case PROPERTY_ID_USEBOOKMARKS
:
805 // -------------------------------------------------------------------------
806 OStatement::~OStatement()
809 IMPLEMENT_SERVICE_INFO(OStatement
,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement");
810 // -----------------------------------------------------------------------------
811 void SAL_CALL
OStatement_Base::acquire() throw()
813 OStatement_BASE::acquire();
815 // -----------------------------------------------------------------------------
816 void SAL_CALL
OStatement::acquire() throw()
818 OStatement_Base::acquire();
820 // -----------------------------------------------------------------------------
821 void SAL_CALL
OStatement::release() throw()
823 OStatement_Base::release();
825 // -----------------------------------------------------------------------------
826 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
OStatement_Base::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
)
828 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
831 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */