[ http://issues.apache.org/jira/browse/DERBY-319 ]
Attached is a patch for DERBY-319.
The JDBC API documents say that the LENGTH field of the result set returned by
DatabaseMetaData.getProcedureColumns(...) is the "length in bytes" of the
column. However, the API doesn't say exactly what the "length in bytes" is for
the various SQL datatypes.
Currently, the values that Derby returns for this field are inconsistent--for
some types it's the length in bytes and for others it's the length in characters.
In the discussion thread here:
http://article.gmane.org/gmane.comp.apache.db.derby.devel/2585
it was decided that the intent of JDBC was to match ODBC behavior in this
regard, and luckily the ODBC specification clearly states what the "length in
bytes" is for each SQL datatype. Thus this patch creates a new method on the
TypeDescriptor interface that returns the max length in bytes as defined in the
ODBC specification. This method is then used by the DatabaseMetaData methods
where needed, such as in the getProcedureColumns() method.
The ODBC definition of "length in bytes" for the SQL types can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbctransfer_octet_length.asp
I have run derbyall on a Windows 2000 machine with Sun JDK 1.4.2 and all tests
passed.
Could a committer please review/commit this patch?
Thanks,
Army