1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_connectivity.hxx" 30 #include "NTables.hxx" 31 #include <com/sun/star/sdbc/XRow.hpp> 32 #include <com/sun/star/sdbc/XResultSet.hpp> 33 #include <com/sun/star/sdbc/ColumnValue.hpp> 34 #include <com/sun/star/sdbc/KeyRule.hpp> 35 #include <com/sun/star/sdbcx/KeyType.hpp> 36 #include <connectivity/sdbcx/VTable.hxx> 37 #include "NCatalog.hxx" 38 #ifndef _CONNECTIVITY_EVOAB_BCONNECTION_HXX_ 39 #include "NConnection.hxx" 40 #endif 41 #include <comphelper/extract.hxx> 42 #include "connectivity/dbtools.hxx" 43 #include "connectivity/dbexception.hxx" 44 #include <cppuhelper/interfacecontainer.h> 45 #include <comphelper/types.hxx> 46 #include "NDebug.hxx" 47 #include "NTable.hxx" 48 using namespace ::comphelper; 49 50 using namespace ::cppu; 51 using namespace connectivity::evoab; 52 using namespace connectivity::sdbcx; 53 using namespace ::com::sun::star::uno; 54 using namespace ::com::sun::star::beans; 55 using namespace ::com::sun::star::sdbcx; 56 using namespace ::com::sun::star::sdbc; 57 using namespace ::com::sun::star::container; 58 using namespace ::com::sun::star::lang; 59 using namespace dbtools; 60 typedef connectivity::sdbcx::OCollection OCollection_TYPE; 61 62 ObjectType OEvoabTables::createObject(const ::rtl::OUString& aName) 63 { 64 ::rtl::OUString aSchema = ::rtl::OUString::createFromAscii("%"); 65 66 Sequence< ::rtl::OUString > aTypes(1); 67 aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); 68 ::rtl::OUString sEmpty; 69 70 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes); 71 72 ObjectType xRet = NULL; 73 if(xResult.is()) 74 { 75 Reference< XRow > xRow(xResult,UNO_QUERY); 76 if(xResult->next()) // there can be only one table with this name 77 { 78 OEvoabTable* pRet = new OEvoabTable( 79 this, 80 (OEvoabConnection *)static_cast<OEvoabCatalog&>(m_rParent).getConnection(), 81 aName, 82 xRow->getString(4), 83 xRow->getString(5), 84 sEmpty); 85 xRet = pRet; 86 } 87 } 88 89 ::comphelper::disposeComponent(xResult); 90 91 return xRet; 92 } 93 // ------------------------------------------------------------------------- 94 void OEvoabTables::impl_refresh( ) throw(RuntimeException) 95 { 96 static_cast<OEvoabCatalog&>(m_rParent).refreshTables(); 97 } 98 // ------------------------------------------------------------------------- 99 void OEvoabTables::disposing(void) 100 { 101 m_xMetaData.clear(); 102 OCollection::disposing(); 103 } 104 // ----------------------------------------------------------------------------- 105 106