summaryrefslogtreecommitdiffstats
path: root/connectivity/source/inc/flat
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /connectivity/source/inc/flat
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'connectivity/source/inc/flat')
-rw-r--r--connectivity/source/inc/flat/ECatalog.hxx42
-rw-r--r--connectivity/source/inc/flat/EColumns.hxx45
-rw-r--r--connectivity/source/inc/flat/EConnection.hxx66
-rw-r--r--connectivity/source/inc/flat/EDatabaseMetaData.hxx48
-rw-r--r--connectivity/source/inc/flat/EDriver.hxx55
-rw-r--r--connectivity/source/inc/flat/EPreparedStatement.hxx43
-rw-r--r--connectivity/source/inc/flat/EResultSet.hxx74
-rw-r--r--connectivity/source/inc/flat/EStatement.hxx43
-rw-r--r--connectivity/source/inc/flat/ETable.hxx108
-rw-r--r--connectivity/source/inc/flat/ETables.hxx44
10 files changed, 568 insertions, 0 deletions
diff --git a/connectivity/source/inc/flat/ECatalog.hxx b/connectivity/source/inc/flat/ECatalog.hxx
new file mode 100644
index 000000000..b28d110a3
--- /dev/null
+++ b/connectivity/source/inc/flat/ECatalog.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
+
+#include <file/FCatalog.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class OFlatConnection;
+ class OFlatCatalog : public file::OFileCatalog
+ {
+ public:
+ virtual void refreshTables() override;
+
+ public:
+ OFlatCatalog(OFlatConnection* _pCon);
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECATALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EColumns.hxx b/connectivity/source/inc/flat/EColumns.hxx
new file mode 100644
index 000000000..800ac771f
--- /dev/null
+++ b/connectivity/source/inc/flat/EColumns.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
+
+#include <file/FColumns.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class OFlatColumns : public file::OColumns
+ {
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ public:
+ OFlatColumns(file::OFileTable* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector
+ ) : file::OColumns(_pTable,_rMutex,_rVector)
+ {}
+
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECOLUMNS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EConnection.hxx b/connectivity/source/inc/flat/EConnection.hxx
new file mode 100644
index 000000000..36f6d0f49
--- /dev/null
+++ b/connectivity/source/inc/flat/EConnection.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECONNECTION_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ECONNECTION_HXX
+
+#include <file/FConnection.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class ODriver;
+ class OFlatConnection : public file::OConnection
+ {
+ private:
+ sal_Int32 m_nMaxRowsToScan;
+ bool m_bHeaderLine; // column names in first row
+ sal_Unicode m_cFieldDelimiter; // look at the name
+ sal_Unicode m_cStringDelimiter;
+ sal_Unicode m_cDecimalDelimiter;
+ sal_Unicode m_cThousandDelimiter;
+ public:
+ OFlatConnection(ODriver* _pDriver);
+ virtual ~OFlatConnection() override;
+
+ virtual void construct(const OUString& _rUrl,const css::uno::Sequence< css::beans::PropertyValue >& _rInfo ) override;
+
+ // own methods
+ bool isHeaderLine() const { return m_bHeaderLine; }
+ sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; }
+ sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; }
+ sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; }
+ sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;}
+ sal_Int32 getMaxRowsToScan() const { return m_nMaxRowsToScan;}
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+
+ // XConnection
+ virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
+ virtual css::uno::Reference< css::sdbcx::XTablesSupplier > createCatalog() override;
+ virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override;
+ virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override;
+ };
+ }
+}
+#endif // _CONNECTIVITY_FLAT_DCONNECTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EDatabaseMetaData.hxx b/connectivity/source/inc/flat/EDatabaseMetaData.hxx
new file mode 100644
index 000000000..f5c1bdd3c
--- /dev/null
+++ b/connectivity/source/inc/flat/EDatabaseMetaData.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDATABASEMETADATA_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDATABASEMETADATA_HXX
+
+#include <file/FDatabaseMetaData.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+
+ //************ Class: java.sql.DatabaseMetaDataDate
+
+
+ class OFlatDatabaseMetaData : public file::ODatabaseMetaData
+ {
+ virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override;
+ protected:
+ virtual ~OFlatDatabaseMetaData() override;
+ public:
+ OFlatDatabaseMetaData(file::OConnection* _pCon);
+
+ virtual OUString SAL_CALL getURL( ) override;
+ virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override;
+ };
+ }
+}
+#endif // _CONNECTIVITY_FLAT_ODATABASEMETADATA_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EDriver.hxx b/connectivity/source/inc/flat/EDriver.hxx
new file mode 100644
index 000000000..c818b3632
--- /dev/null
+++ b/connectivity/source/inc/flat/EDriver.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDRIVER_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EDRIVER_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <connectivity/CommonTools.hxx>
+#include <file/FDriver.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ /// @throws css::uno::Exception
+ css::uno::Reference< css::uno::XInterface > ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory);
+
+ class ODriver : public file::OFileDriver
+ {
+ public:
+ ODriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){}
+
+ // XInterface
+ /// @throws css::uno::RuntimeException
+ static OUString getImplementationName_Static( );
+ // static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ) throw (css::uno::RuntimeException);
+
+ OUString SAL_CALL getImplementationName( ) override;
+ // XDriver
+ virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
+ virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
+ };
+ }
+
+}
+#endif //_CONNECTIVITY_FLAT_DDRIVER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EPreparedStatement.hxx b/connectivity/source/inc/flat/EPreparedStatement.hxx
new file mode 100644
index 000000000..3af19bd94
--- /dev/null
+++ b/connectivity/source/inc/flat/EPreparedStatement.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
+
+#include <file/FPreparedStatement.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class OConnection;
+ class OFlatPreparedStatement : public file::OPreparedStatement
+ {
+ protected:
+ virtual file::OResultSet* createResultSet() override;
+ public:
+ OFlatPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_EPREPAREDSTATEMENT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EResultSet.hxx b/connectivity/source/inc/flat/EResultSet.hxx
new file mode 100644
index 000000000..e7b7c6d87
--- /dev/null
+++ b/connectivity/source/inc/flat/EResultSet.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ERESULTSET_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ERESULTSET_HXX
+
+#include <file/FResultSet.hxx>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class OFlatResultSet;
+ // these typedef's are only necessary for the compiler
+ typedef ::cppu::ImplHelper1< css::sdbcx::XRowLocate> OFlatResultSet_BASE;
+ typedef file::OResultSet OFlatResultSet_BASE2;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OFlatResultSet> OFlatResultSet_BASE3;
+
+
+ class OFlatResultSet : public OFlatResultSet_BASE2,
+ public OFlatResultSet_BASE,
+ public OFlatResultSet_BASE3
+ {
+ bool m_bBookmarkable;
+ protected:
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OFlatResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator);
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ virtual void SAL_CALL acquire() throw() override;
+ virtual void SAL_CALL release() throw() override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
+
+ // XRowLocate
+ virtual css::uno::Any SAL_CALL getBookmark( ) override;
+ virtual sal_Bool SAL_CALL moveToBookmark( const css::uno::Any& bookmark ) override;
+ virtual sal_Bool SAL_CALL moveRelativeToBookmark( const css::uno::Any& bookmark, sal_Int32 rows ) override;
+ virtual sal_Int32 SAL_CALL compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) override;
+ virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) override;
+ virtual sal_Int32 SAL_CALL hashBookmark( const css::uno::Any& bookmark ) override;
+ };
+ }
+}
+#endif //_CONNECTIVITY_FLAT_DRESULTSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/EStatement.hxx b/connectivity/source/inc/flat/EStatement.hxx
new file mode 100644
index 000000000..215d0b0a9
--- /dev/null
+++ b/connectivity/source/inc/flat/EStatement.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ESTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ESTATEMENT_HXX
+
+#include <file/FStatement.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ class OConnection;
+ class OFlatStatement : public file::OStatement
+ {
+ protected:
+ virtual file::OResultSet* createResultSet() override;
+ public:
+ OFlatStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){}
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_FLAT_DSTATEMENT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx
new file mode 100644
index 000000000..6680c2585
--- /dev/null
+++ b/connectivity/source/inc/flat/ETable.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
+
+#include <file/FTable.hxx>
+#include <flat/EConnection.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <file/quotedstring.hxx>
+#include <unotools/syslocale.hxx>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ typedef file::OFileTable OFlatTable_BASE;
+ class OFlatConnection;
+
+ typedef std::pair<sal_Int32, sal_Int32> TRowPositionInFile;
+
+ class OFlatTable : public OFlatTable_BASE
+ {
+ // maps a row position to a file position
+ // 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
+ std::vector<TRowPositionInFile>
+ m_aRowPosToFilePos;
+ 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;
+ QuotedTokenizedString m_aCurrentLine;
+ css::uno::Reference< css::util::XNumberFormatter > m_xNumberFormatter;
+ css::util::Date m_aNullDate;
+ sal_Int32 m_nRowPos;
+ sal_Int32 m_nMaxRowCount; // will be set if stream is once eof
+ sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
+ sal_Unicode m_cFieldDelimiter; // look at the name
+ bool m_bNeedToReadLine;
+ private:
+ void fillColumns(const css::lang::Locale& _aLocale);
+ bool readLine(sal_Int32 *pEndPos, sal_Int32 *pStartPos, bool nonEmpty = false);
+ void setRowPos(std::vector<TRowPositionInFile>::size_type rowNum, const TRowPositionInFile &rowPos);
+ void impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirstLine, sal_Int32& nStartPosFirstLine, sal_Int32& nStartPosFirstLine2,
+ sal_Int32& io_nType, sal_Int32& io_nPrecisions, sal_Int32& io_nScales, OUString& o_sTypeName,
+ const sal_Unicode cDecimalDelimiter, const sal_Unicode cThousandDelimiter, const CharClass& aCharClass);
+ OFlatConnection* getFlatConnection()
+ {
+#if OSL_DEBUG_LEVEL > 0
+ OFlatConnection* pConnection = dynamic_cast<OFlatConnection*>(m_pConnection);
+ assert(pConnection);
+#else
+ OFlatConnection* pConnection = static_cast<OFlatConnection*>(m_pConnection);
+#endif
+ return pConnection;
+ }
+ public:
+ virtual void refreshColumns() override;
+
+ public:
+ // DECLARE_CTY_DEFAULTS( OFlatTable_BASE);
+ OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection,
+ const OUString& Name,
+ const OUString& Type,
+ const OUString& Description = OUString(),
+ const OUString& SchemaName = OUString(),
+ const OUString& CatalogName = OUString()
+ );
+
+ void construct() override; // can throw any exception
+
+ virtual bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) override;
+ virtual bool fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) override;
+ virtual void refreshHeader() override;
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ //XTypeProvider
+ virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
+ virtual void SAL_CALL disposing() override;
+
+ // css::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+ static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+
+ OUString getEntry() const;
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/flat/ETables.hxx b/connectivity/source/inc/flat/ETables.hxx
new file mode 100644
index 000000000..69b6f5562
--- /dev/null
+++ b/connectivity/source/inc/flat/ETables.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
+
+#include <file/FTables.hxx>
+
+namespace connectivity
+{
+ namespace flat
+ {
+ typedef file::OTables OFlatTables_BASE;
+
+ class OFlatTables : public OFlatTables_BASE
+ {
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName) override;
+ public:
+ OFlatTables(const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector) : OFlatTables_BASE(_rMetaData,_rParent,_rMutex,_rVector)
+ {}
+ };
+ }
+}
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FLAT_ETABLES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */