2010-10-27 13:11:31 +01: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 .
|
|
|
|
*/
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2014-04-18 18:41:08 +02:00
|
|
|
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
|
|
|
|
#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2017-10-23 22:43:41 +02:00
|
|
|
#include <file/FTable.hxx>
|
|
|
|
#include <flat/EConnection.hxx>
|
2014-06-04 15:29:58 +02:00
|
|
|
#include <connectivity/sdbcx/VColumn.hxx>
|
|
|
|
#include <connectivity/CommonTools.hxx>
|
2000-10-05 13:47:22 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2017-10-23 22:43:41 +02:00
|
|
|
#include <file/quotedstring.hxx>
|
2010-11-25 08:51:07 +01:00
|
|
|
#include <unotools/syslocale.hxx>
|
2000-10-05 13:47:22 +00:00
|
|
|
|
|
|
|
namespace connectivity
|
|
|
|
{
|
|
|
|
namespace flat
|
|
|
|
{
|
|
|
|
typedef file::OFileTable OFlatTable_BASE;
|
|
|
|
class OFlatConnection;
|
|
|
|
|
2017-02-15 23:55:18 +02:00
|
|
|
typedef std::pair<sal_Int32, sal_Int32> TRowPositionInFile;
|
2000-10-05 13:47:22 +00:00
|
|
|
|
|
|
|
class OFlatTable : public OFlatTable_BASE
|
|
|
|
{
|
2013-05-19 07:35:11 +02:00
|
|
|
// maps a row position to a file position
|
2013-05-19 13:20:51 +02:00
|
|
|
// row n is positions [m_aRowPosToFilePos[n]->first, m_aRowPosToFilePos[n]->second) in file
|
|
|
|
// "real" row indexes start at 1; for the purposes of m_aRowPosToFilePos, row 0 is headers
|
2017-02-15 23:55:18 +02:00
|
|
|
std::vector<TRowPositionInFile>
|
2009-04-23 10:42:05 +00:00
|
|
|
m_aRowPosToFilePos;
|
2017-02-15 23:55:18 +02:00
|
|
|
std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset
|
|
|
|
std::vector<sal_Int32> m_aPrecisions; // same as aboth
|
|
|
|
std::vector<sal_Int32> m_aScales;
|
2006-06-20 01:02:42 +00:00
|
|
|
QuotedTokenizedString m_aCurrentLine;
|
2016-05-27 12:31:29 +02:00
|
|
|
css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter;
|
|
|
|
css::util::Date m_aNullDate;
|
2001-07-30 07:53:02 +00:00
|
|
|
sal_Int32 m_nRowPos;
|
|
|
|
sal_Int32 m_nMaxRowCount; // will be set if stream is once eof
|
2009-04-23 10:42:05 +00:00
|
|
|
sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
|
|
|
|
sal_Unicode m_cFieldDelimiter; // look at the name
|
|
|
|
bool m_bNeedToReadLine;
|
2000-10-05 13:47:22 +00:00
|
|
|
private:
|
2016-05-27 12:31:29 +02:00
|
|
|
void fillColumns(const css::lang::Locale& _aLocale);
|
2016-08-05 11:00:36 +02:00
|
|
|
bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty = false);
|
2017-02-15 23:55:18 +02:00
|
|
|
void setRowPos(std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos);
|
2017-07-18 13:40:38 +02:00
|
|
|
void impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2,
|
2013-07-19 01:31:53 -05:00
|
|
|
sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName,
|
2013-06-29 23:57:38 -05:00
|
|
|
const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass);
|
2013-05-19 13:20:51 +02:00
|
|
|
OFlatConnection* getFlatConnection()
|
|
|
|
{
|
2013-11-30 11:55:26 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-05-19 13:20:51 +02:00
|
|
|
OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
|
|
|
|
assert(pConnection);
|
|
|
|
#else
|
|
|
|
OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
|
|
|
|
#endif
|
|
|
|
return pConnection;
|
|
|
|
}
|
2000-10-05 13:47:22 +00:00
|
|
|
public:
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void refreshColumns() override;
|
2000-10-05 13:47:22 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// DECLARE_CTY_DEFAULTS( OFlatTable_BASE);
|
2001-09-25 12:12:51 +00:00
|
|
|
OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection,
|
2016-04-06 15:30:36 +02:00
|
|
|
const OUString& Name,
|
|
|
|
const OUString& Type,
|
|
|
|
const OUString& Description = OUString(),
|
|
|
|
const OUString& SchemaName = OUString(),
|
|
|
|
const OUString& CatalogName = OUString()
|
2000-10-05 13:47:22 +00:00
|
|
|
);
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
void construct() override; // can throw any exception
|
2002-10-08 07:26:17 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override;
|
2016-03-23 11:02:50 +02:00
|
|
|
virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void refreshHeader() override;
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
|
2000-10-05 13:47:22 +00:00
|
|
|
//XTypeProvider
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL disposing() override;
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2016-05-27 12:31:29 +02:00
|
|
|
// css::lang::XUnoTunnel
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
|
2019-09-06 00:50:24 +03:00
|
|
|
static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2019-08-21 20:21:35 +02:00
|
|
|
OUString getEntry() const;
|
2000-10-05 13:47:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2014-04-18 18:41:08 +02:00
|
|
|
#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
|
2000-10-05 13:47:22 +00:00
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|