db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: A question about types
Date Wed, 08 Mar 2006 15:02:50 GMT
Dyre.Tjeldvoll@Sun.COM wrote:

> Daniel John Debrunner <djd@apache.org> writes:
>>TypeDescriptor represents a type in the catalogs, it's best to create an
>>instance of the runtime type descriptor DataTypeDescriptor from it.
>>TypeDescriptor td; // get from array/method
>>// TypeId represents the fixed aspect of a type, without
>>// nullability or any length attributes.
>>TypeId typeId = TypeId.getBuiltInTypeId(td.getJDBCTypeId());
>>DataTypeDescriptor dtd = new DataTypeDescriptor(typeId,
>>td.getPrecision(), td.getScale(), td.isNullable(), td.getMaximumWidth());
> Hmm, if I read the javadoc correctly it seems like both
> DataTypeDescriptor and TypeDescriptorImpl (which both implement the
> TypeDescriptor interface) already have a TypeId member variable, and
> an accessor method called getTypeId(). Unfortunately, this method in
> NOT part of the TypeDescriptor interface, so the only way to get at it is
> to downcast the TypeDescriptor :(
> Would it be bad to add getTypeId() to the TypeDescriptor interface?

You could use the code I showed the other day that created a
DataTypeDesciptor out from a catalog TypeDescriptor.


View raw message