Update ooo320-m1
[ooovba.git] / connectivity / source / inc / mysql / YTable.hxx
blob15bddc212acb7389c07204f65f09efa4b4f448db
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: YTable.hxx,v $
10 * $Revision: 1.7 $
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_MYSQL_TABLE_HXX
32 #define CONNECTIVITY_MYSQL_TABLE_HXX
34 #include "connectivity/TTableHelper.hxx"
35 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
36 #include <comphelper/IdPropArrayHelper.hxx>
38 namespace connectivity
40 namespace mysql
43 ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
45 class OMySQLTable;
46 typedef ::comphelper::OIdPropertyArrayUsageHelper< OMySQLTable > OMySQLTable_PROP;
47 class OMySQLTable : public OTableHelper
48 ,public OMySQLTable_PROP
50 sal_Int32 m_nPrivileges; // we have to set our privileges by our own
52 /** executes the statmenmt.
53 @param _rStatement
54 The statement to execute.
56 void executeStatement(const ::rtl::OUString& _rStatement );
57 protected:
59 /** creates the column collection for the table
60 @param _rNames
61 The column names.
63 virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames);
65 /** creates the key collection for the table
66 @param _rNames
67 The key names.
69 virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames);
71 /** creates the index collection for the table
72 @param _rNames
73 The index names.
75 virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames);
77 /** Returns always "RENAME TABLE " even for views.
79 * \return The start of the rename statement.
80 * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html
82 virtual ::rtl::OUString getRenameStart() const;
84 /** used to implement the creation of the array helper which is shared amongst all instances of the class.
85 This method needs to be implemented in derived classes.
86 <BR>
87 The method gets called with s_aMutex acquired.
88 <BR>
89 as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
90 assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
91 @return an pointer to the newly created array helper. Must not be NULL.
93 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
94 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
96 public:
97 OMySQLTable( sdbcx::OCollection* _pTables,
98 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
99 OMySQLTable( sdbcx::OCollection* _pTables,
100 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
101 const ::rtl::OUString& _Name,
102 const ::rtl::OUString& _Type,
103 const ::rtl::OUString& _Description = ::rtl::OUString(),
104 const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
105 const ::rtl::OUString& _CatalogName = ::rtl::OUString(),
106 sal_Int32 _nPrivileges = 0
109 // ODescriptor
110 virtual void construct();
111 // com::sun::star::lang::XUnoTunnel
112 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
113 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
115 // XAlterTable
116 virtual void SAL_CALL alterColumnByName( const ::rtl::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);
117 /** returns the ALTER TABLE XXX statement
119 ::rtl::OUString getAlterTableColumnPart();
121 // some methods to alter table structures
122 void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor);
123 void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
124 void dropDefaultValue(const ::rtl::OUString& _sNewDefault);
126 virtual ::rtl::OUString getTypeCreatePattern() const;
130 #endif // CONNECTIVITY_MYSQL_TABLE_HXX