1. tbrugz
  2. sqldump

Commits

tbrugz  committed fd46d94

sqldump/jdbcgrabber: removed DBObjectId class from sqldump.dbmodel package

  • Participants
  • Parent commits 9890b97
  • Branches default

Comments (0)

Files changed (3)

File src/tbrugz/sqldump/JDBCSchemaGrabber.java

View file
  • Ignore whitespace
 import tbrugz.sqldump.dbmodel.Table;
 import tbrugz.sqldump.dbmodel.TableType;
 import tbrugz.sqldump.dbmodel.Constraint.ConstraintType;
-import tbrugz.sqldump.dbmodel.DBObject.DBObjectId;
 import tbrugz.sqldump.dbmodel.View;
 import tbrugz.sqldump.def.DBMSFeatures;
 import tbrugz.sqldump.def.DBMSResources;
 import tbrugz.sqldump.util.ParametrizedProperties;
 import tbrugz.sqldump.util.Utils;
 
+class DBObjectId extends DBIdentifiable {
+	@Override
+	public String getDefinition(boolean dumpSchemaName) {
+		return null;
+	}
+}
+
 /*
  * TODOne: accept list of schemas to grab/dump
  * TODO: accept list of tables/objects to grab/dump, types of objects to grab/dump
 		Set<DBObjectId> ids = new HashSet<DBObjectId>();
 		for(FK fk: schemaModel.getForeignKeys()) {
 			DBObjectId dbid = new DBObjectId();
-			dbid.name = fk.pkTable;
-			dbid.schemaName = fk.pkTableSchemaName;
+			dbid.setName(fk.pkTable);
+			dbid.setSchemaName(fk.pkTableSchemaName);
 			ids.add(dbid);
 	
 			//Exported FKs
 			if(grabExportedFKsAlso) {
 				DBObjectId dbidFk = new DBObjectId();
-				dbidFk.name = fk.fkTable;
-				dbidFk.schemaName = fk.fkTableSchemaName;
+				dbidFk.setName(fk.fkTable);
+				dbidFk.setSchemaName(fk.fkTableSchemaName);
 				ids.add(dbidFk);
 			}
 			
 		}
 		for(DBObjectId id: ids) {
 			//if(!schemaPattern.equals(id.schemaName) && !containsTableWithSchemaAndName(schemaModel.tables, id.schemaName, id.name)) {
-			if(!containsTableWithSchemaAndName(schemaModel.getTables(), id.schemaName, id.name)) {
-				log.debug("recursivegrab-grabschema: "+id.schemaName+"."+id.name);
-				grabRelations(schemaModel, dbmd, dbmsfeatures, id.schemaName, id.name, true);				
+			if(!containsTableWithSchemaAndName(schemaModel.getTables(), id.getSchemaName(), id.getName())) {
+				log.debug("recursivegrab-grabschema: "+id.getSchemaName()+"."+id.getName());
+				grabRelations(schemaModel, dbmd, dbmsfeatures, id.getSchemaName(), id.getName(), true);				
 			}
 		}
 	}

File src/tbrugz/sqldump/dbmodel/DBIdentifiable.java

View file
  • Ignore whitespace
 
 import javax.xml.bind.annotation.XmlTransient;
 
+//XXX implement Comparable<DBIdentifiable>? 
 public abstract class DBIdentifiable {
 	String schemaName;
 

File src/tbrugz/sqldump/dbmodel/DBObject.java

View file
  • Ignore whitespace
 	//public static transient boolean dumpQuoteAll = true;
 	//public static transient String dumpIdentifierQuoteString = "\"";
 
-	public static class DBObjectId implements Comparable<DBObjectId> {
-		public String schemaName;
-		public String name;
-		
-		@Override
-		public boolean equals(Object obj) {
-			if(obj instanceof DBObjectId) {
-				DBObjectId oid = (DBObjectId) obj;
-				return name.equals(oid.name) && schemaName.equals(oid.schemaName);
-			}
-			return false;
-		}
-
-		public int compareTo(DBObjectId o) {
-			int comp = schemaName.compareTo(o.schemaName);
-			if(comp!=0) return comp;
-			return name.compareTo(o.name);
-		}
-	}
-	
-	/*public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}*/
-	
 	//XXX: getDefinition() should have 'sql dialect' param?
 	public abstract String getDefinition(boolean dumpSchemaName);