Re: Enhancement: toBoolean() and empty String - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Enhancement: toBoolean() and empty String
Date
Msg-id Pine.BSO.4.63.0611050210320.1524@leary2.csoft.net
Whole thread Raw
In response to Enhancement: toBoolean() and empty String  (Eberhard Schulte <esc@pixelboxx.de>)
List 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

pgsql-jdbc by date:

Previous
From: William Harris
Date:
Subject: using a SSL connection via WebStart
Next
From: Michael Paesold
Date:
Subject: JDBC Support for standard_conforming_strings