1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef CONNECTIVITY_STATEMENTCOMPOSER_HXX 25 #define CONNECTIVITY_STATEMENTCOMPOSER_HXX 26 27 /** === begin UNO includes === **/ 28 #include <com/sun/star/sdbc/XConnection.hpp> 29 #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> 30 /** === end UNO includes === **/ 31 32 #include <boost/noncopyable.hpp> 33 34 #include <memory> 35 #include "connectivity/dbtoolsdllapi.hxx" 36 37 //........................................................................ 38 namespace dbtools 39 { 40 //........................................................................ 41 42 //==================================================================== 43 //= StatementComposer 44 //==================================================================== 45 struct StatementComposer_Data; 46 /** a class which is able to compose queries (SELECT statements) from a command and a command type 47 */ 48 class OOO_DLLPUBLIC_DBTOOLS StatementComposer : public ::boost::noncopyable 49 { 50 ::std::auto_ptr< StatementComposer_Data > m_pData; 51 52 public: 53 /** constructs an instance 54 55 @param _rxConnection 56 the connection to work with. Must not be <NULL/>. 57 */ 58 StatementComposer( 59 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, 60 const ::rtl::OUString& _rCommand, 61 const sal_Int32 _nCommandType, 62 const sal_Bool _bEscapeProcessing 63 ); 64 65 ~StatementComposer(); 66 67 /** controls whether or not the instance disposes its XSingleSelectQueryComposer upon 68 destruction 69 70 Unless you explicitly call this method with the parameter being <TRUE/>, 71 the XSingleSelectQueryComposer will be disposed when the StatementComposer 72 instance is destroyed. 73 */ 74 void setDisposeComposer( bool _bDoDispose ); 75 bool getDisposeComposer() const; 76 77 void setFilter( const ::rtl::OUString& _rFilter ); 78 void setOrder( const ::rtl::OUString& _rOrder ); 79 80 /** returns the composer which has been fed with the current settings 81 82 @throws ::com::sun::star::sdbc::SQLException 83 if such an exception occurs while creating the composer 84 */ 85 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > 86 getComposer(); 87 88 /** returns the composer statement 89 90 Effectively, this is equivalent to calling getComposer, and asking the composer 91 for its Query attribute. 92 93 @throws ::com::sun::star::sdbc::SQLException 94 if such an exception occurs while creating the composer 95 */ 96 ::rtl::OUString 97 getQuery(); 98 99 private: 100 StatementComposer(); // not implemented 101 }; 102 103 //........................................................................ 104 } // namespace dbtools 105 //........................................................................ 106 107 #endif // CONNECTIVITY_STATEMENTCOMPOSER_HXX 108