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 #include "ado/AGroups.hxx"
27 #include "ado/AGroup.hxx"
28 #include "ado/ATable.hxx"
29 #include "ado/AConnection.hxx"
30 #include <com/sun/star/sdbc/XRow.hpp>
31 #include <com/sun/star/sdbc/XResultSet.hpp>
32 #include "connectivity/sdbcx/IRefreshable.hxx"
33 #include "TConnection.hxx"
34 #include <comphelper/types.hxx>
35 #include <connectivity/dbexception.hxx>
36 #include "resource/ado_res.hrc"
37 
38 using namespace comphelper;
39 using namespace connectivity;
40 using namespace connectivity::ado;
41 using namespace com::sun::star::uno;
42 using namespace com::sun::star::lang;
43 using namespace com::sun::star::beans;
44 using namespace com::sun::star::sdbc;
45 using namespace com::sun::star::container;
46 
47 typedef connectivity::sdbcx::OCollection OCollection_TYPE;
48 // -------------------------------------------------------------------------
createObject(const::rtl::OUString & _rName)49 sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName)
50 {
51 	return new OAdoGroup(m_pCatalog,isCaseSensitive(),_rName);
52 }
53 // -------------------------------------------------------------------------
impl_refresh()54 void OGroups::impl_refresh() throw(RuntimeException)
55 {
56 	m_aCollection.Refresh();
57 }
58 // -------------------------------------------------------------------------
createDescriptor()59 Reference< XPropertySet > OGroups::createDescriptor()
60 {
61 	return new OAdoGroup(m_pCatalog,isCaseSensitive());
62 }
63 // -------------------------------------------------------------------------
64 // XAppend
appendObject(const::rtl::OUString & _rForName,const Reference<XPropertySet> & descriptor)65 sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor )
66 {
67 	OAdoGroup* pGroup = NULL;
68 	if ( !getImplementation(pGroup,descriptor) || pGroup == NULL )
69         m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
70 
71     m_aCollection.Append( pGroup->getImpl() );
72     return createObject( _rForName );
73 }
74 // -------------------------------------------------------------------------
75 // XDrop
dropObject(sal_Int32,const::rtl::OUString _sElementName)76 void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName)
77 {
78 	m_aCollection.Delete(_sElementName);
79 }
80 // -----------------------------------------------------------------------------
81 
82 
83 
84 
85