You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ba...@apache.org on 2005/06/03 05:02:48 UTC

svn commit: r179708 - /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet /incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient /incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook

Author: bandaram
Date: Thu Jun  2 20:02:47 2005
New Revision: 179708

URL: http://svn.apache.org/viewcvs?rev=179708&view=rev
Log:
Address dblook change missed by previous checkins and update master files.
Dblook shouldn't be generating DEFAULT GENERATED_BY_IDENTITY string for identity columns. Also updated master files correctly.

Submitted by Satheesh Bandaram(satheesh@sourcery.org)

Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
    incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook/DB_Table.java

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net.out?rev=179708&r1=179707&r2=179708&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net.out Thu Jun  2 20:02:47 2005
@@ -309,6 +309,36 @@
 null
 null
 -----
+T3_2
+B
+2
+BLOB(20)
+null
+null
+<autoincval>
+null
+null
+-----
+T3_2
+ID
+3
+INTEGER NOT NULL
+GENERATED_BY_DEFAULT
+<systemid>
+<autoincval>
+2
+4
+-----
+T3_2
+P1
+1
+VARCHAR(10)
+'okie'
+<systemid>
+<autoincval>
+null
+null
+-----
 T4
 I
 1
@@ -339,6 +369,36 @@
 1
 1
 -----
+T4_2
+I
+1
+INTEGER
+2
+<systemid>
+<autoincval>
+null
+null
+-----
+T4_2
+J
+2
+INTEGER NOT NULL
+null
+null
+<autoincval>
+null
+null
+-----
+T4_2
+K
+3
+INTEGER NOT NULL
+GENERATED_BY_DEFAULT
+<systemid>
+<autoincval>
+1
+1
+-----
 T5
 COST
 1
@@ -840,6 +900,15 @@
 <systemid>
 -----
 BAR
+T3_2
+<systemnumber>
+T3_2
+false
+null
+false
+<systemid>
+-----
+BAR
 T4
 <systemnumber>
 IX4
@@ -858,6 +927,15 @@
 <systemid>
 -----
 BAR
+T4_2
+<systemnumber>
+T4_2
+false
+null
+false
+<systemid>
+-----
+BAR
 T8
 <systemnumber>
 <systemname>
@@ -1549,8 +1627,20 @@
 BAR
 R
 -----
+T3_2
+T3_2
+T
+BAR
+R
+-----
 T4
 T4
+T
+BAR
+R
+-----
+T4_2
+T4_2
 T
 BAR
 R

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net.out?rev=179708&r1=179707&r2=179708&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net.out Thu Jun  2 20:02:47 2005
@@ -309,6 +309,36 @@
 null
 null
 -----
+T3_2
+B
+2
+BLOB(20)
+null
+null
+<autoincval>
+null
+null
+-----
+T3_2
+ID
+3
+INTEGER NOT NULL
+GENERATED_BY_DEFAULT
+<systemid>
+<autoincval>
+2
+4
+-----
+T3_2
+P1
+1
+VARCHAR(10)
+'okie'
+<systemid>
+<autoincval>
+null
+null
+-----
 T4
 I
 1
@@ -339,6 +369,36 @@
 1
 1
 -----
+T4_2
+I
+1
+INTEGER
+2
+<systemid>
+<autoincval>
+null
+null
+-----
+T4_2
+J
+2
+INTEGER NOT NULL
+null
+null
+<autoincval>
+null
+null
+-----
+T4_2
+K
+3
+INTEGER NOT NULL
+GENERATED_BY_DEFAULT
+<systemid>
+<autoincval>
+1
+1
+-----
 T5
 COST
 1
@@ -840,6 +900,15 @@
 <systemid>
 -----
 BAR
+T3_2
+<systemnumber>
+T3_2
+false
+null
+false
+<systemid>
+-----
+BAR
 T4
 <systemnumber>
 IX4
@@ -858,6 +927,15 @@
 <systemid>
 -----
 BAR
+T4_2
+<systemnumber>
+T4_2
+false
+null
+false
+<systemid>
+-----
+BAR
 T8
 <systemnumber>
 <systemname>
@@ -1549,8 +1627,20 @@
 BAR
 R
 -----
+T3_2
+T3_2
+T
+BAR
+R
+-----
 T4
 T4
+T
+BAR
+R
+-----
+T4_2
+T4_2
 T
 BAR
 R

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out?rev=179708&r1=179707&r2=179708&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out Thu Jun  2 20:02:47 2005
@@ -316,7 +316,7 @@
 ID
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 2
@@ -386,7 +386,7 @@
 K
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 1
@@ -2192,7 +2192,7 @@
 ID
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 2
@@ -2262,7 +2262,7 @@
 K
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 1
@@ -3853,7 +3853,7 @@
 ID
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 2
@@ -3923,7 +3923,7 @@
 K
 3
 INTEGER NOT NULL
-null
+GENERATED_BY_DEFAULT
 <systemid>
 <autoincval>
 1

Modified: incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook/DB_Table.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook/DB_Table.java?rev=179708&r1=179707&r2=179708&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook/DB_Table.java (original)
+++ incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook/DB_Table.java Thu Jun  2 20:02:47 2005
@@ -146,11 +146,11 @@
 				dblook.stripQuotes(colName))));
 			colDef.append(" ");
 			colDef.append(rs.getString(1));
-			if (rs.getString(2) != null) {
+			if (!reinstateAutoIncrement(colName, tableId, colDef) &&
+						 rs.getString(2) != null) {
 				colDef.append(" DEFAULT ");
 				colDef.append(rs.getString(2));
 			}
-			reinstateAutoIncrement(colName, tableId, colDef);
 		}
 
 		rs.close();
@@ -159,15 +159,15 @@
 	}
 
 	/* ************************************************
-	 * Generate autoincrement DDL for a given column.
+	 * Generate autoincrement DDL for a given column and write it to
+	 * received StringBuffer
 	 * @param colName: Name of column that is autoincrement.
 	 * @param tableId: Id of table in which column exists.
 	 * @param colDef: StringBuffer to which DDL will be added.
-	 * @return The DDL for all autoincrement columns
-	 *  has been written to the received string buffer.
+	 * @return True if autoincrement DDL has been generated.
 	 ****/
 
-	public static void reinstateAutoIncrement(String colName,
+	public static boolean reinstateAutoIncrement(String colName,
 		String tableId, StringBuffer colDef) throws SQLException
 	{
 
@@ -186,10 +186,11 @@
 				colDef.append(", INCREMENT BY ");
 				colDef.append(autoIncCols.getLong(2));
 				colDef.append(")");
+				return true;
 			}
 		}
 
-		return;
+		return false;
 
 	}