Permalink
Browse files

NEW - bug 249013: MySQL: catalogs and schemas inconsistent with other…

  • Loading branch information...
1 parent 0e9d243 commit 7185b3a089058db80aedad4800e62db643cddf63 @bfitzpat bfitzpat committed Apr 6, 2009
Showing with 1,144 additions and 749 deletions.
  1. +1 −0 plugins/org.eclipse.datatools.enablement.mysql/META-INF/MANIFEST.MF
  2. +133 −1 plugins/org.eclipse.datatools.enablement.mysql/plugin.xml
  3. +4 −19 ...tools.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogColumn.java
  4. +39 −34 ...ols.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogDatabase.java
  5. +5 −6 ...s.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogForeignKey.java
  6. +4 −4 ...atools.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogIndex.java
  7. +4 −5 ...s.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogPrimaryKey.java
  8. +2 −1 ...ols.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogProvider.java
  9. +6 −112 ...tools.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogSchema.java
  10. +26 −567 ...atools.enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/MySqlCatalogTable.java
  11. +45 −0 ...ablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlRoutineLoader.java
  12. +51 −0 ...nablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlSchemaLoader.java
  13. +92 −0 ...ment.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlTableColumnLoader.java
  14. +396 −0 ....mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlTableConstraintLoader.java
  15. +155 −0 ...ement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlTableIndexLoader.java
  16. +181 −0 ...enablement.mysql/src/org/eclipse/datatools/enablement/mysql/catalog/loaders/MySqlTableLoader.java
@@ -16,6 +16,7 @@ Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)",
Export-Package: org.eclipse.datatools.enablement.internal.mysql.connection,
org.eclipse.datatools.enablement.mysql;x-internal:=true,
org.eclipse.datatools.enablement.mysql.catalog;x-internal:=true,
+ org.eclipse.datatools.enablement.mysql.catalog.loaders,
org.eclipse.datatools.enablement.mysql.ddl;x-internal:=true,
org.eclipse.datatools.enablement.mysql.ddl.shared
Eclipse-LazyStart: true
@@ -19,7 +19,7 @@
</generator>
</extension>
- <extension
+ <extension
point="org.eclipse.datatools.connectivity.sqm.core.catalog">
<catalog
version="4.1"
@@ -346,4 +346,136 @@
</properties>
</driverTemplate>
</extension>
+ <extension
+ point="org.eclipse.datatools.connectivity.sqm.core.catalog">
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.TableConstraint"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableConstraintLoader"
+ version="5.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Table"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableLoader"
+ version="5.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Column"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableColumnLoader"
+ version="5.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.Index"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableIndexLoader"
+ version="5.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.routines.Routine"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlRoutineLoader"
+ version="5.1">
+ </overrideLoader>
+ </extension>
+ <extension
+ point="org.eclipse.datatools.connectivity.sqm.core.catalog">
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.TableConstraint"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableConstraintLoader"
+ version="5.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Table"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableLoader"
+ version="5.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Column"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableColumnLoader"
+ version="5.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.Index"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableIndexLoader"
+ version="5.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.routines.Routine"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlRoutineLoader"
+ version="5.0">
+ </overrideLoader>
+ </extension>
+ <extension
+ point="org.eclipse.datatools.connectivity.sqm.core.catalog">
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.TableConstraint"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableConstraintLoader"
+ version="4.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Table"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableLoader"
+ version="4.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Column"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableColumnLoader"
+ version="4.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.Index"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableIndexLoader"
+ version="4.1">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.routines.Routine"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlRoutineLoader"
+ version="4.1">
+ </overrideLoader>
+ </extension>
+ <extension
+ point="org.eclipse.datatools.connectivity.sqm.core.catalog">
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.TableConstraint"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableConstraintLoader"
+ version="4.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Table"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableLoader"
+ version="4.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.tables.Column"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableColumnLoader"
+ version="4.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.constraints.Index"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlTableIndexLoader"
+ version="4.0">
+ </overrideLoader>
+ <overrideLoader
+ eclass="org.eclipse.datatools.modelbase.sql.routines.Routine"
+ product="MySql"
+ provider="org.eclipse.datatools.enablement.mysql.catalog.loaders.MySqlRoutineLoader"
+ version="4.0">
+ </overrideLoader>
+ </extension>
</plugin>
@@ -1,38 +1,28 @@
/*******************************************************************************
- * Copyright (c) 2005 Versant Corporation and others.
+ * Copyright (c) 2005, 2009 Versant Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Versant Corporation - initial API and implementation
+ * brianf - updates to make catalog loaders work with filtering
*******************************************************************************/
package org.eclipse.datatools.enablement.mysql.catalog;
import java.sql.Connection;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.datatools.connectivity.sqm.core.rte.RefreshManager;
+import org.eclipse.datatools.connectivity.sqm.core.rte.jdbc.JDBCColumn;
import org.eclipse.datatools.modelbase.sql.schema.Database;
-import org.eclipse.datatools.modelbase.sql.schema.IdentitySpecifier;
-import org.eclipse.datatools.modelbase.sql.tables.impl.ColumnImpl;
/**
* This class holds the column information
*/
-public class MySqlCatalogColumn extends ColumnImpl implements ICatalogObject {
+public class MySqlCatalogColumn extends JDBCColumn {
private static final long serialVersionUID = 3257008765202151480L;
- public void refresh() {
- RefreshManager.getInstance().referesh(this);
- }
-
- public boolean isSystemObject() {
- return false;
- }
-
public Connection getConnection() {
Database database = this.getCatalogDatabase();
return ((MySqlCatalogDatabase) database).getConnection();
@@ -41,9 +31,4 @@ public Connection getConnection() {
public Database getCatalogDatabase() {
return this.getTable().getSchema().getDatabase();
}
-
- public IdentitySpecifier getIdentitySpecifier() {
- return this.identitySpecifier;
- }
-
}
@@ -1,68 +1,73 @@
/*******************************************************************************
- * Copyright (c) 2005 Versant Corporation and others. All rights reserved. This
+ * Copyright (c) 2005, 2009 Versant Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Versant Corporation - initial API and implementation
+ * brianf - updates to make catalog loading work with filtering
******************************************************************************/
package org.eclipse.datatools.enablement.mysql.catalog;
import java.sql.Connection;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
import org.eclipse.datatools.connectivity.sqm.core.rte.RefreshManager;
-import org.eclipse.datatools.modelbase.sql.schema.Database;
+import org.eclipse.datatools.connectivity.sqm.core.rte.jdbc.JDBCDatabase;
import org.eclipse.datatools.modelbase.sql.schema.SQLSchemaPackage;
import org.eclipse.datatools.modelbase.sql.schema.Schema;
-import org.eclipse.datatools.modelbase.sql.schema.impl.DatabaseImpl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
/**
* This is the Database implementation, and contains schemas (MySql does not
* have schemas)
*/
-public class MySqlCatalogDatabase extends DatabaseImpl implements ICatalogObject {
-
- private static final long serialVersionUID = 3906091161042301493L;
-
- private Connection connection;
+public class MySqlCatalogDatabase extends JDBCDatabase {
+
+ private Boolean schemasLoaded = Boolean.FALSE;
+ private Boolean catalogsLoaded = Boolean.FALSE;
- public MySqlCatalogDatabase(Connection connection) {
- super();
- if (connection == null) {
- System.err.println("null connection"); //$NON-NLS-1$
- throw new RuntimeException();
- }
- this.connection = connection;
+ public MySqlCatalogDatabase(Connection connection){
+ super(connection);
}
public void refresh() {
- if (schemas != null) {
- schemas.clear();
- schemas = null;
+ synchronized (schemasLoaded) {
+ if (schemasLoaded.booleanValue()) {
+ schemasLoaded = Boolean.FALSE;
+ }
}
+
RefreshManager.getInstance().referesh(this);
}
- public Connection getConnection() {
- return connection;
+ public EList getSchemas() {
+ synchronized (schemasLoaded) {
+ if(!schemasLoaded.booleanValue()) {
+ if (schemas == null) {
+ schemas = new EObjectWithInverseResolvingEList(Schema.class, this,
+ SQLSchemaPackage.DATABASE__SCHEMAS,
+ SQLSchemaPackage.SCHEMA__DATABASE);
+ Schema schema = new MySqlCatalogSchema();
+ schema.setName(getName());
+ schemas.add(schema);
+ }
+ return this.schemas;
+ }
+ }
+ return super.getSchemas();
}
- public Database getCatalogDatabase() {
- return this;
- }
-
- public EList getSchemas() {
- if (schemas == null) {
- schemas = new EObjectWithInverseResolvingEList(Schema.class, this,
- SQLSchemaPackage.DATABASE__SCHEMAS,
- SQLSchemaPackage.SCHEMA__DATABASE);
- Schema schema = new MySqlCatalogSchema();
- schema.setName(getName());
- schemas.add(schema);
+ public EList getCatalogs() {
+ synchronized (catalogsLoaded) {
+ if(!catalogsLoaded.booleanValue()) {
+ if (catalogs == null) {
+ catalogs = new EObjectWithInverseResolvingEList(Schema.class, this,
+ SQLSchemaPackage.DATABASE__CATALOGS,
+ SQLSchemaPackage.SCHEMA__DATABASE);
+ }
+ }
}
- return this.schemas;
+ return catalogs;
}
}
@@ -1,23 +1,23 @@
/*******************************************************************************
- * Copyright (c) 2005 Versant Corporation and others.
+ * Copyright (c) 2005, 2009 Versant Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Versant Corporation - initial API and implementation
+ * Sybase, Inc. - updates to make catalog loaders work with filtering
*******************************************************************************/
package org.eclipse.datatools.enablement.mysql.catalog;
import java.sql.Connection;
import java.util.Iterator;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
+import org.eclipse.datatools.connectivity.sqm.core.rte.jdbc.JDBCForeignKey;
import org.eclipse.datatools.connectivity.sqm.internal.core.RDBCorePlugin;
import org.eclipse.datatools.modelbase.sql.constraints.ForeignKey;
import org.eclipse.datatools.modelbase.sql.constraints.SQLConstraintsPackage;
-import org.eclipse.datatools.modelbase.sql.constraints.impl.ForeignKeyImpl;
import org.eclipse.datatools.modelbase.sql.schema.Database;
import org.eclipse.datatools.modelbase.sql.tables.Column;
import org.eclipse.emf.common.util.EList;
@@ -27,8 +27,7 @@
/**
* This class is the ForeignKey implementation
*/
-public class MySqlCatalogForeignKey extends ForeignKeyImpl implements
- ICatalogObject {
+public class MySqlCatalogForeignKey extends JDBCForeignKey {
private static final long serialVersionUID = 3833460717268643894L;
@@ -99,7 +98,7 @@ public static void setAsIdentifyingRelatinship(ForeignKey fk,
new String());
}
- private boolean isIdentifyingRelationship(EList columns) {
+ public boolean isIdentifyingRelationship(EList columns) {
boolean isIdentifying = true;
Iterator it = columns.iterator();
while (it.hasNext()) {
@@ -1,25 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2005 Versant Corporation and others.
+ * Copyright (c) 2005, 2009 Versant Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Versant Corporation - initial API and implementation
+ * brianf - updates to make catalog loading work with filters
*******************************************************************************/
package org.eclipse.datatools.enablement.mysql.catalog;
import java.sql.Connection;
-import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
-import org.eclipse.datatools.modelbase.sql.constraints.impl.IndexImpl;
+import org.eclipse.datatools.connectivity.sqm.core.rte.jdbc.JDBCIndex;
import org.eclipse.datatools.modelbase.sql.schema.Database;
/**
* This class is the Index implementation
*/
-public class MySqlCatalogIndex extends IndexImpl implements ICatalogObject {
+public class MySqlCatalogIndex extends JDBCIndex {
private static final long serialVersionUID = 4121975841161754672L;
Oops, something went wrong.

0 comments on commit 7185b3a

Please sign in to comment.