Re: Enhancement: toBoolean() and empty String

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Enhancement: toBoolean() and empty String
Дата
Msg-id Pine.BSO.4.63.0611050210320.1524@leary2.csoft.net
обсуждение исходный текст
Ответ на Enhancement: toBoolean() and empty String  (Eberhard Schulte <esc@pixelboxx.de>)
Список 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 по дате отправления:

Предыдущее
От: William Harris
Дата:
Сообщение: using a SSL connection via WebStart
Следующее
От: Michael Paesold
Дата:
Сообщение: JDBC Support for standard_conforming_strings