Re: [BUG?] Extreme dates

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: [BUG?] Extreme dates
Дата
Msg-id 20040519155002.67a46729@kingfisher.intern.logi-track.com
обсуждение исходный текст
Ответ на Re: [BUG?] Extreme dates  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc
Hi, Kris,

On Mon, 17 May 2004 15:45:12 -0500 (EST)
Kris Jurka <books@ejurka.com> wrote:

> > [timestamps like 0002-10-30 are incorrectly seen as 2030-02-10].
>
> Yes, that's a bug alright.  I've fixed this in both the stable and
> development cvs trees.  While looking at this I noticed that the
> timestamp code has no provisions for BC dates, so if you're working
> with years in that area, that's something to be aware of.  Fixing that
> has gone on the todo list, but I wanted to get this fix out to you
> now.

I just notified the change in the JDBC CVS, and have a (very small)
remark:

sbuf.append("0") is less efficient than sbuf.append('0').

The first reason is that for storing "0", there is a String object
created by the jvm, with an associated internal char[] array, which is
bound to the Class instance, while '0' as a constant scalar character is
no extra object.

And the second reason is that, as the StringBuffer source shows, adding
a String to a StringBuffer is much more work including a call to
System.ArrayCopy, while adding a simple character is just ensuring the
capacity and putting it in.

Interestingly, the lines below your insertion, already use chars, while
a little bit above, there's another example adding a single-byte String
(maybe because of lazyness to quote a ' inside of '').

So if you feel like peephole-optimizing, you can apply the attached
patch, if not, don't mind.

Thanks for your patience,
Markus Schaber
--
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


Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: patch for getUDT #3
Следующее
От: ow
Дата:
Сообщение: Re: [BUG?] Extreme dates