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

Generated by: LCOV version 1.10