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