merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / evoab2 / NTables.cxx
blob0109d9f126d2588e27fc0e7c55595d47fa0033e3
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: NTables.cxx,v $
10 * $Revision: 1.6 $
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 "NTables.hxx"
34 #include <com/sun/star/sdbc/XRow.hpp>
35 #include <com/sun/star/sdbc/XResultSet.hpp>
36 #include <com/sun/star/sdbc/ColumnValue.hpp>
37 #include <com/sun/star/sdbc/KeyRule.hpp>
38 #include <com/sun/star/sdbcx/KeyType.hpp>
39 #include <connectivity/sdbcx/VTable.hxx>
40 #include "NCatalog.hxx"
41 #ifndef _CONNECTIVITY_EVOAB_BCONNECTION_HXX_
42 #include "NConnection.hxx"
43 #endif
44 #include <comphelper/extract.hxx>
45 #include "connectivity/dbtools.hxx"
46 #include "connectivity/dbexception.hxx"
47 #include <cppuhelper/interfacecontainer.h>
48 #include <comphelper/types.hxx>
49 #include "NDebug.hxx"
50 #include "NTable.hxx"
51 using namespace ::comphelper;
53 using namespace ::cppu;
54 using namespace connectivity::evoab;
55 using namespace connectivity::sdbcx;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::beans;
58 using namespace ::com::sun::star::sdbcx;
59 using namespace ::com::sun::star::sdbc;
60 using namespace ::com::sun::star::container;
61 using namespace ::com::sun::star::lang;
62 using namespace dbtools;
63 typedef connectivity::sdbcx::OCollection OCollection_TYPE;
65 ObjectType OEvoabTables::createObject(const ::rtl::OUString& aName)
67 ::rtl::OUString aSchema = ::rtl::OUString::createFromAscii("%");
69 Sequence< ::rtl::OUString > aTypes(1);
70 aTypes[0] = ::rtl::OUString::createFromAscii("TABLE");
71 ::rtl::OUString sEmpty;
73 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
75 ObjectType xRet = NULL;
76 if(xResult.is())
78 Reference< XRow > xRow(xResult,UNO_QUERY);
79 if(xResult->next()) // there can be only one table with this name
81 OEvoabTable* pRet = new OEvoabTable(
82 this,
83 (OEvoabConnection *)static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
84 aName,
85 xRow->getString(4),
86 xRow->getString(5),
87 sEmpty);
88 xRet = pRet;
92 ::comphelper::disposeComponent(xResult);
94 return xRet;
96 // -------------------------------------------------------------------------
97 void OEvoabTables::impl_refresh( ) throw(RuntimeException)
99 static_cast<OEvoabCatalog&>(m_rParent).refreshTables();
101 // -------------------------------------------------------------------------
102 void OEvoabTables::disposing(void)
104 m_xMetaData.clear();
105 OCollection::disposing();
107 // -----------------------------------------------------------------------------