pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Calling functions with smallint fails
4+ messages / 3 participants
[nested] [flat]

* Calling functions with smallint fails
@ 2004-10-21 18:55  Christian Niles <christian@unit12.net>
  0 siblings, 1 reply; 4+ messages in thread

From: Christian Niles @ 2004-10-21 18:55 UTC (permalink / raw)
  To: pgsql-jdbc

I'm having problems using CallableStatement to execute a function that 
has a smallint parameter. The problem I'm having is identical to this 
bug report:

http://archives.postgresql.org/pgsql-bugs/2003-04/msg00060.php

 From a basic examination of the code, it seems that setShort(int, 
short) simply serializes the value to a string, making it 
indistinguishable from an integer. The response to that bug mentions 
that the literal needs to be cast to a smallint:

http://archives.postgresql.org/pgsql-bugs/2003-04/msg00061.php

Is this a known problem with the JDBC implementation, or is this a bug 
that can be fixed?

best,
christian.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Calling functions with smallint fails
@ 2004-10-21 18:59  Kris Jurka <books@ejurka.com>
  parent: Christian Niles <christian@unit12.net>
  0 siblings, 2 replies; 4+ messages in thread

From: Kris Jurka @ 2004-10-21 18:59 UTC (permalink / raw)
  To: Christian Niles <christian@unit12.net>; +Cc: pgsql-jdbc



On Thu, 21 Oct 2004, Christian Niles wrote:

> 
>  From a basic examination of the code, it seems that setShort(int, 
> short) simply serializes the value to a string, making it 
> indistinguishable from an integer.

This has been fixed in the 8.0 driver series as all calls are now strongly 
typed.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Calling functions with smallint fails
@ 2004-10-21 19:53  Christian Niles <christian@unit12.net>
  parent: Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Christian Niles @ 2004-10-21 19:53 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

Thanks for the quick reply on both issues. The new driver works as 
advertised.

best,
christian.

On Oct 21, 2004, at 2:59 PM, Kris Jurka wrote:

>
>
> On Thu, 21 Oct 2004, Christian Niles wrote:
>
>>
>>  From a basic examination of the code, it seems that setShort(int,
>> short) simply serializes the value to a string, making it
>> indistinguishable from an integer.
>
> This has been fixed in the 8.0 driver series as all calls are now 
> strongly
> typed.
>
> Kris Jurka
>




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Calling functions with smallint fails
@ 2004-10-25 09:15  Markus Schaber <schabios@logi-track.com>
  parent: Kris Jurka <books@ejurka.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Markus Schaber @ 2004-10-25 09:15 UTC (permalink / raw)
  To: pgsql-jdbc

Hi, Kris,

On Thu, 21 Oct 2004 13:59:54 -0500 (EST)
Kris Jurka <books@ejurka.com> wrote:

> >  From a basic examination of the code, it seems that setShort(int, 
> > short) simply serializes the value to a string, making it 
> > indistinguishable from an integer.
> 
> This has been fixed in the 8.0 driver series as all calls are now strongly 
> typed.

And this just broke the persistence abstraction layer in one of our
legacy apps, as they use code like setString(i, obj.toString()) for
everything including Number types. :-(

Now, we have an additional reason to throw this crappy code away, and
replace it with hibernate :-)

 
Thanks for your great work.
Markus

-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2004-10-25 09:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 18:55 Calling functions with smallint fails Christian Niles <christian@unit12.net>
2004-10-21 18:59 ` Kris Jurka <books@ejurka.com>
2004-10-21 19:53   ` Christian Niles <christian@unit12.net>
2004-10-25 09:15   ` Markus Schaber <schabios@logi-track.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox