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 03:25:30 UTC
svn commit: r179693 -
/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master
/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools
/incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/dblook
Author: bandaram
Date: Thu Jun 2 18:25:29 2005
New Revision: 179693
URL: http://svn.apache.org/viewcvs?rev=179693&view=rev
Log:
Derby-308: Enhance dblook to handle BY DEFAULT IDENTITY columns.
Submitted by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)
Modified:
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out
incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB.sql
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/dblook_test.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test.out?rev=179693&r1=179692&r2=179693&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 18:25:29 2005
@@ -302,6 +302,36 @@
null
null
----
+T3_2
+B
+2
+BLOB(20)
+null
+null
+<autoincval>
+null
+null
+----
+T3_2
+ID
+3
+INTEGER NOT NULL
+null
+<systemid>
+<autoincval>
+2
+4
+----
+T3_2
+P1
+1
+VARCHAR(10)
+'okie'
+<systemid>
+<autoincval>
+null
+null
+----
T4
I
1
@@ -332,6 +362,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
+null
+<systemid>
+<autoincval>
+1
+1
+----
T5
COST
1
@@ -833,6 +893,15 @@
<systemid>
----
BAR
+T3_2
+<systemnumber>
+T3_2
+false
+null
+false
+<systemid>
+----
+BAR
T4
<systemnumber>
IX4
@@ -851,6 +920,15 @@
<systemid>
----
BAR
+T4_2
+<systemnumber>
+T4_2
+false
+null
+false
+<systemid>
+----
+BAR
T8
<systemnumber>
<systemname>
@@ -1542,12 +1620,24 @@
BAR
R
----
+T3_2
+T3_2
+T
+BAR
+R
+----
T4
T4
T
BAR
R
----
+T4_2
+T4_2
+T
+BAR
+R
+----
T5
T5
T
@@ -2088,6 +2178,36 @@
null
null
----
+T3_2
+B
+2
+BLOB(20)
+null
+null
+<autoincval>
+null
+null
+----
+T3_2
+ID
+3
+INTEGER NOT NULL
+null
+<systemid>
+<autoincval>
+2
+4
+----
+T3_2
+P1
+1
+VARCHAR(10)
+'okie'
+<systemid>
+<autoincval>
+null
+null
+----
T4
I
1
@@ -2118,6 +2238,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
+null
+<systemid>
+<autoincval>
+1
+1
+----
T5
COST
1
@@ -2619,6 +2769,15 @@
<systemid>
----
BAR
+T3_2
+<systemnumber>
+T3_2
+false
+null
+false
+<systemid>
+----
+BAR
T4
<systemnumber>
IX4
@@ -2637,6 +2796,15 @@
<systemid>
----
BAR
+T4_2
+<systemnumber>
+T4_2
+false
+null
+false
+<systemid>
+----
+BAR
T8
<systemnumber>
<systemname>
@@ -3328,12 +3496,24 @@
BAR
R
----
+T3_2
+T3_2
+T
+BAR
+R
+----
T4
T4
T
BAR
R
----
+T4_2
+T4_2
+T
+BAR
+R
+----
T5
T5
T
@@ -3659,6 +3839,36 @@
null
null
----
+T3_2
+B
+2
+BLOB(20)
+null
+null
+<autoincval>
+null
+null
+----
+T3_2
+ID
+3
+INTEGER NOT NULL
+null
+<systemid>
+<autoincval>
+2
+4
+----
+T3_2
+P1
+1
+VARCHAR(10)
+'okie'
+<systemid>
+<autoincval>
+null
+null
+----
T4
I
1
@@ -3689,6 +3899,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
+null
+<systemid>
+<autoincval>
+1
+1
+----
T8
FKCHAR
2
@@ -3787,6 +4027,15 @@
<systemid>
----
BAR
+T3_2
+<systemnumber>
+T3_2
+false
+null
+false
+<systemid>
+----
+BAR
T4
<systemnumber>
IX4
@@ -3805,6 +4054,15 @@
<systemid>
----
BAR
+T4_2
+<systemnumber>
+T4_2
+false
+null
+false
+<systemid>
+----
+BAR
T8
<systemnumber>
<systemname>
@@ -3989,8 +4247,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/tests/tools/dblook_makeDB.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB.sql?rev=179693&r1=179692&r2=179693&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB.sql (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_makeDB.sql Thu Jun 2 18:25:29 2005
@@ -67,7 +67,9 @@
-- auto increment/defaults.
create table bar.t3 (p1 varchar(10) default 'okie', b blob(20), id int generated always as identity (start with 2, increment by 4));
+create table bar.t3_2 (p1 varchar(10) default 'okie', b blob(20), id int generated by default as identity (start with 2, increment by 4));
create table bar.t4 (i int default 2, j int not null, k int generated always as identity);
+create table bar.t4_2 (i int default 2, j int not null, k int generated by default as identity);
create table "Foo Bar".t5 (cost double);
create table "Foo Bar".t6 (num integer, letter char(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=179693&r1=179692&r2=179693&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 18:25:29 2005
@@ -68,7 +68,7 @@
getAutoIncStmt =
conn.prepareStatement("SELECT AUTOINCREMENTSTART, " +
- "AUTOINCREMENTINC, COLUMNNAME, REFERENCEID FROM SYS.SYSCOLUMNS " +
+ "AUTOINCREMENTINC, COLUMNNAME, REFERENCEID, COLUMNDEFAULT FROM SYS.SYSCOLUMNS " +
"WHERE COLUMNNAME = ? AND REFERENCEID = ?");
// Walk through list of tables and generate the DDL for
@@ -178,7 +178,10 @@
long start = autoIncCols.getLong(1);
if (!autoIncCols.wasNull()) {
- colDef.append(" GENERATED ALWAYS AS IDENTITY (START WITH ");
+ colDef.append(" GENERATED ");
+ colDef.append(autoIncCols.getObject(5) == null ?
+ "ALWAYS ":"BY DEFAULT ");
+ colDef.append("AS IDENTITY (START WITH ");
colDef.append(autoIncCols.getLong(1));
colDef.append(", INCREMENT BY ");
colDef.append(autoIncCols.getLong(2));