Fixed some StringBuilder wonkiness.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2488 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2008-11-19 23:32:59 +00:00
parent d7321d2c20
commit 9ca07c08df
@@ -103,26 +103,32 @@ public class PostgreSQLLiaison extends BaseLiaison
executeQuery( executeQuery(
conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) + conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) +
" TYPE " + type); " TYPE " + type);
lbuf.append("type=" + type); lbuf.append("type=").append(type);
} }
if (nullable != null) { if (nullable != null) {
executeQuery( executeQuery(
conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) + conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) +
" " + (nullable.booleanValue() ? "SET NOT NULL" : "DROP NOT NULL")); " " + (nullable ? "SET NOT NULL" : "DROP NOT NULL"));
if (lbuf.length() > 0) lbuf.append(", "); if (lbuf.length() > 0) {
lbuf.append("nullable=" + nullable); lbuf.append(", ");
}
lbuf.append("nullable=").append(nullable);
} }
if (unique != null) { if (unique != null) {
// TODO: I think this requires ALTER TABLE DROP CONSTRAINT and so on // TODO: I think this requires ALTER TABLE DROP CONSTRAINT and so on
if (lbuf.length() > 0) lbuf.append(", "); if (lbuf.length() > 0) {
lbuf.append("unique=" + unique + " (not implemented yet)"); lbuf.append(", ");
}
lbuf.append("unique=").append(unique).append(" (not implemented yet)");
} }
if (defaultValue != null) { if (defaultValue != null) {
executeQuery( executeQuery(
conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) + conn, "ALTER TABLE " + tableSQL(table) + " ALTER COLUMN " + columnSQL(column) +
" " + (defaultValue.length() > 0 ? "SET DEFAULT " + defaultValue : "DROP DEFAULT")); " " + (defaultValue.length() > 0 ? "SET DEFAULT " + defaultValue : "DROP DEFAULT"));
if (lbuf.length() > 0) lbuf.append(", "); if (lbuf.length() > 0) {
lbuf.append("defaultValue=" + defaultValue); lbuf.append(", ");
}
lbuf.append("defaultValue=").append(defaultValue);
} }
log.info("Database column '" + column + "' of table '" + table + "' modified to have " + log.info("Database column '" + column + "' of table '" + table + "' modified to have " +
"definition [" + lbuf + "]."); "definition [" + lbuf + "].");