Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef CONNECTIVITY_HSQLDB_TABLE_HXX
21 : #define CONNECTIVITY_HSQLDB_TABLE_HXX
22 :
23 : #include "connectivity/TTableHelper.hxx"
24 : #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 : #include <comphelper/IdPropArrayHelper.hxx>
26 :
27 : namespace connectivity
28 : {
29 : namespace hsqldb
30 : {
31 :
32 : OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
33 :
34 : class OHSQLTable;
35 : typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP;
36 0 : class OHSQLTable : public OTableHelper
37 : ,public OHSQLTable_PROP
38 : {
39 : sal_Int32 m_nPrivileges; // we have to set our privileges by our own
40 :
41 : /** executes the statmenmt.
42 : @param _rStatement
43 : The statement to execute.
44 : */
45 : void executeStatement(const OUString& _rStatement );
46 : protected:
47 :
48 : /** creates the column collection for the table
49 : @param _rNames
50 : The column names.
51 : */
52 : virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames) SAL_OVERRIDE;
53 :
54 : /** creates the key collection for the table
55 : @param _rNames
56 : The key names.
57 : */
58 : virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames) SAL_OVERRIDE;
59 :
60 : /** creates the index collection for the table
61 : @param _rNames
62 : The index names.
63 : */
64 : virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames) SAL_OVERRIDE;
65 :
66 : /** used to implement the creation of the array helper which is shared amongst all instances of the class.
67 : This method needs to be implemented in derived classes.
68 : <BR>
69 : The method gets called with s_aMutex acquired.
70 : <BR>
71 : as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
72 : assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
73 : @return an pointer to the newly created array helper. Must not be NULL.
74 : */
75 : virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const SAL_OVERRIDE;
76 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
77 :
78 : public:
79 : OHSQLTable( sdbcx::OCollection* _pTables,
80 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
81 : OHSQLTable( sdbcx::OCollection* _pTables,
82 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
83 : const OUString& _Name,
84 : const OUString& _Type,
85 : const OUString& _Description = OUString(),
86 : const OUString& _SchemaName = OUString(),
87 : const OUString& _CatalogName = OUString(),
88 : sal_Int32 _nPrivileges = 0
89 : );
90 :
91 : // ODescriptor
92 : virtual void construct() SAL_OVERRIDE;
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();
96 :
97 : 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;
98 : //XTypeProvider
99 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : // XAlterTable
101 : virtual void SAL_CALL alterColumnByName( const OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 :
103 : // XRename
104 : virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 :
106 : /**
107 : returns the ALTER TABLE XXX COLUMN statement
108 : */
109 : OUString getAlterTableColumnPart();
110 :
111 : // some methods to alter table structures
112 : void alterColumnType(sal_Int32 nNewType,const OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor);
113 : void alterDefaultValue(const OUString& _sNewDefault,const OUString& _rColName);
114 : void dropDefaultValue(const OUString& _sNewDefault);
115 :
116 : };
117 : }
118 : }
119 : #endif // CONNECTIVITY_HSQLDB_TABLE_HXX
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|