db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Army <qoz...@sbcglobal.net>
Subject [PATCH] DERBY-194: Precision/scale for Derby datetime values.
Date Wed, 01 Jun 2005 16:50:00 GMT
Attached is a patch that modifies the Derby metadata for datetime values so that 
the correct "precision" and "scale" for those types will be returned in metadata 
calls.

Since the definitions of "precision" and "scale" aren't clearly defined for 
datetime values in JDBC, I've set them based on the ODBC specification.  It was 
agreed in discussion of this issue (and also of DERBY-319) that the "intent" of 
JDBC for these values is to mimic ODBC behavior.  See the thread here for that 
discussion:

http://article.gmane.org/gmane.comp.apache.db.derby.devel/2786
http://article.gmane.org/gmane.comp.apache.db.derby.devel/2787

So that said, the attached patch sets precision/scale for datetime values 
according to the following ODBC pages:

[ Precision ]

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbccolumn_size.asp

Pasted from the above link:

"The column (or parameter) size of numeric data types is defined as the maximum 
number of digits used by the data type of the column or parameter, or the 
precision of the data. For character types, this is the length in characters of 
the data; for binary data types, column size is defined as the length in bytes 
of the data. For the time, timestamp, and all interval data types, this is the 
number of characters in the character representation of this data."

[ Scale ]

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcdecimal_digits.asp

Pasted from the above link:

"The decimal digits of decimal and numeric data types is defined as the maximum 
number of digits to the right of the decimal point, or the scale of the data. 
For approximate floating-point number columns or parameters, the scale is 
undefined because the number of digits to the right of the decimal point is not 
fixed. For datetime or interval data that contains a seconds component, the 
decimal digits is defined as the number of digits to the right of the decimal 
point in the seconds component of the data."

I have run "derbyall" on Windows 2000 with Sun JDK 1.4.2 and have included all 
required master updates in the patch.  The "svn stat" output is attached to this 
email, along with the patch itself.

Could someone review/commit?

Many Thanks,
Army

Mime
View raw message