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 #ifndef _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_
24 #define _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_
25 
26 #include <rtl/ustring.hxx>
27 #include "connectivity/dbtoolsdllapi.hxx"
28 
29 namespace connectivity
30 {
31 	class OOO_DLLPUBLIC_DBTOOLS OAutoRetrievingBase
32 	{
33 		::rtl::OUString m_sGeneratedValueStatement; // contains the statement which should be used when query for automatically generated values
34 		sal_Bool		m_bAutoRetrievingEnabled; // set to when we should allow to query for generated values
35 	protected:
OAutoRetrievingBase()36 		OAutoRetrievingBase() : m_bAutoRetrievingEnabled(sal_False) {}
~OAutoRetrievingBase()37 		virtual ~OAutoRetrievingBase(){}
38 
enableAutoRetrievingEnabled(sal_Bool _bAutoEnable)39 		inline void	enableAutoRetrievingEnabled(sal_Bool _bAutoEnable)			{ m_bAutoRetrievingEnabled = _bAutoEnable; }
setAutoRetrievingStatement(const::rtl::OUString & _sStmt)40 		inline void	setAutoRetrievingStatement(const ::rtl::OUString& _sStmt)	{ m_sGeneratedValueStatement = _sStmt; }
41 	public:
isAutoRetrievingEnabled() const42 		inline sal_Bool					isAutoRetrievingEnabled()		const {	return m_bAutoRetrievingEnabled; }
getAutoRetrievingStatement() const43 		inline const ::rtl::OUString&	getAutoRetrievingStatement()	const {	return m_sGeneratedValueStatement; }
44 
45 		/** transform the statement to query for auto generated values
46 			@param	_sInsertStatement
47 				The "INSERT" statement, is used to query for column and table names
48 			@return
49 				The transformed generated statement.
50 		*/
51 		::rtl::OUString getTransformedGeneratedStatement(const ::rtl::OUString& _sInsertStatement) const;
52 	};
53 }
54 #endif // _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_
55 
56