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: FTable.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_FILE_TABLE_HXX_
32 #define _CONNECTIVITY_FILE_TABLE_HXX_
34 #include "connectivity/sdbcx/VTable.hxx"
35 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_
38 #include "file/FConnection.hxx"
40 #include "file/filedllapi.hxx"
41 #include <tools/stream.hxx>
42 #include "connectivity/FValue.hxx"
43 #include "TResultSetHelper.hxx"
45 namespace connectivity
49 typedef connectivity::sdbcx::OTable OTable_TYPEDEF
;
51 class OOO_DLLPUBLIC_FILE OFileTable
: public OTable_TYPEDEF
54 OConnection
* m_pConnection
;
55 SvStream
* m_pFileStream
;
56 ::vos::ORef
<OSQLColumns
> m_aColumns
;
57 sal_Int32 m_nFilePos
; // aktuelle IResultSetHelper::Movement
59 sal_uInt16 m_nBufferSize
; // Groesse des ReadBuffer, wenn pBuffer != NULL
60 sal_Bool m_bWriteable
; // svstream cann't say if we are writeable
63 virtual void FileClose();
64 virtual ~OFileTable( );
66 virtual void refreshColumns();
67 virtual void refreshKeys();
68 virtual void refreshIndexes();
70 OFileTable( sdbcx::OCollection
* _pTables
,OConnection
* _pConnection
);
71 OFileTable( sdbcx::OCollection
* _pTables
,OConnection
* _pConnection
,
72 const ::rtl::OUString
& _Name
,
73 const ::rtl::OUString
& _Type
,
74 const ::rtl::OUString
& _Description
= ::rtl::OUString(),
75 const ::rtl::OUString
& _SchemaName
= ::rtl::OUString(),
76 const ::rtl::OUString
& _CatalogName
= ::rtl::OUString()
80 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
81 virtual void SAL_CALL
acquire() throw();
82 virtual void SAL_CALL
release() throw();
83 // ::cppu::OComponentHelper
84 virtual void SAL_CALL
disposing(void);
86 OConnection
* getConnection() const { return m_pConnection
;}
87 virtual sal_Int32
getCurrentLastPos() const {return -1;}
89 virtual sal_Bool
seekRow(IResultSetHelper::Movement eCursorPosition
, sal_Int32 nOffset
, sal_Int32
& nCurPos
) = 0;
90 virtual sal_Bool
fetchRow(OValueRefRow
& _rRow
,const OSQLColumns
& _rCols
, sal_Bool _bUseTableDefs
,sal_Bool bRetrieveData
) = 0;
92 ::vos::ORef
<OSQLColumns
> getTableColumns() const {return m_aColumns
;}
93 virtual BOOL
InsertRow(OValueRefVector
& rRow
, BOOL bFlush
,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& _xCols
);
94 virtual BOOL
DeleteRow(const OSQLColumns
& _rCols
);
95 virtual BOOL
UpdateRow(OValueRefVector
& rRow
, OValueRefRow
& pOrgRow
,const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& _xCols
);
96 virtual void addColumn(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& descriptor
);
97 virtual void dropColumn(sal_Int32 _nPos
);
98 // refresh the header of file based tables to see changes done by someone
99 virtual void refreshHeader();
101 ::rtl::OUString SAL_CALL
getName() throw() { return m_Name
; }
103 ::rtl::OUString
getSchema() { return m_SchemaName
; }
104 sal_Bool
isReadOnly() const { return !m_bWriteable
; }
105 // m_pFileStream && !m_pFileStream->IsWritable(); }
106 // com::sun::star::lang::XUnoTunnel
107 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
108 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
111 sal_Int32
getFilePos() const { return m_nFilePos
; }
116 // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified
117 // (NULL or non-NULL is returned)
118 static SvStream
* createStream_simpleError( const String
& _rFileName
, StreamMode _eOpenMode
);
122 #endif // _CONNECTIVITY_FILE_TABLE_HXX_