You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by TomohitoNakayama <to...@basil.ocn.ne.jp> on 2005/05/01 07:57:03 UTC
Re: Question about softupgrade mode ..
Hello.
Daniel John Debrunner wrote:
> I think your proposal should be modified a little and take advantage of
> the current implementation of DefaultInfoImpl.
>
> 1) Continue to store NULL in the COLUMNDEFAULT column of SYSCOLUMNS for
> GENERATED ALWAYS, means there is no default option. This makes sense,
> this column is not applicable for GENERATED ALWAYS
>
> 2) For GENERATED BY DEFAULT store a non-NULL value in the COLUMNDEFAULT
> column of SYSCOLUMNS, using the an instance of the DefaultInfoImpl
> class. This class has a spare field in its stored format that is
> currently always zero, this is very useful to add meaning or
> functionality to its stored form. So I would propose
>
> - existing defaults continue as they are, the extra field becomes
> a status field and a value of zero means a regular default.
>
> - GENERATED BY DEFAULT store a one (1) in that field and null
> references for the defaultText and defaultValue. So a 1 means that the
> default is a generated by default column.
>
> 3) Add methods and fields as needed to DefaultInfo and DefaultInfoImpl
>
> e.g. in DefaultInfo
>
> static final int DEFAULT_CLAUSE = 0; // regular DEFAULTur
> static final int GENERATED_DEFAULT = 1;
>
> /**
> Return default type of column, one of DEFAULT_CLAUSE or
> GENERATED_DEFAULT
> */
> int getDefaultType()
>
> 4) Only upgrade code (apart from testing) needed is the soft upgrade
> check to disallow GENERATED BY DEFAULT when running in soft upgrade mode.
>
>
I think this approach is very reasonable.
//I didn't know that we can use the spare field in the stored format ..
//I thought it was kind of terminator...
Aside from cleaning up, I would go on this way in DERBY-167.
Thanks a lot !
Best regards.
/*
Tomohito Nakayama
tomonaka@basil.ocn.ne.jp
tomohito@rose.zero.ad.jp
Naka
http://www5.ocn.ne.jp/~tomohito/TopPage.html
*/
----- Original Message -----
From: "Daniel John Debrunner" <dj...@debrunners.com>
To: "Derby Development" <de...@db.apache.org>
Sent: Saturday, April 30, 2005 1:34 AM
Subject: Re: Question about softupgrade mode ..
> TomohitoNakayama wrote:
>
>> Hello.
>>
>
>>> I think adding extra information to the DefaultInfo is the correct way
>>> and is the way the system was designed. The column's definition is
>>> through the interface DefaultInfo, thus allowing different object
>>> implementations to be stored in the column, representing additional
>>> information as needed.
>>
>>
>> Thinking freely in these days,
>> I came to thought it would be worth to rollback to first phase of
>> desicion aboout solution1-3.
>
> I think you are close to a good solution for implementing GENERATED BY
> DEFAULT.
>
> You other e-mails say that currently for GENERATED ALWAYS that no
> information is stored in the COLUMNDEFAULT column of SYSCOLUMNS, I
> assume that means a NULL.
>
> Then you propose that you always store information in the COLUMNDEFAULT
> column for GENERATED ALWAYS and GENERATED BY DEFAULT, but this has some
> issues related to upgrade.
>
> I think your proposal should be modified a little and take advantage of
> the current implementation of DefaultInfoImpl.
>
> 1) Continue to store NULL in the COLUMNDEFAULT column of SYSCOLUMNS for
> GENERATED ALWAYS, means there is no default option. This makes sense,
> this column is not applicable for GENERATED ALWAYS
>
> 2) For GENERATED BY DEFAULT store a non-NULL value in the COLUMNDEFAULT
> column of SYSCOLUMNS, using the an instance of the DefaultInfoImpl
> class. This class has a spare field in its stored format that is
> currently always zero, this is very useful to add meaning or
> functionality to its stored form. So I would propose
>
> - existing defaults continue as they are, the extra field becomes
> a status field and a value of zero means a regular default.
>
> - GENERATED BY DEFAULT store a one (1) in that field and null
> references for the defaultText and defaultValue. So a 1 means that the
> default is a generated by default column.
>
> 3) Add methods and fields as needed to DefaultInfo and DefaultInfoImpl
>
> e.g. in DefaultInfo
>
> static final int DEFAULT_CLAUSE = 0; // regular DEFAULT
> static final int GENERATED_DEFAULT = 1;
>
> /**
> Return default type of column, one of DEFAULT_CLAUSE or
> GENERATED_DEFAULT
> */
> int getDefaultType()
>
> 4) Only upgrade code (apart from testing) needed is the soft upgrade
> check to disallow GENERATED BY DEFAULT when running in soft upgrade mode.
>
>
> Dan.
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 2005/04/29
>
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 2005/04/29