1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
23 #include <connectivity/sdbcx/VTable.hxx>
24 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include "file/FConnection.hxx"
27 #include "file/filedllapi.hxx"
28 #include <tools/stream.hxx>
29 #include <connectivity/FValue.hxx>
30 #include "TResultSetHelper.hxx"
32 namespace connectivity
36 typedef connectivity::sdbcx::OTable OTable_TYPEDEF
;
38 class OOO_DLLPUBLIC_FILE OFileTable
: public OTable_TYPEDEF
41 OConnection
* m_pConnection
;
42 SvStream
* m_pFileStream
;
43 ::rtl::Reference
<OSQLColumns
> m_aColumns
;
44 sal_Int32 m_nFilePos
; // current IResultSetHelper::Movement
46 sal_uInt16 m_nBufferSize
; // size of the ReadBuffer, if pBuffer != NULL
47 bool m_bWriteable
; // svstream cann't say if we are writeable
50 virtual void FileClose();
51 virtual ~OFileTable( );
53 virtual void refreshColumns() SAL_OVERRIDE
;
54 virtual void refreshKeys() SAL_OVERRIDE
;
55 virtual void refreshIndexes() SAL_OVERRIDE
;
57 OFileTable( sdbcx::OCollection
* _pTables
,OConnection
* _pConnection
);
58 OFileTable( sdbcx::OCollection
* _pTables
,OConnection
* _pConnection
,
59 const OUString
& _Name
,
60 const OUString
& _Type
,
61 const OUString
& _Description
= OUString(),
62 const OUString
& _SchemaName
= OUString(),
63 const OUString
& _CatalogName
= OUString()
67 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
69 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
70 // ::cppu::OComponentHelper
71 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
73 OConnection
* getConnection() const { return m_pConnection
;}
74 virtual sal_Int32
getCurrentLastPos() const {return -1;}
76 virtual bool seekRow(IResultSetHelper::Movement eCursorPosition
, sal_Int32 nOffset
, sal_Int32
& nCurPos
) = 0;
77 virtual bool fetchRow(OValueRefRow
& _rRow
, const OSQLColumns
& _rCols
, bool _bUseTableDefs
, bool bRetrieveData
) = 0;
79 ::rtl::Reference
<OSQLColumns
> getTableColumns() const {return m_aColumns
;}
80 virtual bool InsertRow(OValueRefVector
& rRow
, bool bFlush
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& _xCols
);
81 virtual bool DeleteRow(const OSQLColumns
& _rCols
);
82 virtual bool UpdateRow(OValueRefVector
& rRow
, OValueRefRow
& pOrgRow
,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& _xCols
);
83 virtual void addColumn(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& descriptor
);
84 virtual void dropColumn(sal_Int32 _nPos
);
85 // refresh the header of file based tables to see changes done by someone
86 virtual void refreshHeader();
88 OUString SAL_CALL
getName() throw(std::exception
) SAL_OVERRIDE
{ return m_Name
; }
90 OUString
getSchema() { return m_SchemaName
; }
91 bool isReadOnly() const { return !m_bWriteable
; }
92 // m_pFileStream && !m_pFileStream->IsWritable(); }
93 // com::sun::star::lang::XUnoTunnel
94 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
98 sal_Int32
getFilePos() const { return m_nFilePos
; }
103 // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified
104 // (NULL or non-NULL is returned)
105 static SvStream
* createStream_simpleError( const OUString
& _rFileName
, StreamMode _eOpenMode
);
109 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FTABLE_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */