LCOV - code coverage report
Current view: top level - connectivity/source/drivers/flat - EResultSet.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 68 0.0 %
Date: 2014-04-14 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/sdbcx/CompareBookmark.hpp>
      21             : #include <com/sun/star/sdbcx/XDeleteRows.hpp>
      22             : #include "flat/EResultSet.hxx"
      23             : #include <com/sun/star/lang/DisposedException.hpp>
      24             : #include <comphelper/sequence.hxx>
      25             : #include <comphelper/types.hxx>
      26             : #include <cppuhelper/supportsservice.hxx>
      27             : 
      28             : using namespace ::comphelper;
      29             : 
      30             : using namespace connectivity::flat;
      31             : using namespace connectivity::file;
      32             : using namespace ::cppu;
      33             : using namespace com::sun::star::uno;
      34             : using namespace com::sun::star::lang;
      35             : using namespace com::sun::star::beans;
      36             : using namespace com::sun::star::sdbc;
      37             : using namespace com::sun::star::sdbcx;
      38             : 
      39             : 
      40           0 : OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
      41             :                 : file::OResultSet(pStmt,_aSQLIterator)
      42           0 :                 ,m_bBookmarkable(sal_True)
      43             : {
      44           0 :     registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE),         PROPERTY_ID_ISBOOKMARKABLE,       PropertyAttribute::READONLY,&m_bBookmarkable,                ::getBooleanCppuType());
      45           0 : }
      46             : 
      47           0 : OUString SAL_CALL OFlatResultSet::getImplementationName(  ) throw ( RuntimeException, std::exception)
      48             : {
      49           0 :     return OUString("com.sun.star.sdbcx.flat.ResultSet");
      50             : }
      51             : 
      52           0 : Sequence< OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames(  ) throw( RuntimeException, std::exception)
      53             : {
      54           0 :      Sequence< OUString > aSupported(2);
      55           0 :     aSupported[0] = "com.sun.star.sdbc.ResultSet";
      56           0 :     aSupported[1] = "com.sun.star.sdbcx.ResultSet";
      57           0 :     return aSupported;
      58             : }
      59             : 
      60           0 : sal_Bool SAL_CALL OFlatResultSet::supportsService( const OUString& _rServiceName ) throw( RuntimeException, std::exception)
      61             : {
      62           0 :     return cppu::supportsService(this, _rServiceName);
      63             : }
      64             : 
      65           0 : Any SAL_CALL OFlatResultSet::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
      66             : {
      67           0 :     if(rType == ::getCppuType((const Reference<XDeleteRows>*)0) || rType == ::getCppuType((const Reference<XResultSetUpdate>*)0)
      68           0 :         || rType == ::getCppuType((const Reference<XRowUpdate>*)0))
      69           0 :         return Any();
      70             : 
      71           0 :     const Any aRet = OResultSet::queryInterface(rType);
      72           0 :     return aRet.hasValue() ? aRet : OFlatResultSet_BASE::queryInterface(rType);
      73             : }
      74             : 
      75           0 : Sequence<  Type > SAL_CALL OFlatResultSet::getTypes(  ) throw( RuntimeException, std::exception)
      76             : {
      77           0 :     Sequence< Type > aTypes = OResultSet::getTypes();
      78           0 :     ::std::vector<Type> aOwnTypes;
      79           0 :     aOwnTypes.reserve(aTypes.getLength());
      80           0 :     const Type* pBegin = aTypes.getConstArray();
      81           0 :     const Type* pEnd = pBegin + aTypes.getLength();
      82           0 :     for(;pBegin != pEnd;++pBegin)
      83             :     {
      84           0 :         if(!(*pBegin == ::getCppuType((const Reference<XDeleteRows>*)0) ||
      85           0 :             *pBegin == ::getCppuType((const Reference<XResultSetUpdate>*)0) ||
      86           0 :             *pBegin == ::getCppuType((const Reference<XRowUpdate>*)0)))
      87             :         {
      88           0 :             aOwnTypes.push_back(*pBegin);
      89             :         }
      90             :     }
      91           0 :     Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
      92           0 :     Sequence< Type > aRet(pTypes, aOwnTypes.size());
      93           0 :     return ::comphelper::concatSequences(aRet,OFlatResultSet_BASE::getTypes());
      94             : }
      95             : 
      96             : 
      97             : // XRowLocate
      98           0 : Any SAL_CALL OFlatResultSet::getBookmark(  ) throw( SQLException,  RuntimeException, std::exception)
      99             : {
     100           0 :      ::osl::MutexGuard aGuard( m_aMutex );
     101           0 :     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     102             : 
     103           0 :     return makeAny((sal_Int32)(m_aRow->get())[0]->getValue());
     104             : }
     105             : 
     106           0 : sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const  Any& bookmark ) throw( SQLException,  RuntimeException, std::exception)
     107             : {
     108           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     109           0 :         checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     110             : 
     111             : 
     112           0 :     m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
     113             : 
     114           0 :     return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_True);
     115             : }
     116             : 
     117           0 : sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const  Any& bookmark, sal_Int32 rows ) throw( SQLException,  RuntimeException, std::exception)
     118             : {
     119           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     120           0 :         checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
     121             : 
     122             : 
     123           0 :     m_bRowDeleted = m_bRowInserted = m_bRowUpdated = sal_False;
     124             : 
     125           0 :     Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),sal_False);
     126             : 
     127           0 :     return relative(rows);
     128             : }
     129             : 
     130             : 
     131           0 : sal_Int32 SAL_CALL OFlatResultSet::compareBookmarks( const Any& lhs, const  Any& rhs ) throw( SQLException,  RuntimeException, std::exception)
     132             : {
     133           0 :     return (lhs == rhs) ? 0 : 2;
     134             : }
     135             : 
     136           0 : sal_Bool SAL_CALL OFlatResultSet::hasOrderedBookmarks(  ) throw( SQLException,  RuntimeException, std::exception)
     137             : {
     138           0 :     return sal_True;
     139             : }
     140             : 
     141           0 : sal_Int32 SAL_CALL OFlatResultSet::hashBookmark( const  Any& bookmark ) throw( SQLException,  RuntimeException, std::exception)
     142             : {
     143           0 :     return comphelper::getINT32(bookmark);
     144             : }
     145             : 
     146           0 : IPropertyArrayHelper* OFlatResultSet::createArrayHelper( ) const
     147             : {
     148           0 :     Sequence< Property > aProps;
     149           0 :     describeProperties(aProps);
     150           0 :     return new ::cppu::OPropertyArrayHelper(aProps);
     151             : }
     152             : 
     153           0 : IPropertyArrayHelper & OFlatResultSet::getInfoHelper()
     154             : {
     155           0 :     return *OFlatResultSet_BASE3::getArrayHelper();
     156             : }
     157             : 
     158           0 : void SAL_CALL OFlatResultSet::acquire() throw()
     159             : {
     160           0 :     OFlatResultSet_BASE2::acquire();
     161           0 : }
     162             : 
     163           0 : void SAL_CALL OFlatResultSet::release() throw()
     164             : {
     165           0 :     OFlatResultSet_BASE2::release();
     166           0 : }
     167             : 
     168           0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OFlatResultSet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     169             : {
     170           0 :     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
     171             : }
     172             : 
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10