LCOV - code coverage report
Current view: top level - connectivity/source/drivers/mork - MPreparedStatement.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 66 230 28.7 %
Date: 2014-11-03 Functions: 16 54 29.6 %
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             : 
      10             : #include <stdio.h>
      11             : #include <osl/diagnose.h>
      12             : #include <connectivity/sdbcx/VColumn.hxx>
      13             : #include "MPreparedStatement.hxx"
      14             : #include <com/sun/star/sdbc/DataType.hpp>
      15             : #include "MResultSetMetaData.hxx"
      16             : #include <cppuhelper/typeprovider.hxx>
      17             : #include <comphelper/sequence.hxx>
      18             : #include <com/sun/star/lang/DisposedException.hpp>
      19             : #include <connectivity/dbexception.hxx>
      20             : #include <connectivity/dbtools.hxx>
      21             : #include <comphelper/types.hxx>
      22             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      23             : #include "diagnose_ex.h"
      24             : 
      25             : #if OSL_DEBUG_LEVEL > 0
      26             : # define OUtoCStr( x ) ( OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
      27             : #else /* OSL_DEBUG_LEVEL */
      28             : # define OUtoCStr( x ) ("dummy")
      29             : #endif /* OSL_DEBUG_LEVEL */
      30             : 
      31             : using namespace ::comphelper;
      32             : using namespace connectivity;
      33             : using namespace connectivity::mork;
      34             : using namespace com::sun::star::uno;
      35             : using namespace com::sun::star::lang;
      36             : using namespace com::sun::star::beans;
      37             : using namespace com::sun::star::sdbc;
      38             : using namespace com::sun::star::sdbcx;
      39             : using namespace com::sun::star::container;
      40             : using namespace com::sun::star::io;
      41             : using namespace com::sun::star::util;
      42             : 
      43           0 : IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.mork.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
      44             : 
      45             : 
      46           4 : OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OUString& sql)
      47             :     :OCommonStatement(_pConnection)
      48             :     ,m_nNumParams(0)
      49             :     ,m_sSqlStatement(sql)
      50             :     ,m_bPrepared(false)
      51           4 :     ,m_pResultSet()
      52             : {
      53           4 : }
      54             : 
      55           8 : OPreparedStatement::~OPreparedStatement()
      56             : {
      57           8 : }
      58             : 
      59           4 : void OPreparedStatement::lateInit()
      60             : {
      61           4 :     if ( eSelect != parseSql( m_sSqlStatement ) )
      62           0 :         throw SQLException();
      63           4 : }
      64             : 
      65           4 : void SAL_CALL OPreparedStatement::disposing()
      66             : {
      67           4 :     ::osl::MutexGuard aGuard(m_aMutex);
      68             : 
      69           4 :     OCommonStatement::disposing();
      70             : 
      71           4 :     m_xMetaData.clear();
      72           4 :     if(m_aParameterRow.is())
      73             :     {
      74           0 :         m_aParameterRow->get().clear();
      75           0 :         m_aParameterRow = NULL;
      76             :     }
      77           4 :     m_xParamColumns = NULL;
      78           4 : }
      79             : 
      80             : 
      81           4 : OCommonStatement::StatementType OPreparedStatement::parseSql( const OUString& sql , bool bAdjusted )
      82             :     throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
      83             : {
      84           4 :     StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
      85           4 :     if ( eStatementType != eSelect )
      86           0 :         return eStatementType;
      87             : 
      88           4 :     m_xParamColumns = new OSQLColumns();
      89             : 
      90             :     // describe all parameters need for the resultset
      91           4 :     describeParameter();
      92             : 
      93           4 :     Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
      94           4 :     OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, false, m_xDBMetaData, m_aColMapping );
      95             : 
      96           4 :     return eStatementType;
      97             : }
      98             : 
      99             : 
     100           4 : void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
     101             : {
     102           4 :     OCommonStatement::initializeResultSet( _pResult );
     103           4 :     _pResult->setParameterColumns( m_xParamColumns );
     104           4 :     _pResult->setParameterRow( m_aParameterRow );
     105           4 : }
     106             : 
     107             : 
     108           8 : void OPreparedStatement::clearCachedResultSet()
     109             : {
     110           8 :     OCommonStatement::clearCachedResultSet();
     111           8 :     m_pResultSet.clear();
     112           8 :     m_xMetaData.clear();
     113           8 : }
     114             : 
     115           4 : void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
     116             : {
     117           4 :     OCommonStatement::cacheResultSet( _pResult );
     118             :     OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
     119           4 :     m_pResultSet = _pResult;
     120           4 : }
     121             : 
     122             : 
     123          36 : void SAL_CALL OPreparedStatement::acquire() throw()
     124             : {
     125          36 :     OCommonStatement::acquire();
     126          36 : }
     127             : 
     128          36 : void SAL_CALL OPreparedStatement::release() throw()
     129             : {
     130          36 :     OCommonStatement::release();
     131          36 : }
     132             : 
     133          12 : Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     134             : {
     135          12 :     Any aRet = OCommonStatement::queryInterface(rType);
     136          12 :     if(!aRet.hasValue())
     137           0 :         aRet = OPreparedStatement_BASE::queryInterface(rType);
     138          12 :     return aRet;
     139             : }
     140             : 
     141           0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception)
     142             : {
     143           0 :     return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
     144             : }
     145             : 
     146             : 
     147           0 : Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData(  ) throw(SQLException, RuntimeException, std::exception)
     148             : {
     149           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     150           0 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     151             : 
     152           0 :     bool bReadOnly = true;
     153           0 :     if ( m_pResultSet.is() )
     154           0 :         bReadOnly = m_pResultSet->determineReadOnly();
     155             :     // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
     156             :     // okay, /me thinks.
     157             : 
     158           0 :     if ( !m_xMetaData.is() )
     159           0 :         m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
     160             : 
     161           0 :     return m_xMetaData;
     162             : }
     163             : 
     164             : 
     165           0 : sal_Bool SAL_CALL OPreparedStatement::execute(  ) throw(SQLException, RuntimeException, std::exception)
     166             : {
     167           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     168           0 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     169             : 
     170           0 :     Reference< XResultSet> xResult = executeQuery();
     171           0 :     return xResult.is();
     172             : }
     173             : 
     174             : 
     175           0 : sal_Int32 SAL_CALL OPreparedStatement::executeUpdate(  ) throw(SQLException, RuntimeException, std::exception)
     176             : {
     177           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XStatement::executeUpdate", *this );
     178           0 :     return 0;
     179             : }
     180             : 
     181             : 
     182           0 : void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x ) throw(SQLException, RuntimeException, std::exception)
     183             : {
     184           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     185           0 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     186             : 
     187             :     OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
     188           0 :     setParameter( parameterIndex, x );
     189           0 : }
     190             : 
     191             : 
     192           4 : Reference< XConnection > SAL_CALL OPreparedStatement::getConnection(  ) throw(SQLException, RuntimeException, std::exception)
     193             : {
     194           4 :     ::osl::MutexGuard aGuard( m_aMutex );
     195           4 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     196             : 
     197           4 :     return Reference< XConnection >(m_pConnection);
     198             : }
     199             : 
     200             : 
     201           4 : Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery(  ) throw(SQLException, RuntimeException, std::exception)
     202             : {
     203           4 :     ::osl::MutexGuard aGuard( m_aMutex );
     204             :     OSL_TRACE("In: OPreparedStatement::executeQuery" );
     205           4 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     206             : 
     207             :     // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
     208             :     // stuff again. Just execute.
     209           4 :     return impl_executeCurrentQuery();
     210             : }
     211             : 
     212             : 
     213           0 : void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 /*parameterIndex*/, sal_Bool /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     214             : {
     215           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBoolean", *this );
     216           0 : }
     217             : 
     218           0 : void SAL_CALL OPreparedStatement::setByte( sal_Int32 /*parameterIndex*/, sal_Int8 /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     219             : {
     220           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setByte", *this );
     221           0 : }
     222             : 
     223             : 
     224           0 : void SAL_CALL OPreparedStatement::setDate( sal_Int32 /*parameterIndex*/, const Date& /*aData*/ ) throw(SQLException, RuntimeException, std::exception)
     225             : {
     226           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setDate", *this );
     227           0 : }
     228             : 
     229             : 
     230             : 
     231           0 : void SAL_CALL OPreparedStatement::setTime( sal_Int32 /*parameterIndex*/, const css::util::Time& /*aVal*/ ) throw(SQLException, RuntimeException, std::exception)
     232             : {
     233           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setTime", *this );
     234           0 : }
     235             : 
     236             : 
     237           0 : void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 /*parameterIndex*/, const DateTime& /*aVal*/ ) throw(SQLException, RuntimeException, std::exception)
     238             : {
     239           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setTimestamp", *this );
     240           0 : }
     241             : 
     242             : 
     243           0 : void SAL_CALL OPreparedStatement::setDouble( sal_Int32 /*parameterIndex*/, double /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     244             : {
     245           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setDouble", *this );
     246           0 : }
     247             : 
     248             : 
     249             : 
     250           0 : void SAL_CALL OPreparedStatement::setFloat( sal_Int32 /*parameterIndex*/, float /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     251             : {
     252           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setFloat", *this );
     253           0 : }
     254             : 
     255             : 
     256           0 : void SAL_CALL OPreparedStatement::setInt( sal_Int32 /*parameterIndex*/, sal_Int32 /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     257             : {
     258           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setInt", *this );
     259           0 : }
     260             : 
     261             : 
     262           0 : void SAL_CALL OPreparedStatement::setLong( sal_Int32 /*parameterIndex*/, sal_Int64 /*aVal*/ ) throw(SQLException, RuntimeException, std::exception)
     263             : {
     264           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setLong", *this );
     265           0 : }
     266             : 
     267             : 
     268           0 : void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException, std::exception)
     269             : {
     270           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     271           0 :     checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     272             : 
     273           0 :     checkAndResizeParameters(parameterIndex);
     274             : 
     275           0 :     (m_aParameterRow->get())[parameterIndex].setNull();
     276           0 : }
     277             : 
     278             : 
     279           0 : void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     280             : {
     281           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setClob", *this );
     282           0 : }
     283             : 
     284             : 
     285           0 : void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     286             : {
     287           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBlob", *this );
     288           0 : }
     289             : 
     290             : 
     291           0 : void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     292             : {
     293           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setArray", *this );
     294           0 : }
     295             : 
     296             : 
     297           0 : void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     298             : {
     299           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setRef", *this );
     300           0 : }
     301             : 
     302             : 
     303           0 : void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 /*parameterIndex*/, const Any& /*x*/, sal_Int32 /*sqlType*/, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException, std::exception)
     304             : {
     305           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setObjectWithInfo", *this );
     306           0 : }
     307             : 
     308             : 
     309           0 : void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& /*typeName*/ ) throw(SQLException, RuntimeException, std::exception)
     310             : {
     311           0 :     setNull(parameterIndex,sqlType);
     312           0 : }
     313             : 
     314             : 
     315           0 : void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException, std::exception)
     316             : {
     317           0 :     ::dbtools::implSetObject(this,parameterIndex,x);
     318           0 : }
     319             : 
     320             : 
     321           0 : void SAL_CALL OPreparedStatement::setShort( sal_Int32 /*parameterIndex*/, sal_Int16 /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     322             : {
     323           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setShort", *this );
     324           0 : }
     325             : 
     326             : 
     327           0 : void SAL_CALL OPreparedStatement::setBytes( sal_Int32 /*parameterIndex*/, const Sequence< sal_Int8 >& /*x*/ ) throw(SQLException, RuntimeException, std::exception)
     328             : {
     329           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBytes", *this );
     330           0 : }
     331             : 
     332             : 
     333             : 
     334           0 : void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException, std::exception)
     335             : {
     336           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setCharacterStream", *this );
     337           0 : }
     338             : 
     339             : 
     340           0 : void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException, std::exception)
     341             : {
     342           0 :     ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setBinaryStream", *this );
     343           0 : }
     344             : 
     345             : 
     346           0 : void SAL_CALL OPreparedStatement::clearParameters(  ) throw(SQLException, RuntimeException, std::exception)
     347             : {
     348           0 : }
     349             : 
     350           0 : void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) throw (Exception, std::exception)
     351             : {
     352           0 :     switch(nHandle)
     353             :     {
     354             :         case PROPERTY_ID_RESULTSETCONCURRENCY:
     355           0 :             break;
     356             :         case PROPERTY_ID_RESULTSETTYPE:
     357           0 :             break;
     358             :         case PROPERTY_ID_FETCHDIRECTION:
     359           0 :             break;
     360             :         case PROPERTY_ID_USEBOOKMARKS:
     361           0 :             break;
     362             :         default:
     363           0 :             OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
     364             :     }
     365           0 : }
     366             : 
     367             : 
     368           0 : void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
     369             : {
     370           0 :     ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
     371             : 
     372           0 :     if ( !m_aParameterRow.is() ) {
     373           0 :         m_aParameterRow = new OValueVector();
     374           0 :         m_aParameterRow->get().push_back(sal_Int32(0));
     375             :     }
     376             : 
     377           0 :     if ((sal_Int32)(m_aParameterRow->get()).size() <= parameterIndex)
     378           0 :         (m_aParameterRow->get()).resize(parameterIndex+1);
     379           0 : }
     380             : 
     381           0 : void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const
     382             : ORowSetValue& x)
     383             : {
     384           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     385           0 :     checkAndResizeParameters(parameterIndex);
     386             : 
     387             :     OSL_TRACE("setParameter( %d, '%s')", parameterIndex, OUtoCStr(x) );
     388           0 :     (m_aParameterRow->get())[parameterIndex] = x;
     389           0 : }
     390             : 
     391             : 
     392           0 : size_t OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol)
     393             : {
     394             :     OSL_UNUSED( pParameter );
     395             :     // Count of the newly added Parameters
     396           0 :     size_t nParameter = m_xParamColumns->get().size()+1;
     397             : 
     398             :     OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument is not a Parameter");
     399             :     OSL_ENSURE(pParameter->count() > 0,"OResultSet: error in parse tree");
     400             : #if OSL_DEBUG_LEVEL > 0
     401             :     OSQLParseNode * pMark = pParameter->getChild(0);
     402             :     OSL_UNUSED( pMark );
     403             : #endif
     404             : 
     405           0 :     OUString sParameterName;
     406             : 
     407             :     // set up Parameter-Column:
     408           0 :     sal_Int32 eType = DataType::VARCHAR;
     409           0 :     sal_uInt32 nPrecision = 255;
     410           0 :     sal_Int32 nScale = 0;
     411           0 :     sal_Int32 nNullable = ColumnValue::NULLABLE;
     412             : 
     413           0 :     if (_xCol.is())
     414             :     {
     415             :         // Type, Precision, Scale ... utilize the selected Columns,
     416             :         // then this Column will get the value assigned or with this
     417             :         // Column will the value be compared.
     418           0 :         eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)));
     419           0 :         nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)));
     420           0 :         nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)));
     421           0 :         nNullable = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE)));
     422           0 :         _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sParameterName;
     423             :     }
     424             : 
     425             :     Reference<XPropertySet> xParaColumn = new connectivity::sdbcx::OColumn(sParameterName
     426             :                                                     ,OUString()
     427             :                                                     ,OUString()
     428             :                                                     ,OUString()
     429             :                                                     ,nNullable
     430             :                                                     ,nPrecision
     431             :                                                     ,nScale
     432             :                                                     ,eType
     433             :                                                     ,false
     434             :                                                     ,false
     435             :                                                     ,false
     436           0 :                                                     ,m_pSQLIterator->isCaseSensitive()
     437             :                                                     ,OUString()
     438             :                                                     ,OUString()
     439           0 :                                                     ,OUString());
     440           0 :     m_xParamColumns->get().push_back(xParaColumn);
     441           0 :     return nParameter;
     442             : }
     443             : 
     444           0 : void OPreparedStatement::describeColumn(OSQLParseNode*
     445             : _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable)
     446             : {
     447           0 :     Reference<XPropertySet> xProp;
     448           0 :     if(SQL_ISRULE(_pNode,column_ref))
     449             :     {
     450           0 :         OUString sColumnName,sTableRange;
     451           0 :         m_pSQLIterator->getColumnRange(_pNode,sColumnName,sTableRange);
     452           0 :         if(!sColumnName.isEmpty())
     453             :         {
     454           0 :             Reference<XNameAccess> xNameAccess = _xTable->getColumns();
     455           0 :             if(xNameAccess->hasByName(sColumnName))
     456           0 :                 xNameAccess->getByName(sColumnName) >>= xProp;
     457           0 :             AddParameter(_pParameter,xProp);
     458           0 :         }
     459           0 :     }
     460             :     //  else
     461             :         //  AddParameter(_pParameter,xProp);
     462           0 : }
     463             : 
     464           4 : void OPreparedStatement::describeParameter()
     465             : {
     466           4 :     ::std::vector< OSQLParseNode*> aParseNodes;
     467           4 :     scanParameter(m_pParseTree,aParseNodes);
     468           4 :     if(!aParseNodes.empty())
     469             :     {
     470           0 :         m_xParamColumns = new OSQLColumns();
     471           0 :         const OSQLTables& xTabs = m_pSQLIterator->getTables();
     472           0 :         if(xTabs.size())
     473             :         {
     474           0 :             OSQLTable xTable = xTabs.begin()->second;
     475             :             ::std::vector< OSQLParseNode*>::const_iterator aIter =
     476           0 : aParseNodes.begin();
     477           0 :             for (;aIter != aParseNodes.end();++aIter )
     478             :             {
     479           0 :                 describeColumn(*aIter,(*aIter)->getParent()->getChild(0),xTable);
     480           0 :             }
     481             :         }
     482           4 :     }
     483           4 : }
     484             : 
     485             : 
     486         128 : void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes)
     487             : {
     488             :     OSL_ENSURE(pParseNode != NULL,"OResultSet: internal error: invalid ParseNode");
     489             : 
     490             :     // Parameter Name-Row found?
     491         128 :     if (SQL_ISRULE(pParseNode,parameter))
     492             :     {
     493             :         OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Faulty Parse Tree");
     494             :         OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Faulty Parse Tree");
     495             : 
     496           0 :         _rParaNodes.push_back(pParseNode);
     497             :         // further search isn't necessary
     498         128 :         return;
     499             :     }
     500             : 
     501             :     // Search on in Parse Tree
     502         252 :     for (sal_uInt32 i = 0; i < pParseNode->count(); i++)
     503         124 :         scanParameter(pParseNode->getChild(i),_rParaNodes);
     504             : }
     505             : 
     506           0 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL OPreparedStatement::getResultSet(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     507             : {
     508           0 :     return NULL;
     509             : }
     510             : 
     511           0 : sal_Int32 SAL_CALL OPreparedStatement::getUpdateCount(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     512             : {
     513           0 :     return 0;
     514             : }
     515             : 
     516           0 : sal_Bool SAL_CALL OPreparedStatement::getMoreResults(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception)
     517             : {
     518           0 :     return sal_False;
     519             : }
     520             : 
     521             : 
     522             : 
     523             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10