update dev300-m58
[ooovba.git] / connectivity / source / inc / java / sql / JStatement.hxx
blob1f675ffe1a7f94db4933feb24b4cc7e0d72b8219
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: JStatement.hxx,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
30 #ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_
31 #define _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_
33 #include "java/lang/Object.hxx"
34 #include <com/sun/star/sdbc/XStatement.hpp>
35 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
36 #include <com/sun/star/sdbc/XMultipleResults.hpp>
37 #include <com/sun/star/sdbc/XBatchExecution.hpp>
38 #include <com/sun/star/sdbc/XCloseable.hpp>
39 #include <com/sun/star/util/XCancellable.hpp>
40 #include <com/sun/star/sdbc/XGeneratedResultSet.hpp>
41 #include <comphelper/proparrhlp.hxx>
42 #include <cppuhelper/compbase6.hxx>
43 #include <comphelper/uno3.hxx>
44 #include "connectivity/CommonTools.hxx"
45 #include "OSubComponent.hxx"
46 #include <com/sun/star/lang/XServiceInfo.hpp>
47 #include <comphelper/broadcasthelper.hxx>
49 #include "java/sql/ConnectionLog.hxx"
51 namespace connectivity
54 typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::sdbc::XStatement,
55 ::com::sun::star::sdbc::XWarningsSupplier,
56 ::com::sun::star::util::XCancellable,
57 ::com::sun::star::sdbc::XCloseable,
58 ::com::sun::star::sdbc::XGeneratedResultSet,
59 ::com::sun::star::sdbc::XMultipleResults> java_sql_Statement_BASE;
61 class java_sql_Connection;
63 //**************************************************************
64 //************ Class: java.sql.Statement
65 //**************************************************************
66 class java_sql_Statement_Base : public comphelper::OBaseMutex,
67 public java_sql_Statement_BASE,
68 public java_lang_Object,
69 public ::cppu::OPropertySetHelper,
70 public ::comphelper::OPropertyArrayUsageHelper<java_sql_Statement_Base>
74 sal_Int32 getQueryTimeOut() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
75 sal_Int32 getMaxFieldSize() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
76 sal_Int32 getMaxRows() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
77 sal_Int32 getResultSetConcurrency() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
78 sal_Int32 getResultSetType() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
79 sal_Int32 getFetchDirection() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
80 sal_Int32 getFetchSize() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81 ::rtl::OUString getCursorName() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83 void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
85 void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
86 void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
87 void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
88 void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
89 void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
90 void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
91 void setEscapeProcessing(sal_Bool _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
93 protected:
94 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement> m_xGeneratedStatement;
95 java_sql_Connection* m_pConnection;
96 java::sql::ConnectionLog m_aLogger;
97 ::rtl::OUString m_sSqlStatement;
98 // Properties
99 sal_Int32 m_nResultSetConcurrency;
100 sal_Int32 m_nResultSetType;
101 sal_Bool m_bEscapeProcessing;
102 ::cppu::OBroadcastHelper& rBHelper;
105 // statische Daten fuer die Klasse
106 static jclass theClass;
108 // OPropertyArrayUsageHelper
109 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
110 // OPropertySetHelper
111 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
113 virtual sal_Bool SAL_CALL convertFastPropertyValue(
114 ::com::sun::star::uno::Any & rConvertedValue,
115 ::com::sun::star::uno::Any & rOldValue,
116 sal_Int32 nHandle,
117 const ::com::sun::star::uno::Any& rValue
118 ) throw (::com::sun::star::lang::IllegalArgumentException);
120 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
121 sal_Int32 nHandle,
122 const ::com::sun::star::uno::Any& rValue
123 ) throw (::com::sun::star::uno::Exception);
125 virtual void SAL_CALL getFastPropertyValue(
126 ::com::sun::star::uno::Any& rValue,
127 sal_Int32 nHandle
128 ) const;
130 virtual void createStatement(JNIEnv* _pEnv) = 0;
132 virtual ~java_sql_Statement_Base();
134 sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID);
135 sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault);
137 public:
138 virtual jclass getMyClass() const;
140 // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
141 java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon );
143 sal_Int32 getStatementObjectID() const { return m_aLogger.getObjectID(); }
145 // OComponentHelper
146 virtual void SAL_CALL disposing(void);
147 // XInterface
148 virtual void SAL_CALL acquire() throw();
149 virtual void SAL_CALL release() throw();
150 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
151 //XTypeProvider
152 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
154 // XPropertySet
155 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
156 // XStatement
157 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
158 virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
159 virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
161 // XWarningsSupplier
162 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
163 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
164 // XCancellable
165 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
166 // XCloseable
167 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
168 // XMultipleResults
169 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
170 virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
171 virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
172 //XGeneratedResultSet
173 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
175 public:
176 using ::cppu::OPropertySetHelper::getFastPropertyValue;
179 class OStatement_BASE2 :public java_sql_Statement_Base
180 ,public OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>
183 friend class OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>;
184 public:
185 OStatement_BASE2(JNIEnv * pEnv, java_sql_Connection& _rCon ) : java_sql_Statement_Base( pEnv, _rCon ),
186 OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>((::cppu::OWeakObject*)(&_rCon), this){}
188 // OComponentHelper
189 virtual void SAL_CALL disposing(void);
190 // XInterface
191 virtual void SAL_CALL release() throw();
194 class java_sql_Statement : public OStatement_BASE2,
195 public ::com::sun::star::sdbc::XBatchExecution,
196 public ::com::sun::star::lang::XServiceInfo
198 protected:
199 // statische Daten fuer die Klasse
200 static jclass theClass;
202 virtual void createStatement(JNIEnv* _pEnv);
204 virtual ~java_sql_Statement();
205 public:
206 DECLARE_SERVICE_INFO();
207 virtual jclass getMyClass() const;
209 // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
210 java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){};
212 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
213 virtual void SAL_CALL acquire() throw();
214 virtual void SAL_CALL release() throw();
215 // XBatchExecution
216 virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
217 virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
218 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
221 #endif // _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_