Update ooo320-m1
[ooovba.git] / connectivity / source / inc / java / sql / Connection.hxx
blob55244525da7afe51ec79c38d8b8e4fab8ae30b7a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Connection.hxx,v $
10 * $Revision: 1.19 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_
31 #define _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_
33 #include "java/lang/Object.hxx"
34 #include "TConnection.hxx"
35 #include "connectivity/CommonTools.hxx"
36 #include "OSubComponent.hxx"
37 #include <cppuhelper/weakref.hxx>
38 #include "AutoRetrievingBase.hxx"
39 #include "java/sql/ConnectionLog.hxx"
40 #include "java/LocalRef.hxx"
41 #include "java/GlobalRef.hxx"
43 #include <com/sun/star/beans/NamedValue.hpp>
45 namespace connectivity
47 class java_sql_Driver;
49 typedef OMetaConnection java_sql_Connection_BASE;
51 class java_sql_Connection : public java_sql_Connection_BASE,
52 public java_lang_Object,
53 public OSubComponent<java_sql_Connection, java_sql_Connection_BASE>,
54 public OAutoRetrievingBase
56 friend class OSubComponent<java_sql_Connection, java_sql_Connection_BASE>;
57 const java_sql_Driver* m_pDriver;
58 jobject m_pDriverobject;
59 jdbc::GlobalRef< jobject >
60 m_pDriverClassLoader;
62 jclass m_Driver_theClass;
63 java::sql::ConnectionLog
64 m_aLogger;
65 sal_Bool m_bParameterSubstitution;
66 sal_Bool m_bIgnoreDriverPrivileges;
67 sal_Bool m_bIgnoreCurrency;
68 ::com::sun::star::uno::Any m_aCatalogRestriction;
69 ::com::sun::star::uno::Any m_aSchemaRestriction;
71 /** transform named parameter into unnamed one.
72 @param _sSQL
73 The SQL statement to transform.
74 @return
75 The new statement witgh unnamed parameters.
77 ::rtl::OUString transFormPreparedStatement(const ::rtl::OUString& _sSQL);
78 void loadDriverFromProperties(
79 const ::rtl::OUString& _sDriverClass,
80 const ::rtl::OUString& _sDriverClassPath,
81 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSystemProperties
84 protected:
85 // statische Daten fuer die Klasse
86 static jclass theClass;
88 virtual ~java_sql_Connection();
90 public:
91 virtual jclass getMyClass() const;
93 DECLARE_SERVICE_INFO();
94 // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
95 java_sql_Connection( const java_sql_Driver& _rDriver );
96 sal_Bool construct( const ::rtl::OUString& url,
97 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info);
99 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&
100 getConnectionInfo() const { return m_aConnectionInfo; }
102 inline sal_Bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges;}
103 inline sal_Bool isIgnoreCurrencyEnabled() const { return m_bIgnoreCurrency; }
104 inline const ::com::sun::star::uno::Any& getCatalogRestriction() const { return m_aCatalogRestriction; }
105 inline const ::com::sun::star::uno::Any& getSchemaRestriction() const { return m_aSchemaRestriction; }
107 /** returns the instance used for logging events related to this connection
109 const java::sql::ConnectionLog& getLogger() const { return m_aLogger; }
111 /** returns the class loader which was used to load the driver class
113 Usually used in conjunction with a ContextClassLoaderScope instance.
115 const jdbc::GlobalRef< jobject >& getDriverClassLoader() const { return m_pDriverClassLoader; }
117 // OComponentHelper
118 virtual void SAL_CALL disposing(void);
119 // XInterface
120 virtual void SAL_CALL release() throw();
122 // XConnection
123 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
125 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
126 virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
127 virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
128 virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
129 virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
130 virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
131 virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
132 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
133 virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
134 virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
136 virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
137 virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
138 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
139 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
140 virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
141 // XCloseable
142 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
143 // XWarningsSupplier
144 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
145 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
148 #endif // _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_