db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "ErandaSooriyabandara" by ErandaSooriyabandara
Date Wed, 29 Jul 2009 08:46:04 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by ErandaSooriyabandara:
http://wiki.apache.org/db-derby/ErandaSooriyabandara

------------------------------------------------------------------------------
  
  But it is differ from what we expect as the result.
  
- 
- === I hope to work on, ===
- 
  ==== DERBY-4256 ====
  ==== allow alter table to increase the maximum size of a blob and a clob ====
  (https://issues.apache.org/jira/browse/DERBY-4256)
+ 
+ I study this issue and I came up with solution with the help of Bryan's comment on the issue,
as follow.
+ 
+ I ran the the test as,
+ 
+ ij> connect 'jdbc:derby:MyDbTest;create=true';
+ ij> create table binarydata(c1 int,data blob(64));
+ 0 rows inserted/updated/deleted
+ ij> ALTER TABLE binarydata ALTER COLUMN data SET DATA TYPE blob(256M);
+ ERROR 42Z16: Only columns of type VARCHAR may have their length altered.
+ 
+ The error give me the idea of that in the code there must be a code restrict the clob\blob
to be resize. So I check the place where the Bryan mentioned.(I think the first place to start
is with the 'checkUserType()' method in o.a.d.impl.sql.compile.ModifyColumnNode. Look around
line 118. ). So I think the following additional code will success the test.
+ 
+ 
+ if (!(typeName.equals(TypeId.VARCHAR_NAME)) &&
+ !(typeName.equals(TypeId.VARBIT_NAME)) ''' &&!(typeName.equals(TypeId.BLOB_NAME)))&&!(typeName.equals(TypeId.CLOB_NAME))
''' )
+ {
+ throw StandardException.newException(
+  SQLState.LANG_MODIFY_COLUMN_INVALID_TYPE);
+ }
+ 
+ 
+ and it succeed the test
+ 
+ ij version 10.6
+ 
+ ij> connect 'jdbc:derby:testdb;create=true';
+ 
+ ij> create table binarydata(c1 int,data blob(64));
+ 
+ 0 rows inserted/updated/deleted
+ 
+ ij> ALTER TABLE binarydata ALTER COLUMN data SET DATA TYPE blob(256M);
+ 
+ 0 rows inserted/updated/deleted
  
  ==== DERBY-3920 ====
  ==== Allow altering size limits for blob and clob columns ====

Mime
View raw message