1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _CONNECTIVITY_KAB_STATEMENT_HXX_ 29*cdf0e10cSrcweir #define _CONNECTIVITY_KAB_STATEMENT_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "KConnection.hxx" 32*cdf0e10cSrcweir #include <list> 33*cdf0e10cSrcweir #include "connectivity/sqliterator.hxx" 34*cdf0e10cSrcweir #ifndef _CONNECTIVITY_PARSE_SQLPARSE_HXX_ 35*cdf0e10cSrcweir #include "connectivity/sqlparse.hxx" 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #include <com/sun/star/sdbc/XStatement.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/util/XCancellable.hpp> 39*cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx> 40*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 41*cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir namespace connectivity 44*cdf0e10cSrcweir { 45*cdf0e10cSrcweir namespace kab 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XStatement, 48*cdf0e10cSrcweir ::com::sun::star::sdbc::XWarningsSupplier, 49*cdf0e10cSrcweir ::com::sun::star::util::XCancellable, 50*cdf0e10cSrcweir ::com::sun::star::sdbc::XCloseable> KabCommonStatement_BASE; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir //************************************************************** 53*cdf0e10cSrcweir // Class KabCommonStatement 54*cdf0e10cSrcweir // is a base class for the normal statement and for the prepared statement 55*cdf0e10cSrcweir //************************************************************** 56*cdf0e10cSrcweir class KabCommonStatement : public comphelper::OBaseMutex, 57*cdf0e10cSrcweir public KabCommonStatement_BASE, 58*cdf0e10cSrcweir public ::cppu::OPropertySetHelper, 59*cdf0e10cSrcweir public comphelper::OPropertyArrayUsageHelper<KabCommonStatement> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir ::com::sun::star::sdbc::SQLWarning m_aLastWarning; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir protected: 65*cdf0e10cSrcweir ::std::list< ::rtl::OUString> m_aBatchList; 66*cdf0e10cSrcweir connectivity::OSQLParser m_aParser; 67*cdf0e10cSrcweir connectivity::OSQLParseTreeIterator m_aSQLIterator; 68*cdf0e10cSrcweir connectivity::OSQLParseNode* m_pParseTree; 69*cdf0e10cSrcweir KabConnection* m_pConnection; // The owning Connection object 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir protected: 72*cdf0e10cSrcweir class KabCondition *analyseWhereClause( 73*cdf0e10cSrcweir const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException); 74*cdf0e10cSrcweir class KabOrder *analyseOrderByClause( 75*cdf0e10cSrcweir const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException); 76*cdf0e10cSrcweir sal_Bool isTableKnown(class KabResultSet *pResult) const; 77*cdf0e10cSrcweir void setKabFields(class KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException); 78*cdf0e10cSrcweir void selectAddressees(KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException); 79*cdf0e10cSrcweir void sortAddressees(KabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // OPropertyArrayUsageHelper 82*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir // OPropertySetHelper 85*cdf0e10cSrcweir virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 86*cdf0e10cSrcweir virtual sal_Bool SAL_CALL convertFastPropertyValue( 87*cdf0e10cSrcweir ::com::sun::star::uno::Any & rConvertedValue, 88*cdf0e10cSrcweir ::com::sun::star::uno::Any & rOldValue, 89*cdf0e10cSrcweir sal_Int32 nHandle, 90*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::lang::IllegalArgumentException); 91*cdf0e10cSrcweir virtual void SAL_CALL setFastPropertyValue_NoBroadcast( 92*cdf0e10cSrcweir sal_Int32 nHandle, 93*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); 94*cdf0e10cSrcweir virtual void SAL_CALL getFastPropertyValue( 95*cdf0e10cSrcweir ::com::sun::star::uno::Any& rValue, 96*cdf0e10cSrcweir sal_Int32 nHandle) const; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException); 99*cdf0e10cSrcweir virtual void getNextParameter(::rtl::OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException); 100*cdf0e10cSrcweir virtual ~KabCommonStatement(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir public: 103*cdf0e10cSrcweir ::cppu::OBroadcastHelper& rBHelper; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir KabCommonStatement(KabConnection *_pConnection); 106*cdf0e10cSrcweir using KabCommonStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // OComponentHelper 109*cdf0e10cSrcweir virtual void SAL_CALL disposing(); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir // XInterface 112*cdf0e10cSrcweir virtual void SAL_CALL release() throw(); 113*cdf0e10cSrcweir virtual void SAL_CALL acquire() throw(); 114*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 115*cdf0e10cSrcweir const ::com::sun::star::uno::Type & rType 116*cdf0e10cSrcweir ) throw(::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir // XTypeProvider 119*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( 120*cdf0e10cSrcweir ) throw(::com::sun::star::uno::RuntimeException); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir // XPropertySet 123*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( 124*cdf0e10cSrcweir ) throw(::com::sun::star::uno::RuntimeException); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // XStatement 127*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( 128*cdf0e10cSrcweir const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 129*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL executeUpdate( 130*cdf0e10cSrcweir const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 131*cdf0e10cSrcweir virtual sal_Bool SAL_CALL execute( 132*cdf0e10cSrcweir const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 133*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( 134*cdf0e10cSrcweir ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // XWarningsSupplier 137*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( 138*cdf0e10cSrcweir ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 139*cdf0e10cSrcweir virtual void SAL_CALL clearWarnings( 140*cdf0e10cSrcweir ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir // XCancellable 143*cdf0e10cSrcweir virtual void SAL_CALL cancel( 144*cdf0e10cSrcweir ) throw(::com::sun::star::uno::RuntimeException); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // XCloseable 147*cdf0e10cSrcweir virtual void SAL_CALL close( 148*cdf0e10cSrcweir ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // other methods 151*cdf0e10cSrcweir inline KabConnection* getOwnConnection() const { return m_pConnection; } 152*cdf0e10cSrcweir }; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir //************************************************************** 155*cdf0e10cSrcweir // Class KabStatement 156*cdf0e10cSrcweir //************************************************************** 157*cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1< 158*cdf0e10cSrcweir KabCommonStatement, ::com::sun::star::lang::XServiceInfo > KabStatement_BASE; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir class KabStatement : public KabStatement_BASE 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir protected: 163*cdf0e10cSrcweir virtual ~KabStatement() { } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir public: 166*cdf0e10cSrcweir KabStatement(KabConnection* _pConnection); 167*cdf0e10cSrcweir DECLARE_SERVICE_INFO(); 168*cdf0e10cSrcweir }; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir #endif // _CONNECTIVITY_KAB_STATEMENT_HXX_ 173