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_MYSQL_YTABLE_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
23 #include <connectivity/TTableHelper.hxx>
24 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 #include <comphelper/IdPropArrayHelper.hxx>
27 namespace connectivity
32 OUString
getTypeString(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xColProp
);
35 typedef ::comphelper::OIdPropertyArrayUsageHelper
< OMySQLTable
> OMySQLTable_PROP
;
36 class OMySQLTable
: public OTableHelper
37 ,public OMySQLTable_PROP
39 sal_Int32 m_nPrivileges
; // we have to set our privileges by our own
41 /** executes the statmenmt.
43 The statement to execute.
45 void executeStatement(const OUString
& _rStatement
);
48 /** creates the column collection for the table
52 virtual sdbcx::OCollection
* createColumns(const TStringVector
& _rNames
) SAL_OVERRIDE
;
54 /** creates the key collection for the table
58 virtual sdbcx::OCollection
* createKeys(const TStringVector
& _rNames
) SAL_OVERRIDE
;
60 /** creates the index collection for the table
64 virtual sdbcx::OCollection
* createIndexes(const TStringVector
& _rNames
) SAL_OVERRIDE
;
66 /** Returns always "RENAME TABLE " even for views.
68 * \return The start of the rename statement.
69 * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html
71 virtual OUString
getRenameStart() const SAL_OVERRIDE
;
73 /** used to implement the creation of the array helper which is shared amongst all instances of the class.
74 This method needs to be implemented in derived classes.
76 The method gets called with s_aMutex acquired.
78 as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
79 assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
80 @return an pointer to the newly created array helper. Must not be NULL.
82 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper(sal_Int32 nId
) const SAL_OVERRIDE
;
83 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
86 OMySQLTable( sdbcx::OCollection
* _pTables
,
87 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
);
88 OMySQLTable( sdbcx::OCollection
* _pTables
,
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _xConnection
,
90 const OUString
& _Name
,
91 const OUString
& _Type
,
92 const OUString
& _Description
= OUString(),
93 const OUString
& _SchemaName
= OUString(),
94 const OUString
& _CatalogName
= OUString(),
95 sal_Int32 _nPrivileges
= 0
99 virtual void construct() SAL_OVERRIDE
;
100 // com::sun::star::lang::XUnoTunnel
101 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
;
102 static ::com::sun::star::uno::Sequence
< sal_Int8
> getUnoTunnelImplementationId();
105 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
;
106 /** returns the ALTER TABLE XXX statement
108 OUString
getAlterTableColumnPart();
110 // some methods to alter table structures
111 void alterColumnType(sal_Int32 nNewType
,const OUString
& _rColName
,const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xDescriptor
);
112 void alterDefaultValue(const OUString
& _sNewDefault
,const OUString
& _rColName
);
113 void dropDefaultValue(const OUString
& _sNewDefault
);
115 virtual OUString
getTypeCreatePattern() const SAL_OVERRIDE
;
119 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_MYSQL_YTABLE_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */