1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SharedConnection.cxx,v $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBA_CORE_SHARED_CONNECTION_HXX
34 #include "SharedConnection.hxx"
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::lang
;
45 using namespace ::com::sun::star::sdbc
;
46 using namespace ::com::sun::star::container
;
47 // using namespace ::com::sun::star::reflection;
48 using namespace connectivity
;
50 DBG_NAME(OSharedConnection
)
51 OSharedConnection::OSharedConnection(Reference
< XAggregation
>& _rxProxyConnection
)
52 : OSharedConnection_BASE(m_aMutex
)
54 DBG_CTOR(OSharedConnection
,NULL
);
55 setDelegation(_rxProxyConnection
,m_refCount
);
57 // -----------------------------------------------------------------------------
58 OSharedConnection::~OSharedConnection()
60 DBG_DTOR(OSharedConnection
,NULL
);
62 // -----------------------------------------------------------------------------
63 void SAL_CALL
OSharedConnection::disposing(void)
65 OSharedConnection_BASE::disposing();
66 OConnectionWrapper::disposing();
68 // -----------------------------------------------------------------------------
69 Reference
< XStatement
> SAL_CALL
OSharedConnection::createStatement( ) throw(SQLException
, RuntimeException
)
71 ::osl::MutexGuard
aGuard( m_aMutex
);
72 checkDisposed(rBHelper
.bDisposed
);
75 return m_xConnection
->createStatement();
77 // --------------------------------------------------------------------------------
78 Reference
< XPreparedStatement
> SAL_CALL
OSharedConnection::prepareStatement( const ::rtl::OUString
& sql
) throw(SQLException
, RuntimeException
)
80 ::osl::MutexGuard
aGuard( m_aMutex
);
81 checkDisposed(rBHelper
.bDisposed
);
84 return m_xConnection
->prepareStatement(sql
);
86 // --------------------------------------------------------------------------------
87 Reference
< XPreparedStatement
> SAL_CALL
OSharedConnection::prepareCall( const ::rtl::OUString
& sql
) throw(SQLException
, RuntimeException
)
89 ::osl::MutexGuard
aGuard( m_aMutex
);
90 checkDisposed(rBHelper
.bDisposed
);
93 return m_xConnection
->prepareCall(sql
);
95 // --------------------------------------------------------------------------------
96 ::rtl::OUString SAL_CALL
OSharedConnection::nativeSQL( const ::rtl::OUString
& sql
) throw(SQLException
, RuntimeException
)
98 ::osl::MutexGuard
aGuard( m_aMutex
);
99 checkDisposed(rBHelper
.bDisposed
);
102 return m_xConnection
->nativeSQL(sql
);
104 // --------------------------------------------------------------------------------
105 sal_Bool SAL_CALL
OSharedConnection::getAutoCommit( ) throw(SQLException
, RuntimeException
)
107 ::osl::MutexGuard
aGuard( m_aMutex
);
108 checkDisposed(rBHelper
.bDisposed
);
111 return m_xConnection
->getAutoCommit();
113 // --------------------------------------------------------------------------------
114 void SAL_CALL
OSharedConnection::commit( ) throw(SQLException
, RuntimeException
)
116 ::osl::MutexGuard
aGuard( m_aMutex
);
117 checkDisposed(rBHelper
.bDisposed
);
120 m_xConnection
->commit();
122 // --------------------------------------------------------------------------------
123 void SAL_CALL
OSharedConnection::rollback( ) throw(SQLException
, RuntimeException
)
125 ::osl::MutexGuard
aGuard( m_aMutex
);
126 checkDisposed(rBHelper
.bDisposed
);
129 m_xConnection
->rollback();
131 // --------------------------------------------------------------------------------
132 sal_Bool SAL_CALL
OSharedConnection::isClosed( ) throw(SQLException
, RuntimeException
)
134 ::osl::MutexGuard
aGuard( m_aMutex
);
136 return m_xConnection
->isClosed();
138 // --------------------------------------------------------------------------------
139 Reference
< XDatabaseMetaData
> SAL_CALL
OSharedConnection::getMetaData( ) throw(SQLException
, RuntimeException
)
141 ::osl::MutexGuard
aGuard( m_aMutex
);
142 checkDisposed(rBHelper
.bDisposed
);
145 return m_xConnection
->getMetaData();
147 // --------------------------------------------------------------------------------
148 sal_Bool SAL_CALL
OSharedConnection::isReadOnly( ) throw(SQLException
, RuntimeException
)
150 ::osl::MutexGuard
aGuard( m_aMutex
);
151 checkDisposed(rBHelper
.bDisposed
);
154 return m_xConnection
->isReadOnly();
156 // --------------------------------------------------------------------------------
157 ::rtl::OUString SAL_CALL
OSharedConnection::getCatalog( ) throw(SQLException
, RuntimeException
)
159 ::osl::MutexGuard
aGuard( m_aMutex
);
160 checkDisposed(rBHelper
.bDisposed
);
163 return m_xConnection
->getCatalog();
165 // --------------------------------------------------------------------------------
166 sal_Int32 SAL_CALL
OSharedConnection::getTransactionIsolation( ) throw(SQLException
, RuntimeException
)
168 ::osl::MutexGuard
aGuard( m_aMutex
);
169 checkDisposed(rBHelper
.bDisposed
);
172 return m_xConnection
->getTransactionIsolation();
174 // --------------------------------------------------------------------------------
175 Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
OSharedConnection::getTypeMap( ) throw(SQLException
, RuntimeException
)
177 ::osl::MutexGuard
aGuard( m_aMutex
);
178 checkDisposed(rBHelper
.bDisposed
);
181 return m_xConnection
->getTypeMap();
183 // -----------------------------------------------------------------------------
185 //........................................................................
186 } // namespace dbaccess
187 //........................................................................