summaryrefslogtreecommitdiff
path: root/connectivity/source/inc/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/inc/mysql')
-rw-r--r--connectivity/source/inc/mysql/YCatalog.hxx73
-rw-r--r--connectivity/source/inc/mysql/YColumns.hxx70
-rw-r--r--connectivity/source/inc/mysql/YDriver.hxx126
-rw-r--r--connectivity/source/inc/mysql/YTable.hxx128
-rw-r--r--connectivity/source/inc/mysql/YTables.hxx83
-rw-r--r--connectivity/source/inc/mysql/YUser.hxx82
-rw-r--r--connectivity/source/inc/mysql/YUsers.hxx62
-rw-r--r--connectivity/source/inc/mysql/YViews.hxx64
8 files changed, 688 insertions, 0 deletions
diff --git a/connectivity/source/inc/mysql/YCatalog.hxx b/connectivity/source/inc/mysql/YCatalog.hxx
new file mode 100644
index 000000000000..49450f17a342
--- /dev/null
+++ b/connectivity/source/inc/mysql/YCatalog.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_MYSQL_CATALOG_HXX
+#define CONNECTIVITY_MYSQL_CATALOG_HXX
+
+#include "connectivity/sdbcx/VCatalog.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+
+namespace connectivity
+{
+ namespace mysql
+ {
+ // please don't name the class the same name as in an other namespaces
+ // some compilers have problems with this task as I noticed on windows
+ class OAdabasConnection;
+ class OMySQLCatalog : public connectivity::sdbcx::OCatalog
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+
+ /** calls XDatabaseMetaData::getTables.
+ @param _sKindOfObject
+ The type of tables to be fetched.
+ @param _rNames
+ The container for the names to be filled. <OUT/>
+ */
+ void refreshObjects(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _sKindOfObject,TStringVector& _rNames);
+
+ public:
+ // implementation of the pure virtual methods
+ virtual void refreshTables();
+ virtual void refreshViews() ;
+ virtual void refreshGroups();
+ virtual void refreshUsers() ;
+
+ public:
+ OMySQLCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
+
+ inline sdbcx::OCollection* getPrivateTables() const { return m_pTables;}
+ inline sdbcx::OCollection* getPrivateViews() const { return m_pViews; }
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection() const { return m_xConnection; }
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ // ::cppu::OComponentHelper
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+#endif // CONNECTIVITY_MYSQL_CATALOG_HXX
+
diff --git a/connectivity/source/inc/mysql/YColumns.hxx b/connectivity/source/inc/mysql/YColumns.hxx
new file mode 100644
index 000000000000..e6b8a416c8b7
--- /dev/null
+++ b/connectivity/source/inc/mysql/YColumns.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_MYSQL_COLUMN_HXX
+#define CONNECTIVITY_MYSQL_COLUMN_HXX
+#include "connectivity/TColumnsHelper.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace mysql
+ {
+ class OMySQLColumns : public OColumnsHelper
+ {
+ protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ public:
+ OMySQLColumns( ::cppu::OWeakObject& _rParent
+ ,sal_Bool _bCase
+ ,::osl::Mutex& _rMutex
+ ,const TStringVector &_rVector
+ ,sal_Bool _bUseHardRef = sal_True
+ );
+ };
+
+ class OMySQLColumn;
+ typedef sdbcx::OColumn OMySQLColumn_BASE;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OMySQLColumn> OMySQLColumn_PROP;
+
+ class OMySQLColumn : public OMySQLColumn_BASE,
+ public OMySQLColumn_PROP
+ {
+ ::rtl::OUString m_sAutoIncrement;
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ public:
+ OMySQLColumn(sal_Bool _bCase);
+ virtual void construct();
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+#endif // CONNECTIVITY_MYSQL_COLUMN_HXX
+
diff --git a/connectivity/source/inc/mysql/YDriver.hxx b/connectivity/source/inc/mysql/YDriver.hxx
new file mode 100644
index 000000000000..dd231c87fda9
--- /dev/null
+++ b/connectivity/source/inc/mysql/YDriver.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_MYSQL_DRIVER_HXX
+#define CONNECTIVITY_MYSQL_DRIVER_HXX
+
+#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/CommonTools.hxx"
+
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ class OMetaConnection;
+
+ namespace mysql
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriverDelegator_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception );
+
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver
+ , ::com::sun::star::sdbcx::XDataDefinitionSupplier
+ , ::com::sun::star::lang::XServiceInfo
+ > ODriverDelegator_BASE;
+
+ typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,OMetaConnection*> TWeakConnectionPair;
+ typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
+ typedef ::std::vector< TWeakPair > TWeakPairVector;
+ DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >,TJDBCDrivers);
+ typedef enum
+ {
+ D_ODBC,
+ D_JDBC,
+ D_NATIVE
+ } T_DRIVERTYPE;
+
+
+ /** delegates all calls to the orignal driver and extend the existing one with the SDBCX layer.
+
+ */
+ class ODriverDelegator : public ::comphelper::OBaseMutex
+ ,public ODriverDelegator_BASE
+ {
+ TJDBCDrivers m_aJdbcDrivers; // all jdbc drivers
+ TWeakPairVector m_aConnections; // vector containing a list
+ // of all the Connection objects
+ // for this Driver
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xODBCDriver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xNativeDriver;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::rtl::OUString m_sOldDriverClass;
+ T_DRIVERTYPE m_eDriverType;
+
+ /** load the driver we want to delegate.
+ The <member>m_xODBCDriver</member> or <member>m_xDBCDriver</member> may be <NULL/> if the driver could not be loaded.
+ @param url
+ The URL.
+ @param info
+ The property info contains which driver we have to delegate.
+ @return
+ The driver which was currently selected.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > loadDriver( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info );
+
+ public:
+ /** creates a new delegator for a mysql driver
+ */
+ ODriverDelegator(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDriver
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDataDefinitionSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ protected:
+ /// dtor
+ virtual ~ODriverDelegator();
+ // OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ };
+ }
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+#endif // CONNECTIVITY_MYSQL_DRIVER_HXX
+
diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx
new file mode 100644
index 000000000000..4f660282748a
--- /dev/null
+++ b/connectivity/source/inc/mysql/YTable.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONNECTIVITY_MYSQL_TABLE_HXX
+#define CONNECTIVITY_MYSQL_TABLE_HXX
+
+#include "connectivity/TTableHelper.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+
+namespace connectivity
+{
+ namespace mysql
+ {
+
+ ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
+
+ class OMySQLTable;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper< OMySQLTable > OMySQLTable_PROP;
+ class OMySQLTable : public OTableHelper
+ ,public OMySQLTable_PROP
+ {
+ sal_Int32 m_nPrivileges; // we have to set our privileges by our own
+
+ /** executes the statmenmt.
+ @param _rStatement
+ The statement to execute.
+ */
+ void executeStatement(const ::rtl::OUString& _rStatement );
+ protected:
+
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames);
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames);
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames);
+
+ /** Returns always "RENAME TABLE " even for views.
+ *
+ * \return The start of the rename statement.
+ * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html
+ */
+ virtual ::rtl::OUString getRenameStart() const;
+
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with s_aMutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ public:
+ OMySQLTable( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
+ OMySQLTable( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ const ::rtl::OUString& _Name,
+ const ::rtl::OUString& _Type,
+ const ::rtl::OUString& _Description = ::rtl::OUString(),
+ const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
+ const ::rtl::OUString& _CatalogName = ::rtl::OUString(),
+ sal_Int32 _nPrivileges = 0
+ );
+
+ // ODescriptor
+ virtual void construct();
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ // XAlterTable
+ 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);
+ /** returns the ALTER TABLE XXX statement
+ */
+ ::rtl::OUString getAlterTableColumnPart();
+
+ // some methods to alter table structures
+ void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor);
+ void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName);
+ void dropDefaultValue(const ::rtl::OUString& _sNewDefault);
+
+ virtual ::rtl::OUString getTypeCreatePattern() const;
+ };
+ }
+}
+#endif // CONNECTIVITY_MYSQL_TABLE_HXX
+
diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx
new file mode 100644
index 000000000000..421012e3678e
--- /dev/null
+++ b/connectivity/source/inc/mysql/YTables.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_MYSQL_TABLES_HXX
+#define CONNECTIVITY_MYSQL_TABLES_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity
+{
+ namespace mysql
+ {
+ class OTables : public sdbcx::OCollection
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+
+ void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject);
+ public:
+ OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
+ ,m_xMetaData(_rMetaData)
+ {}
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ // XDrop
+ void appendNew(const ::rtl::OUString& _rsNewTable);
+ // some helper functions
+ /**
+ returns a sql string which contains the column definition part for create or alter statements
+ */
+ static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+ /**
+ returns the "not null" part or the default part of the table statement
+ */
+ static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+ /**
+ returns the corresponding typename
+ can contain () which have to filled with values
+ */
+ static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp);
+
+ /** convert the sql statement to fit MySQL notation
+ @param _sSql in/out
+ */
+ static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql);
+ };
+ }
+}
+#endif // CONNECTIVITY_MYSQL_TABLES_HXX
+
diff --git a/connectivity/source/inc/mysql/YUser.hxx b/connectivity/source/inc/mysql/YUser.hxx
new file mode 100644
index 000000000000..f546ae12443c
--- /dev/null
+++ b/connectivity/source/inc/mysql/YUser.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MYSQL_USER_HXX_
+#define _CONNECTIVITY_MYSQL_USER_HXX_
+
+#include "connectivity/sdbcx/VUser.hxx"
+#include "com/sun/star/sdbc/XConnection.hpp"
+
+namespace connectivity
+{
+ namespace mysql
+ {
+ typedef connectivity::sdbcx::OUser OUser_TYPEDEF;
+
+ class OMySQLUser : public OUser_TYPEDEF
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+
+ ::rtl::OUString getPrivilegeString(sal_Int32 nRights) const;
+ // return the privileges and additional the grant rights
+ void findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ public:
+ virtual void refreshGroups();
+ public:
+ OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
+ OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& _Name);
+
+ // XUser
+ virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+
+ class OUserExtend;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP;
+
+ class OUserExtend : public OMySQLUser,
+ public OUserExtend_PROP
+ {
+ protected:
+ ::rtl::OUString m_Password;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OUserExtend(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection);
+
+ virtual void construct();
+ };
+ }
+}
+#endif // _CONNECTIVITY_MYSQL_USER_HXX_
+
diff --git a/connectivity/source/inc/mysql/YUsers.hxx b/connectivity/source/inc/mysql/YUsers.hxx
new file mode 100644
index 000000000000..252925577d9b
--- /dev/null
+++ b/connectivity/source/inc/mysql/YUsers.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONNECTIVITY_MYSQL_USERS_HXX_
+#define _CONNECTIVITY_MYSQL_USERS_HXX_
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "com/sun/star/sdbc/XConnection.hpp"
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class IRefreshableUsers;
+ }
+ namespace mysql
+ {
+ class OUsers : public sdbcx::OCollection
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+ connectivity::sdbcx::IRefreshableUsers* m_pParent;
+ public:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+ public:
+ OUsers( ::cppu::OWeakObject& _rParent,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ connectivity::sdbcx::IRefreshableUsers* _pParent);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_MYSQL_USERS_HXX_
+
diff --git a/connectivity/source/inc/mysql/YViews.hxx b/connectivity/source/inc/mysql/YViews.hxx
new file mode 100644
index 000000000000..9fe5de9022f5
--- /dev/null
+++ b/connectivity/source/inc/mysql/YViews.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONNECTIVITY_MYSQL_VIEWS_HXX_
+#define _CONNECTIVITY_MYSQL_VIEWS_HXX_
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+namespace connectivity
+{
+ namespace mysql
+ {
+ class OViews : public sdbcx::OCollection
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+ sal_Bool m_bInDrop;
+ // OCatalog* m_pParent;
+ protected:
+ virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
+
+ void createView( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ public:
+ OViews(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector)
+ ,m_xMetaData(_rMetaData)
+ ,m_bInDrop(sal_False)
+ {}
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ void dropByNameImpl(const ::rtl::OUString& elementName);
+ };
+ }
+}
+#endif // _CONNECTIVITY_MYSQL_VIEWS_HXX_
+