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 "adabas/BGroups.hxx" 27 #include "adabas/BGroup.hxx" 28 #include "adabas/BTable.hxx" 29 #include <com/sun/star/sdbc/XRow.hpp> 30 #include <com/sun/star/sdbc/XResultSet.hpp> 31 #include <comphelper/types.hxx> 32 33 using namespace ::comphelper; 34 using namespace connectivity; 35 using namespace connectivity::adabas; 36 using namespace ::com::sun::star::uno; 37 using namespace ::com::sun::star::beans; 38 // using namespace ::com::sun::star::sdbcx; 39 using namespace ::com::sun::star::sdbc; 40 using namespace ::com::sun::star::container; 41 using namespace ::com::sun::star::lang; 42 typedef connectivity::sdbcx::OCollection OCollection_TYPE; 43 // ------------------------------------------------------------------------- 44 sdbcx::ObjectType OGroups::createObject(const ::rtl::OUString& _rName) 45 { 46 return new OAdabasGroup(m_pConnection,_rName); 47 } 48 // ------------------------------------------------------------------------- 49 void OGroups::impl_refresh() throw(RuntimeException) 50 { 51 m_pParent->refreshGroups(); 52 } 53 // ------------------------------------------------------------------------- 54 Reference< XPropertySet > OGroups::createDescriptor() 55 { 56 // OAdabasGroup* pNew = 57 return new OAdabasGroup(m_pConnection); 58 } 59 // ------------------------------------------------------------------------- 60 // XAppend 61 sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& /*descriptor*/ ) 62 { 63 ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USERGROUP "); 64 ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); 65 66 aSql = aSql + aQuote + _rForName + aQuote; 67 68 Reference< XStatement > xStmt = m_pConnection->createStatement( ); 69 xStmt->execute(aSql); 70 ::comphelper::disposeComponent(xStmt); 71 72 return createObject( _rForName ); 73 } 74 // ------------------------------------------------------------------------- 75 // XDrop 76 void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) 77 { 78 ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USERGROUP "); 79 ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); 80 81 aSql = aSql + aQuote + _sElementName + aQuote; 82 83 Reference< XStatement > xStmt = m_pConnection->createStatement( ); 84 xStmt->execute(aSql); 85 ::comphelper::disposeComponent(xStmt); 86 } 87 // ------------------------------------------------------------------------- 88 89 90