incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1132862 - /incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Date Tue, 07 Jun 2011 05:14:26 GMT
Author: kwright
Date: Tue Jun  7 05:14:26 2011
New Revision: 1132862

URL: http://svn.apache.org/viewvc?rev=1132862&view=rev
Log:
Correct usage of ALTER TABLE to match capabilities of HSQLDB

Modified:
    incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java

Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1132862&r1=1132861&r2=1132862&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
(original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
Tue Jun  7 05:14:26 2011
@@ -349,7 +349,7 @@ public class DBInterfaceHSQLDB extends D
         while (i < columnDeleteList.size())
         {
           String columnName = columnDeleteList.get(i++);
-          performModification("ALTER TABLE "+tableName+" DROP "+columnName+" RESTRICT",null,invalidateKeys);
+          performModification("ALTER TABLE "+tableName+" DROP "+columnName,null,invalidateKeys);
         }
       }
 
@@ -362,24 +362,10 @@ public class DBInterfaceHSQLDB extends D
           StringBuilder sb;
           String columnName = iter.next();
           ColumnDescription cd = columnModifyMap.get(columnName);
-          String renameColumn = "__temp__";
           sb = new StringBuilder();
-          appendDescription(sb,renameColumn,cd,true);
+          appendDescription(sb,columnName,cd,false);
           // Rename current column.  This too involves a copy.
-          performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
-          performModification("UPDATE "+tableName+" SET "+renameColumn+"="+columnName,null,invalidateKeys);
-          performModification("ALTER TABLE "+tableName+" DROP "+columnName+" RESTRICT",null,invalidateKeys);
-          // Create new column
-          sb = new StringBuilder();
-          appendDescription(sb,columnName,cd,true);
-          performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
-          // Copy old data to new
-          performModification("UPDATE "+tableName+" SET "+columnName+"="+renameColumn,null,invalidateKeys);
-          // Make the column null, if it needs it
-          if (cd.getIsNull() == false)
-            performModification("ALTER TABLE "+tableName+" ALTER "+columnName+" SET NOT NULL",null,invalidateKeys);
-          // Drop old column
-          performModification("ALTER TABLE "+tableName+" DROP "+renameColumn+" RESTRICT",null,invalidateKeys);
+          performModification("ALTER TABLE "+tableName+" ALTER COLUMN "+sb.toString(),null,invalidateKeys);
         }
       }
 



Mime
View raw message