db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <e...@jpox.org>
Subject RE: Binding a char to PreparedStatement
Date Thu, 21 Jul 2005 09:10:45 GMT
See inline
 
Erik Bengtson
-----Original Message-----
From: Craig Russell [mailto:Craig.Russell@Sun.COM] 
Sent: Thursday, July 21, 2005 12:26 AM
To: jdo-dev@db.apache.org
Subject: Re: Binding a char to PreparedStatement
 
>I was thinking that most of the value in the jdbc-type would be in the
java-to-database schema creation, where the user could rely on the jdo
impl to create appropriate schema. In the case of char or >Character,
that would be CHAR(1). In the case of double or Double, with a length of
20 and a scale of 12, that would be DOUBLE if the database supported it,
or DECIMAL(20, 12) if not.
 
CHAR(1) will not allow Unicode storage, you need either to use NCHAR(1),
CHAR(4) or another type that allows you to store 2 bytes. We use INTEGER
data type by default which works in all databases, and more, it allows
operators like > < on SQL queries without having to convert it using
ASCII functions.
 
The origin of the problem Michael reported is down to the lack of a
jdbc-type 
specification in the metadata, and the fact that JPOX's current
"default" for 
char is to store it as INTEGER (for whatever reason) - hence why he got
the 
problem.
 
Ok. I thought that you would agree that this is a bug in JPOX, since the
"obvious default" for a char column is CHAR.


It is not that obvious when you have to support a wide range of
databases and data types. The most obvious choice to me is the most
common type among these databases.
 
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message