merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / kab / KTables.cxx
blob82131b8538620a4abb803578985b6ff565859cd2
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: KTables.cxx,v $
10 * $Revision: 1.4 $
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"
34 #include "KTables.hxx"
35 #include "KTable.hxx"
36 #include "KCatalog.hxx"
37 #include "KConnection.hxx"
38 #include <comphelper/types.hxx>
40 using namespace connectivity::kab;
41 using namespace connectivity;
42 using namespace ::comphelper;
43 using namespace ::cppu;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star::beans;
46 using namespace ::com::sun::star::sdbcx;
47 using namespace ::com::sun::star::sdbc;
48 using namespace ::com::sun::star::container;
49 using namespace ::com::sun::star::lang;
51 sdbcx::ObjectType KabTables::createObject(const ::rtl::OUString& _rName)
53 ::rtl::OUString aName,aSchema;
54 aSchema = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
55 aName = _rName;
57 Sequence< ::rtl::OUString > aTypes(1);
58 aTypes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("%"));
59 ::rtl::OUString sEmpty;
61 Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), aSchema, aName, aTypes);
63 sdbcx::ObjectType xRet = NULL;
64 if (xResult.is())
66 Reference< XRow > xRow(xResult, UNO_QUERY);
67 if (xResult->next()) // there can be only one table with this name
69 KabTable* pRet = new KabTable(
70 this,
71 static_cast<KabCatalog&>(m_rParent).getConnection(),
72 aName,
73 xRow->getString(4),
74 xRow->getString(5),
75 sEmpty);
76 xRet = pRet;
79 ::comphelper::disposeComponent(xResult);
81 return xRet;
83 // -------------------------------------------------------------------------
84 void KabTables::impl_refresh( ) throw(RuntimeException)
86 static_cast<KabCatalog&>(m_rParent).refreshTables();
88 // -------------------------------------------------------------------------
89 void KabTables::disposing(void)
91 m_xMetaData.clear();
92 OCollection::disposing();