Author: tomdz
Date: Tue May  2 15:19:08 2006
New Revision: 399067

URL: http://svn.apache.org/viewcvs?rev=399067&view=rev
Log:
Added redefinable method for creating the temporary table sql within the 
alteration algorithm

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java

Modified: 
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL: 
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=399067&r1=399066&r2=399067&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java 
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java Tue 
May  2 15:19:08 2006
@@ -768,10 +768,10 @@
         Map   parameters      = null;
         Table sourceTable     = currentModel.findTable(tableName, 
getPlatform().isDelimitedIdentifierModeOn());
         Table targetTable     = desiredModel.findTable(tableName, 
getPlatform().isDelimitedIdentifierModeOn());
-        Table tempTable       = createTemporaryTable(desiredModel, 
targetTable);
-        Table realTargetTable = createRealTargetTable(desiredModel, 
sourceTable, targetTable);
+        Table tempTable       = getTemporaryTableFor(desiredModel, 
targetTable);
+        Table realTargetTable = getRealTargetTableFor(desiredModel, 
sourceTable, targetTable);
 
-        createTable(desiredModel, tempTable, parameters);
+        createTemporaryTable(desiredModel, tempTable, parameters);
         writeCopyDataStatement(sourceTable, tempTable);
         // Note that we don't drop the indices here because the DROP TABLE 
will take care of that
         // Likewise, foreign keys have already been dropped as necessary
@@ -782,7 +782,7 @@
     }
 
     /**
-     * Creates a temporary table that corresponds to the given table.
+     * Creates a temporary table object that corresponds to the given table.
      * Database-specific implementations may redefine this method if e.g. the
      * database directly supports temporary tables. The default implementation
      * simply appends an underscore to the table name and uses that as the
@@ -792,7 +792,7 @@
      * @param targetTable The target table
      * @return The temporary table
      */
-    protected Table createTemporaryTable(Database targetModel, Table 
targetTable) throws IOException
+    protected Table getTemporaryTableFor(Database targetModel, Table 
targetTable) throws IOException
     {
         Table table = new Table();
 
@@ -816,7 +816,20 @@
     }
 
     /**
-     * Creates the target table that differs from the given target table only 
in the
+     * Outputs the DDL to create the given temporary table. Per default this 
is simply
+     * a call to [EMAIL PROTECTED] #createTable(Database, Table, Map)}.
+     * 
+     * @param database   The database model
+     * @param table      The table
+     * @param parameters Additional platform-specific parameters for the table 
creation
+     */
+    protected void createTemporaryTable(Database database, Table table, Map 
parameters) throws IOException 
+    {
+        createTable(database, table, parameters);
+    }
+
+    /**
+     * Creates the target table object that differs from the given target 
table only in the
      * indices. More specifically, only those indices are used that have not 
changed.
      * 
      * @param targetModel The target database
@@ -824,7 +837,7 @@
      * @param targetTable The target table
      * @return The table
      */
-    protected Table createRealTargetTable(Database targetModel, Table 
sourceTable, Table targetTable) throws IOException
+    protected Table getRealTargetTableFor(Database targetModel, Table 
sourceTable, Table targetTable) throws IOException
     {
         Table table = new Table();
 
@@ -1319,7 +1332,7 @@
         createTable(database, table, null); 
     }
 
-    /** 
+    /**
      * Outputs the DDL to create the table along with any non-external 
constraints as well
      * as with external primary keys and indices (but not foreign keys).
      * 


Reply via email to