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

Generated by: LCOV version 1.11