aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabine Heider2013-01-07 05:29:18 (EST)
committertware2013-01-10 13:53:57 (EST)
commitb53c96d3158f337c56e0b8774242346475827fa9 (patch)
tree0654b50de8b9871787af0ddd8cc4f89ec62e218e
parente73b77f46711d0c0bfa67e2464a061512c8c8cdb (diff)
downloadeclipselink.runtime-b53c96d3158f337c56e0b8774242346475827fa9.zip
eclipselink.runtime-b53c96d3158f337c56e0b8774242346475827fa9.tar.gz
eclipselink.runtime-b53c96d3158f337c56e0b8774242346475827fa9.tar.bz2
Allow the database platform to modify the ALTER TABLE ADD <column> clause.
Bug #397558 Signed-off-by: Sabine Heider <sabine.heider@sap.com>
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java13
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/tools/schemaframework/TableDefinition.java5
2 files changed, 15 insertions, 3 deletions
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java
index 126f9df..bf09502 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/databaseaccess/DatabasePlatform.java
@@ -3269,4 +3269,17 @@ public class DatabasePlatform extends DatasourcePlatform {
*/
public void initializeConnectionData(Connection connection) throws SQLException {
}
+
+ /**
+ * INTERNAL:
+ * May need to override this method if the platform supports ALTER TABLE ADD &lt;column&gt;
+ * and the generated sql doesn't work.
+ * Write the string that follows ALTER TABLE to create a sql statement for
+ * the platform in order to append a new column to an existing table.
+ */
+ public void writeAddColumnClause(Writer writer, AbstractSession session, TableDefinition table, FieldDefinition field) throws IOException {
+ writer.write("ADD ");
+ field.appendDBString(writer, session, table);
+ }
+
}
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/tools/schemaframework/TableDefinition.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/tools/schemaframework/TableDefinition.java
index 392326c..a144907 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/tools/schemaframework/TableDefinition.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/tools/schemaframework/TableDefinition.java
@@ -131,9 +131,8 @@ public class TableDefinition extends DatabaseObjectDefinition {
*/
public Writer buildAddFieldWriter(AbstractSession session, FieldDefinition field, Writer writer) throws ValidationException {
try {
- writer.write("ALTER TABLE " + getFullName());
- writer.write(" ADD " );
- field.appendDBString(writer, session, this);
+ writer.write("ALTER TABLE " + getFullName() + " ");
+ session.getPlatform().writeAddColumnClause(writer, session, this, field);
writer.write(" ");
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);