1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
23 #include <com/sun/star/sdbc/XStatement.hpp>
24 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
25 #include <com/sun/star/sdbc/XMultipleResults.hpp>
26 #include <com/sun/star/sdbc/XBatchExecution.hpp>
27 #include <com/sun/star/sdbc/XCloseable.hpp>
28 #include <com/sun/star/sdbc/SQLWarning.hpp>
29 #include <com/sun/star/util/XCancellable.hpp>
30 #include <cppuhelper/compbase5.hxx>
31 #include <comphelper/proparrhlp.hxx>
32 #include <comphelper/uno3.hxx>
33 #include <comphelper/broadcasthelper.hxx>
34 #include "ado/AConnection.hxx"
36 #include "ado/Awrapado.hxx"
37 #include <com/sun/star/lang/XServiceInfo.hpp>
39 namespace connectivity
43 typedef ::cppu::WeakComponentImplHelper5
< ::com::sun::star::sdbc::XStatement
,
44 ::com::sun::star::sdbc::XWarningsSupplier
,
45 ::com::sun::star::util::XCancellable
,
46 ::com::sun::star::sdbc::XCloseable
,
47 ::com::sun::star::sdbc::XMultipleResults
> OStatement_BASE
;
50 //************ Class: java.sql.Statement
52 class OStatement_Base
: public comphelper::OBaseMutex
,
53 public OStatement_BASE
,
54 public ::cppu::OPropertySetHelper
,
55 public ::comphelper::OPropertyArrayUsageHelper
<OStatement_Base
>,
56 public connectivity::OSubComponent
<OStatement_Base
, OStatement_BASE
>
59 friend class connectivity::OSubComponent
<OStatement_Base
, OStatement_BASE
>;
60 friend class OResultSet
;
62 ::com::sun::star::sdbc::SQLWarning m_aLastWarning
;
65 ::std::list
< OUString
> m_aBatchList
;
67 ::com::sun::star::uno::WeakReference
< ::com::sun::star::sdbc::XResultSet
> m_xResultSet
; // The last ResultSet created
70 OConnection
* m_pConnection
;// The owning Connection object
71 WpADOCommand m_Command
;
72 WpADORecordset m_RecordSet
;
73 OLEVariant m_RecordsAffected
;
74 OLEVariant m_Parameters
;
75 ::std::vector
<connectivity::OTypeInfo
> m_aTypeInfo
; // Hashtable containing an entry
76 // for each row returned by
77 // DatabaseMetaData.getTypeInfo.
78 ADO_LONGPTR m_nMaxRows
;
79 sal_Int32 m_nFetchSize
;
80 LockTypeEnum m_eLockType
;
81 CursorTypeEnum m_eCursorType
;
83 using OStatement_BASE::rBHelper
;
86 sal_Int32
getQueryTimeOut() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
87 sal_Int32
getMaxFieldSize() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
88 sal_Int32
getMaxRows() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
89 sal_Int32
getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
90 sal_Int32
getResultSetType() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
91 sal_Int32
getFetchDirection() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
92 sal_Int32
getFetchSize() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
93 OUString
getCursorName() const throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
95 void setQueryTimeOut(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
96 void setMaxFieldSize(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
97 void setMaxRows(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
98 void setResultSetConcurrency(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
99 void setResultSetType(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
100 void setFetchDirection(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
101 void setFetchSize(sal_Int32 _par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
102 void setCursorName(const OUString
&_par0
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
106 void assignRecordSet( ADORecordset
* _pRS
);
108 void reset () throw( ::com::sun::star::sdbc::SQLException
);
109 void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException
);
110 void setWarning (const ::com::sun::star::sdbc::SQLWarning
&ex
) throw( ::com::sun::star::sdbc::SQLException
);
111 sal_Int32
getColumnCount () throw( ::com::sun::star::sdbc::SQLException
);
112 sal_Int32
getRowCount () throw( ::com::sun::star::sdbc::SQLException
);
113 sal_Int32
getPrecision ( sal_Int32 sqlType
);
115 void disposeResultSet();
117 // OPropertyArrayUsageHelper
118 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
119 // OPropertySetHelper
120 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
121 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
122 ::com::sun::star::uno::Any
& rConvertedValue
,
123 ::com::sun::star::uno::Any
& rOldValue
,
125 const ::com::sun::star::uno::Any
& rValue
)
126 throw (::com::sun::star::lang::IllegalArgumentException
);
127 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
129 const ::com::sun::star::uno::Any
& rValue
131 throw (::com::sun::star::uno::Exception
);
132 virtual void SAL_CALL
getFastPropertyValue(
133 ::com::sun::star::uno::Any
& rValue
,
137 OStatement_Base(OConnection
* _pConnection
);
139 using OStatement_BASE::operator ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>;
141 virtual void SAL_CALL
disposing();
143 virtual void SAL_CALL
acquire() throw();
144 virtual void SAL_CALL
release() throw();
145 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
147 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
150 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
152 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XResultSet
> SAL_CALL
executeQuery( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
) ;
153 virtual sal_Int32 SAL_CALL
executeUpdate( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
) ;
154 virtual sal_Bool SAL_CALL
execute( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
) ;
155 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
) ;
157 virtual ::com::sun::star::uno::Any SAL_CALL
getWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
158 virtual void SAL_CALL
clearWarnings( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
160 virtual void SAL_CALL
cancel( ) throw(::com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
close( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
164 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
);
165 virtual sal_Int32 SAL_CALL
getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
166 virtual sal_Bool SAL_CALL
getMoreResults( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
169 class OStatement
: public OStatement_Base
,
170 public ::com::sun::star::sdbc::XBatchExecution
,
171 public ::com::sun::star::lang::XServiceInfo
174 // a Constructor, that is needed for when Returning the Object is needed:
175 OStatement( OConnection
* _pConnection
) : OStatement_Base( _pConnection
){};
178 DECLARE_SERVICE_INFO();
180 virtual void SAL_CALL
acquire() throw();
181 virtual void SAL_CALL
release() throw();
182 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
184 virtual void SAL_CALL
addBatch( const OUString
& sql
) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
185 virtual void SAL_CALL
clearBatch( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
186 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
executeBatch( ) throw(::com::sun::star::sdbc::SQLException
, ::com::sun::star::uno::RuntimeException
);
190 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ASTATEMENT_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */