agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString
Date: Tue, 27 Jun 2006 17:47:24 +0200
Message-ID: <44A1530C.3090209@tada.se> (raw)
In-Reply-To: <BAY16-F122D445F6E3BA71358D5CA957E0@phx.gbl>
References: <BAY16-F122D445F6E3BA71358D5CA957E0@phx.gbl>
Hi Jean-Pierre,
I'm not sure this is incorrect behavior. There's nothing in the spec
that indicates that String values should be trimmed by setString and
setObject. On the contrary. Some datatypes (the CHAR in particular) are
sensitive to whitespace according to the SQL standard. Perhaps the
client jdbc driver is doing something wrong here?
Regards,
Thomas Hallgren
JEAN-PIERRE PELLETIER wrote:
> Hi,
>
> Trailing space are not handled properly by setObject & setString.
>
> PreparedStatement pstmt = connection.prepareStatement(
> "select * from mytable where mycharcolumn = ?");
>
> String myString = "abc ";
> pstmt.setObject(1, myString); // or setObject(1, myString, Types.CHAR) or
> setString(1, myString)
>
> No rows are returned, but using trim works fine as in:
> pstmt.setObject(1, myString.trim());
>
> My environment is Pl/Java 1.3, Sun JDK 1.5.07, PostgreSQL 8.1.4, Windows XP
> SP2
>
> With PostgreSQL own (non pl/java) jdbc driver, setObject on char works fine
> without the trim.
>
> Thanks,
> Jean-Pierre Pelletier
>
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>
view thread (3+ messages) latest in thread
Message-ID: <44A1530C.3090209@tada.se>
Permalink: ../44A1530C.3090209@tada.se/
Also on: postgresql.org/message-id/44A1530C.3090209@tada.se
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] char with trailing space, PreparedStatement.setObject & SetString
In-Reply-To: <44A1530C.3090209@tada.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox