scale parameter to setObject method
От | Bob Bruynooghe |
---|---|
Тема | scale parameter to setObject method |
Дата | |
Msg-id | DE105EF3-6E2B-475F-8255-0065E78A96E3@mac.com обсуждение исходный текст |
Ответы |
Re: scale parameter to setObject method
|
Список | pgsql-jdbc |
Hi, I am calling the method setObject(int parameterIndex, Object x, int targetSqlType) with NUMERIC as the targetSqlType and a BigDecimal value of -92233720368.54775 as x. I expected the value placed in the database to have no fractional part. In fact the database contains -92233720368.54775. (Checked by both a JDBC query and using psql.) The prepared statement I am using is INSERT INTO alltypes (key, short, int, long, bigdecimal, float, double) ( ?, ?, ?, ?, ?, ?, ? ) and, the table was created using CREATE TABLE alltypes (key smallint PRIMARY KEY, short smallint, int integer, long bigint, bigdecimal numeric, float real, double double precision) I have also tried using the method setObject(int parameterIndex, Object x, int targetSqlType, int scale) and setting the scale explicitly. The value of scale is being ignored. I had a quick look at code for void setObject(int parameterIndex, Object x, int targetSqlType, int scale) in AbstractJdbc2Statement in the CVS repository. It looks to me like the scale parameter is not used within the method. If I have understood the code correctly then I would expect the behaviour I am seeing. However, I don't think that is the behaviour that the spec defines. Am I understanding things correctly? The server is PostgreSQL 8.2.5 and the JDBC driver is postgresql-8.3-603.jdbc3. regards Bob Bruynooghe
В списке pgsql-jdbc по дате отправления: