1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef CACHEDROWSET_HXX
29 #define CACHEDROWSET_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/sdbc/XResultSet.hpp>
33 #include <com/sun/star/sdbc/XConnection.hpp>
34 /** === end UNO includes === **/
35 
36 #include <comphelper/componentcontext.hxx>
37 #include <unotools/sharedunocomponent.hxx>
38 
39 #include <memory>
40 
41 //........................................................................
42 namespace frm
43 {
44 //........................................................................
45 
46     struct CachedRowSet_Data;
47 	//====================================================================
48 	//= CachedRowSet
49 	//====================================================================
50     /** caches a result set obtained from a SQL statement
51     */
52 	class CachedRowSet
53 	{
54     public:
55         CachedRowSet( const ::comphelper::ComponentContext& _rContext );
56         ~CachedRowSet();
57 
58     public:
59         /** executes the statement
60 
61             @return
62                 the result set produced by the statement. The caller takes ownership of the
63                 given object.
64 
65             @throws ::com::sun::star::sdbc::SQLException
66                 if such an exception is thrown when executing the statement
67         */
68         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
69                 execute();
70 
71         /// determines whether the row set properties are dirty, i.e. have changed since the last call to execute
72         bool    isDirty() const;
73 
74         /// disposes the instance and frees all associated resources
75         void    dispose();
76 
77         /** sets the command of a query as command to be executed
78 
79             A connection must have been set before.
80 
81             @throws Exception
82         */
83         void    setCommandFromQuery ( const ::rtl::OUString& _rQueryName );
84 
85         void    setCommand          ( const ::rtl::OUString& _rCommand );
86         void    setEscapeProcessing ( const sal_Bool _bEscapeProcessing );
87         void    setConnection       ( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection );
88 
89     private:
90         ::std::auto_ptr< CachedRowSet_Data >    m_pData;
91 	};
92 
93 //........................................................................
94 } // namespace frm
95 //........................................................................
96 
97 #endif // CACHEDROWSET_HXX
98