1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ETable.hxx,v $
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 #ifndef _CONNECTIVITY_FLAT_TABLE_HXX_
32 #define _CONNECTIVITY_FLAT_TABLE_HXX_
34 #include "file/FTable.hxx"
35 #include "connectivity/sdbcx/VColumn.hxx"
36 #include "connectivity/CommonTools.hxx"
37 #include <tools/urlobj.hxx>
38 #include "file/quotedstring.hxx"
40 namespace connectivity
44 typedef file::OFileTable OFlatTable_BASE
;
45 class OFlatConnection
;
47 typedef ::std::map
< ::rtl::OUString
,
48 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNamed
>, comphelper::UStringMixLess
> OContainer
;
49 typedef ::std::map
<sal_Int32
, sal_Int32
> TRowPositionsInFile
;
51 class OFlatTable
: public OFlatTable_BASE
53 // maps a row postion to a file position
54 TRowPositionsInFile m_aFilePosToEndLinePos
;
55 ::std::map
<sal_Int32
, TRowPositionsInFile::iterator
>
57 ::std::vector
<sal_Int32
> m_aTypes
; // holds all type for columns just to avoid to ask the propertyset
58 ::std::vector
<sal_Int32
> m_aPrecisions
; // same as aboth
59 ::std::vector
<sal_Int32
> m_aScales
;
60 QuotedTokenizedString m_aCurrentLine
;
61 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
> m_xNumberFormatter
;
62 ::com::sun::star::util::Date m_aNullDate
;
63 sal_Int32 m_nStartRowFilePos
;
65 sal_Int32 m_nMaxRowCount
; // will be set if stream is once eof
66 sal_Unicode m_cStringDelimiter
; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter
67 sal_Unicode m_cFieldDelimiter
; // look at the name
68 bool m_bNeedToReadLine
;
70 void fillColumns(const ::com::sun::star::lang::Locale
& _aLocale
);
71 BOOL
CreateFile(const INetURLObject
& aFile
, BOOL
& bCreateMemo
);
72 sal_Bool
readLine(sal_Int32
& _rnCurrentPos
);
74 virtual void refreshColumns();
77 // DECLARE_CTY_DEFAULTS( OFlatTable_BASE);
78 OFlatTable( sdbcx::OCollection
* _pTables
,OFlatConnection
* _pConnection
,
79 const ::rtl::OUString
& _Name
,
80 const ::rtl::OUString
& _Type
,
81 const ::rtl::OUString
& _Description
= ::rtl::OUString(),
82 const ::rtl::OUString
& _SchemaName
= ::rtl::OUString(),
83 const ::rtl::OUString
& _CatalogName
= ::rtl::OUString()
86 void construct(); // can throw any exception
88 virtual sal_Bool
seekRow(IResultSetHelper::Movement eCursorPosition
, sal_Int32 nOffset
, sal_Int32
& nCurPos
);
89 virtual sal_Bool
fetchRow(OValueRefRow
& _rRow
,const OSQLColumns
& _rCols
, sal_Bool bIsTable
,sal_Bool bRetrieveData
);
90 virtual void refreshHeader();
92 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
94 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
disposing(void);
97 // com::sun::star::lang::XUnoTunnel
98 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
99 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
105 #endif // _CONNECTIVITY_FLAT_TABLE_HXX_