2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-12 22:04:38 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2005-06-09 13:13:50 +00:00
|
|
|
|
|
|
|
#include "NTables.hxx"
|
|
|
|
#include <com/sun/star/sdbc/XRow.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XResultSet.hpp>
|
|
|
|
#include <com/sun/star/sdbc/ColumnValue.hpp>
|
|
|
|
#include <com/sun/star/sdbc/KeyRule.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/KeyType.hpp>
|
|
|
|
#include <connectivity/sdbcx/VTable.hxx>
|
|
|
|
#include "NCatalog.hxx"
|
|
|
|
#include "NConnection.hxx"
|
|
|
|
#include <comphelper/extract.hxx>
|
2014-06-04 15:29:58 +02:00
|
|
|
#include <connectivity/dbtools.hxx>
|
|
|
|
#include <connectivity/dbexception.hxx>
|
2005-06-09 13:13:50 +00:00
|
|
|
#include <cppuhelper/interfacecontainer.h>
|
|
|
|
#include <comphelper/types.hxx>
|
2006-02-28 09:35:24 +00:00
|
|
|
#include "NTable.hxx"
|
2005-06-09 13:13:50 +00:00
|
|
|
using namespace ::comphelper;
|
|
|
|
|
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace connectivity::evoab;
|
|
|
|
using namespace connectivity::sdbcx;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace dbtools;
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
ObjectType OEvoabTables::createObject(const OUString& aName)
|
2005-06-09 13:13:50 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aSchema( "%" );
|
2005-06-09 13:13:50 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > aTypes(1);
|
2013-11-04 13:51:21 +02:00
|
|
|
aTypes[0] = "TABLE";
|
2005-06-09 13:13:50 +00:00
|
|
|
|
|
|
|
Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes);
|
|
|
|
|
2015-11-10 10:12:07 +01:00
|
|
|
ObjectType xRet = nullptr;
|
2005-06-09 13:13:50 +00:00
|
|
|
if(xResult.is())
|
|
|
|
{
|
|
|
|
Reference< XRow > xRow(xResult,UNO_QUERY);
|
|
|
|
if(xResult->next()) // there can be only one table with this name
|
|
|
|
{
|
2006-02-28 09:35:24 +00:00
|
|
|
OEvoabTable* pRet = new OEvoabTable(
|
|
|
|
this,
|
2015-04-21 13:51:39 +01:00
|
|
|
static_cast<OEvoabConnection*>(static_cast<OEvoabCatalog&>(m_rParent).getConnection()),
|
2006-02-28 09:35:24 +00:00
|
|
|
aName,
|
|
|
|
xRow->getString(4),
|
|
|
|
xRow->getString(5),
|
2015-08-26 22:59:12 +02:00
|
|
|
"");
|
2006-02-28 09:35:24 +00:00
|
|
|
xRet = pRet;
|
2005-06-09 13:13:50 +00:00
|
|
|
}
|
|
|
|
}
|
2006-02-28 09:35:24 +00:00
|
|
|
|
2005-06-09 13:13:50 +00:00
|
|
|
::comphelper::disposeComponent(xResult);
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-06-09 13:13:50 +00:00
|
|
|
void OEvoabTables::impl_refresh( ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
static_cast<OEvoabCatalog&>(m_rParent).refreshTables();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
void OEvoabTables::disposing()
|
2005-06-09 13:13:50 +00:00
|
|
|
{
|
2009-09-08 09:50:48 +00:00
|
|
|
m_xMetaData.clear();
|
2005-06-09 13:13:50 +00:00
|
|
|
OCollection::disposing();
|
|
|
|
}
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-06-09 13:13:50 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|