Re: Using boolean '1' in jdbc2
От | Rene Pijlman |
---|---|
Тема | Re: Using boolean '1' in jdbc2 |
Дата | |
Msg-id | 1k22qtoo56se2serm4gt9q9mc8uk70st3q@4ax.com обсуждение исходный текст |
Ответ на | Re: Using boolean '1' in jdbc2 (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Using boolean '1' in jdbc2
|
Список | pgsql-jdbc |
On Thu, 13 Sep 2001 15:29:38 -0400 (EDT), you wrote: >> Bruce Momjian writes: >> > I noticed that jdbc1 getBoolean allows '1', while jdbc2 does not. The >> > following patch makes jdbc2 accept '1' also. Is this OK? >> >> Why? Booleans always come out as 't' or 'f'. > >Someone emailed me privately that they wanted to use '1' for >boolean. No idea why, and no idea why jdbc1 has it. In jdbc1 the string to boolean conversion is implemented within getBoolean() itself, which interprets data from the PostgreSQL backend. In jdbc2 its implemented in a helper method ResultSet.toBoolean(), which is public, probably because its now also used in the new Array feature. Perhaps someone is now using ResultSet.toBoolean() as a utility method. I don't think that's a good idea. Even though its public its not part of any published interface. So anyone who wants to convert 1 to true should use his own method. We could rule this out by declaring the method protected or package (no access specifier). This doesn't explain why jdbc1 accepts '1' though. Anyone? Regards, René Pijlman <rene@lab.applinet.nl>
В списке pgsql-jdbc по дате отправления: