Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / ado / AGroups.cxx
blob5e366825f1ce8af1f2faffcd636d0dbbaf35f86f
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: AGroups.cxx,v $
10 * $Revision: 1.12.56.1 $
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_connectivity.hxx"
33 #include "ado/AGroups.hxx"
34 #include "ado/AGroup.hxx"
35 #include "ado/ATable.hxx"
36 #include "ado/AConnection.hxx"
37 #include <com/sun/star/sdbc/XRow.hpp>
38 #include <com/sun/star/sdbc/XResultSet.hpp>
39 #include "connectivity/sdbcx/IRefreshable.hxx"
40 #include "TConnection.hxx"
41 #include <comphelper/types.hxx>
42 #include <connectivity/dbexception.hxx>
43 #include "resource/ado_res.hrc"
45 using namespace comphelper;
46 using namespace connectivity;
47 using namespace connectivity::ado;
48 using namespace com::sun::star::uno;
49 using namespace com::sun::star::lang;
50 using namespace com::sun::star::beans;
51 using namespace com::sun::star::sdbc;
52 using namespace com::sun::star::container;
54 typedef connectivity::sdbcx::OCollection OCollection_TYPE;
55 // -------------------------------------------------------------------------
56 sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName)
58 return new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName);
60 // -------------------------------------------------------------------------
61 void OGroups::impl_refresh() throw(RuntimeException)
63 m_aCollection.Refresh();
65 // -------------------------------------------------------------------------
66 Reference< XPropertySet > OGroups::createDescriptor()
68 return new OAdoGroup(m_pCatalog,isCaseSensitive());
70 // -------------------------------------------------------------------------
71 // XAppend
72 sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
74 OAdoGroup* pGroup = NULL;
75 if ( !getImplementation(pGroup,descriptor) || pGroup == NULL )
76 m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
78 m_aCollection.Append( pGroup->getImpl() );
79 return createObject( _rForName );
81 // -------------------------------------------------------------------------
82 // XDrop
83 void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
85 m_aCollection.Delete(_sElementName);
87 // -----------------------------------------------------------------------------