Commits

tbrugz committed 26b587b

model: DBObject: added getQualifiedName() ; + TableDiff change

Comments (0)

Files changed (2)

src/tbrugz/sqldump/dbmodel/DBObject.java

 		return name.compareTo(o.name);
 	}
 	
+	public String getQualifiedName() {
+		return (schemaName!=null?schemaName+".":"")+name;
+	}
+
+	public String getFinalQualifiedName() {
+		return getFinalQualifiedName(true);
+	}
+	
+	public String getFinalQualifiedName(boolean dumpschema) {
+		return ((dumpschema && schemaName!=null)?
+				sqlIddecorator.get(schemaName)+".":"")+sqlIddecorator.get(name);
+	}
+	
 	//XXX: move to DBIdentifiable?
 	public static DBObject findDBObjectBySchemaAndName(Collection<? extends DBObject> col, String schemaName, String name) {
 		for(DBObject obj: col) {

src_diff/tbrugz/sqldiff/model/TableDiff.java

 		//constraints
 		//XXX: constraints should be dumper in defined order (FKs at end)
 		List<DBIdentifiableDiff> dbiddiffs = new ArrayList<DBIdentifiableDiff>();
-		diffs(DBObjectType.CONSTRAINT, dbiddiffs, origTable.getConstraints(), newTable.getConstraints(), origTable.getName(), newTable.getName());
+		diffs(DBObjectType.CONSTRAINT, dbiddiffs, origTable.getConstraints(), newTable.getConstraints(), origTable.getQualifiedName(), newTable.getQualifiedName());
 		//FIXedME: schemaname dumps as null
 		for(int i=0;i<dbiddiffs.size();i++) {
 			dbiddiffs.get(i).ident().setSchemaName(newTable.getSchemaName());