[Pljava-dev] ResultSet getString

From: thomas at tada(dot)se (Thomas Hallgren)
To:
Subject: [Pljava-dev] ResultSet getString
Date: 2006-05-18 12:34:16
Message-ID: 446C69C8.3030908@tada.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Marek Lewczuk wrote:
> Ok, I thought that getString() will return any postgresql type as string
> - e.g. varchar[] would be {"val","val"}, boolean would be "t" or "f" -
> that is how pgsql works, when assigning value of any type to variable
> defined as text/varchar.
>
>
I see what you mean. Question is, what string representation should be
used? What is more intuitive? Using the Java 'toString()' representation
of an object or the PostgreSQL String representation of the SQL type?

A typical Java developer who's not fluent in PostgreSQL type coercion
would expect that ResultSet.getString() on a boolean would return "true"
or "false", i.e. something that can be passed to Boolean.valueOf(String)
and that Array types would follow the format stipulated by
java.util.Arrays.toString(<type>[]) family of methods.

At present, the getString() method will coerce basic types to strings
using Java semantics. Arrays are not coerced though, since that
functionality was introduced in Java 1.5.

Regards,
Thomas Hallgren

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Marek Lewczuk 2006-05-18 13:31:42 [Pljava-dev] ResultSet getString
Previous Message Marek Lewczuk 2006-05-18 11:41:53 [Pljava-dev] ResultSet getString