Issue Details (XML | Word | Printable)

Key: DERBY-194
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: A B
Reporter: George Baklarz
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

getPrecision() on TIME and TIMESTAMP is zero

Created: 04/Apr/05 08:15 AM   Updated: 08/Jun/05 08:03 AM
Return to search
Component/s: JDBC
Affects Version/s: 10.0.2.0
Fix Version/s: 10.1.1.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works derby-194.patch 2005-06-02 01:51 AM A B 44 kB
File Licensed for inclusion in ASF works derby-194.stat 2005-06-02 01:51 AM A B 1.0 kB
Environment: Windows XP SP1 Professional

Resolution Date: 04/Jun/05 03:51 PM


 Description  « Hide
Sun JDBC defines getPrecision() to return either the maximum length or maximum number of digits of the column, or zero for failure (such as the precision is unknown).

http://docs.sun.com/source/816-6105-10/apicola.htm#211083

The DATE field returns 10 characters on a getPrecision() call so why doesn't TIME and TIMESTAMP give a precision length equal to the display length? Just seems inconsistent that DATE would return a precision (as well as all other data types) and not TIME nor TIMESTAMP.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
A B added a comment - 05/Apr/05 01:01 AM
I (Army) have been looking at a couple of database metadata issues in Derby (as a follow-up to DERBY-107), and this is one that I too have noticed.

Fix is to change the "setTypeIdSpecificInstanceVariables()" method in org/apache/derby/iapi/types/TypeId.java to set the "maxMaxWidth" variable to be the correct value (namely, 8 for TIME (hh:mm:ss) and 26 for TIMESTAMP (yyyy-mm-dd hh:mm:ss.ffffff)).

Unless someone wants to create a specific patch for this, I'll submit this fix as part of another patch that I'm writing--one that will make Derby metadata return the correct value for the BUFFER_LENGTH field for builtin (including datetime) types. See the thread here for more on the BUFFER_LENGTH issue: http://mail-archives.eu.apache.org/mod_mbox/db-derby-dev/200503.mbox/%3c42449744.8010109@sbcglobal.net%3e

Myrna van Lunteren added a comment - 05/Apr/05 05:13 AM
When this get fixed, the PRECISION field of Metadata.getTypeInfo should also be changed to match.

Daniel John Debrunner added a comment - 05/Apr/05 05:50 AM
While the JDBC spec does say 'length', it does not explictly say what length is being referred to. Length of the object as a String, length of the stored form of the value, maximum length of the Java serialized form of getObject or something else?
Is there any clarification in the JDBC tutorial book, or is returning NULL a better option here?

A B made changes - 27/May/05 06:24 AM
Field Original Value New Value
Assignee A B [ army ]
A B added a comment - 02/Jun/05 01:51 AM
Attaching a patch for this issue.

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

A B made changes - 02/Jun/05 01:51 AM
Attachment derby-194.patch [ 20365 ]
Attachment derby-194.stat [ 20364 ]
A B made changes - 02/Jun/05 01:51 AM
Status Open [ 1 ] In Progress [ 3 ]
A B made changes - 03/Jun/05 06:10 AM
Fix Version/s 10.1.0.0 [ 10993 ]
A B added a comment - 04/Jun/05 05:42 AM
Patch was committed with svn revision 179839. George Baklarz, if you can do an "svn update" and then confirm that the problem has been fixed, please post saying so and I will close this issue. ..

A B added a comment - 04/Jun/05 05:47 AM
Patch was committed with svn revision 179839. I tried to "Resolve" this issue with a comment, but something went wrong with JIRA so I don't think it went through. That said, the "resolve" option is no longer available, so I guess "close" is the next option. SO, George Baklarz, if you can do an "svn update" and then confirm that the problem has been fixed, please post saying so and I will close this issue...Thanks.

Andrew McIntyre added a comment - 04/Jun/05 03:50 PM
Reopening to fix resolved field in JIRA.

Andrew McIntyre made changes - 04/Jun/05 03:50 PM
Status In Progress [ 3 ] Reopened [ 4 ]
Andrew McIntyre added a comment - 04/Jun/05 03:51 PM
Patch was committed with svn revision 179839. Could Army or George please verify this is fixed and close?

Andrew McIntyre made changes - 04/Jun/05 03:51 PM
Resolution Fixed [ 1 ]
Status Reopened [ 4 ] Resolved [ 5 ]
A B added a comment - 08/Jun/05 08:03 AM
Hearing nothing more from George Baklarz, who reported this issue, I'm going to go ahead and close it...

A B made changes - 08/Jun/05 08:03 AM
Status Resolved [ 5 ] Closed [ 6 ]