bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / ado / AStatement.cxx
blob01fea934cd199f92e543b4a5a1574d68ad6bb876
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <osl/thread.h>
25 #include <cppuhelper/typeprovider.hxx>
26 #include <cppuhelper/queryinterface.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>
34 #undef max
36 #include <algorithm>
37 #include <numeric>
39 using namespace ::comphelper;
41 #define CHECK_RETURN(x) \
42 if(!x) \
43 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 ,m_pConnection(_pConnection)
58 ,m_nMaxRows(0)
59 ,m_nFetchSize(1)
60 ,m_eLockType(adLockReadOnly)
61 ,m_eCursorType(adOpenForwardOnly)
63 osl_atomic_increment( &m_refCount );
65 m_Command.Create();
66 if(m_Command.IsValid())
67 m_Command.putref_ActiveConnection(m_pConnection->getConnection());
68 else
69 ADOS::ThrowException(*m_pConnection->getConnection(),*this);
71 m_RecordsAffected.setNoArg();
72 m_Parameters.setNoArg();
74 m_pConnection->acquire();
76 osl_atomic_decrement( &m_refCount );
79 void OStatement_Base::disposeResultSet()
81 // free the cursor if alive
82 Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
83 if (xComp.is())
84 xComp->dispose();
85 m_xResultSet.clear();
89 void OStatement_Base::disposing()
91 ::osl::MutexGuard aGuard(m_aMutex);
94 disposeResultSet();
96 if ( m_Command.IsValid() )
97 m_Command.putref_ActiveConnection( nullptr );
98 m_Command.clear();
100 if ( m_RecordSet.IsValid() )
101 m_RecordSet.PutRefDataSource( nullptr );
102 m_RecordSet.clear();
104 if (m_pConnection)
105 m_pConnection->release();
107 OStatement_BASE::disposing();
110 void SAL_CALL OStatement_Base::release() throw()
112 OStatement_BASE::release();
115 Any SAL_CALL OStatement_Base::queryInterface( const Type & rType )
117 Any aRet = OStatement_BASE::queryInterface(rType);
118 return aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface(rType);
121 css::uno::Sequence< css::uno::Type > SAL_CALL OStatement_Base::getTypes( )
123 ::cppu::OTypeCollection aTypes( cppu::UnoType<css::beans::XMultiPropertySet>::get(),
124 cppu::UnoType<css::beans::XFastPropertySet>::get(),
125 cppu::UnoType<css::beans::XPropertySet>::get());
127 return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
131 void SAL_CALL OStatement_Base::cancel( )
133 ::osl::MutexGuard aGuard( m_aMutex );
134 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
137 CHECK_RETURN(m_Command.Cancel())
141 void SAL_CALL OStatement_Base::close( )
144 ::osl::MutexGuard aGuard( m_aMutex );
145 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
148 dispose();
152 void SAL_CALL OStatement::clearBatch( )
158 void OStatement_Base::reset()
160 ::osl::MutexGuard aGuard( m_aMutex );
161 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
164 clearWarnings ();
166 if (m_xResultSet.get().is())
167 clearMyResultSet();
170 // clearMyResultSet
171 // If a ResultSet was created for this Statement, close it
174 void OStatement_Base::clearMyResultSet ()
176 ::osl::MutexGuard aGuard( m_aMutex );
177 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
181 Reference<XCloseable> xCloseable(
182 m_xResultSet.get(), css::uno::UNO_QUERY);
183 if ( xCloseable.is() )
184 xCloseable->close();
186 catch( const DisposedException& ) { }
188 m_xResultSet.clear();
191 sal_Int32 OStatement_Base::getRowCount ()
193 ::osl::MutexGuard aGuard( m_aMutex );
194 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
197 return m_RecordsAffected.getInt32();
200 // getPrecision
201 // Given a SQL type, return the maximum precision for the column.
202 // Returns -1 if not known
205 sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType)
207 ::osl::MutexGuard aGuard( m_aMutex );
208 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
211 sal_Int32 prec = -1;
212 OTypeInfo aInfo;
213 aInfo.nType = static_cast<sal_Int16>(sqlType);
214 if (!m_aTypeInfo.empty())
216 std::vector<OTypeInfo>::const_iterator aIter = std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo);
217 for(;aIter != m_aTypeInfo.end();++aIter)
219 prec = std::max(prec,(*aIter).nPrecision);
223 return prec;
226 // setWarning
227 // Sets the warning
230 void OStatement_Base::setWarning (const SQLWarning &ex)
232 ::osl::MutexGuard aGuard( m_aMutex );
233 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
236 m_aLastWarning = ex;
239 void OStatement_Base::assignRecordSet( ADORecordset* _pRS )
241 WpADORecordset aOldRS( m_RecordSet );
242 m_RecordSet = WpADORecordset( _pRS );
244 if ( aOldRS.IsValid() )
245 aOldRS.PutRefDataSource( nullptr );
247 if ( m_RecordSet.IsValid() )
248 m_RecordSet.PutRefDataSource( static_cast<IDispatch*>(m_Command) );
251 sal_Bool SAL_CALL OStatement_Base::execute( const OUString& sql )
253 ::osl::MutexGuard aGuard( m_aMutex );
254 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
257 // Reset the statement handle and warning
259 reset();
263 ADORecordset* pSet = nullptr;
264 CHECK_RETURN(m_Command.put_CommandText(sql))
265 CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText,&pSet))
267 assignRecordSet( pSet );
269 catch (SQLWarning& ex)
272 // Save pointer to warning and save with ResultSet
273 // object once it is created.
275 m_aLastWarning = ex;
278 return m_RecordSet.IsValid();
281 Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const OUString& sql )
283 ::osl::MutexGuard aGuard( m_aMutex );
284 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
287 reset();
289 m_xResultSet = WeakReference<XResultSet>(nullptr);
291 WpADORecordset aSet;
292 aSet.Create();
293 CHECK_RETURN(m_Command.put_CommandText(sql))
294 OLEVariant aCmd;
295 aCmd.setIDispatch(m_Command);
296 OLEVariant aCon;
297 aCon.setNoArg();
298 CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize))
299 CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows))
300 CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
303 CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize))
304 CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows))
305 CHECK_RETURN(aSet.get_CursorType(m_eCursorType))
306 CHECK_RETURN(aSet.get_LockType(m_eLockType))
308 OResultSet* pSet = new OResultSet(aSet,this);
309 Reference< XResultSet > xRs = pSet;
310 pSet->construct();
312 m_xResultSet = WeakReference<XResultSet>(xRs);
314 return xRs;
318 Reference< XConnection > SAL_CALL OStatement_Base::getConnection( )
320 ::osl::MutexGuard aGuard( m_aMutex );
321 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
324 return static_cast<Reference< XConnection >>(m_pConnection);
328 Any SAL_CALL OStatement::queryInterface( const Type & rType )
330 Any aRet = ::cppu::queryInterface(rType,static_cast< XBatchExecution*> (this));
331 return aRet.hasValue() ? aRet : OStatement_Base::queryInterface(rType);
335 void SAL_CALL OStatement::addBatch( const OUString& sql )
337 ::osl::MutexGuard aGuard( m_aMutex );
338 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
341 m_aBatchVector.push_back(sql);
344 Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( )
346 ::osl::MutexGuard aGuard( m_aMutex );
347 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
350 reset();
352 OUString aBatchSql = std::accumulate(m_aBatchVector.begin(), m_aBatchVector.end(), OUString(),
353 [](const OUString& rRes, const OUString& rStr) { return rRes + rStr + ";"; });
354 sal_Int32 nLen = m_aBatchVector.size();
357 if ( m_RecordSet.IsValid() )
358 m_RecordSet.PutRefDataSource( nullptr );
359 m_RecordSet.clear();
360 m_RecordSet.Create();
362 CHECK_RETURN(m_Command.put_CommandText(aBatchSql))
363 if ( m_RecordSet.IsValid() )
364 m_RecordSet.PutRefDataSource(static_cast<IDispatch*>(m_Command));
366 CHECK_RETURN(m_RecordSet.UpdateBatch(adAffectAll))
368 ADORecordset* pSet=nullptr;
369 Sequence< sal_Int32 > aRet(nLen);
370 sal_Int32* pArray = aRet.getArray();
371 for(sal_Int32 j=0;j<nLen;++j)
373 pSet = nullptr;
374 OLEVariant aRecordsAffected;
375 if(m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet)
377 assignRecordSet( pSet );
379 ADO_LONGPTR nValue;
380 if(m_RecordSet.get_RecordCount(nValue))
381 pArray[j] = nValue;
384 return aRet;
388 sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const OUString& sql )
390 ::osl::MutexGuard aGuard( m_aMutex );
391 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
394 reset();
396 try {
397 ADORecordset* pSet = nullptr;
398 CHECK_RETURN(m_Command.put_CommandText(sql))
399 CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdText|adExecuteNoRecords,&pSet))
401 catch (SQLWarning& ex) {
403 // Save pointer to warning and save with ResultSet
404 // object once it is created.
406 m_aLastWarning = ex;
408 if(!m_RecordsAffected.isEmpty() && !m_RecordsAffected.isNull() && m_RecordsAffected.getType() != VT_ERROR)
409 return m_RecordsAffected.getInt32();
411 return 0;
415 Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( )
417 ::osl::MutexGuard aGuard( m_aMutex );
418 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
421 return m_xResultSet;
425 sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( )
427 ::osl::MutexGuard aGuard( m_aMutex );
428 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
431 ADO_LONGPTR nRet;
432 if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet))
433 return nRet;
434 return -1;
438 sal_Bool SAL_CALL OStatement_Base::getMoreResults( )
440 ::osl::MutexGuard aGuard( m_aMutex );
441 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
444 SQLWarning warning;
446 // clear previous warnings
448 clearWarnings ();
450 // Call SQLMoreResults
454 ADORecordset* pSet=nullptr;
455 OLEVariant aRecordsAffected;
456 if(m_RecordSet.IsValid() && m_RecordSet.NextRecordset(aRecordsAffected,&pSet) && pSet)
457 assignRecordSet( pSet );
459 catch (SQLWarning &ex)
462 // Save pointer to warning and save with ResultSet
463 // object once it is created.
465 warning = ex;
467 return m_RecordSet.IsValid();
471 Any SAL_CALL OStatement_Base::getWarnings( )
473 ::osl::MutexGuard aGuard( m_aMutex );
474 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
477 return makeAny(m_aLastWarning);
481 void SAL_CALL OStatement_Base::clearWarnings( )
483 ::osl::MutexGuard aGuard( m_aMutex );
484 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
487 m_aLastWarning = SQLWarning();
491 sal_Int32 OStatement_Base::getQueryTimeOut() const
493 return m_Command.get_CommandTimeout();
496 sal_Int32 OStatement_Base::getMaxRows() const
498 ADO_LONGPTR nRet=-1;
499 if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet)))
500 ::dbtools::throwFunctionSequenceException(nullptr);
501 return nRet;
504 sal_Int32 OStatement_Base::getResultSetConcurrency() const
506 sal_Int32 nValue;
508 switch(m_eLockType)
510 case adLockReadOnly:
511 nValue = ResultSetConcurrency::READ_ONLY;
512 break;
513 default:
514 nValue = ResultSetConcurrency::UPDATABLE;
515 break;
518 return nValue;
521 sal_Int32 OStatement_Base::getResultSetType() const
523 sal_Int32 nValue=0;
524 switch(m_eCursorType)
526 case adOpenUnspecified:
527 case adOpenForwardOnly:
528 nValue = ResultSetType::FORWARD_ONLY;
529 break;
530 case adOpenStatic:
531 case adOpenKeyset:
532 nValue = ResultSetType::SCROLL_INSENSITIVE;
533 break;
534 case adOpenDynamic:
535 nValue = ResultSetType::SCROLL_SENSITIVE;
536 break;
538 return nValue;
541 sal_Int32 OStatement_Base::getFetchDirection()
543 return FetchDirection::FORWARD;
546 sal_Int32 OStatement_Base::getFetchSize() const
548 return m_nFetchSize;
551 sal_Int32 OStatement_Base::getMaxFieldSize()
553 return 0;
556 OUString OStatement_Base::getCursorName() const
558 return m_Command.GetName();
561 void OStatement_Base::setQueryTimeOut(sal_Int32 seconds)
563 ::osl::MutexGuard aGuard( m_aMutex );
564 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
567 m_Command.put_CommandTimeout(seconds);
570 void OStatement_Base::setMaxRows(sal_Int32 _par0)
572 ::osl::MutexGuard aGuard( m_aMutex );
573 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
575 m_nMaxRows = _par0;
578 void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0)
580 ::osl::MutexGuard aGuard( m_aMutex );
581 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
583 switch(_par0)
585 case ResultSetConcurrency::READ_ONLY:
586 m_eLockType = adLockReadOnly;
587 break;
588 default:
589 m_eLockType = adLockOptimistic;
590 break;
594 void OStatement_Base::setResultSetType(sal_Int32 _par0)
596 ::osl::MutexGuard aGuard( m_aMutex );
597 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
600 switch(_par0)
602 case ResultSetType::FORWARD_ONLY:
603 m_eCursorType = adOpenForwardOnly;
604 break;
605 case ResultSetType::SCROLL_INSENSITIVE:
606 m_eCursorType = adOpenKeyset;
607 break;
608 case ResultSetType::SCROLL_SENSITIVE:
609 m_eCursorType = adOpenDynamic;
610 break;
614 void OStatement_Base::setFetchDirection(sal_Int32 /*_par0*/)
616 ::osl::MutexGuard aGuard( m_aMutex );
617 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
618 ::dbtools::throwFeatureNotImplementedSQLException( "Statement::FetchDirection", *this );
621 void OStatement_Base::setFetchSize(sal_Int32 _par0)
623 ::osl::MutexGuard aGuard( m_aMutex );
624 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
627 m_nFetchSize = _par0;
630 void OStatement_Base::setMaxFieldSize(sal_Int32 /*_par0*/)
632 ::osl::MutexGuard aGuard( m_aMutex );
633 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
634 ::dbtools::throwFeatureNotImplementedSQLException( "Statement::MaxFieldSize", *this );
637 void OStatement_Base::setCursorName(const OUString &_par0)
639 ::osl::MutexGuard aGuard( m_aMutex );
640 checkDisposed(OStatement_BASE::rBHelper.bDisposed);
642 m_Command.put_Name(_par0);
646 ::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
648 Sequence< css::beans::Property > aProps(10);
649 css::beans::Property* pProperties = aProps.getArray();
650 sal_Int32 nPos = 0;
651 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_CURSORNAME),
652 PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0);
653 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ESCAPEPROCESSING),
654 PROPERTY_ID_ESCAPEPROCESSING, cppu::UnoType<bool>::get(), 0);
655 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHDIRECTION),
656 PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0);
657 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_FETCHSIZE),
658 PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0);
659 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXFIELDSIZE),
660 PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0);
661 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_MAXROWS),
662 PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0);
663 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_QUERYTIMEOUT),
664 PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0);
665 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETCONCURRENCY),
666 PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0);
667 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RESULTSETTYPE),
668 PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0);
669 pProperties[nPos++] = css::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_USEBOOKMARKS),
670 PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0);
672 return new ::cppu::OPropertyArrayHelper(aProps);
676 ::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
678 return *getArrayHelper();
681 sal_Bool OStatement_Base::convertFastPropertyValue(
682 Any & rConvertedValue,
683 Any & rOldValue,
684 sal_Int32 nHandle,
685 const Any& rValue )
687 bool bModified = false;
689 bool bValidAdoRS = m_RecordSet.IsValid();
690 // some of the properties below, when set, are remembered in a member, and applied in the next execute
691 // For these properties, the record set does not need to be valid to allow setting them.
692 // For all others (where the values are forwarded to the ADO RS directly), the recordset must be valid.
696 switch(nHandle)
698 case PROPERTY_ID_MAXROWS:
699 bModified = ::comphelper::tryPropertyValue( rConvertedValue, rOldValue, rValue, bValidAdoRS ? getMaxRows() : m_nMaxRows );
700 break;
702 case PROPERTY_ID_RESULTSETTYPE:
703 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetType());
704 break;
705 case PROPERTY_ID_FETCHSIZE:
706 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
707 break;
708 case PROPERTY_ID_RESULTSETCONCURRENCY:
709 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getResultSetConcurrency());
710 break;
711 case PROPERTY_ID_QUERYTIMEOUT:
712 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getQueryTimeOut());
713 break;
714 case PROPERTY_ID_MAXFIELDSIZE:
715 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getMaxFieldSize());
716 break;
717 case PROPERTY_ID_CURSORNAME:
718 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getCursorName());
719 break;
720 case PROPERTY_ID_FETCHDIRECTION:
721 bModified = ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
722 break;
725 catch( const Exception& )
727 bModified = true; // will ensure that the property is set
728 OSL_FAIL( "OStatement_Base::convertFastPropertyValue: caught something strange!" );
730 return bModified;
733 void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
735 switch(nHandle)
737 case PROPERTY_ID_QUERYTIMEOUT:
738 setQueryTimeOut(comphelper::getINT32(rValue));
739 break;
740 case PROPERTY_ID_MAXFIELDSIZE:
741 setMaxFieldSize(comphelper::getINT32(rValue));
742 break;
743 case PROPERTY_ID_MAXROWS:
744 setMaxRows(comphelper::getINT32(rValue));
745 break;
746 case PROPERTY_ID_CURSORNAME:
747 setCursorName(comphelper::getString(rValue));
748 break;
749 case PROPERTY_ID_RESULTSETCONCURRENCY:
750 setResultSetConcurrency(comphelper::getINT32(rValue));
751 break;
752 case PROPERTY_ID_RESULTSETTYPE:
753 setResultSetType(comphelper::getINT32(rValue));
754 break;
755 case PROPERTY_ID_FETCHDIRECTION:
756 setFetchDirection(comphelper::getINT32(rValue));
757 break;
758 case PROPERTY_ID_FETCHSIZE:
759 setFetchSize(comphelper::getINT32(rValue));
760 break;
761 case PROPERTY_ID_ESCAPEPROCESSING:
762 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
763 case PROPERTY_ID_USEBOOKMARKS:
764 // return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAsLink);
765 default:
770 void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
772 switch(nHandle)
774 case PROPERTY_ID_QUERYTIMEOUT:
775 rValue <<= getQueryTimeOut();
776 break;
777 case PROPERTY_ID_MAXFIELDSIZE:
778 rValue <<= getMaxFieldSize();
779 break;
780 case PROPERTY_ID_MAXROWS:
781 rValue <<= getMaxRows();
782 break;
783 case PROPERTY_ID_CURSORNAME:
784 rValue <<= getCursorName();
785 break;
786 case PROPERTY_ID_RESULTSETCONCURRENCY:
787 rValue <<= getResultSetConcurrency();
788 break;
789 case PROPERTY_ID_RESULTSETTYPE:
790 rValue <<= getResultSetType();
791 break;
792 case PROPERTY_ID_FETCHDIRECTION:
793 rValue <<= getFetchDirection();
794 break;
795 case PROPERTY_ID_FETCHSIZE:
796 rValue <<= getFetchSize();
797 break;
798 case PROPERTY_ID_ESCAPEPROCESSING:
799 rValue <<= true;
800 break;
801 case PROPERTY_ID_USEBOOKMARKS:
802 default:
807 OStatement::~OStatement()
810 IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.AStatement","com.sun.star.sdbc.Statement");
812 void SAL_CALL OStatement_Base::acquire() throw()
814 OStatement_BASE::acquire();
817 void SAL_CALL OStatement::acquire() throw()
819 OStatement_Base::acquire();
822 void SAL_CALL OStatement::release() throw()
824 OStatement_Base::release();
827 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo( )
829 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
832 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */