db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narayanan <V.Naraya...@Sun.COM>
Subject Re: [jira] Commented: (DERBY-3523) sql states (X0Y63, X0Y63, X0Y63.S) related to nulls in unique constraints are associated with wrong message texts
Date Wed, 12 Mar 2008 08:02:06 GMT
Jørgen Løland wrote:
> Mike Matrigali wrote:
> > It does seem like the best case would be for the error message 
> system to
> > somehow return a different error message for the same number if it is
> > in soft upgrade vs. hard upgrade.  Does the error message system 
> support
> > such a thing?
>
> Yes, it does. If you want multiple messages with the same SQL state, 
> you need to add the ".<severity>.<#>" information to the error state 
> in SQLState.java. E.g, all these messages have SQL State 08004:
>
> ----- snip from SQLState.java ----
> String LOGIN_FAILED = "08004";
> String NET_CONNECT_AUTH_FAILED                          = "08004.C.1";
> String NET_DATABASE_NOT_FOUND                           = "08004.C.2";
> String AUTH_DATABASE_CONNECTION_REFUSED                 = "08004.C.3";
> String AUTH_SHUTDOWN_NOT_DB_OWNER                       = "08004.C.4";
> String AUTH_ENCRYPT_NOT_DB_OWNER                        = "08004.C.5";
> ...
> ----- snip -------
>
> If, e.g., both these messages
>
> '{0}' cannot be a column of a primary key or unique key because it can 
> contain null values.
> '{0}' cannot be a column of a primary key because it can contain null 
> values.
>
> ... should have the same 42831 error code, you would need something 
> like this in the SQLState.java file:
>
> String LANG_DB2_ADD_UNIQUE_OR_PRIMARY_KEY_ON_NULL_COLS = "42831.S.1";
> String LANG_DB2_ADD_PRIMARY_KEY_ON_NULL_COLS = "42831.S.2";
>
> 'S' because 42831 is statement severity level (see class javadoc in 
> SQLState.java), while 1 and 2 are used to tell the messages apart. 
> messages.xml also needs to be updated, of course.
>
But how will this  help in printing different error messages in hard and 
soft upgrade? I thought this would be useful
in grouping together the same family of messages, but can this act as a 
switch for messages that need to be printed
in hard and soft upgrade?

Narayanan

Mime
View raw message