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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_connectivity.hxx"
26 
27 #include <connectivity/virtualdbtools.hxx>
28 #include <connectivity/formattedcolumnvalue.hxx>
29 #include "dbtfactory.hxx"
30 #include "parser_s.hxx"
31 #include "staticdbtools_s.hxx"
32 #include "charset_s.hxx"
33 
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::lang;
36 
37 //================================================================
38 // the entry point for load-on-call usage of the DBTOOLS lib
createDataAccessToolsFactory()39 extern "C" void* SAL_CALL createDataAccessToolsFactory()
40 {
41 	::connectivity::ODataAccessToolsFactory* pFactory = new ::connectivity::ODataAccessToolsFactory;
42 	pFactory->acquire();
43 	return pFactory;
44 }
45 
46 //........................................................................
47 namespace connectivity
48 {
49 //........................................................................
50 
51 	//================================================================
52 	//= ODataAccessToolsFactory
53 	//================================================================
54 	//----------------------------------------------------------------
ODataAccessToolsFactory()55 	ODataAccessToolsFactory::ODataAccessToolsFactory()
56 	{
57 		ODataAccessStaticTools* pStaticTools = new ODataAccessStaticTools;
58 		m_xTypeConversionHelper = pStaticTools;
59 		m_xToolsHelper = pStaticTools;
60 	}
61 
62 	//----------------------------------------------------------------
acquire()63 	oslInterlockedCount SAL_CALL ODataAccessToolsFactory::acquire()
64 	{
65 		return ORefBase::acquire();
66 	}
67 
68 	//----------------------------------------------------------------
release()69 	oslInterlockedCount SAL_CALL ODataAccessToolsFactory::release()
70 	{
71 		return ORefBase::release();
72 	}
73 
74 	//----------------------------------------------------------------
getTypeConversionHelper()75 	::rtl::Reference< simple::IDataAccessTypeConversion > ODataAccessToolsFactory::getTypeConversionHelper()
76 	{
77 		return m_xTypeConversionHelper;
78 	}
79 
80 	//----------------------------------------------------------------
createCharsetHelper() const81 	::rtl::Reference< simple::IDataAccessCharSet > ODataAccessToolsFactory::createCharsetHelper( ) const
82 	{
83 		return new ODataAccessCharSet;
84 	}
85 
86 	//----------------------------------------------------------------
getDataAccessTools()87 	::rtl::Reference< simple::IDataAccessTools > ODataAccessToolsFactory::getDataAccessTools()
88 	{
89 		return m_xToolsHelper;
90 	}
91 
92 	//----------------------------------------------------------------
createFormattedColumnValue(const::comphelper::ComponentContext & _rContext,const Reference<::com::sun::star::sdbc::XRowSet> & _rxRowSet,const Reference<::com::sun::star::beans::XPropertySet> & _rxColumn)93     ::std::auto_ptr< ::dbtools::FormattedColumnValue > ODataAccessToolsFactory::createFormattedColumnValue( const ::comphelper::ComponentContext& _rContext,
94         const Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet, const Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
95     {
96         ::std::auto_ptr< ::dbtools::FormattedColumnValue > pValue( new ::dbtools::FormattedColumnValue( _rContext, _rxRowSet, _rxColumn ) );
97         return pValue;
98     }
99 
100 	//----------------------------------------------------------------
createSQLParser(const Reference<XMultiServiceFactory> & _rxServiceFactory,const IParseContext * _pContext) const101 	::rtl::Reference< simple::ISQLParser > ODataAccessToolsFactory::createSQLParser(const Reference< XMultiServiceFactory >& _rxServiceFactory,const IParseContext* _pContext) const
102 	{
103 		return new OSimpleSQLParser(_rxServiceFactory,_pContext);
104 	}
105 
106 //........................................................................
107 }	// namespace connectivity
108 //........................................................................
109 
110 
111