Re: Enhancement: toBoolean() and empty String

From: Kris Jurka <books(at)ejurka(dot)com>
To: Eberhard Schulte <esc(at)pixelboxx(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Enhancement: toBoolean() and empty String
Date: 2006-11-05 07:45:25
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-jdbc

On Fri, 3 Mar 2006, Eberhard Schulte wrote:

> 1. Encoding.decode() creates for each empty String a new String object.
> Memory is wasted unnecessary.

I have been unable to measure a difference in a test of "SELECT NULL FROM
generate_series(1,1000000)" and calling getString for each result. Do you
have another test case that shows an impact?

> 2. AbstractJdbc2ResultSet.toBoolean(): there is no explicite false check. A
> false is produced by an NumberFormatException.

Yes, that's a problem. I timed a factor of two or so speedup with your
patch. I've extended it to also check for "1" and "0" as strings which
will also be common and applied it to cvs. I did not put in the exception
for invalid data like "hello". The spec is a little vague about this and
since we haven't heard any complaints, I'm inclined to retain backwards
compatible behavior.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2006-11-05 20:46:31 JDBC Support for standard_conforming_strings
Previous Message William Harris 2006-11-04 21:07:36 using a SSL connection via WebStart