Bump for 3.6-28
[LibreOffice.git] / connectivity / source / inc / ado / AStatement.hxx
blob03eb3fbcb9e60d8fbd177ac54ae18ee2cfa919d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_
30 #define _CONNECTIVITY_ADO_ASTATEMENT_HXX_
32 #include <com/sun/star/sdbc/XStatement.hpp>
33 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
34 #include <com/sun/star/sdbc/XMultipleResults.hpp>
35 #include <com/sun/star/sdbc/XBatchExecution.hpp>
36 #include <com/sun/star/sdbc/XCloseable.hpp>
37 #include <com/sun/star/sdbc/SQLWarning.hpp>
38 #include <com/sun/star/util/XCancellable.hpp>
39 #include <cppuhelper/compbase5.hxx>
40 #include <comphelper/proparrhlp.hxx>
41 #include <comphelper/uno3.hxx>
42 #include <comphelper/broadcasthelper.hxx>
43 #include "ado/AConnection.hxx"
44 #ifndef _LIST_
45 #include <list>
46 #endif
47 #include "ado/Awrapado.hxx"
48 #include <com/sun/star/lang/XServiceInfo.hpp>
50 namespace connectivity
52 namespace ado
54 typedef ::cppu::WeakComponentImplHelper5< ::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::XMultipleResults> OStatement_BASE;
60 //**************************************************************
61 //************ Class: java.sql.Statement
62 //**************************************************************
63 class OStatement_Base : public comphelper::OBaseMutex,
64 public OStatement_BASE,
65 public ::cppu::OPropertySetHelper,
66 public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>,
67 public connectivity::OSubComponent<OStatement_Base, OStatement_BASE>
70 friend class connectivity::OSubComponent<OStatement_Base, OStatement_BASE>;
71 friend class OResultSet;
73 ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
75 protected:
76 ::std::list< ::rtl::OUString> m_aBatchList;
78 ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
79 // for this Statement
81 OConnection* m_pConnection;// The owning Connection object
82 WpADOCommand m_Command;
83 WpADORecordset m_RecordSet;
84 OLEVariant m_RecordsAffected;
85 OLEVariant m_Parameters;
86 ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry
87 // for each row returned by
88 // DatabaseMetaData.getTypeInfo.
89 ADO_LONGPTR m_nMaxRows;
90 sal_Int32 m_nFetchSize;
91 LockTypeEnum m_eLockType;
92 CursorTypeEnum m_eCursorType;
94 using OStatement_BASE::rBHelper;
95 private:
97 sal_Int32 getQueryTimeOut() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
98 sal_Int32 getMaxFieldSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
99 sal_Int32 getMaxRows() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
100 sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
101 sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
102 sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
103 sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
104 ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
106 void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
107 void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
108 void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
109 void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
110 void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
111 void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
112 void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
113 void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
115 protected:
117 void assignRecordSet( ADORecordset* _pRS );
119 void reset () throw( ::com::sun::star::sdbc::SQLException);
120 void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
121 void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException);
122 sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException);
123 sal_Int32 getRowCount () throw( ::com::sun::star::sdbc::SQLException);
124 sal_Int32 getPrecision ( sal_Int32 sqlType);
126 void disposeResultSet();
128 // OPropertyArrayUsageHelper
129 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
130 // OPropertySetHelper
131 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
132 virtual sal_Bool SAL_CALL convertFastPropertyValue(
133 ::com::sun::star::uno::Any & rConvertedValue,
134 ::com::sun::star::uno::Any & rOldValue,
135 sal_Int32 nHandle,
136 const ::com::sun::star::uno::Any& rValue )
137 throw (::com::sun::star::lang::IllegalArgumentException);
138 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
139 sal_Int32 nHandle,
140 const ::com::sun::star::uno::Any& rValue
142 throw (::com::sun::star::uno::Exception);
143 virtual void SAL_CALL getFastPropertyValue(
144 ::com::sun::star::uno::Any& rValue,
145 sal_Int32 nHandle
146 ) const;
147 public:
148 OStatement_Base(OConnection* _pConnection );
150 using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
151 // OComponentHelper
152 virtual void SAL_CALL disposing(void);
153 // XInterface
154 virtual void SAL_CALL acquire() throw();
155 virtual void SAL_CALL release() throw();
156 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
157 //XTypeProvider
158 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
160 // XPropertySet
161 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
162 // XStatement
163 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) ;
164 virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
165 virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ;
166 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) ;
167 // XWarningsSupplier
168 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
169 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
170 // XCancellable
171 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException);
172 // XCloseable
173 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
174 // XMultipleResults
175 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);
176 virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
177 virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
180 class OStatement : public OStatement_Base,
181 public ::com::sun::star::sdbc::XBatchExecution,
182 public ::com::sun::star::lang::XServiceInfo
184 public:
185 // a Constructor, that is needed for when Returning the Object is needed:
186 OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){};
187 ~OStatement();
189 DECLARE_SERVICE_INFO();
191 virtual void SAL_CALL acquire() throw();
192 virtual void SAL_CALL release() throw();
193 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
194 // XBatchExecution
195 virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
196 virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
197 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
201 #endif // _CONNECTIVITY_ADO_ASTATEMENT_HXX_
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */