empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r747615 - in /incubator/empire-db/trunk/empire-db/src: main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java test/java/org/apache/empire/commons/AttributesTest.java
Date Tue, 24 Feb 2009 23:36:14 GMT
Author: francisdb
Date: Tue Feb 24 23:36:14 2009
New Revision: 747615

URL: http://svn.apache.org/viewvc?rev=747615&view=rev
Log:
derby driver now works in the advanced sample app

Modified:
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
    incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/commons/AttributesTest.java

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java?rev=747615&r1=747614&r2=747615&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
(original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
Tue Feb 24 23:36:14 2009
@@ -424,7 +424,7 @@
         {
             DBTableColumn c = (DBTableColumn) columns.next();
             sql.append((addSeparator) ? ",\r\n   " : "\r\n   ");
-            if (appendColumnDesc(c, sql)==false)
+            if (appendColumnDesc(c, sql, false)==false)
                 continue; // Ignore and continue;
             addSeparator = true;
         }
@@ -496,11 +496,15 @@
      * @param sql the sql builder object
      * @return true if the column was successfully appended or false otherwise
      */
-    private boolean appendColumnDesc(DBTableColumn c, StringBuilder sql)
+    private boolean appendColumnDesc(DBTableColumn c, StringBuilder sql, boolean alter)
     {
         // Append name
         c.addSQL(sql, DBExpr.CTX_NAME);
-        sql.append(" ");
+        if(alter){
+        	sql.append(" SET DATA TYPE ");
+        }else{
+        	sql.append(" ");
+        }
         switch (c.getDataType())
         {
             case INTEGER:
@@ -656,11 +660,11 @@
         {
             case CREATE:
                 sql.append(" ADD ");
-                appendColumnDesc(col, sql);
+                appendColumnDesc(col, sql, false);
                 break;
             case ALTER:
-                sql.append(" MODIFY ");
-                appendColumnDesc(col, sql);
+                sql.append(" ALTER ");
+                appendColumnDesc(col, sql, true);
                 break;
             case DROP:
                 sql.append(" DROP COLUMN ");

Modified: incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/commons/AttributesTest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/commons/AttributesTest.java?rev=747615&r1=747614&r2=747615&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/commons/AttributesTest.java
(original)
+++ incubator/empire-db/trunk/empire-db/src/test/java/org/apache/empire/commons/AttributesTest.java
Tue Feb 24 23:36:14 2009
@@ -5,7 +5,6 @@
 
 import static org.junit.Assert.*;
 
-import java.util.Calendar;
 import java.util.Random;
 
 import javax.xml.parsers.DocumentBuilder;



Mime
View raw message