Bump for 3.6-28
[LibreOffice.git] / connectivity / source / inc / file / FTable.hxx
blob17224fad624b6a9e92f430a96c20e354e511fef8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _CONNECTIVITY_FILE_TABLE_HXX_
30 #define _CONNECTIVITY_FILE_TABLE_HXX_
32 #include "connectivity/sdbcx/VTable.hxx"
33 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include "file/FConnection.hxx"
36 #include "file/filedllapi.hxx"
37 #include <tools/stream.hxx>
38 #include "connectivity/FValue.hxx"
39 #include "TResultSetHelper.hxx"
41 namespace connectivity
43 namespace file
45 typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
47 class OOO_DLLPUBLIC_FILE OFileTable : public OTable_TYPEDEF
49 protected:
50 OConnection* m_pConnection;
51 SvStream* m_pFileStream;
52 ::rtl::Reference<OSQLColumns> m_aColumns;
53 sal_Int32 m_nFilePos; // current IResultSetHelper::Movement
54 sal_uInt8* m_pBuffer;
55 sal_uInt16 m_nBufferSize; // size of the ReadBuffer, if pBuffer != NULL
56 sal_Bool m_bWriteable; // svstream cann't say if we are writeable
57 // so we have to
59 virtual void FileClose();
60 virtual ~OFileTable( );
61 public:
62 virtual void refreshColumns();
63 virtual void refreshKeys();
64 virtual void refreshIndexes();
65 public:
66 OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection);
67 OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection,
68 const ::rtl::OUString& _Name,
69 const ::rtl::OUString& _Type,
70 const ::rtl::OUString& _Description = ::rtl::OUString(),
71 const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
72 const ::rtl::OUString& _CatalogName = ::rtl::OUString()
75 //XInterface
76 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
77 virtual void SAL_CALL acquire() throw();
78 virtual void SAL_CALL release() throw();
79 // ::cppu::OComponentHelper
80 virtual void SAL_CALL disposing(void);
82 OConnection* getConnection() const { return m_pConnection;}
83 virtual sal_Int32 getCurrentLastPos() const {return -1;}
85 virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0;
86 virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) = 0;
88 ::rtl::Reference<OSQLColumns> getTableColumns() const {return m_aColumns;}
89 virtual sal_Bool InsertRow(OValueRefVector& rRow, sal_Bool bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols);
90 virtual sal_Bool DeleteRow(const OSQLColumns& _rCols);
91 virtual sal_Bool UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols);
92 virtual void addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& descriptor);
93 virtual void dropColumn(sal_Int32 _nPos);
94 // refresh the header of file based tables to see changes done by someone
95 virtual void refreshHeader();
97 ::rtl::OUString SAL_CALL getName() throw() { return m_Name; }
99 ::rtl::OUString getSchema() { return m_SchemaName; }
100 sal_Bool isReadOnly() const { return !m_bWriteable; }
101 // m_pFileStream && !m_pFileStream->IsWritable(); }
102 // com::sun::star::lang::XUnoTunnel
103 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
104 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
107 sal_Int32 getFilePos() const { return m_nFilePos; }
109 public:
110 // helper
112 // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified
113 // (NULL or non-NULL is returned)
114 static SvStream* createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode);
118 #endif // _CONNECTIVITY_FILE_TABLE_HXX_
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */