Subject | Re: Error in SELECT string from BLOB (DataTruncation) |
---|---|
Author | rrokytskyy |
Post date | 2002-08-23T09:44:45Z |
Hi,
I will check this issue. So far such usage was not considered during
development, but I think there's noting against it.
Best regards,
Roman Rokytskyy
I will check this issue. So far such usage was not considered during
development, but I think there's noting against it.
Best regards,
Roman Rokytskyy
--- In Firebird-Java@y..., "Kenneth Foo" <kenneth@n...> wrote:
> Hi
>
> I'm having problem with a code like this...
>
> Object from = "test123456789012345678901234567890";
> PreparedStatement ps = con.prepareStatement("SELECT ID FROM
MESSAGES WHERE MSG_FROM=?;");
> ps.setObject(1, from);
> ResultSet rs = ps.executeQuery();
>
> MSG_FROM field is type BLOB (subtype 1 - MEMO).
> When setObject is called, a java.sql.DataTruncation exception is
thrown.
>
> I traced through the latest Type4 driver, and found that this
exception is thrown
> in the function setString of FBStringField, line 274 which reads...
>
> if (supplied.length > field.sqllen)
> throw new DataTruncation(-1, true, false,
supplied.length, field.sqllen);
>
> field.sqllen is apparently 30 (by default?).
> Since I'm searching for a string that is longer than 30 characters,
an exception is thrown.
>
> Is this a bug or am I missing something?
>
> Thanks!
>
> Regards
> Kenneth