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 DBACCESS_OBJECTNAMEAPPROVAL_HXX
25 #define DBACCESS_OBJECTNAMEAPPROVAL_HXX
26 
27 #ifndef DBACCESS_CONTAINERAPPROVE_HXX
28 #include "containerapprove.hxx"
29 #endif
30 
31 /** === begin UNO includes === **/
32 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
33 #include <com/sun/star/sdbc/XConnection.hpp>
34 #endif
35 /** === end UNO includes === **/
36 
37 //........................................................................
38 namespace dbaccess
39 {
40 //........................................................................
41 
42 	//====================================================================
43 	//= ObjectNameApproval
44 	//====================================================================
45     struct ObjectNameApproval_Impl;
46     /** implementation of the IContainerApprove interface which approves
47         elements for insertion into a query or tables container.
48 
49         The only check done by this instance is whether the query name is
50         not already used, taking into account that in some databases, queries
51         and tables share the same namespace.
52 
53         The class is not thread-safe.
54     */
55     class ObjectNameApproval : public IContainerApprove
56 	{
57         ::std::auto_ptr< ObjectNameApproval_Impl >   m_pImpl;
58 
59     public:
60         enum ObjectType
61         {
62             TypeQuery,
63             TypeTable
64         };
65 
66     public:
67         /** constructs the instance
68 
69             @param _rxConnection
70                 the connection relative to which the names should be checked. This connection
71                 will be held weak. In case it is closed, subsequent calls to this instance's
72                 methods throw a DisposedException.
73             @param _eType
74                 specifies which type of objects is to be approved with this instance
75         */
76         ObjectNameApproval(
77             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
78             ObjectType _eType
79         );
80         virtual ~ObjectNameApproval();
81 
82         // IContainerApprove
83         virtual void SAL_CALL approveElement( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
84 
85     };
86 
87 //........................................................................
88 } // namespace dbaccess
89 //........................................................................
90 
91 #endif // DBACCESS_OBJECTNAMEAPPROVAL_HXX
92