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